From 290357a4cd0364d6ee2f4e2e44a68160699d642b Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 12 Jul 2023 14:10:17 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8E=A8?= =?UTF-8?q?=E9=80=81nameCode=E4=B8=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/trace/UdiTraceService.java | 65 ++++--- .../mapper/basic/BasicUdiRelMapper.xml | 182 ++++++++++-------- 2 files changed, 139 insertions(+), 108 deletions(-) diff --git a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java index 5d3d358..454d526 100644 --- a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java +++ b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java @@ -162,15 +162,18 @@ public class UdiTraceService { List certNums = toCorpCreditNums.stream().distinct().collect(Collectors.toList()); for (String certNum : certNums) { UserCompanyEntity userCompanyEntity = userCompanyService.getOne(new QueryWrapper().eq("creditNum", certNum.trim())); - TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(2, traceProductDetailEntity.getId(), userCompanyEntity.getId()); - if (taskNoticeEntity == null) { - taskNoticeEntity = createTraceNotice(2, traceProductDetailEntity, userCompanyEntity.getId()); - pushDelayExpireTask(taskNoticeEntity); - pushMq(taskNoticeEntity, userCompanyEntity.getId()); - } else if (taskNoticeEntity.getStatus() == 4) { - //任务超时未处理,重新推送消息 - pushMq(taskNoticeEntity, userCompanyEntity.getId()); + if (userCompanyEntity != null) { + TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(2, traceProductDetailEntity.getId(), userCompanyEntity.getId()); + if (taskNoticeEntity == null) { + taskNoticeEntity = createTraceNotice(2, traceProductDetailEntity, userCompanyEntity.getId()); + pushDelayExpireTask(taskNoticeEntity); + pushMq(taskNoticeEntity, userCompanyEntity.getId()); + } else if (taskNoticeEntity.getStatus() == 4) { + //任务超时未处理,重新推送消息 + pushMq(taskNoticeEntity, userCompanyEntity.getId()); + } } + } } } @@ -190,32 +193,32 @@ public class UdiTraceService { } // if (traceProductDetailEntity.getStatus() == 2) { //出入库订单未处理完成 - //列出需要查询推送企业 - List traceOrderEntities = traceOrderService.findByProductIdFk(traceProductDetailEntity.getId()); - if (CollUtil.isNotEmpty(traceOrderEntities)) { - List toCorpCreditNums = new ArrayList<>(); - for (TraceOrderEntity traceOrderEntity : traceOrderEntities) { - if (StrUtil.isNotEmpty(traceOrderEntity.getToCorpCreditNum())) { - toCorpCreditNums.add(traceOrderEntity.getToCorpCreditNum()); - } - if (StrUtil.isNotEmpty(traceOrderEntity.getFromCorpCreditNum())) { - toCorpCreditNums.add(traceOrderEntity.getFromCorpCreditNum()); - } + //列出需要查询推送企业 + List traceOrderEntities = traceOrderService.findByProductIdFk(traceProductDetailEntity.getId()); + if (CollUtil.isNotEmpty(traceOrderEntities)) { + List toCorpCreditNums = new ArrayList<>(); + for (TraceOrderEntity traceOrderEntity : traceOrderEntities) { + if (StrUtil.isNotEmpty(traceOrderEntity.getToCorpCreditNum())) { + toCorpCreditNums.add(traceOrderEntity.getToCorpCreditNum()); } - List certNums = toCorpCreditNums.stream().distinct().collect(Collectors.toList()); - for (String certNum : certNums) { - UserCompanyEntity userCompanyEntity = userCompanyService.getOne(new QueryWrapper().eq("creditNum", certNum)); - TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), userCompanyEntity.getId()); - if (taskNoticeEntity == null) { - taskNoticeEntity = createTraceNotice(1, traceProductDetailEntity, userCompanyEntity.getId()); - pushDelayExpireTask(taskNoticeEntity); - pushMq(taskNoticeEntity, userCompanyEntity.getId()); - } else if (taskNoticeEntity.getStatus() == 4) { - //任务超时未处理,重新推送消息 - pushMq(taskNoticeEntity, userCompanyEntity.getId()); - } + if (StrUtil.isNotEmpty(traceOrderEntity.getFromCorpCreditNum())) { + toCorpCreditNums.add(traceOrderEntity.getFromCorpCreditNum()); + } + } + List certNums = toCorpCreditNums.stream().distinct().collect(Collectors.toList()); + for (String certNum : certNums) { + UserCompanyEntity userCompanyEntity = userCompanyService.getOne(new QueryWrapper().eq("creditNum", certNum)); + TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), userCompanyEntity.getId()); + if (taskNoticeEntity == null) { + taskNoticeEntity = createTraceNotice(1, traceProductDetailEntity, userCompanyEntity.getId()); + pushDelayExpireTask(taskNoticeEntity); + pushMq(taskNoticeEntity, userCompanyEntity.getId()); + } else if (taskNoticeEntity.getStatus() == 4) { + //任务超时未处理,重新推送消息 + pushMq(taskNoticeEntity, userCompanyEntity.getId()); } } + } // } } diff --git a/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml b/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml index a10affc..ed2bb25 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml @@ -57,7 +57,7 @@ left join user_company uc on bur.companyIdFk = uc.id - AND companyIdFk=#{companyIdFk} + AND companyIdFk = #{companyIdFk} AND ylqxzcrbarmc LIKE concat('%', #{ylqxzcrbarmc}, '%') @@ -93,11 +93,21 @@ AND nameCode LIKE concat(#{unionCode}, '%') + + AND nameCode = #{nameCode} + - or p.cpmctymc LIKE concat('%', #{unionFilterStr}, '%') - or p.ylqxzcrbarmc LIKE concat('%', #{unionFilterStr}, '%') - or p.ggxh LIKE concat('%', #{unionFilterStr}, '%') - or p.zczbhhzbapzbh LIKE concat('%', #{unionFilterStr}, '%') + or p.cpmctymc LIKE concat('%', #{unionFilterStr} + , '%') + or p.ylqxzcrbarmc LIKE concat('%' + , #{unionFilterStr} + , '%') + or p.ggxh LIKE concat('%' + , #{unionFilterStr} + , '%') + or p.zczbhhzbapzbh LIKE concat('%' + , #{unionFilterStr} + , '%') AND nameCode = #{unionCode} @@ -108,60 +118,62 @@ - SELECT sup_manufacturer.* ,user_company.companyName as supName - - ,(SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND sup_product.auditStatus!=0 AND sup_product.auditStatus!=1 AND sup_product.auditStatus!=4 AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as failCout, - (SELECT count(*) FROM sup_product WHERE sup_manufacturer.customerId=sup_product.customerId AND (sup_product.auditStatus=1 OR sup_product.auditStatus=4) AND sup_manufacturer.manufacturerId=sup_product.manufacturerIdFk ) as passCout + SELECT sup_manufacturer.*, + user_company.companyName as supName + + , + (SELECT count(*) + FROM sup_product + WHERE sup_manufacturer.customerId = sup_product.customerId + AND sup_product.auditStatus != 0 + AND sup_product.auditStatus != 1 + AND sup_product.auditStatus != 4 + AND sup_manufacturer.manufacturerId = sup_product.manufacturerIdFk) as failCout, + (SELECT count(*) + FROM sup_product + WHERE sup_manufacturer.customerId = sup_product.customerId + AND (sup_product.auditStatus = 1 OR sup_product.auditStatus = 4) + AND sup_manufacturer.manufacturerId = sup_product.manufacturerIdFk) as passCout FROM sup_manufacturer - inner join user_company on sup_manufacturer.customerId = user_company.customerId + inner join user_company on sup_manufacturer.customerId = user_company.customerId - + and id = #{id} and manufacturerId = #{manufacturerId} - and sup_manufacturer.companyName like concat('%',#{companyName},'%') + and sup_manufacturer.companyName like concat('%', #{companyName}, '%') - and creditCode like concat('%',#{creditCode},'%') + and creditCode like concat('%', #{creditCode}, '%') - and placeArea like concat('%',#{placeArea},'%') + and placeArea like concat('%', #{placeArea}, '%') and sup_manufacturer.customerId = #{customerId} - + and sup_manufacturer.auditStatus = #{auditStatus} - - and (sup_manufacturer.auditStatus = 0 or sup_manufacturer.auditStatus=5 or - sup_manufacturer.auditStatus=2) + + and (sup_manufacturer.auditStatus = 0 or sup_manufacturer.auditStatus = 5 or + sup_manufacturer.auditStatus = 2) - - and 0 ]]> + + and 0 + ]]> - - and (sup_manufacturer.auditStatus = 1 or sup_manufacturer.auditStatus=4 ) + + and (sup_manufacturer.auditStatus = 1 or sup_manufacturer.auditStatus = 4) - - = DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]> + + = + DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') + ]]> and id != #{id}