yangdamao 2 years ago
parent
commit
9fdd8fa7a8

+ 41 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/goods/service/impl/TopOldOrderServiceImpl.java

@@ -1153,11 +1153,11 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
             try {
                 respone = HttpUtils.postFormBody(CHECK_ORDER_BROKERAGE, params);
                 if (!respone.contains("\"Status\":true")) {
-                    throw new CustomException("旧系统订单审核接口请求错误");
+                    throw new CustomException("旧系统订单佣金审核接口请求错误");
                 }
             } catch (IOException e) {
                 log.error("旧系统订单审核接口请求错误" + respone);
-                throw new CustomException("旧系统订单审核接口请求错误");
+                throw new CustomException("旧系统订单佣金审核接口请求错误");
             }
         } else {
             //订单审核
@@ -2384,6 +2384,26 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
 
                 }
         );
+
+        if (bo.getFinishStatus() == 1){
+            //完单通知旧系统
+            Map<String, String> params = new HashMap<>();
+            Long nowTime = DateUtils.getNowTime();
+            String sign = ToolsUtils.EncoderByMd5( nowTime.toString() + "pubilc2022");
+            params.put("stamp", nowTime.toString());
+            params.put("sign", sign);
+            params.put("orderSn", bo.getOrderSnList().stream().collect(Collectors.joining(",")));
+            String respone = "";
+            try {
+                respone = HttpUtils.postFormBody(FINISH_ORDER, params);
+                if (!respone.contains("\"Status\":true")) {
+                    throw new CustomException("旧系统订单完单接口请求错误");
+                }
+            } catch (IOException e) {
+                log.error("旧系统订单完单接口请求错误" + respone);
+                throw new CustomException("旧系统订单完单接口请求错误");
+            }
+        }
         return true;
     }
 
@@ -3237,7 +3257,7 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
         if (order.getOrderReceived().compareTo(order.getOrderPrice()) == 0) {
             //账款已结清
             order.setCreditTime(DateUtils.getNowTime());
-            //是否自动完单
+            //自动完单
             if (order.getFinishSign() == 0) {
                 //成本设置项
                 String costJson = order.getCostJson();
@@ -3256,6 +3276,24 @@ public class TopOldOrderServiceImpl extends ServiceImpl<TopOldOrderMapper, TopOl
                         calculateDivide(divideList, order, divideModel);
                     }
                 }
+
+                //完单通知旧系统
+                Map<String, String> params = new HashMap<>();
+                Long nowTime = DateUtils.getNowTime();
+                String sign = ToolsUtils.EncoderByMd5( nowTime.toString() + "pubilc2022");
+                params.put("stamp", nowTime.toString());
+                params.put("sign", sign);
+                params.put("orderSn", bo.getOrderSn());
+                String respone = "";
+                try {
+                    respone = HttpUtils.postFormBody(FINISH_ORDER, params);
+                    if (!respone.contains("\"Status\":true")) {
+                        throw new CustomException("旧系统订单完单接口请求错误");
+                    }
+                } catch (IOException e) {
+                    log.error("旧系统订单完单接口请求错误" + respone);
+                    throw new CustomException("旧系统订单完单接口请求错误");
+                }
             }
         }
         return updateById(order);