Procházet zdrojové kódy

1.设置停止接单逻辑修改
2.设置停止接单去除MongoDB->insert

lengfaqiang před 1 rokem
rodič
revize
b95f751dc8

+ 33 - 13
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtAcceptCarriageOrderService.java

@@ -1283,24 +1283,44 @@ public class KwtAcceptCarriageOrderService {
      */
     @Transactional(rollbackFor = Exception.class)
     public HttpResult stopDocumentCommit(StopOrderTakingDTO stopOrderTakingDTO) {
-        List<String> stringList = StringUtils.splitStrToList(stopOrderTakingDTO.getIds(), ",", String.class);
-        List<Long> circulateIds = logisticsOrderCirculateMapper.selectEntityBylOrderIdAndOrderIds(stopOrderTakingDTO.getLOrderId(), stringList);
-        if (CollectionUtils.isEmpty(circulateIds)) {
+        List<Long> ids = StringUtils.splitStrToList(stopOrderTakingDTO.getIds(), ",", Long.class);
+        List<KwtWaybillOrderSubtask> subtasks = waybillOrderSubtaskMapper.selectList(new LambdaQueryWrapper<KwtWaybillOrderSubtask>()
+                        .eq(KwtWaybillOrderSubtask::getDelFlag,0)
+                        .eq(KwtWaybillOrderSubtask::getLOrderId,Long.parseLong(stopOrderTakingDTO.getLOrderId()))
+                                .in(KwtWaybillOrderSubtask::getId,ids)
+        );
+        if (CollectionUtils.isEmpty(subtasks)) {
             return HttpResult.error("循环停止接单,单据不存在!");
         }
-        List<JSONObject> list = new ArrayList<>(stringList.size());
-        acceptStopDocumentCommit(stopOrderTakingDTO, list, circulateIds);
-//        String type = stopOrderTakingDTO.getType();
-//        if (String.valueOf(NumberConstant.TWO).equals(type)) {
-//            acceptStopDocumentCommit(stopOrderTakingDTO, list, wOrderIds);
-//        } else if (String.valueOf(NumberConstant.ONE).equals(type)) {
-//            consignStopDocumentCommit(stopOrderTakingDTO, list, wOrderIds);
-//        } else {
-//            return HttpResult.error("单据类型错误!");
-//        }
+        List<JSONObject> list = new ArrayList<>(subtasks.size());
+        updateWayBillOrderSubtask(stopOrderTakingDTO, list,ids );
         return HttpResult.ok(list);
     }
 
+    /**
+     * 承运订单设置停止接单
+     *
+     * @param stopOrderTakingDTO
+     */
+    private void updateWayBillOrderSubtask(StopOrderTakingDTO stopOrderTakingDTO, List<JSONObject> list, List<Long> ids) {
+        if (CollectionUtils.isNotEmpty(ids)) {
+            ids.forEach(id -> {
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("id", id);
+                waybillOrderSubtaskMapper.update(null, new LambdaUpdateWrapper<KwtWaybillOrderSubtask>()
+                        .set(KwtWaybillOrderSubtask::getStatus, NumberConstant.ONE)
+                        .set(KwtWaybillOrderSubtask::getUpdateBy, LoginUserHolder.getUserId())
+                        .set(KwtWaybillOrderSubtask::getUpdateTime, new Date())
+                        .eq(KwtWaybillOrderSubtask::getId, id)
+                );
+                jsonObject.put("status", HttpStatus.SUCCESS_CODE);
+                jsonObject.put("message", "停止接单成功");
+                list.add(jsonObject);
+            });
+        }
+    }
+
+
     /**
      * 托运订单-设置停止接单
      *