diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index a979edc50..d10c3ae2f 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -319,5 +319,8 @@ public interface IDistributionParcelListClient { @PostMapping(API_PREFIX + "/findListByOrderPackageCodesAndCode") List findListByOrderPackageCodesAndCode(@RequestBody List orderPackageCodeGroup); + @PostMapping(API_PREFIX + "/findSignOrderPackageCodes") + List findSignOrderPackageCodes(@RequestBody List orderPackageCodeList); + } diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpdownZeroOrderVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpdownZeroOrderVO.java index 2c935226f..e8d63a823 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpdownZeroOrderVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/UpdownZeroOrderVO.java @@ -13,6 +13,8 @@ public class UpdownZeroOrderVO implements Serializable { private String orderCode;//订单号 private Integer totalNumber;//合同数量 private Integer residueNumber;//剩余数量 + private String consignee;//收货单位 + private String consigneePerson;//收货人 private List list = new ArrayList<>(); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 98c540d69..3192ac094 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -674,4 +674,9 @@ public class DistributionParcelListClient implements IDistributionParcelListClie return distributionParcelListService.findListByOrderPackageCodesAndCode(orderPackageCodeGroup); } + @Override + public List findSignOrderPackageCodes(List orderPackageCodeList) { + return distributionParcelListService.findSignOrderPackageCodes(orderPackageCodeList); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java index ccaf3aa60..118f4dcff 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java @@ -346,4 +346,7 @@ public interface DistributionParcelListMapper extends BaseMapper findListByOrderPackageCodesAndCode(@Param("orderPackageCodes") List orderPackageCodeGroup); + + List findSignOrderPackageCodes(@Param("orderPackageCodeList") List orderPackageCodeList); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml index 905487996..2b04c9d50 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml @@ -2304,4 +2304,15 @@ and ldpl.is_deleted = 0 + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index 1731075e6..d77302509 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -320,4 +320,6 @@ public interface IDistributionParcelListService extends BaseService findListByOrderPackageCodesAndCode(List orderPackageCodeGroup); + + List findSignOrderPackageCodes(List orderPackageCodeList); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index eaefbf8ff..f848eca37 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -1610,4 +1610,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl findListByOrderPackageCodesAndCode(List orderPackageCodeGroup) { return baseMapper.findListByOrderPackageCodesAndCode(orderPackageCodeGroup); } + + @Override + public List findSignOrderPackageCodes(List orderPackageCodeList) { + return baseMapper.findSignOrderPackageCodes(orderPackageCodeList); + } } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java index 4bf81b106..a2b5ccd36 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.statistics.entity.*; import com.logpm.statistics.service.*; import com.logpm.statistics.vo.StatisticsPackageFeeInfoVO; @@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @Slf4j @@ -50,6 +52,7 @@ public class WaybillCheckListener { private final IStatisticsWarehousePackageService warehousePackageService; private final IStatisticsDistributionPackageService distributionPackageService; private final IStatisticsBalanceOrderInfoService balanceOrderInfoService; + private final IDistributionParcelListClient distributionParcelListClient; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FanoutConstants.trunkline.CHECKWAYBILL.QUEUE.CHECKWAYBILL_INCOMINGDATA), @@ -526,10 +529,18 @@ public class WaybillCheckListener { List trunklinePackageEntities = new ArrayList<>(); List warehousePackageEntities = new ArrayList<>(); List distributionPackageEntities = new ArrayList<>(); + List updateSignList = new ArrayList<>(); orderInfoEntities.forEach(orderInfoEntity -> { Long orderId = orderInfoEntity.getId(); String orderCode = orderInfoEntity.getOrderCode(); List advanceDetailList = advanceDetailGroupByOrderCode.get(orderCode); + //把advanceDetailList中所有orderPackageCode放入一个List + List orderPackageCodeList = advanceDetailList.stream().map(TrunklineAdvanceDetailEntity::getOrderPackageCode).collect(Collectors.toList()); + //查询包件是否签收 + List signPackages = distributionParcelListClient.findSignOrderPackageCodes(orderPackageCodeList); + + AtomicReference signNum = new AtomicReference<>(0); + advanceDetailList.forEach(advanceDetailEntity -> { Long incomeCategoryId = advanceDetailEntity.getIncomeCategoryId(); String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); @@ -712,6 +723,11 @@ public class WaybillCheckListener { distributionPackageEntity.setDeliveryCrossingFee(BigDecimal.ZERO); distributionPackageEntity.setSignNum(0); distributionPackageEntity.setIsSign(0); + if(signPackages.contains(orderPackageCode)){ + distributionPackageEntity.setSignNum(1); + distributionPackageEntity.setIsSign(1); + signNum.set(signNum.get() + 1); + } distributionPackageEntity.setBrandId(brandId); distributionPackageEntity.setConsigneeId(consigneeId); distributionPackageEntity.setDeliveryLoadingFee(handlingPrice.multiply(BigDecimal.ONE)); @@ -769,6 +785,23 @@ public class WaybillCheckListener { distributionPackageEntities.add(distributionPackageEntity); }); + + StatisticsOrderInfoEntity updateEntity = new StatisticsOrderInfoEntity(); + updateEntity.setId(orderInfoEntity.getId()); + int size = advanceDetailList.size(); + Integer sn = signNum.get(); + if(sn == 0){ + updateEntity.setSignStatus(0); + }else{ + if(sn != size){ + updateEntity.setSignStatus(1); + }else{ + updateEntity.setSignStatus(2); + } + } + + updateSignList.add(updateEntity); + }); if (CollUtil.isNotEmpty(trunklinePackageEntities)) { trunklinePackageService.saveBatch(trunklinePackageEntities); @@ -780,6 +813,10 @@ public class WaybillCheckListener { distributionPackageService.saveBatch(distributionPackageEntities); } + if(CollUtil.isNotEmpty(updateSignList)){ + statisticsOrderInfoService.updateBatchById(updateSignList); + } + } else { log.warn("#############dealwithPackageOrder: 保存订单数据失败 waybillNo={}", waybillNo); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index b1073d8b6..a4489706c 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -8184,6 +8184,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl