From d1743d12b44fa7f37affc052475270f4479b4576 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Mon, 25 Mar 2024 15:56:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E4=B8=89=E6=96=B9=E7=9A=84=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=A1=A8-=E7=94=9F=E6=88=90=E5=8D=95=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/controller/TestController.java | 5 + .../dao/thrsys/ThrInvOrderDetailMapper.java | 2 + .../glxp/api/entity/inout/IoOrderEntity.java | 6 + .../api/entity/thrsys/ThrInvOrderDetail.java | 5 + .../service/thrsys/ThrInvOrderService.java | 15 + .../thrsys/impl/ThrInvOrderServiceImpl.java | 291 +++++++++++++++++- .../task/ScanThrOrderGenerateOrderTask.java | 73 +++++ .../mapper/thrsys/ThrInvOrderDetailMapper.xml | 12 + src/main/resources/schemas/schema_v2.4.sql | 14 + 9 files changed, 419 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/glxp/api/task/ScanThrOrderGenerateOrderTask.java diff --git a/src/main/java/com/glxp/api/controller/TestController.java b/src/main/java/com/glxp/api/controller/TestController.java index fc72cd991..d9748f00d 100644 --- a/src/main/java/com/glxp/api/controller/TestController.java +++ b/src/main/java/com/glxp/api/controller/TestController.java @@ -97,5 +97,10 @@ public class TestController { return ResultVOUtils.success(""); } + @GetMapping("/test/scanInvGhOrderGenerateGhOrder") + public BaseResponse scanInvGhOrderGenerateGhOrder() { + thrInvOrderService.scanInvGhOrderGenerateGhOrder(); + return ResultVOUtils.success(""); + } } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderDetailMapper.java b/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderDetailMapper.java index 28beef238..5ec4f844f 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderDetailMapper.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrInvOrderDetailMapper.java @@ -16,4 +16,6 @@ public interface ThrInvOrderDetailMapper extends BaseMapperPlus filterThrOrderDetailDetail(FilterThrInvOrderDetailRequest filterThrInvOrderDetailRequest); int deleteBatchByThrCodeIds(@Param("list") List delThrCodes); + + List selectSourceTypeList(Integer thrInvSfOrderType); } diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java index c61946750..389c829ec 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderEntity.java @@ -297,4 +297,10 @@ public class IoOrderEntity { @TableField(value = "fromPatientCode") private String fromPatientCode; + /** + * 来源thr单据号 + */ + @TableField(value = "thrOrderIdFk") + private String thrOrderIdFk; + } diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java index 6529f5506..636118c4b 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java @@ -174,6 +174,11 @@ public class ThrInvOrderDetail implements Serializable { */ private String sickerName; + /** + * 是否已处理 + */ + private Integer handleStatus; + private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/glxp/api/service/thrsys/ThrInvOrderService.java b/src/main/java/com/glxp/api/service/thrsys/ThrInvOrderService.java index 70ba6eafe..370aaaceb 100644 --- a/src/main/java/com/glxp/api/service/thrsys/ThrInvOrderService.java +++ b/src/main/java/com/glxp/api/service/thrsys/ThrInvOrderService.java @@ -76,4 +76,19 @@ public interface ThrInvOrderService { void downloadInvGhOrderFilter(FilterDownloadInvOrderRequest filterDownloadInvOrderRequest); void downloadInvPhOrderFilter(FilterDownloadInvOrderRequest filterDownloadInvOrderRequest); + + /** + * 定时扫描三方的明细表-收费明细类型 未处理的 进行重新处理生成单据 + */ + void scanInvSfOrderGenerateSfOrder(); + + /** + * 定时扫描三方的明细表-普耗明细类型 未处理的 进行重新处理生成单据 + */ + void scanInvPhOrderGeneratePhOrder(); + + /** + * 定时扫描三方的明细表-高耗明细类型 未处理的 进行重新处理生成单据 + */ + void scanInvGhOrderGenerateGhOrder(); } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java index 3ec47fb9d..d68d9606d 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java @@ -23,6 +23,7 @@ import com.glxp.api.entity.inout.IoOrderDetailBizEntity; import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.entity.thrsys.*; +import com.glxp.api.exception.JsonException; import com.glxp.api.http.ErpInvClient; import com.glxp.api.req.inv.FilterInvProductRequest; import com.glxp.api.req.thrsys.FilterDownloadInvOrderRequest; @@ -168,6 +169,15 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) { handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, list.get(0), Constant.THR_INV_PH_ORDER_TYPE); + //是否自动生成出入库单据 + if (IntUtil.value(systemParamConfigService.selectValueByParamKey("fee_out_auto_gen")) > 0) { + GenerateOrderRequest generateOrderRequest = new GenerateOrderRequest(); + generateOrderRequest.setBillNo(thrInvOrder.getBillNo()); + generateOrderRequest.setAction(thrInvOrder.getBillType()); + generateOrderRequest.setFromCorp(thrInvOrder.getFromCorp()); + generateOrder(generateOrderRequest); + } + //保存数据 thrInvOrderMapper.insert(thrInvOrder); thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails); @@ -391,7 +401,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { if (CollectionUtil.isEmpty(thrInvOrderDetails)) return false; //校验单据的relId有null不生成单据 - if (!inspectionDocuments(thrInvOrderDetails)) return false; +// if (!inspectionDocuments(thrInvOrderDetails)) return false; BasicBussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findByAction(generateOrderRequest.getAction()); @@ -421,7 +431,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { ioOrderEntity.setFromType(ConstantStatus.FROM_WEBNEW);//网页新增 ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿 ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿 - ioOrderEntity.setCorpOrderId(billNo);//单据号 + ioOrderEntity.setCorpOrderId(UUID.randomUUID()+"");//单据号 + ioOrderEntity.setThrOrderIdFk(billNo);//单据号 ioOrderEntity.setUpdateTime(new Date()); ioOrderEntity.setCustomerId("110"); ioOrderEntity.setCreateTime(new Date()); @@ -435,6 +446,15 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { return false; } + //更新三方明细列表为已处理 + List value = entry.getValue(); + List updateThrInvOrderDetails = new ArrayList<>(value.size()); + value.forEach( x -> { + x.setHandleStatus(1); + updateThrInvOrderDetails.add(x); + }); + + thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails); ioOrderService.insertOrder(ioOrderEntity); thrInvOrder.setStatus(ConstantStatus.SFIO_CFMD);//已确认 thrInvOrder.setUpdateTime(new Date()); @@ -474,7 +494,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { if (CollectionUtil.isEmpty(thrInvOrderDetails)) return false; //校验单据的relId有null不生成单据 - if (!inspectionDocuments(thrInvOrderDetails)) return false; +// if (!inspectionDocuments(thrInvOrderDetails)) return false; BasicBussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findByAction(generateOrderRequest.getAction()); Map> grouped = new HashMap<>(); @@ -500,7 +520,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { ioOrderEntity.setFromType(ConstantStatus.FROM_WEBNEW);//网页新增 ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿 ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿 - ioOrderEntity.setCorpOrderId(billNo);//单据号 + ioOrderEntity.setCorpOrderId(UUID.randomUUID()+"");//单据号 + ioOrderEntity.setThrOrderIdFk(billNo);//单据号 ioOrderEntity.setUpdateTime(new Date()); ioOrderEntity.setCreateTime(new Date()); ioOrderEntity.setCustomerId("110"); @@ -520,6 +541,15 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { return false; } + //更新三方明细列表为已处理 + List value = entry.getValue(); + List updateThrInvOrderDetails = new ArrayList<>(value.size()); + value.forEach( x -> { + x.setHandleStatus(1); + updateThrInvOrderDetails.add(x); + }); + + thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails); ioOrderService.insertOrder(ioOrderEntity); thrInvOrder.setStatus(ConstantStatus.SFIO_CFMD);//已确认 thrInvOrder.setUpdateTime(new Date()); @@ -757,6 +787,259 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { log.info("手动抓取第三方普耗出入库明细生成单据定时任务结束"); } + @Override + public void scanInvSfOrderGenerateSfOrder() { + log.info("扫描处理第三方收费明细生成单据定时任务开始"); + List list = thrInvOrderDetailMapper.selectSourceTypeList(Constant.THR_INV_SF_ORDER_TYPE); + /** + * 1、根据 外检单号 进行 分组 + * 2、遍历不同分组 在分组的列表再次进行匹配 + * 3、匹配到的列表 不为空 进行 新增关联的单据 插入明细操作 + * 4、需要 回写三方的明细表 标记已处理 + */ + if (CollectionUtil.isEmpty(list)) return; + Map> grouped = list.stream() + .collect(Collectors.groupingBy(ThrInvOrderDetail::getOrderIdFk)); + for (Map.Entry> entry : grouped.entrySet()) { + String orderIdFk = entry.getKey(); + List thrInvOrderDetails = entry.getValue(); + List generatethrInvOrderDetails = new ArrayList<>(entry.getValue().size());//需要生成的明细 + + thrInvOrderDetails.forEach(item -> { + Long relId = item.getRelId(); + if (ObjectUtil.isNull(relId)) { + String nameCode = item.getNameCode(); + List productsEntities = udiRelevanceDao.getProductsEntitiesByNameCode(nameCode); + if (CollectionUtil.isNotEmpty(productsEntities)) { + BasicProductsEntity basicProductsEntity = productsEntities.get(0); + item.setRelId(basicProductsEntity.getId()); + item.setHandleStatus(1); + generatethrInvOrderDetails.add(item); + } else { + + } + } + }); + + if (generatethrInvOrderDetails.size() >0 ){ + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails);//先进行 回写已处理状态 + + //通过单号获取单据信息 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("billNo", orderIdFk); + ThrInvOrder thrInvOrder = thrInvOrderMapper.selectOne(qw); + BasicBussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findByAction(thrInvOrder.getBillType()); + + //新单号 + String newBillNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")); + IoOrderEntity ioOrderEntity = new IoOrderEntity(); + ioOrderEntity.setBillNo(newBillNo); + ioOrderEntity.setMainAction(thrInvOrder.getMainAction()); + ioOrderEntity.setFromCorp(thrInvOrder.getFromCorp()); + ioOrderEntity.setInvCode(thrInvOrder.getInvCode()); + ioOrderEntity.setDeptCode(thrInvOrder.getDeptCode()); + ioOrderEntity.setAction(thrInvOrder.getBillType()); + + ioOrderEntity.setFromType(ConstantStatus.FROM_WEBNEW);//网页新增 + ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿 + ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿 + ioOrderEntity.setCorpOrderId(UUID.randomUUID()+"");//单据号 + ioOrderEntity.setThrOrderIdFk(thrInvOrder.getBillNo());//单据号 + ioOrderEntity.setUpdateTime(new Date()); + ioOrderEntity.setCreateTime(new Date()); + ioOrderEntity.setCustomerId("110"); + Long userId = customerService.getUserId(); + ioOrderEntity.setCreateUser(userId + ""); + ioOrderEntity.setUpdateUser(userId + ""); + ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理 + + List newOrderDetailBiz = new ArrayList<>(generatethrInvOrderDetails.size()); + if (!copyOrderDetailBiz(generatethrInvOrderDetails, newOrderDetailBiz, newBillNo)) { + throw new JsonException("第三方收费明细自动转化单据异常"); + } + + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails); + ioOrderService.insertOrder(ioOrderEntity); + ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz); + + //自动处理业务单据 + ioAddInoutService.dealBusProcess(ioOrderEntity, bussinessTypeEntity); + } + } + + log.info("扫描处理第三方收费明细生成单据定时任务结束"); + } + + @Override + public void scanInvPhOrderGeneratePhOrder() { + log.info("扫描处理第三方普耗明细生成单据定时任务开始"); + List list = thrInvOrderDetailMapper.selectSourceTypeList(Constant.THR_INV_PH_ORDER_TYPE); + /** + * 1、根据 外检单号 进行 分组 + * 2、遍历不同分组 在分组的列表再次进行匹配 + * 3、匹配到的列表 不为空 进行 新增关联的单据 插入明细操作 + * 4、需要 回写三方的明细表 标记已处理 + */ + if (CollectionUtil.isEmpty(list)) return; + Map> grouped = list.stream() + .collect(Collectors.groupingBy(ThrInvOrderDetail::getOrderIdFk)); + for (Map.Entry> entry : grouped.entrySet()) { + String orderIdFk = entry.getKey(); + List thrInvOrderDetails = entry.getValue(); + List generatethrInvOrderDetails = new ArrayList<>(entry.getValue().size());//需要生成的明细 + + thrInvOrderDetails.forEach(item -> { + Long relId = item.getRelId(); + if (ObjectUtil.isNull(relId)) { + String nameCode = item.getNameCode(); + List productsEntities = udiRelevanceDao.getProductsEntitiesByNameCode(nameCode); + if (CollectionUtil.isNotEmpty(productsEntities)) { + BasicProductsEntity basicProductsEntity = productsEntities.get(0); + item.setRelId(basicProductsEntity.getId()); + item.setHandleStatus(1); + generatethrInvOrderDetails.add(item); + } else { + + } + } + }); + + if (generatethrInvOrderDetails.size() > 0) { + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails);//先进行 回写已处理状态 + + //通过单号获取单据信息 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("billNo", orderIdFk); + ThrInvOrder thrInvOrder = thrInvOrderMapper.selectOne(qw); + BasicBussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findByAction(thrInvOrder.getBillType()); + + //新单号 + String newBillNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")); + IoOrderEntity ioOrderEntity = new IoOrderEntity(); + ioOrderEntity.setBillNo(newBillNo); + ioOrderEntity.setMainAction(thrInvOrder.getMainAction()); + ioOrderEntity.setFromCorp(thrInvOrder.getFromCorp()); + ioOrderEntity.setInvCode(thrInvOrder.getInvCode()); + ioOrderEntity.setDeptCode(thrInvOrder.getDeptCode()); + ioOrderEntity.setAction(thrInvOrder.getBillType()); + + ioOrderEntity.setFromType(ConstantStatus.FROM_WEBNEW);//网页新增 + ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿 + ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿 + ioOrderEntity.setCorpOrderId(UUID.randomUUID() + "");//单据号 + ioOrderEntity.setThrOrderIdFk(thrInvOrder.getBillNo());//单据号 + ioOrderEntity.setUpdateTime(new Date()); + ioOrderEntity.setCreateTime(new Date()); + ioOrderEntity.setCustomerId("110"); + Long userId = customerService.getUserId(); + ioOrderEntity.setCreateUser(userId + ""); + ioOrderEntity.setUpdateUser(userId + ""); + ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理 + + List newOrderDetailBiz = new ArrayList<>(generatethrInvOrderDetails.size()); + if (!copyOrderDetailBiz(generatethrInvOrderDetails, newOrderDetailBiz, newBillNo)) { + throw new JsonException("第三方普耗明细自动转化单据异常"); + } + + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails); + ioOrderService.insertOrder(ioOrderEntity); + ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz); + + //自动处理业务单据 + ioAddInoutService.dealBusProcess(ioOrderEntity, bussinessTypeEntity); + } + } + log.info("扫描处理第三方普耗明细生成单据定时任务结束"); + } + + @Override + public void scanInvGhOrderGenerateGhOrder() { + log.info("扫描处理第三方高耗明细生成单据定时任务开始"); + List list = thrInvOrderDetailMapper.selectSourceTypeList(Constant.THR_INV_GH_ORDER_TYPE); + /** + * 1、根据 外检单号 进行 分组 + * 2、遍历不同分组 在分组的列表再次进行匹配 + * 3、匹配到的列表 不为空 进行 新增关联的单据 插入明细操作 + * 4、需要 回写三方的明细表 标记已处理 + */ + if (CollectionUtil.isEmpty(list)) return; + Map> grouped = list.stream() + .collect(Collectors.groupingBy(ThrInvOrderDetail::getOrderIdFk)); + for (Map.Entry> entry : grouped.entrySet()) { + String orderIdFk = entry.getKey(); + List thrInvOrderDetails = entry.getValue(); + List generatethrInvOrderDetails = new ArrayList<>(entry.getValue().size());//需要生成的明细 + + thrInvOrderDetails.forEach(item -> { + Long relId = item.getRelId(); + if (ObjectUtil.isNull(relId)) { + String nameCode = item.getNameCode(); + List productsEntities = udiRelevanceDao.getProductsEntitiesByNameCode(nameCode); + if (CollectionUtil.isNotEmpty(productsEntities)) { + BasicProductsEntity basicProductsEntity = productsEntities.get(0); + item.setRelId(basicProductsEntity.getId()); + item.setHandleStatus(1); + generatethrInvOrderDetails.add(item); + } else { + + } + } + }); + + if (generatethrInvOrderDetails.size() >0 ) { + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails);//先进行 回写已处理状态 + + //通过单号获取单据信息 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("billNo", orderIdFk); + ThrInvOrder thrInvOrder = thrInvOrderMapper.selectOne(qw); + + //新单号 + String newBillNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd")); + IoOrderEntity ioOrderEntity = new IoOrderEntity(); + ioOrderEntity.setBillNo(newBillNo); + ioOrderEntity.setMainAction(thrInvOrder.getMainAction()); + ioOrderEntity.setFromCorp(thrInvOrder.getFromCorp()); + ioOrderEntity.setInvCode(thrInvOrder.getInvCode()); + ioOrderEntity.setDeptCode(thrInvOrder.getDeptCode()); + ioOrderEntity.setAction(thrInvOrder.getBillType()); + + ioOrderEntity.setFromType(ConstantStatus.FROM_WEBNEW);//网页新增 + ioOrderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);//草稿 + ioOrderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);//草稿 + ioOrderEntity.setCorpOrderId(UUID.randomUUID() + "");//单据号 + ioOrderEntity.setThrOrderIdFk(thrInvOrder.getBillNo());//单据号 + ioOrderEntity.setUpdateTime(new Date()); + ioOrderEntity.setCreateTime(new Date()); + ioOrderEntity.setCustomerId("110"); + Long userId = customerService.getUserId(); + ioOrderEntity.setCreateUser(userId + ""); + ioOrderEntity.setUpdateUser(userId + ""); + ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理 + + List newIoCodeTemps = new ArrayList<>(thrInvOrderDetails.size()); + GenerateOrderRequest generateOrderRequest = new GenerateOrderRequest(); + generateOrderRequest.setAction(thrInvOrder.getBillType()); + if (!copyIoCodeTemps(entry.getValue(), newIoCodeTemps, newBillNo, generateOrderRequest)) { + throw new JsonException("第三方高耗明细自动转化单据异常"); + } + + thrInvOrderDetailMapper.updateBatchById(generatethrInvOrderDetails); + ioOrderService.insertOrder(ioOrderEntity); + ioCodeTempDao.insertBatch(newIoCodeTemps); + for (IoCodeTempEntity codeTempEntity : newIoCodeTemps) { + addInoutService.genOrderDetailCode(ioOrderEntity, codeTempEntity); + } + ioAddInoutService.dealProcess(ioOrderEntity); + if (!ioCheckInoutService.checkManual(ioOrderEntity.getBillNo())) { + ioCheckInoutService.check(ioOrderEntity.getBillNo()); + } + + } + } + log.info("扫描处理第三方高耗明细生成单据定时任务结束"); + } + /** * 校验relId字段有空返回false * diff --git a/src/main/java/com/glxp/api/task/ScanThrOrderGenerateOrderTask.java b/src/main/java/com/glxp/api/task/ScanThrOrderGenerateOrderTask.java new file mode 100644 index 000000000..aa9cb7083 --- /dev/null +++ b/src/main/java/com/glxp/api/task/ScanThrOrderGenerateOrderTask.java @@ -0,0 +1,73 @@ +package com.glxp.api.task; + +import com.glxp.api.dao.schedule.ScheduledDao; +import com.glxp.api.entity.system.ScheduledEntity; +import com.glxp.api.req.system.ScheduledRequest; +import com.glxp.api.service.thrsys.ThrInvOrderService; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; +import org.springframework.scheduling.support.CronTrigger; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Slf4j +@Component +public class ScanThrOrderGenerateOrderTask implements SchedulingConfigurer { + + final Logger logger = LoggerFactory.getLogger(AsyncFetchUdiTask.class); + + @Resource + private ScheduledDao scheduledDao; + @Resource + private ThrInvOrderService thrInvOrderService; + + @Override + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { + scheduledTaskRegistrar.addTriggerTask(() -> process(), + triggerContext -> { + ScheduledRequest scheduledRequest = new ScheduledRequest(); + scheduledRequest.setCronName("scanThrOrderGenerateOrderTask"); + logger.info("ScanThrOrderGenerateOrderTask----------------"); + ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest); + String cron = scheduledEntity != null ? scheduledEntity.getCron() : "0 0 5 * * ?"; + + if (cron.isEmpty()) { + logger.error("cron is null"); + } + logger.info("ScanThrOrderGenerateOrderTask----------------" + cron); + return new CronTrigger(cron).nextExecutionTime(triggerContext); + }); + } + + private void process() { +//======================================================================================= + log.info("定时扫描三方的明细表-收费明细类型开开始"); + try { + thrInvOrderService.scanInvSfOrderGenerateSfOrder(); + } catch (Exception e) { + + } + log.info("定时扫描三方的明细表-收费明细类型结束"); +//======================================================================================= + log.info("定时扫描三方的明细表-普耗明细类型开开始"); + try { + thrInvOrderService.scanInvPhOrderGeneratePhOrder(); + } catch (Exception e) { + + } + log.info("定时扫描三方的明细表-普耗明细类型结束"); +//======================================================================================= +// log.info("定时扫描三方的明细表-收费高耗类型开开始"); +// try { +// thrInvOrderService.scanInvGhOrderGenerateGhOrder(); +// } catch (Exception e) { +// +// } +// log.info("定时扫描三方的明细表-收费高耗类型结束"); +//======================================================================================= + } +} diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderDetailMapper.xml b/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderDetailMapper.xml index baad34469..b369e901a 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderDetailMapper.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrInvOrderDetailMapper.xml @@ -22,4 +22,16 @@ + + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index f5b8dda15..43f8f7760 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -1857,3 +1857,17 @@ CALL Pro_Temp_ColumnWork('basic_products', 'catalogname3', CALL Pro_Temp_ColumnWork('basic_products', 'matrial', ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT ''耗材材质''', 1); + + +CALL Pro_Temp_ColumnWork('thr_inv_order_detail', 'handleStatus', + ' int(0) NULL DEFAULT NULL COMMENT ''是否处理''', + 1); + +CALL Pro_Temp_ColumnWork('io_order', 'thrOrderIdFk', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT ''来源单据号''', + 1); +ALTER TABLE thr_inv_order_detail + MODIFY COLUMN `relId` bigint(0) NULL DEFAULT NULL COMMENT '物资字典主键' AFTER `cpmctymc`; + +INSERT IGNORE INTO sys_scheduled(`id`, `cronName`, `cron`, `customerId`, `remark`) +VALUES (151, 'scanThrOrderGenerateOrderTask', '0 0 5 * * ?', NULL, '定时扫描三方的明细表生成单据');