Browse Source

代码优化

chen 2 days ago
parent
commit
ac9c9fb753

+ 27 - 2
yudao-module-contract/yudao-module-contract-biz/src/main/java/cn/iocoder/yudao/module/contract/webservice/ContractWebService.java

@@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.contract.enums.OrderStatusEnum;
 import cn.iocoder.yudao.module.contract.service.basicData.BasicSupplierService;
 import cn.iocoder.yudao.module.contract.service.client.ClientService;
 import cn.iocoder.yudao.module.contract.service.contractTemplate.ContractTemplateService;
+import cn.iocoder.yudao.module.contract.service.exportContract.ExportContractService;
 import cn.iocoder.yudao.module.contract.service.order.OrderService;
 import cn.iocoder.yudao.module.contract.service.orderContract.OrderContractService;
 import cn.iocoder.yudao.module.contract.webservice.holders.TABLE_OF_ZJS004HHolder;
@@ -25,6 +26,8 @@ import cn.iocoder.yudao.module.contract.webservice.holders.TABLE_OF_ZSD_JS_009Ho
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.slf4j.Slf4j;
@@ -64,6 +67,8 @@ public class ContractWebService {
     private OrderContractService orderContractService;
     @Resource
     private BasicSupplierService basicSupplierService;
+    @Resource
+    private ExportContractService exportContractService;
 
 
     public String getOrderList(String vbeln) {
@@ -101,7 +106,12 @@ public class ContractWebService {
                     if(!"Y4".equals(orderDO.getHtdymb())){
                         //非出口合同-作废时更新
                         if (!"3".equals(order.getZzxshtzt())) {
-                            log.info("销售凭证:{}已存在并非作废状态,不操作", orderDO.getVbeln());
+                            log.info("销售凭证:{}已存在并非作废状态,重新通知{}", orderDO.getVbeln(),order.getZzxshtzt());
+                            OrderContractDO orderContract = orderContractService.getOne(new LambdaQueryWrapper<OrderContractDO>().eq(OrderContractDO::getOrderId,orderDO.getId()),false);
+                            if(orderContract == null){
+                                orderContract = new OrderContractDO();
+                            }
+                            pushOrderStatus(orderDO.getVbeln(),order.getZzxshtzt(),orderContract);
                             continue;
                         } else {
                             update = update + 1;
@@ -110,7 +120,14 @@ public class ContractWebService {
                     }else{
                         //出口合同-未生成合同时可更新
                         if ("1".equals(order.getStatus())) {
-                            log.info("出口合同-销售凭证:{}已生成合同,不操作", orderDO.getVbeln());
+                            log.info("出口合同-销售凭证:{}已生成合同,重新通知{}", orderDO.getVbeln(),order.getZzxshtzt());
+                            ExportContractDO exportContractDO = exportContractService.getOne(new QueryWrapper<ExportContractDO>().like("CONCAT(',',vbelns,',')",","+orderDO.getVbeln()+",").ne("status","3"),false);
+                            if(exportContractDO == null){
+                                //未生成合同时通知已接收数据
+                                exportContractDO = new ExportContractDO();
+                                exportContractDO.setStatus("1");
+                            }
+                            pushOrderStatus(orderDO.getVbeln(),exportContractDO);
                             continue;
                         } else {
                             update = update + 1;
@@ -133,6 +150,14 @@ public class ContractWebService {
                     //异步创建合同
                     orderContractService.createOrderContract(orderDO);
                     add = add+1;
+                }else{
+                    ExportContractDO exportContractDO = exportContractService.getOne(new QueryWrapper<ExportContractDO>().like("CONCAT(',',vbelns,',')",","+orderDO.getVbeln()+",").ne("status","3"),false);
+                    if(exportContractDO == null){
+                        //未生成合同时通知已接收数据
+                        exportContractDO = new ExportContractDO();
+                        exportContractDO.setStatus("1");
+                        pushOrderStatus(orderDO.getVbeln(),exportContractDO);
+                    }
                 }
             }
             log.info("订单同步WebService结束");

+ 1 - 1
yudao-server/src/main/resources/application-dev.yaml

@@ -43,7 +43,7 @@ spring:
       primary: master
       datasource:
         master:
-          url: jdbc:mysql://10.5.5.151:3306/xshtdb?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&connectTimeout=60000&socketTimeout=60000 # MySQL Connector/J 8.X 连接的示例
+          url: jdbc:mysql://10.5.5.151:3306/xshtdb?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
           username: xshtadmin
           password: Xsht.123456
 #        slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改