diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index 5ee4695b2..ff9f81986 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -9,7 +9,7 @@ public interface ModuleNameConstant { /** * 如果不需要 "" */ - public static final String DEVAUTH ="-zhy"; + public static final String DEVAUTH =""; /** * 工厂对接服务名称 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java index f0e1c371c..627013a05 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java @@ -11,7 +11,6 @@ import com.rabbitmq.client.Channel; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.RabbitConstant; -import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitHandler; @@ -148,8 +147,9 @@ public class OpenOrderToLoadListener { List scanEntityList = warehouseIdMap.get(warehouseId); TrunklineCarsLoadEntity carsLoadEntity = loadIdMap1.get(loadId); + //TODO 暂时注释 //发送干线发车广播 - carsLoadAsyncService.sendReportCarsLoadSuppleFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,carsLoadEntity,scanEntityList); +// carsLoadAsyncService.sendReportCarsLoadSuppleFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,carsLoadEntity,scanEntityList); }); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java index 156410367..bfc397c82 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java @@ -83,6 +83,26 @@ public class CarsLoadDealListener { }else{ log.warn(method+"未知的操作类型"); } + }else if(WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE.equals(node)){ + if(BizOperationEnums.ADD.equals(bizOperation)){ + + }else if(BizOperationEnums.DELETE.equals(bizOperation)){ + + }else if(BizOperationEnums.MODIFY.equals(bizOperation)){ + saveUnloadData(main, operator, operatorId,operatorTime,warehouse,warehouseId); + }else{ + log.warn(method+"未知的操作类型"); + } + }else if(WorkNodeEnums.SIGN_DIRECT_SHIPPER.equals(node) || WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART.equals(node)){ + if(BizOperationEnums.ADD.equals(bizOperation)){ + + }else if(BizOperationEnums.DELETE.equals(bizOperation)){ + + }else if(BizOperationEnums.MODIFY.equals(bizOperation)){ + saveSignData(main, operator, operatorId,operatorTime,warehouse,warehouseId); + }else{ + log.warn(method+"未知的操作类型"); + } }else { log.warn(method+"未知的节点类型"); } @@ -91,6 +111,287 @@ public class CarsLoadDealListener { } + private void saveSignData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) { + String method = "####################saveSignData: "; + + JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class); + + JSONArray details = js.getJSONArray("details"); + + List packageDataList = JSONUtil.toList(details, PackageData.class); + //把packageDataList通过packageType的code进行分组 + Map> packageTypeEnumsListMap = packageDataList.stream().collect(Collectors.groupingBy(t->t.getPackageType().getCode())); + + + TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class); + + + List addList = new ArrayList<>(); + packageTypeEnumsListMap.keySet().forEach(packageTypeCode -> { + List packageDataListByPackageType = packageTypeEnumsListMap.get(packageTypeCode); + if(NumberUtil.equals(packageTypeCode,1)){ + //把packageDataListByPackageType中所有元素的orderPackageCode放入一个List + List packageCodes = packageDataListByPackageType.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList()); + //把packageDataListByPackageType转化成以orderPackageCode为key的Map + Map packageDataMap = packageDataListByPackageType.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity())); + + List packageBasicEntityList = reportPackageBasicService.findByOrderPackageCodes(packageCodes); + packageBasicEntityList.forEach(entity -> { + ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity(); + reportPackageTrunklineEntity.setBasicId(entity.getId()); + reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo()); + reportPackageTrunklineEntity.setWaybillNo(entity.getWaybillNo()); + reportPackageTrunklineEntity.setServiceNo(entity.getServiceNo()); + reportPackageTrunklineEntity.setOrderCode(entity.getOrderCode()); + String orderPackageCode = entity.getOrderPackageCode(); + PackageData packageData = packageDataMap.get(orderPackageCode); + + reportPackageTrunklineEntity.setOrderPackageCode(orderPackageCode); + reportPackageTrunklineEntity.setProductName(entity.getProductName()); + reportPackageTrunklineEntity.setProductId(entity.getProductId()); + reportPackageTrunklineEntity.setBrand(entity.getBrand()); + reportPackageTrunklineEntity.setBrandId(entity.getBrandId()); + Long departureWarehouseId = entity.getDepartureWarehouseId(); + reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId); + reportPackageTrunklineEntity.setDepartureWarehouseName(entity.getDepartureWarehouseName()); + Long destinationWarehouseId = entity.getDestinationWarehouseId(); + reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId); + reportPackageTrunklineEntity.setDestinationWarehouseName(entity.getDestinationWarehouseName()); + reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId); + reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse); + reportPackageTrunklineEntity.setLoadingUserId(operatorId); + reportPackageTrunklineEntity.setLoadingUserName(operator); + reportPackageTrunklineEntity.setFinalNodeId(packageData.getFinalNodeId()); + reportPackageTrunklineEntity.setFinalNodeName(packageData.getFinalNodeName()); + + reportPackageTrunklineEntity.setIsStartWarehouse(0); + if(warehouseId.equals(departureWarehouseId)){ + reportPackageTrunklineEntity.setIsStartWarehouse(1); + } + reportPackageTrunklineEntity.setIsEndWarehouse(0); + if(warehouseId.equals(destinationWarehouseId)){ + reportPackageTrunklineEntity.setIsEndWarehouse(1); + } + reportPackageTrunklineEntity.setTrunklineStatus(3); + reportPackageTrunklineEntity.setIsCustomer(0); + reportPackageTrunklineEntity.setLoadingNum(entity.getNum()); + reportPackageTrunklineEntity.setUnloadNum(0); + reportPackageTrunklineEntity.setSignNum(0); + addList.add(reportPackageTrunklineEntity); + }); + + }else if(NumberUtil.equals(packageTypeCode,2)){ + //把packageDataListByPackageType中所有元素的orderCode放入一个List + List orderCodeList = packageDataListByPackageType.stream().map(PackageData::getOrderCode).collect(java.util.stream.Collectors.toList()); + List packageBasicEntityList = reportPackageBasicService.findListByOrderCodeList(orderCodeList); + //把packageBasicEntityList通过orderCode进行分组 + Map> packageBasicEntityListMap = packageBasicEntityList.stream().collect(Collectors.groupingBy(ReportPackageBasicEntity::getOrderCode)); + + //把packageDataListByPackageType通过orderCode进行分组 + Map> packageDataListMap = packageDataListByPackageType.stream().collect(Collectors.groupingBy(PackageData::getOrderCode)); + packageDataListMap.keySet().forEach(orderCode -> { + List packageDataList1 = packageDataListMap.get(orderCode); + List packageBasicEntities = packageBasicEntityListMap.get(orderCode); + //把packageBasicEntities转化成以productName为key的Map + Map packageBasicEntityMap = packageBasicEntities.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity())); + + packageDataList1.forEach(packageData1 -> { + String productName = packageData1.getProductName(); + ReportPackageBasicEntity packageBasicEntity = packageBasicEntityMap.get(productName); + + ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity(); + reportPackageTrunklineEntity.setBasicId(packageBasicEntity.getId()); + reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo()); + reportPackageTrunklineEntity.setWaybillNo(packageBasicEntity.getWaybillNo()); + reportPackageTrunklineEntity.setServiceNo(packageBasicEntity.getServiceNo()); + reportPackageTrunklineEntity.setOrderCode(packageBasicEntity.getOrderCode()); + + reportPackageTrunklineEntity.setOrderPackageCode(packageBasicEntity.getOrderPackageCode()); + reportPackageTrunklineEntity.setProductName(packageBasicEntity.getProductName()); + reportPackageTrunklineEntity.setProductId(packageBasicEntity.getProductId()); + reportPackageTrunklineEntity.setBrand(packageBasicEntity.getBrand()); + reportPackageTrunklineEntity.setBrandId(packageBasicEntity.getBrandId()); + Long departureWarehouseId = packageBasicEntity.getDepartureWarehouseId(); + reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId); + reportPackageTrunklineEntity.setDepartureWarehouseName(packageBasicEntity.getDepartureWarehouseName()); + Long destinationWarehouseId = packageBasicEntity.getDestinationWarehouseId(); + reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId); + reportPackageTrunklineEntity.setDestinationWarehouseName(packageBasicEntity.getDestinationWarehouseName()); + reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId); + reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse); + reportPackageTrunklineEntity.setLoadingUserId(operatorId); + reportPackageTrunklineEntity.setLoadingUserName(operator); + reportPackageTrunklineEntity.setFinalNodeId(packageData1.getFinalNodeId()); + reportPackageTrunklineEntity.setFinalNodeName(packageData1.getFinalNodeName()); + + reportPackageTrunklineEntity.setIsStartWarehouse(0); + if(warehouseId.equals(departureWarehouseId)){ + reportPackageTrunklineEntity.setIsStartWarehouse(1); + } + reportPackageTrunklineEntity.setIsEndWarehouse(0); + if(warehouseId.equals(destinationWarehouseId)){ + reportPackageTrunklineEntity.setIsEndWarehouse(1); + } + reportPackageTrunklineEntity.setTrunklineStatus(3); + reportPackageTrunklineEntity.setIsCustomer(0); + reportPackageTrunklineEntity.setLoadingNum(packageData1.getNumber()); + reportPackageTrunklineEntity.setUnloadNum(0); + reportPackageTrunklineEntity.setSignNum(0); + addList.add(reportPackageTrunklineEntity); + }); + + }); + + } + }); + + if(CollUtil.isNotEmpty(addList)){ + reportPackageTrunklineService.saveBatch(addList); + } + } + + private void saveUnloadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) { + String method = "####################saveUnloadData: "; + + JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class); + + JSONArray details = js.getJSONArray("details"); + + List packageDataList = JSONUtil.toList(details, PackageData.class); + //把packageDataList通过packageType的code进行分组 + Map> packageTypeEnumsListMap = packageDataList.stream().collect(Collectors.groupingBy(t->t.getPackageType().getCode())); + + + TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class); + + + List addList = new ArrayList<>(); + packageTypeEnumsListMap.keySet().forEach(packageTypeCode -> { + List packageDataListByPackageType = packageTypeEnumsListMap.get(packageTypeCode); + if(NumberUtil.equals(packageTypeCode,1)){ + //把packageDataListByPackageType中所有元素的orderPackageCode放入一个List + List packageCodes = packageDataListByPackageType.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList()); + //把packageDataListByPackageType转化成以orderPackageCode为key的Map + Map packageDataMap = packageDataListByPackageType.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity())); + + List packageBasicEntityList = reportPackageBasicService.findByOrderPackageCodes(packageCodes); + packageBasicEntityList.forEach(entity -> { + ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity(); + reportPackageTrunklineEntity.setBasicId(entity.getId()); + reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo()); + reportPackageTrunklineEntity.setWaybillNo(entity.getWaybillNo()); + reportPackageTrunklineEntity.setServiceNo(entity.getServiceNo()); + reportPackageTrunklineEntity.setOrderCode(entity.getOrderCode()); + String orderPackageCode = entity.getOrderPackageCode(); + PackageData packageData = packageDataMap.get(orderPackageCode); + + reportPackageTrunklineEntity.setOrderPackageCode(orderPackageCode); + reportPackageTrunklineEntity.setProductName(entity.getProductName()); + reportPackageTrunklineEntity.setProductId(entity.getProductId()); + reportPackageTrunklineEntity.setBrand(entity.getBrand()); + reportPackageTrunklineEntity.setBrandId(entity.getBrandId()); + Long departureWarehouseId = entity.getDepartureWarehouseId(); + reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId); + reportPackageTrunklineEntity.setDepartureWarehouseName(entity.getDepartureWarehouseName()); + Long destinationWarehouseId = entity.getDestinationWarehouseId(); + reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId); + reportPackageTrunklineEntity.setDestinationWarehouseName(entity.getDestinationWarehouseName()); + reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId); + reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse); + reportPackageTrunklineEntity.setLoadingUserId(operatorId); + reportPackageTrunklineEntity.setLoadingUserName(operator); + reportPackageTrunklineEntity.setFinalNodeId(packageData.getFinalNodeId()); + reportPackageTrunklineEntity.setFinalNodeName(packageData.getFinalNodeName()); + + reportPackageTrunklineEntity.setIsStartWarehouse(0); + if(warehouseId.equals(departureWarehouseId)){ + reportPackageTrunklineEntity.setIsStartWarehouse(1); + } + reportPackageTrunklineEntity.setIsEndWarehouse(0); + if(warehouseId.equals(destinationWarehouseId)){ + reportPackageTrunklineEntity.setIsEndWarehouse(1); + } + reportPackageTrunklineEntity.setTrunklineStatus(2); + reportPackageTrunklineEntity.setIsCustomer(0); + reportPackageTrunklineEntity.setLoadingNum(entity.getNum()); + reportPackageTrunklineEntity.setUnloadNum(0); + reportPackageTrunklineEntity.setSignNum(0); + addList.add(reportPackageTrunklineEntity); + }); + + }else if(NumberUtil.equals(packageTypeCode,2)){ + //把packageDataListByPackageType中所有元素的orderCode放入一个List + List orderCodeList = packageDataListByPackageType.stream().map(PackageData::getOrderCode).collect(java.util.stream.Collectors.toList()); + List packageBasicEntityList = reportPackageBasicService.findListByOrderCodeList(orderCodeList); + //把packageBasicEntityList通过orderCode进行分组 + Map> packageBasicEntityListMap = packageBasicEntityList.stream().collect(Collectors.groupingBy(ReportPackageBasicEntity::getOrderCode)); + + //把packageDataListByPackageType通过orderCode进行分组 + Map> packageDataListMap = packageDataListByPackageType.stream().collect(Collectors.groupingBy(PackageData::getOrderCode)); + packageDataListMap.keySet().forEach(orderCode -> { + List packageDataList1 = packageDataListMap.get(orderCode); + List packageBasicEntities = packageBasicEntityListMap.get(orderCode); + //把packageBasicEntities转化成以productName为key的Map + Map packageBasicEntityMap = packageBasicEntities.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity())); + + packageDataList1.forEach(packageData1 -> { + String productName = packageData1.getProductName(); + ReportPackageBasicEntity packageBasicEntity = packageBasicEntityMap.get(productName); + + ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity(); + reportPackageTrunklineEntity.setBasicId(packageBasicEntity.getId()); + reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo()); + reportPackageTrunklineEntity.setWaybillNo(packageBasicEntity.getWaybillNo()); + reportPackageTrunklineEntity.setServiceNo(packageBasicEntity.getServiceNo()); + reportPackageTrunklineEntity.setOrderCode(packageBasicEntity.getOrderCode()); + + reportPackageTrunklineEntity.setOrderPackageCode(packageBasicEntity.getOrderPackageCode()); + reportPackageTrunklineEntity.setProductName(packageBasicEntity.getProductName()); + reportPackageTrunklineEntity.setProductId(packageBasicEntity.getProductId()); + reportPackageTrunklineEntity.setBrand(packageBasicEntity.getBrand()); + reportPackageTrunklineEntity.setBrandId(packageBasicEntity.getBrandId()); + Long departureWarehouseId = packageBasicEntity.getDepartureWarehouseId(); + reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId); + reportPackageTrunklineEntity.setDepartureWarehouseName(packageBasicEntity.getDepartureWarehouseName()); + Long destinationWarehouseId = packageBasicEntity.getDestinationWarehouseId(); + reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId); + reportPackageTrunklineEntity.setDestinationWarehouseName(packageBasicEntity.getDestinationWarehouseName()); + reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId); + reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse); + reportPackageTrunklineEntity.setLoadingUserId(operatorId); + reportPackageTrunklineEntity.setLoadingUserName(operator); + reportPackageTrunklineEntity.setFinalNodeId(packageData1.getFinalNodeId()); + reportPackageTrunklineEntity.setFinalNodeName(packageData1.getFinalNodeName()); + + reportPackageTrunklineEntity.setIsStartWarehouse(0); + if(warehouseId.equals(departureWarehouseId)){ + reportPackageTrunklineEntity.setIsStartWarehouse(1); + } + reportPackageTrunklineEntity.setIsEndWarehouse(0); + if(warehouseId.equals(destinationWarehouseId)){ + reportPackageTrunklineEntity.setIsEndWarehouse(1); + } + reportPackageTrunklineEntity.setTrunklineStatus(2); + reportPackageTrunklineEntity.setIsCustomer(0); + reportPackageTrunklineEntity.setLoadingNum(packageData1.getNumber()); + reportPackageTrunklineEntity.setUnloadNum(0); + reportPackageTrunklineEntity.setSignNum(0); + addList.add(reportPackageTrunklineEntity); + }); + + }); + + + } + }); + + if(CollUtil.isNotEmpty(addList)){ + reportPackageTrunklineService.saveBatch(addList); + } + + + } + private void deleteCarsLoadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) { String method = "####################deleteCarsLoadData: "; diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java index 2cfb61dbe..9e43d17ea 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java @@ -44,4 +44,8 @@ public interface ICarsLoadAsyncService { void sendFactoryData(String orderCode, String orderPackageCode, Long warehouseId, String warehouseName); void downPackageOrDelTray(String orderPackageCode, Long fromWarehouseId, String remark); + + void sendReportPackageSignData(String nickName, Long userId, Long warehouseId, String warehouseName, TrunklineCarsLoadEntity carsLoadEntity, List orderPackageCodeList); + + void sendReportZeroPackageSignData(Long userId, String nickName, Long warehouseId, String warehouseName, List updateScanZeroDetailList, TrunklineCarsLoadScanEntity carsLoadScanEntity, TrunklineCarsLoadEntity carsLoadEntity); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java index 5ee9335a5..cdcb4e54a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java @@ -1017,6 +1017,90 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService { } + @LogpmAsync("asyncExecutor") + @Override + public void sendReportPackageSignData(String nickName, Long userId, Long warehouseId, String warehouseName, TrunklineCarsLoadEntity carsLoadEntity, List orderPackageCodeList) { + NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); + String loadType = carsLoadEntity.getLoadType(); + if("4".equals(loadType)){ + nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART); + }else{ + nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_DIRECT_SHIPPER); + } + nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); + nodeFanoutMsg.setOperator(nickName); + nodeFanoutMsg.setOperatorId(userId); + nodeFanoutMsg.setWarehouse(warehouseName); + nodeFanoutMsg.setWarehouseId(warehouseId); + nodeFanoutMsg.setOperatorTime(new Date()); + + //组装包件数据 + + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(carsLoadEntity)); + + List packageDataList = new ArrayList<>(); + + orderPackageCodeList.forEach(packageCode -> { + PackageData packageData = new PackageData(); + packageData.setPackageCode(packageCode); + packageData.setNumber(1); + packageData.setPackageType(PackageTypeEnums.CMP); + packageDataList.add(packageData); + }); + + json.put("details", packageDataList); + + nodeFanoutMsg.setMain(json); + + FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build(); + + sendFanoutService.sendFanoutMsg(fanoutMsg); + } + + @LogpmAsync("asyncExecutor") + @Override + public void sendReportZeroPackageSignData(Long userId, String nickName, Long warehouseId, String warehouseName, List sendList, TrunklineCarsLoadScanEntity carsLoadScanEntity, TrunklineCarsLoadEntity carsLoadEntity) { + + NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); + String loadType = carsLoadEntity.getLoadType(); + if("4".equals(loadType)){ + nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART); + }else{ + nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_DIRECT_SHIPPER); + } + nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); + nodeFanoutMsg.setOperator(nickName); + nodeFanoutMsg.setOperatorId(userId); + nodeFanoutMsg.setWarehouse(warehouseName); + nodeFanoutMsg.setWarehouseId(warehouseId); + nodeFanoutMsg.setOperatorTime(new Date()); + + //组装包件数据 + + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(carsLoadEntity)); + + List packageDataList = new ArrayList<>(); + + sendList.forEach(zeroDetailVO -> { + PackageData packageData = new PackageData(); + packageData.setOrderCode(carsLoadScanEntity.getOrderCode()); + packageData.setNumber(zeroDetailVO.getUnloadNum()); + packageData.setPackageType(PackageTypeEnums.LTL); + packageData.setWaybillNumber(carsLoadScanEntity.getWaybillNo()); + packageData.setProductId(zeroDetailVO.getGoodsId()); + packageData.setProductName(zeroDetailVO.getGoodsName()); + packageDataList.add(packageData); + }); + + json.put("details", packageDataList); + nodeFanoutMsg.setMain(json); + + FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build(); + + sendFanoutService.sendFanoutMsg(fanoutMsg); + + } + @LogpmAsync("asyncExecutor") @Override public void sendReportCarsLoadSuppleFanout(Long userId, String nickName, Long warehouseId, TrunklineCarsLoadEntity carsLoadEntity, List scanEntityList) { 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 18786cf3c..84e76c86c 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 @@ -479,8 +479,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl list = mapByScanId.get(scanId); - - carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseEntity.getName(),list,carsLoadScanEntity,carsLoadEntity); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseEntity.getName(),list,carsLoadScanEntity,carsLoadEntity); }); @@ -5383,8 +5385,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl packageCodes = newParcelListEntities.stream().map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.toList()); + //TODO 暂时注释 + //发送报表模块卸车数据 +// carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,packageCodes); + } trunklineCarsLoadScanService.updateBatchById(updateScanEntityList); @@ -8652,6 +8661,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderPackageCodeList = new ArrayList<>(); + orderPackageCodeList.add(orderPackageCode); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, carsLoadEntity, orderPackageCodeList); + } catch (Exception e) { log.error("推送签收数据给工厂失败 {}", e); } @@ -8695,11 +8710,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl list = trunklineCarsLoadScanService.findListHasSignOrderIdByIds(loadScanIds); + //把list中所有的loadId放入一个List + List loadIdList = list.stream().map(TrunklineCarsLoadScanVO::getLoadId).collect(Collectors.toList()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id", loadIdList); + List trunklineCarsLoadEntities = baseMapper.selectList(queryWrapper); + //trunklineCarsLoadEntities转化为以id为key的Map + Map trunklineCarsLoadMap = trunklineCarsLoadEntities.stream().collect(Collectors.toMap(TrunklineCarsLoadEntity::getId, Function.identity())); + + List parcelListEntityList = trunklineCarsLoadScanService.findParceListByCarsLoadScanIds(loadScanIds); //把parcelListEntityList通过orderPackageCode分组 Map> parcelListMap = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getOrderPackageCode)); @@ -8845,6 +8878,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl trunklineCarsLoadScanVOS = map.get(e);//该签收单对应的包件 trunklineCarsLoadScanVOS.forEach(t -> { + Long loadId = t.getLoadId(); TrunklineCarsLoadScanEntity entity = new TrunklineCarsLoadScanEntity(); BeanUtil.copy(t, entity); entity.setScanStatus("3"); @@ -8858,25 +8892,42 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderPackageCodeList = new ArrayList<>(); String scanCode = entity.getScanCode(); List parcelList = parcelListMap.get(scanCode); if (!Objects.isNull(parcelList)) { parcelList.forEach(p -> { p.setOrderPackageStatus("70"); updateParcelList.add(p); + orderPackageCodeList.add(p.getOrderPackageCode()); }); } orderPackageCodes.add(entity.getScanCode()); + + TrunklineCarsLoadEntity carsLoadEntity = trunklineCarsLoadMap.get(loadId); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId() , warehouseId, warehouseName, carsLoadEntity, orderPackageCodeList); + }else if(type.equals(2)){ //零担 List zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId); + List nowList = new ArrayList<>(); zeroDetailVOList.forEach(p -> { TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity(); scanZeroDetailEntity.setId(p.getId()); + scanZeroDetailEntity.setPackageId(p.getPackageId()); + scanZeroDetailEntity.setGoodsId(p.getGoodsId()); + scanZeroDetailEntity.setGoodsName(p.getGoodsName()); + scanZeroDetailEntity.setLoadingNum(p.getLoadingNum()); scanZeroDetailEntity.setUnloadNum(p.getLoadingNum()); updateZerpPackageList.add(scanZeroDetailEntity); + nowList.add(scanZeroDetailEntity); }); + TrunklineCarsLoadEntity carsLoadEntity = trunklineCarsLoadMap.get(loadId); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, nowList, entity, carsLoadEntity); + } updateCarsLoadScanList.add(entity); loadIds.add(entity.getLoadId()); @@ -9569,6 +9620,39 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl loadScanEntityList = trunklineCarsLoadScanService.findListByIds(loadScanIds); + //把loadScanEntityList中所有元素通过type进行分组 + Map> map = loadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getType)); + map.keySet().forEach(type -> { + List trunklineCarsLoadScanEntities = map.get(type); + if(type == 1){ + //定制 + //把trunklineCarsLoadScanEntities中所有scanCode放入一个List + List scanCodes = trunklineCarsLoadScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList()); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,scanCodes); + }else{ + + trunklineCarsLoadScanEntities.forEach(carsLoadScanEntity -> { + + Long scanId = carsLoadScanEntity.getId(); + List zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(scanId); + List zeroDetailList = new ArrayList<>(); + zeroDetailVOList.forEach(zeroDetailVO -> { + TrunklineScanZeroDetailEntity entity = new TrunklineScanZeroDetailEntity(); + BeanUtil.copy(zeroDetailVO, entity); + zeroDetailList.add(entity); + }); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, zeroDetailList, carsLoadScanEntity, carsLoadEntity); + + }); + + } + }); + + return R.success("签收成功"); } @@ -10946,7 +11030,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl neloadScanQueryWrapper = new QueryWrapper<>(); neloadScanQueryWrapper.eq("load_id", loadId) @@ -12046,6 +12131,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderPackageCodeList = new ArrayList<>(); - orderPackageCodeList.add(orderPackageCode); - carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList); - if (isData == 0) { return Resp.fail(4005,"系统无编码"); } @@ -12809,7 +12892,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl orderPackageCodeList = new ArrayList<>(); orderPackageCodeList.add(orderPackageCode); - carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList); + //TODO 暂时注释 +// carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList); if (isData == 0) { return Resp.scanSuccess("卸车成功", "系统无编码");