Merge remote-tracking branch 'origin/master'

master
郑明梁 2 years ago
commit 5b8278cec8

@ -8,7 +8,7 @@ import lombok.Getter;
@Getter
public enum ResultEnum {
SUCCESS(0, "success"),
SUCCESS(20000, "success"),
NOT_NETWORK(1, "系统繁忙,请稍后再试。"),
LOGIN_VERIFY_FALL(2, "登录失效"),
PARAM_VERIFY_FALL(3, "参数验证错误"),

@ -0,0 +1,38 @@
package com.glxp.api.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 线
*/
@Configuration
@EnableAsync
public class TaskPoolConfig {
@Bean(name = "taskExecutor")
public ThreadPoolTaskExecutor taskExecutor() {
// 获取当前主机的cpu核心数
int threadCount = Runtime.getRuntime().availableProcessors();
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
//核心池的大小
taskExecutor.setCorePoolSize(threadCount);
//线程池最大线程数
taskExecutor.setMaxPoolSize(threadCount * 2);
//队列最大长度
taskExecutor.setQueueCapacity(200);
//线程空闲时间
taskExecutor.setKeepAliveSeconds(60);
//配置线程前缀
taskExecutor.setThreadNamePrefix("custom_executor");
//配置拒绝策略
taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//执行初始化
taskExecutor.initialize();
return taskExecutor;
}
}

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* task
*/
@Getter
@AllArgsConstructor
public enum BasicExportStatusEnum {

@ -5,6 +5,9 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
/**
* taskkey
*/
@Getter
@AllArgsConstructor
public enum BasicExportStatusTimeEnum {

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*/
@Getter
@AllArgsConstructor
public enum BasicExportTypeEnum {
@ -18,6 +21,11 @@ public enum BasicExportTypeEnum {
*/
COUNTRY_DI_DATA("country_di_data", "国家库DI数据"),
/**
*
*/
DOCUMENT_TYPE("document_type", "单据类型"),
/**
*
*/

@ -10,6 +10,7 @@ import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.dao.auth.AuthAdminDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.CustomerInfoEntity;
import com.glxp.api.entity.auth.UserRegisterEntity;
@ -250,12 +251,12 @@ public class RegisterController {
if (StrUtil.isNotBlank(company_check) && company_check.equals("1")) {
//新用户注册时根据往来单位字典进行企业名称校验
CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(userRegisterEntity.getCompanyId());
if (customerInfoEntity != null ) {
if (customerInfoEntity != null) {
return ResultVOUtils.error(500, "该企业已被注册!");
}
}
UserRegisterEntity userRegisterEntity2 = userRegisterService.selectByCname(userRegisterEntity.getCompanyName());
if (userRegisterEntity2 !=null ) {
if (userRegisterEntity2 != null) {
return ResultVOUtils.error(500, "该企业已被注册!");
}
@ -275,8 +276,8 @@ public class RegisterController {
}
userRegisterEntity.setUserName(userName);
UserRegisterEntity userRegisterEntity1 = userRegisterService.selectByMobile(userRegisterEntity.getMobile());
if(userRegisterEntity1!=null){
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(),2);
if (userRegisterEntity1 != null) {
userRegisterService.deleteByMobile(userRegisterEntity.getMobile(), 2);
}
boolean b = userRegisterService.insertUserRegister(userRegisterEntity);
if (!b) {
@ -327,6 +328,9 @@ public class RegisterController {
return ResultVOUtils.success("密码修改成功");
}
@Resource
AuthAdminDao authAdminDao;
@AuthRuleAnnotation("")
@PostMapping("salewarehouse/register/check")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@ -383,18 +387,20 @@ public class RegisterController {
}
//创建新用户
AuthAdmin authAdmin = new AuthAdmin();
authAdmin.setCustomerId(customerId+"");
authAdmin.setId(generateUserId());
authAdmin.setCustomerId(customerId + "");
authAdmin.setPassWord(userRegisterEntity.getPassword());
authAdmin.setCreateTime(DateUtil.parseDate(userRegisterEntity.getCheckTime()));
authAdmin.setUserName(userRegisterEntity.getUserName()); //用手机号当用户名,通过手机号登录
authAdmin.setEmployeeName(userRegisterEntity.getNickName());
authAdmin.setCustomerId(userRegisterEntity.getCompanyId());
//默认给部门、仓库
//默认给部门、仓库 默认给随机用户ID避免数据同步时出错覆盖
authAdmin.setLocDeptCode("1000");
authAdmin.setLocInvCode("1000000");
authAdmin.setUserFlag(1);
authAdmin.setLastModifyTime(new Date());
authAdminService.insertAuthAdmin(authAdmin);
authAdminDao.insert(authAdmin);
// authAdminService.insertAuthAdmin(authAdmin);
authAdmin = authAdminService.findByUserName(authAdmin.getUserName());
//分配角色
@ -431,13 +437,13 @@ public class RegisterController {
customerContactEntity.setMobile(userRegisterEntity.getMobile());
customerContactEntity.setTel(userRegisterEntity.getTel());
CustomerContactEntity customerContactEntity1 = customerContactService.selectById(customerId);
if(customerContactEntity1==null){
if (customerContactEntity1 == null) {
customerContactService.insertCustomerContact(customerContactEntity);
}
//生产本企业信息
CompanyEntity companyEntity = new CompanyEntity();
companyEntity.setCustomerId(customerId+"");
companyEntity.setCustomerId(customerId + "");
companyEntity.setArea(userRegisterEntity.getArea());
companyEntity.setAreaCode(userRegisterEntity.getAreaCode());
companyEntity.setDetailAddr(userRegisterEntity.getDetailAddr());
@ -465,21 +471,18 @@ public class RegisterController {
CustomerInfoFilterRequest request = new CustomerInfoFilterRequest();
request.setCompanyName(registerCheckRequest.getCompanyName());
List<CustomerInfoEntity> customerInfoEntities = customerInfoService.filterCustomerInfo(request);
int i=0;
int i = 0;
for (CustomerInfoEntity infoEntity : customerInfoEntities) {
if(registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())){
if (registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())) {
i++;
}
}
if(i<=0){
if (i <= 0) {
customerInfoService.insertCustomerInfo(customerInfoEntity);
companyService.insertCompany(companyEntity);//TODO !!!!!!!!!!!
}
if (!b) {
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
}

@ -422,7 +422,7 @@ public class IoCodeTempController extends BaseController {
//过期提醒:
// SystemParamConfigEntity expireParamConfigEntity = systemParamConfigService.selectByParamKey("expire_date_tip");
if (bussinessTypeEntity.getCheckVailDate() == 1 && !addOrderRequest.isIgnoreExpire()) {
if (bussinessTypeEntity.getCheckExpire() == 1 && !addOrderRequest.isIgnoreExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
@ -432,6 +432,16 @@ public class IoCodeTempController extends BaseController {
}
}
if (bussinessTypeEntity.getCheckExpire() == 2) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
String expireDate = "20" + udiEntity.getExpireDate();
long expireTime = DateUtil.parseDateExpire(expireDate);
if (expireTime - System.currentTimeMillis() < 0) {
return ResultVOUtils.error(604, "当前产品已过期,无法添加?");
}
}
}
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
//近效期提醒
@ -465,7 +475,7 @@ public class IoCodeTempController extends BaseController {
if (resultTime > 0) {
long time = resultTime / (24 * 60 * 60 * 1000);
if (resultTime < recentTieme) {
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,无法添加?");
return ResultVOUtils.error(605, "当前产品临近过期,距过期还剩" + time + "天,无法添加");
}
}
}

@ -1,32 +1,28 @@
package com.glxp.api.controller.sync;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.*;
import com.glxp.api.controller.purchase.PurOrderController;
import com.glxp.api.constant.BasicExportStatusEnum;
import com.glxp.api.constant.BasicExportTypeEnum;
import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.dao.auth.*;
import com.glxp.api.dao.basic.BasicBusTypeChangeDao;
import com.glxp.api.dao.basic.BasicBusTypePreDao;
import com.glxp.api.dao.basic.BasicBussinessTypeDao;
import com.glxp.api.dao.basic.EntrustReceDao;
import com.glxp.api.dao.basic.*;
import com.glxp.api.dao.inout.*;
import com.glxp.api.dao.purchase.*;
import com.glxp.api.dao.schedule.SystemParamConfigDao;
import com.glxp.api.dao.system.*;
import com.glxp.api.dao.thrsys.*;
import com.glxp.api.entity.auth.*;
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
import com.glxp.api.entity.basic.BasicBusTypePreEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.basic.EntrustReceEntity;
import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.inout.*;
import com.glxp.api.entity.purchase.*;
@ -35,7 +31,9 @@ import com.glxp.api.entity.sync.BasicExportStatusEntity;
import com.glxp.api.entity.system.*;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.req.sync.SpsSyncDataRequest;
import com.glxp.api.req.sync.SyncUpLoadRequest;
import com.glxp.api.res.sync.*;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.IoAddInoutService;
import com.glxp.api.service.inout.IoCheckInoutService;
import com.glxp.api.service.inout.IoOrderService;
@ -45,10 +43,10 @@ import com.glxp.api.service.sync.BasicDownloadService;
import com.glxp.api.service.sync.BasicExportService;
import com.glxp.api.service.sync.SpsSyncDownloadService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.JsonUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
@ -64,10 +62,12 @@ import javax.validation.Valid;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import java.util.Date;
import java.util.List;
@RestController
@Api(tags = "同步下载相关")
@RequiredArgsConstructor
public class SpsSyncDownloadController {
@Resource
@ -321,6 +321,134 @@ public class SpsSyncDownloadController {
return baseResponse;
}
@ApiOperation("上传同步数据")
@PostMapping("sps/sync/upload/data")
public Object uploadData(@RequestBody SyncUpLoadRequest upLoadRequest) {
try {
JSONObject obj = JSONUtil.parseObj(upLoadRequest.getData());
switch (upLoadRequest.getExportType()) {
case BASIC_DATA:
saveUploadBasicData(JSONUtil.toBean(obj, SpsSyncBasicDataResponse.class));
break;
case OTHER_DATA:
saveUploadOtherData(JSONUtil.toBean(obj, SpsSyncOtherDataResponse.class));
break;
case DOCUMENT_TYPE:
saveUploadDocumentTypeData(JSONUtil.toBean(obj, SpsSyncBusResponse.class));
break;
case COUNTRY_DI_DATA:
}
String taskId = obj.getStr("taskId");
BasicDownloadStatusEntity downloadStatus = BasicDownloadStatusEntity.builder()
.id(taskId)
.taskId(taskId)
.startTime(new Date())
.endTime(new Date())
.updateTime(new Date())
.type(upLoadRequest.getExportType().getRemark())
.idDatas(upLoadRequest.getExportType().getKey())
.scheduleType(1)
.build();
basicDownloadService.insertDownloadStatus(downloadStatus);
return ResultVOUtils.success();
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(ResultEnum.NOT_NETWORK, e.getMessage());
}
}
private final BasicBussinessTypeDao basicBussinessTypeDao;
private final BasicBusTypeChangeDao busTypeChangeDao;
private final ThrBusTypeOriginDao thrBusTypeOriginDao;
/**
*
*
* @param bean
*/
private void saveUploadDocumentTypeData(SpsSyncBusResponse bean) {
if (CollectionUtil.isNotEmpty(bean.getBussinessTypeEntities())) {
basicBussinessTypeDao.insertOrUpdateBatch(bean.getBussinessTypeEntities());
}
if (CollectionUtil.isNotEmpty(bean.getBusTypeChangeEntities())) {
busTypeChangeDao.insertOrUpdateBatch(bean.getBusTypeChangeEntities());
}
if (CollectionUtil.isNotEmpty(bean.getThrBusTypeOriginEntities())) {
thrBusTypeOriginDao.insertOrUpdateBatch(bean.getThrBusTypeOriginEntities());
}
}
private final IoCodeLostMapper ioCodeLostMapper;
private final IoCodeRelMapper ioCodeRelMapper;
/**
*
*
* @param bean
*/
private void saveUploadOtherData(SpsSyncOtherDataResponse bean) {
if (CollectionUtil.isNotEmpty(bean.getIoCodeLostList())) {
ioCodeLostMapper.insertOrUpdateBatch(bean.getIoCodeLostList());
}
if (CollectionUtil.isNotEmpty(bean.getIoCodeRelList())) {
ioCodeRelMapper.insertOrUpdateBatch(bean.getIoCodeRelList());
}
}
private final BasicHospTypeDao basicHospTypeDao;
private final UdiRelevanceDao udiRelevanceDao;
private final BasicProductsDao basicProductsDao;
private final CompanyProductRelevanceDao relevanceDao;
private final BasicCorpDao corpDao;
private final SupCertDao supCertDao;
private final SupCertSetDao supCertSetDao;
private final SupCompanyDao supCompanyDao;
private final SupManufacturerDao supManufacturerDao;
private final SupProductDao supProductDao;
/**
*
*
* @param bean
*/
private void saveUploadBasicData(SpsSyncBasicDataResponse bean) {
if (CollectionUtil.isNotEmpty(bean.getHospTypeList())) {
basicHospTypeDao.insertOrUpdateBatch(bean.getHospTypeList());
}
if (CollectionUtil.isNotEmpty(bean.getUdiRelevanceList())) {
udiRelevanceDao.insertOrUpdateBatch(bean.getUdiRelevanceList());
}
if (CollectionUtil.isNotEmpty(bean.getProductsList())) {
basicProductsDao.insertOrUpdateBatch(bean.getProductsList());
}
if (CollectionUtil.isNotEmpty(bean.getRelevanceList())) {
relevanceDao.insertOrUpdateBatch(bean.getRelevanceList());
}
if (CollectionUtil.isNotEmpty(bean.getCorpList())) {
corpDao.insertOrUpdateBatch(bean.getCorpList());
}
if (CollectionUtil.isNotEmpty(bean.getSupCertList())) {
supCertDao.insertOrUpdateBatch(bean.getSupCertList());
}
if (CollectionUtil.isNotEmpty(bean.getSupCertSetList())) {
supCertSetDao.insertOrUpdateBatch(bean.getSupCertSetList());
}
if (CollectionUtil.isNotEmpty(bean.getSupCompanyList())) {
supCompanyDao.insertOrUpdateBatch(bean.getSupCompanyList());
}
if (CollectionUtil.isNotEmpty(bean.getSupManufacturerList())) {
supManufacturerDao.insertOrUpdateBatch(bean.getSupManufacturerList());
}
if (CollectionUtil.isNotEmpty(bean.getSupProductList())) {
supProductDao.insertOrUpdateBatch(bean.getSupProductList());
}
}
//接收中继服务、UDI管理系统上传单据
@AuthRuleAnnotation("sps/sync/order/upload")
@PostMapping("/sps/sync/order/upload")

@ -1,8 +1,6 @@
package com.glxp.api.controller.thrsys;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.Log;
@ -10,13 +8,10 @@ import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.req.thrsys.ThrProductsRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.service.auth.CustomerService;
@ -24,7 +19,10 @@ import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.service.thrsys.ThrSystemDetailService;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
@ -63,54 +61,13 @@ public class ThrProductsController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("piQueryUrl", filterThrProductsRequest.getThirdSys());
if (thrSystemDetailEntity == null || thrSystemDetailEntity.getValue() == null) {
return ResultVOUtils.error(500, "ERP产品信息接口地址未定义");
}
if (thrSystemDetailEntity.getEnabled()) {
if (thrSystemDetailEntity.getFromType() == 0 || (filterThrProductsRequest.getIsDownThrSys() != null && filterThrProductsRequest.getIsDownThrSys())) {
BaseResponse<PageSimpleResponse<ThrProductsResponse>> udiDlDeviceResponse = erpBasicClient.getErpProducts(filterThrProductsRequest);
if (udiDlDeviceResponse.getCode() == 20000) {
List<ThrProductsResponse> invmandocResponses = udiDlDeviceResponse.getData().getList();
//todo 耗材字典未确认数据库
// if (invmandocResponses != null) {
// for (ThrProductsResponse invmandocResponse : invmandocResponses) {
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(invmandocResponse.getCode(), filterErpGoodsRequest.getThirdSys());
// invmandocResponse.setThirdSys(thrProductsRequest.getThirdSys());
// if (udiRelevanceEntity != null) {
// invmandocResponse.setChecked(true);
// } else {
// invmandocResponse.setChecked(false);
// }
// }
// }
}
return udiDlDeviceResponse;
} else {
List<ThrProductsResponse> thrCorpEntities = thrProductsService.filterJoinThrProducts(filterThrProductsRequest);
//todo 耗材字典未确认数据库
// for (ThrProductsEntity thrProductsEntity : thrCorpEntities) {
// UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thrProductsEntity.getThirdSysFk());
// if (udiRelevanceEntity != null) {
// thrProductsEntity.setChecked(true);
// } else {
// thrProductsEntity.setChecked(false);
// }
// }
PageInfo<ThrProductsResponse> pageInfo;
pageInfo = new PageInfo<>(thrCorpEntities);
PageSimpleResponse<ThrProductsResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrCorpEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
} else {
return ResultVOUtils.error(500, "第三方系统产品信息接口服务未启用");
}
List<ThrProductsResponse> thrCorpEntities = thrProductsService.filterJoinThrProducts(filterThrProductsRequest);
PageInfo<ThrProductsResponse> pageInfo;
pageInfo = new PageInfo<>(thrCorpEntities);
PageSimpleResponse<ThrProductsResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrCorpEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/udiwms/thrsys/delThrProducts")
@ -169,15 +126,14 @@ public class ThrProductsController {
@AuthRuleAnnotation("")
@PostMapping("/udiwms/udiinfo/erp/products/saveProduct")
@Log(title = "第三方产品信息", businessType = BusinessType.INSERT)
public BaseResponse saveProduct(@RequestBody ThrProductsEntity thrProductsEntity,FilterThrProductsRequest filterThrProductsRequest) {
public BaseResponse saveProduct(@RequestBody ThrProductsEntity thrProductsEntity, FilterThrProductsRequest filterThrProductsRequest) {
if (null == thrProductsEntity)
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
BeanUtils.copyProperties(thrProductsEntity,filterThrProductsRequest);
BeanUtils.copyProperties(thrProductsEntity, filterThrProductsRequest);
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProducts1(filterThrProductsRequest);
if(thrProductsEntities.size()==0){
if (thrProductsEntities.size() == 0) {
thrProductsEntity.setUpdateUser(String.valueOf(customerService.getUserId()));
thrProductsEntity.setCreateUser(String.valueOf(customerService.getUserId()));
thrProductsEntity.setUpdateTime(new Date());
@ -185,7 +141,7 @@ public class ThrProductsController {
thrProductsService.insertThrProducts(thrProductsEntity);
return ResultVOUtils.success();
}
return ResultVOUtils.error(999,"数据已存在!");
return ResultVOUtils.error(999, "数据已存在!");
// //新增主系统产品信息直接加到耗材字典里

@ -2,6 +2,7 @@ package com.glxp.api.dao.basic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
@ -11,7 +12,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BasicCorpDao extends BaseMapper<BasicCorpEntity> {
public interface BasicCorpDao extends BaseMapperPlus<BasicCorpDao, BasicCorpEntity, BasicCorpEntity> {
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);

@ -1,14 +1,17 @@
package com.glxp.api.dao.basic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.BasicHospTypeEntity;
import java.util.List;
import com.glxp.api.res.basic.BasicHospTypeResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface BasicHospTypeDao extends BaseMapper<BasicHospTypeEntity> {
public interface BasicHospTypeDao extends BaseMapperPlus<BasicHospTypeDao, BasicHospTypeEntity, BasicHospTypeEntity> {
List<BasicHospTypeResponse> getTreeList();

@ -2,6 +2,7 @@ package com.glxp.api.dao.basic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.BasicProductSetEntity;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.req.basic.FilterBasicProductSetrequest;
@ -10,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BasicProductsDao extends BaseMapper<BasicProductsEntity> {
public interface BasicProductsDao extends BaseMapperPlus<BasicProductsDao, BasicProductsEntity,BasicProductsEntity> {
}

@ -1,6 +1,7 @@
package com.glxp.api.dao.inout;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inout.IoCodeRelEntity;
import com.glxp.api.req.inout.IoOrderRelRequest;
import com.glxp.api.res.inout.IoCodeRelResponse;
@ -9,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface IoCodeRelMapper extends BaseMapper<IoCodeRelEntity> {
public interface IoCodeRelMapper extends BaseMapperPlus<IoCodeRelMapper, IoCodeRelEntity, IoCodeRelEntity> {
List<IoCodeRelResponse> selectIoCodeRelList(IoOrderRelRequest ioOrderRelRequest);

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.SupCertEntity;
import com.glxp.api.req.purchase.FilterSupCertRequest;
import com.glxp.api.req.purchase.purPlanPrintRequest;
@ -11,7 +12,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SupCertDao extends BaseMapper<SupCertEntity> {
public interface SupCertDao extends BaseMapperPlus<SupCertDao, SupCertEntity, SupCertEntity> {
List<SupCertEntity> filterCompanyCert(FilterSupCertRequest filterSupCertRequest);

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.SupCertSetEntity;
import com.glxp.api.req.purchase.FilterCertSetsRequest;
import org.apache.ibatis.annotations.Mapper;
@ -9,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SupCertSetDao extends BaseMapper<SupCertSetEntity> {
public interface SupCertSetDao extends BaseMapperPlus<SupCertSetDao, SupCertSetEntity, SupCertSetEntity> {
List<SupCertSetEntity> filterCertSets(FilterCertSetsRequest filterCertSetsRequest);
boolean insertCertSet(SupCertSetEntity supCertSetEntity);

@ -2,6 +2,8 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.SupCertSetEntity;
import com.glxp.api.entity.purchase.SupCompanyEntity;
import com.glxp.api.req.purchase.FilterSupCompanyRequest;
import org.apache.ibatis.annotations.Mapper;
@ -9,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SupCompanyDao extends BaseMapper<SupCompanyEntity> {
public interface SupCompanyDao extends BaseMapperPlus<SupCompanyDao, SupCompanyEntity, SupCompanyEntity> {
SupCompanyEntity findCompany(String CustomerId);

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.SupManufacturerEntity;
import com.glxp.api.req.purchase.FilterSupManufacturerRequest;
import org.apache.ibatis.annotations.Mapper;
@ -10,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SupManufacturerDao extends BaseMapper<SupManufacturerEntity> {
public interface SupManufacturerDao extends BaseMapperPlus<SupManufacturerDao, SupManufacturerEntity, SupManufacturerEntity> {
SupManufacturerEntity findCompany(Long id);

@ -2,6 +2,7 @@ package com.glxp.api.dao.purchase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.purchase.PurDeliveryDetailEntity;
import com.glxp.api.entity.purchase.SupProductEntity;
import com.glxp.api.req.purchase.FilterPoductRequest;
@ -12,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SupProductDao extends BaseMapper<SupProductEntity> {
public interface SupProductDao extends BaseMapperPlus<SupProductDao, SupProductEntity, SupProductEntity> {
SupProductEntity findRegistration(Long id);

@ -70,7 +70,7 @@ public class BasicProductsEntity {
/**
* 使:
使
* 使
*/
@TableField(value = "zxxsbzbhsydysl")
private Integer zxxsbzbhsydysl;
@ -163,7 +163,7 @@ public class BasicProductsEntity {
* 1.2使3.4
*/
@TableField(value = "diType")
private Byte diType;
private Integer diType;
/**
*
@ -193,7 +193,7 @@ public class BasicProductsEntity {
* 0:UDI1
*/
@TableField(value = "productType")
private Byte productType;
private Integer productType;
/**
*
@ -235,13 +235,13 @@ public class BasicProductsEntity {
*
*/
@TableField(value = "allowNoExpire")
private Byte allowNoExpire;
private Boolean allowNoExpire;
/**
*
*/
@TableField(value = "allowNoProduct")
private Byte allowNoProduct;
private Boolean allowNoProduct;
/**
*

@ -1,10 +1,16 @@
package com.glxp.api.entity.sync;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class BasicDownloadStatusEntity {
/**

@ -23,7 +23,7 @@ public class SysMenuHelpEntity {
private String menuName;
@TableField(value = "`status`")
private Byte status;
private Integer status;
@TableField(value = "filePath")
private String filePath;

@ -57,11 +57,11 @@ public class SysPdfTemplateRelevanceBizEntity {
private String remark3;
@TableField(value = "`printType`")
private Byte printType;
private Integer printType;
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}
}

@ -58,11 +58,11 @@ public class SysPdfTemplateRelevanceCodeEntity {
private String remark3;
@TableField(value = "`printType`")
private Byte printType;
private Integer printType;
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}
}

@ -57,11 +57,11 @@ public class SysPdfTemplateRelevanceLabelEntity {
private String remark3;
@TableField(value = "`printType`")
private Byte printType;
private Integer printType;
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}
}

@ -69,7 +69,7 @@ public class ThrOrderEntity {
* 1:2:
*/
@TableField(value = "inoutType")
private Byte inoutType;
private Integer inoutType;
/**
*

@ -0,0 +1,22 @@
package com.glxp.api.req.sync;
import com.glxp.api.constant.BasicExportTypeEnum;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SyncUpLoadRequest {
@ApiParam("数据类型")
private BasicExportTypeEnum exportType;
@ApiParam("数据内容")
private Object data;
}

@ -21,7 +21,7 @@ public class SysMenuHelpRequest extends ListPageRequest {
private String menuName;
private Byte status;
private Integer status;
private String filePath;

@ -12,7 +12,7 @@ public class IoCodeRelResponse {
private String code;
private String parentCode;
private String nameCode;
private Byte diType;
private Integer diType;
private String mainNameCode;
private String level;
private String produceDate;

@ -18,7 +18,7 @@ public class SysMenuHelpResponse {
private String menuName;
private Byte status;
private Integer status;
private String filePath;

@ -1,5 +1,6 @@
package com.glxp.api.service.basic;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
@ -9,7 +10,7 @@ import java.util.List;
/**
* Service
*/
public interface IBasicBussinessTypeService {
public interface IBasicBussinessTypeService extends IService<BasicBussinessTypeEntity> {
/**
*

@ -3,6 +3,7 @@ package com.glxp.api.service.basic.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
@ -27,7 +28,7 @@ import java.util.stream.Collectors;
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class BasicBussinessTypeServiceImpl implements IBasicBussinessTypeService {
public class BasicBussinessTypeServiceImpl extends ServiceImpl<BasicBussinessTypeDao,BasicBussinessTypeEntity> implements IBasicBussinessTypeService {
@Resource
private CustomerService customerService;

@ -33,8 +33,6 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
@Resource
BasicCorpImportLogDao basicCorpImportLogDao;
@Resource
BasicCorpImportLogService basicCorpImportLogService;
@Resource
SqlSessionFactory sqlSessionFactory;
@ -101,13 +99,13 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity();
basicCorpsImportLogEntity.setGenKey(genKey);
basicCorpsImportLogEntity.setRemark("导入数据成功,导入数量为:"+ corpList.size()+"条");
basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity);
this.updateImportLog(basicCorpsImportLogEntity);
} catch (Exception e) {
log.error("导入往来单位信息异常", e);
BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity();
basicCorpsImportLogEntity.setGenKey(genKey);
basicCorpsImportLogEntity.setRemark("导入数据失败");
basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity);
this.updateImportLog(basicCorpsImportLogEntity);
}
}

@ -35,6 +35,7 @@ import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -66,6 +67,7 @@ public class IoAddInoutService {
@Resource
BasicCorpService basicCorpService;
@Resource
@Lazy
IoCheckInoutService ioCheckInoutService;
@Resource
SystemParamConfigService systemParamConfigService;

@ -23,6 +23,7 @@ import com.glxp.api.util.DateUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -49,6 +50,7 @@ public class IoChangeInoutService {
@Resource
IoAddInoutService addInoutService;
@Resource
@Lazy
IoCheckInoutService ioCheckInoutService;
@Resource
InvWarehouseService invWarehouseService;

@ -28,9 +28,11 @@ import com.glxp.api.util.JasperUtils;
import com.glxp.api.util.OrderNoTypeBean;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiCalCountUtil;
import lombok.RequiredArgsConstructor;
import net.sf.jasperreports.engine.JRException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,6 +46,7 @@ import java.util.*;
*/
@Service
@Transactional(rollbackFor = Exception.class)
@RequiredArgsConstructor
public class IoCheckInoutService {
@Resource
@ -54,10 +57,12 @@ public class IoCheckInoutService {
IoCodeTempService codeTempService;
@Resource
IBasicBussinessTypeService basicBussinessTypeService;
@Resource
IoOrderDetailCodeService orderDetailCodeService;
@Resource
IoOrderDetailBizService orderDetailBizService;
@Lazy
private final IoOrderDetailCodeService orderDetailCodeService;
@Lazy
private final IoOrderDetailBizService orderDetailBizService;
@Resource
IoOrderDetailResultService orderDetailResultService;
@Resource

@ -12,6 +12,7 @@ import com.glxp.api.res.inout.IoOrderInvoiceResponse;
import com.glxp.api.service.inout.IoCheckInoutService;
import com.glxp.api.service.inout.IoOrderDetailBizService;
import com.glxp.api.service.inout.IoOrderDetailCodeService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -116,8 +117,10 @@ public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService {
@Resource
@Lazy
IoOrderDetailCodeService orderDetailCodeService;
@Resource
@Lazy
IoCheckInoutService checkInoutService;
@Override

@ -14,6 +14,7 @@ import com.glxp.api.res.inout.IoOrderDetailCodeResponse;
import com.glxp.api.service.inout.IoCheckInoutService;
import com.glxp.api.service.inout.IoOrderDetailBizService;
import com.glxp.api.service.inout.IoOrderDetailCodeService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +32,7 @@ public class IoOrderDetailCodeServiceImpl implements IoOrderDetailCodeService {
@Resource
IoOrderDetailBizService orderDetailBizService;
@Resource
@Lazy
IoCheckInoutService checkInoutService;
@Resource
private BasicCorpDao basicCorpDao;

@ -193,8 +193,29 @@ public class IoOrderServiceImpl implements IoOrderService {
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
//判断单据是否是预验收单据,如果是预验收单据,则删除预验收库库存
if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
preinOrderService.deleteByOrderId(billNo);
preinDetailService.deleteByOrderId(billNo);
//删除普通库存
List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
//更新库存
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (invProductEntity != null) {
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
//计算实际数量
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreinProductService.update(invProductEntity);
}
}
//删除库存详情
invPreinProductDetailService.deleteByOrderId(billNo);
}
} else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
//是否寄售,删除寄售库存
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
@ -285,20 +306,33 @@ public class IoOrderServiceImpl implements IoOrderService {
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) {
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
//预验收库存
if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
InvPreinDetailEntity invPreinDetailEntity = preinDetailService.findByCode(billNo, code);
int count = invPreinDetailEntity.getCount() - 1;
InvPreInProductDetailEntity invProductDetailEntity = invPreinProductDetailService.selectByCode(billNo, code);
int count = invProductDetailEntity.getCount() - 1;
if (count == 0) {
preinDetailService.deleteById(invPreinDetailEntity.getId());
invPreinProductDetailService.deleteById(invProductDetailEntity.getId() + "");
} else {
invPreinDetailEntity.setCount(count);
int reCount = udiCalCountUtil.getActCount(invPreinDetailEntity.getNameCode());
invPreinDetailEntity.setReCount(invPreinDetailEntity.getReCount() - reCount);
preinDetailService.update(invPreinDetailEntity);
//更新详情表
invProductDetailEntity.setCount(count);
int reCount = udiCalCountUtil.getActCount(invProductDetailEntity.getNameCode());
invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() - reCount);
invPreinProductDetailService.update(invProductDetailEntity);
}
//更新产品表
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (invProductEntity != null) {
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int inCount = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(inCount);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int outCount = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(outCount);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
}
invPreinProductService.update(invProductEntity);
} else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) { //寄售库存
InvPreProductDetailEntity invProductDetailEntity = invPreProductDetailService.selectByCode(billNo, code);
@ -374,9 +408,9 @@ public class IoOrderServiceImpl implements IoOrderService {
@Resource
InvPreinOrderService invPreinOrderService;
InvPreinProductService invPreinProductService;
@Resource
InvPreinDetailService invPreinDetailService;
InvPreinProductDetailService invPreinProductDetailService;
//已验收单据撤回
@Override
@ -387,8 +421,43 @@ public class IoOrderServiceImpl implements IoOrderService {
//预验收撤回---直接删除预验收库存
if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) {
invPreinOrderService.deleteByOrderId(billNo);
invPreinDetailService.deleteByOrderId(billNo);
List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(),
invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreinProductService.update(invProductEntity);
}
invPreinProductDetailService.deleteByOrderId(billNo);
}
} else if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(),
invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
invProductEntity.setInCount(count);
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
invProductEntity.setOutCount(count);
}
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invPreProductService.update(invProductEntity);
}
invPreProductDetailService.deleteByOrderId(billNo);
}
} else {
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo);
if (CollUtil.isNotEmpty(invProductDetailEntities)) {

@ -149,6 +149,34 @@ public class SpsSyncDownloadService {
@Value("${file_path}")
private String filePath;
/**
*
*
* @param info
* @param exportType
*/
public void syncData(SyncDataSetResponse info, BasicExportTypeEnum exportType) {
Date now = new Date();
switch (exportType) {
case BASIC_DATA:
if (needExec(info.getBasicProducts(), info.getBasicCorp(), info.getSupCert())) {
basicExportInfoCreate(exportType, now
, x -> x.generateBasicDataFile(info, now, false)
, x -> x.generateBasicDataFile(info, now, true));
}
break;
case OTHER_DATA:
if (needExec(info.getUdiCodeLost(), info.getUdiCodeRel())) {
basicExportInfoCreate(exportType, now
, x -> x.generateOtherDataFile(info, now, false)
, x -> x.generateOtherDataFile(info, now, true));
}
break;
case COUNTRY_DI_DATA:
}
}
/**
*
*
@ -163,7 +191,7 @@ public class SpsSyncDownloadService {
return;
}
try {
basicExportInfoCreate(BasicExportTypeEnum.BASIC_DATA, now, this.getClass()
basicExportInfoCreate(BasicExportTypeEnum.BASIC_DATA, now
, x -> x.generateBasicDataFile(info, now, false)
, x -> x.generateBasicDataFile(info, now, true));
} catch (Exception e) {
@ -173,7 +201,7 @@ public class SpsSyncDownloadService {
}
/**
* TODO
*
*
* @param info
*/
@ -186,7 +214,7 @@ public class SpsSyncDownloadService {
return;
}
try {
basicExportInfoCreate(BasicExportTypeEnum.OTHER_DATA, now, this.getClass()
basicExportInfoCreate(BasicExportTypeEnum.OTHER_DATA, now
, x -> x.generateOtherDataFile(info, now, false)
, x -> x.generateOtherDataFile(info, now, true));
} catch (Exception e) {
@ -195,6 +223,16 @@ public class SpsSyncDownloadService {
}
/**
*
*
* @param set
* @return
*/
private boolean needExec(int... set) {
return CollectionUtil.contains(Collections.singleton(set), 2);
}
/**
*
*
@ -202,15 +240,14 @@ public class SpsSyncDownloadService {
* @param hasDataMethod
* @param createFileMethod
*/
private void basicExportInfoCreate(BasicExportTypeEnum exportEnum, Date now
, Class<? extends SpsSyncDownloadService> clazz, Function<SpsSyncDownloadService, Boolean> hasDataMethod, Function<SpsSyncDownloadService, Boolean> createFileMethod) throws Exception {
private void basicExportInfoCreate(BasicExportTypeEnum exportEnum, Date now, Function<SpsSyncDownloadService, Boolean> hasDataMethod, Function<SpsSyncDownloadService, Boolean> createFileMethod) {
//防止出现同时调用问题
String redisKey = String.format("spsm-sync-create:%s", exportEnum.getKey());
boolean result = redisUtil.setIfAbsent(redisKey, 1, 10);
if (!result) {
String errorMsg = String.format("syncIdcSps----process------------同步[%s]重复进入", exportEnum.getRemark());
// logger.info(errorMsg);
throw new Exception(errorMsg);
throw new RuntimeException(errorMsg);
}
BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class)
.eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.BASIC_DATA.getRemark())
@ -229,6 +266,7 @@ public class SpsSyncDownloadService {
exportStatus = BasicExportStatusEntity.builder()
.id(CustomUtil.getId())
.status(BasicExportStatusEnum.WAIT_TRIGGERED.getCode())
.idDatas(BasicExportTypeEnum.BASIC_DATA.getKey())
.type(BasicExportTypeEnum.BASIC_DATA.getRemark())
.scheduleType(0)
.updateTime(cn.hutool.core.date.DateUtil.date())
@ -254,7 +292,7 @@ public class SpsSyncDownloadService {
Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10);
try {
//确认有开启物资字典由外向内同步
if (info.getBasicProducts() == 2) {
if (needExec(info.getBasicProducts())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_PRODUCTS, createFile);
totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_PRODUCTS, map);
List<BasicHospTypeEntity> hospTypeList = hospTypeService.list(Wrappers.lambdaQuery(BasicHospTypeEntity.class)
@ -291,7 +329,7 @@ public class SpsSyncDownloadService {
}
}
//确认有开启往来单位字典同步
if (info.getBasicCorp() == 2) {
if (needExec(info.getBasicCorp())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_CORP, createFile);
totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_CORP, map);
List<BasicCorpEntity> corpList = corpService.list(Wrappers.lambdaQuery(BasicCorpEntity.class)
@ -305,7 +343,7 @@ public class SpsSyncDownloadService {
}
//确认有开启首营资质同步
if (info.getSupCert() == 2) {
if (needExec(info.getSupCert())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.SUP_CERT, createFile);
totalTimeMap.put(BasicExportStatusTimeEnum.SUP_CERT, map);
List<SupCertEntity> supCertList = supCertService.list(Wrappers.lambdaQuery(SupCertEntity.class)

@ -31,8 +31,6 @@ public class ThrOrderImportLogServiceImpl implements ThrOrderImportLogService {
@Resource
ThrOrderImportLogDao thrOrderImportLogDao;
@Resource
ThrOrderImportLogService thrOrderImportLogService;
@Resource
ThrOrderImportDetailService thrOrderImportDetailService;
@Resource
@ -87,7 +85,7 @@ public class ThrOrderImportLogServiceImpl implements ThrOrderImportLogService {
@Async
public void importThrOrder(String genKey) {
ThrOrderImportLogEntity thrOrderImportLogEntity = thrOrderImportLogService.selectByGenKey(genKey);
ThrOrderImportLogEntity thrOrderImportLogEntity = this.selectByGenKey(genKey);
if (thrOrderImportLogEntity.getStatus() == BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS) {
FilterThrCorpImportLogRequest filterUdiIpLogRequest = new FilterThrCorpImportLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
@ -120,7 +118,7 @@ public class ThrOrderImportLogServiceImpl implements ThrOrderImportLogService {
}
thrOrderImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrOrderImportLogService.updateImportLog(thrOrderImportLogEntity);
this.updateImportLog(thrOrderImportLogEntity);
}
}

@ -2,16 +2,14 @@ package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.dao.thrsys.ThrProductsDao;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.res.thrsys.ThrProductsAddDiResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.service.thrsys.ThrProductsAddDiService;
import com.glxp.api.service.thrsys.ThrProductsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -83,8 +81,7 @@ public class ThrProductsServiceImpl implements ThrProductsService {
int offset = (filterThrProductsRequest.getPage() - 1) * filterThrProductsRequest.getLimit();
PageHelper.offsetPage(offset, filterThrProductsRequest.getLimit());
}
List<ThrProductsResponse> data = thrProductsDao.filterJoinThrProducts(filterThrProductsRequest);
return data;
return thrProductsDao.filterJoinThrProducts(filterThrProductsRequest);
}
@Override

@ -1,5 +1,6 @@
package com.glxp.api.task;
import com.glxp.api.constant.BasicExportTypeEnum;
import com.glxp.api.dao.schedule.ScheduledDao;
import com.glxp.api.entity.system.ScheduledEntity;
import com.glxp.api.req.system.ScheduledRequest;
@ -17,6 +18,7 @@ import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
@Component
@ -65,8 +67,11 @@ public class AsyncHeartTask implements SchedulingConfigurer {
if (curTime - lastTime > timeInterval) {
spsSyncDownloadService.syncDiProductsTask();
// todo 生成任务都写在这
spsSyncDownloadService.syncBasicData(syncDataSetEntity);
spsSyncDownloadService.syncOtherData(syncDataSetEntity);
Arrays.stream(BasicExportTypeEnum.values()).forEach(i -> {
spsSyncDownloadService.syncData(syncDataSetEntity, i);
});
// spsSyncDownloadService.syncBasicData(syncDataSetEntity);
// spsSyncDownloadService.syncOtherData(syncDataSetEntity);
redisUtil.set("SPS_SYNC_GEN_DATA", curTime);
}
}

@ -101,9 +101,9 @@
<select id="filterJoinThrProducts" parameterType="com.glxp.api.req.thrsys.FilterThrProductsRequest"
resultType="com.glxp.api.res.thrsys.ThrProductsResponse">
SELECT thr_products.*, thr_system.thirdName thirdSysName
SELECT thr_products.*,
(select thirdName from thr_system t where t.thirdId = thr_products.thirdSysFk) thirdSysName
FROM thr_products
LEFT JOIN thr_system on thr_products.thirdSysFk = thr_system.thirdId
<where>
<if test="name != '' and name != null">
AND name LIKE concat('%', #{name}, '%')

Loading…
Cancel
Save