24282 преди 1 година
родител
ревизия
72b10bc963

+ 5 - 0
sd-business/src/main/java/com/sd/business/entity/order/vo/IssueBillVo.java

@@ -112,6 +112,11 @@ public class IssueBillVo {
     private BigDecimal totalVolume;
 
     /**
+     * 包裹总数
+     */
+    private Integer total;
+
+    /**
      * 合并订单列表
      */
     private List<String> groupOrderCodeList;

+ 7 - 3
sd-business/src/main/java/com/sd/business/service/order/impl/IssueBillServiceImpl.java

@@ -104,6 +104,7 @@ public class IssueBillServiceImpl implements IssueBillService {
         QueryWrapper<OrderEncasement> orderEncasementWrapper = new QueryWrapper<>();
         orderEncasementWrapper.select(
                 "order_id as orderId",
+                "ifnull(sum(total),0) total",
                 "ifnull(sum(net_weight*total),0) totalNetWeight",
                 "ifnull(sum(length*width*height*total/1000000),0) totalVolume"
         );
@@ -118,9 +119,11 @@ public class IssueBillServiceImpl implements IssueBillService {
             if (itemMap != null) {
                 record.setTotalNetWeight((BigDecimal) itemMap.get("totalNetWeight"));
                 record.setTotalVolume((BigDecimal) itemMap.get("totalVolume"));
+                record.setTotal((Integer) itemMap.get("total"));
             } else {
                 record.setTotalNetWeight(BigDecimal.ZERO);
                 record.setTotalVolume(BigDecimal.ZERO);
+                record.setTotal(0);
             }
         }
 
@@ -169,9 +172,10 @@ public class IssueBillServiceImpl implements IssueBillService {
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void merge(MergeOrderDto dto) {
-        orderService.update(q -> q.eq(OrderInfo::getId, dto.getId()).set(OrderInfo::getMasterOrderId, 0));
-        orderService.update(q -> q.in(OrderInfo::getId, dto.getMergeIdList()).set(OrderInfo::getMasterOrderId, dto.getId()));
-        orderEncasementService.deleteByOrderId(dto.getId());
+        Long orderId = dto.getId();
+        orderService.update(q -> q.eq(OrderInfo::getId, orderId).set(OrderInfo::getMasterOrderId, null));
+        orderService.update(q -> q.in(OrderInfo::getId, dto.getMergeIdList()).set(OrderInfo::getMasterOrderId, orderId));
+        orderEncasementService.deleteByOrderId(orderId);
     }
 
     @Transactional(rollbackFor = Exception.class)

+ 1 - 3
sd-cainiao/src/main/java/com/sd/cainiao/service/IsticeService.java

@@ -1,7 +1,5 @@
 package com.sd.cainiao.service;
 
-import com.sd.cainiao.entity.dto.TakeNumParamDto;
-
 import java.util.List;
 import java.util.Map;
 
@@ -10,6 +8,6 @@ public interface IsticeService {
     /**
      * 通过物流云获取电子面单--批量取号
      */
-    List<Map<String, Object>> takeNumBatch(List<TakeNumParamDto> dto);
+    List<Map<String, Object>> takeNumBatch(List<Long> orderIdList);
 
 }

+ 38 - 1
sd-cainiao/src/main/java/com/sd/cainiao/service/impl/IsticeServiceImpl.java

@@ -1,6 +1,15 @@
 package com.sd.cainiao.service.impl;
 
+import com.ruoyi.common.core.domain.BaseIdPo;
 import com.ruoyi.common.exception.ServiceException;
+import com.sd.business.entity.order.po.OrderEncasement;
+import com.sd.business.entity.order.po.OrderEncasementDetail;
+import com.sd.business.entity.order.po.OrderInfo;
+import com.sd.business.entity.order.po.OrderSku;
+import com.sd.business.service.order.OrderEncasementDetailService;
+import com.sd.business.service.order.OrderEncasementService;
+import com.sd.business.service.order.OrderService;
+import com.sd.business.service.order.OrderSkuService;
 import com.sd.cainiao.entity.bo.BasicKeyBo;
 import com.sd.cainiao.entity.dto.TakeNumParamDto;
 import com.sd.cainiao.service.IsticeService;
@@ -24,8 +33,36 @@ public class IsticeServiceImpl implements IsticeService {
     @Autowired
     private BasicKeyBo basicKeyBo;
 
+    @Autowired
+    private OrderService orderService;
+
+    @Autowired
+    private OrderSkuService orderSkuService;
+
+    @Autowired
+    private OrderEncasementService orderEncasementService;
+
+    @Autowired
+    private OrderEncasementDetailService orderEncasementDetailService;
+
     @Override
-    public List<Map<String, Object>> takeNumBatch(List<TakeNumParamDto> dto) {
+    public List<Map<String, Object>> takeNumBatch(List<Long> orderIdList) {
+
+        if (orderIdList.size() == 0) {
+            return Collections.emptyList();
+        }
+
+        List<OrderInfo> orderList = orderService.list(q -> q
+                .and(r -> r.eq(BaseIdPo::getId, orderIdList).isNull(OrderInfo::getMasterOrderId))
+                .or().in(OrderInfo::getMasterOrderId, orderIdList));
+        List<Long> allOrderIdList = orderList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
+
+        List<OrderSku> orderSkuList = orderSkuService.list(q -> q.in(OrderSku::getOrderId, allOrderIdList));
+        List<Long> allOrderSkuIdList = orderSkuList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
+
+        List<OrderEncasement> orderEncasementList = orderEncasementService.list(q -> q.in(OrderEncasement::getOrderId, allOrderIdList));
+        List<OrderEncasementDetail> orderEncasementDetailList = orderEncasementDetailService.list(q -> q.in(OrderEncasementDetail::getOrderSkuId, allOrderSkuIdList));
+
 
         // List<Map<String, Object>> resultList = new ArrayList<>();
         //