diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java index acbee6a43..a79cdacf9 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpClientVO.java @@ -50,6 +50,7 @@ public class DistributionAppStockUpClientVO implements Serializable { private List stockUpZeroOrderDetailVOList; private List deliveryPackageDetailList; private List deliveryTrayList; + private List stockUpScanDetailVO; diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java index 74e382788..6850d7645 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpScanDetailVO.java @@ -31,10 +31,11 @@ import java.util.List; public class DistributionAppStockUpScanDetailVO implements Serializable { private static final long serialVersionUID = 1L; - private String trayName; - private String trayCode; - private Integer planNum; - private Integer scanNum; - - + private Long stockId; + private Integer type; + private String orderPackageCode; + private String typeName; + private String goodsName; + private String orderCode; + private String stockupAllocation; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java index a0e824928..5f0552576 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockUpTrayDetailVO.java @@ -30,12 +30,9 @@ import java.io.Serializable; public class DistributionAppStockUpTrayDetailVO implements Serializable { - private Long orderId; - private Long packageId; - private String waybillNumber; - private String orderCode; - private String categoryName; + private String trayName; + private String trayCode; private Integer planNum; - private String scanNum; + private Integer scanNum; } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java index 238494f66..568619b5b 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java @@ -75,6 +75,30 @@ public class ExpenseDispatchTrainDetailEntity extends TenantEntity { @ApiModelProperty(value = "配送日期") @ExcelProperty("车次号") private String deliveryDate; + /** + * 车次完成时间 + */ + @ApiModelProperty(value = "车次完成时间") + @ExcelProperty("车次完成时间") + private Date trainCompletionTime; + /** + * 车次完成时间-年 + */ + @ApiModelProperty(value = "车次完成时间-年") + @ExcelProperty("车次完成时间-年") + private int trainCompletionYear; + /** + * 车次完成时间-月 + */ + @ApiModelProperty(value = "车次完成时间-月") + @ExcelProperty("车次完成时间-月") + private int trainCompletionMonth; + /** + * 车次完成时间-日 + */ + @ApiModelProperty(value = "车次完成时间-日") + @ExcelProperty("车次完成时间-日") + private int trainCompletionDay; /** * 目的仓 */ diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java index 84f8830c0..94c76b04d 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java @@ -140,7 +140,6 @@ public class AftersalesWorkOrderController extends BladeController { log.error("工单查询系统异常》》》{}", e.getMessage()); return R.fail("系统异常!"); } - } /** diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml index 8973a9c22..4e6eff028 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml @@ -1250,9 +1250,10 @@ logpm_aftersales_processor AS lbp WHERE lbp.types_of != 3 - AND lbp.processing_status IN ( '1', '3' ) + AND lbp.processing_status = 1 AND lbp.is_deleted = 0 - AND DATEDIFF(DATE_FORMAT(lbp.create_time,'%y%m%d'), DATE_FORMAT(NOW(),'%y%m%d')) <= -3 + AND DATEDIFF(DATE_FORMAT(lbp.create_time,'%y%m%d'), DATE_FORMAT('2025-01-01','%y%m%d')) <= -3 + AND DATE_FORMAT(lbp.create_time,'%y%m%d') >= DATE_FORMAT( '2025-01-01', '%y%m%d' ) + SELECT - lds.id, + lds.id AS stockId, + lds.type AS type, lds.coding AS orderPackageCode, CASE lds.type - WHEN 1 THEN '订制品' + WHEN 1 THEN '定制品' WHEN 2 THEN '库存品' WHEN 3 THEN '零担' ELSE diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java index fd28d3904..f0dd71cb4 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.java @@ -373,7 +373,7 @@ public interface DistributionStockupMapper extends BaseMapper selectDeliveryPackageDetailList(@Param("reservationId")Long reservationId,@Param("orderId") Long orderId); + List selectDeliveryPackageDetailList(@Param("reservationId")Long reservationId); /** * 查询自提包件列表 @@ -381,7 +381,7 @@ public interface DistributionStockupMapper extends BaseMapper selectBillPackageDetailList(@Param("billId")Long billId,@Param("orderId") Long orderId); + List selectBillPackageDetailList(@Param("billId")Long billId); /** * 查询自提备货所有包件 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml index 161e778cc..ad5cd26e0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml @@ -1145,7 +1145,7 @@ LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.id = ldbp.parce_list_id AND ldpl.is_deleted = 0 AND ldpl.is_transfer = 0 LEFT JOIN logpm_warehouse_tray AS lwt ON ldpl.pallet = lwt.pallet_name AND lwt.warehouse_id = ldpl.warehouse_id - LEFT JOIN logpm_distribution_stock AS lds ON lds.reservation_id = ldbp.bill_lading_id + LEFT JOIN logpm_distribution_stock AS lds ON lds.reservation_id = ldbp.bill_lading_id AND lds.coding = ldpl.order_package_code AND lds.type = 1 AND lds.outbound_type = 3 AND lds.cancel_status != 1 @@ -1155,7 +1155,7 @@ GROUP BY ldpl.pallet HAVING - IFNULL( sum( ldpl.quantity ), 0 ) > 0 + IFNULL( sum( ldpl.quantity ), 0 ) > 0 AND ldpl.pallet IS NOT NULL ) AS t LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON lwtg.tray_code = t.trayCode AND lwtg.is_deleted = 0 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java index ab3aad485..995989d82 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java @@ -365,18 +365,18 @@ public interface IDistributionStockupService extends BaseService> oldPackageList = list.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getPacketBarCode)); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index 87ea7a0a5..02d5b33fc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -2030,7 +2030,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl>>>>>>>>>>>>>>>>>>>>>reservationId:{}",reservationId); return R.fail("查询计划信息错误"); } - List trayPackageIds = trayIdList.stream().map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList()); + boolean isAllStockUp = distributionParcelListEntities.stream().anyMatch(a -> OrderPackageStockupStatusConstant.daibeihuo.getValue().equals(a.getOrderPackageStockupStatus())); + if (isAllStockUp) { + List unStockUpPackageData = distributionParcelListEntities.stream().filter(f1 -> OrderPackageStockupStatusConstant.daibeihuo.getValue().equals(f1.getOrderPackageStockupStatus())).collect(Collectors.toList()); + if (unStockUpPackageData.isEmpty()) { + return Resp.scanFail("扫描已完成","扫描已完成"); + } + List trayPackageIds = trayIdList.stream().map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList()); + List packageData = unStockUpPackageData.stream().filter(f -> trayPackageIds.contains(f.getId())).collect(Collectors.toList()); + if (packageData.isEmpty()) { + return R.fail("当前托盘无此客户的货物"); + } + warehouseUpdownTypeClient.downTray(trayByTrayCode.getPalletCode(),myCurrentWarehouse.getId()); + //生成扫描数据 + List stockEntityList = generateDeliveryTrayPackageStockEntity(reservationEntity,packageData,myCurrentWarehouse,user,stockupDTO.getStockupId(),stockupEntity); + if (!stockEntityList.isEmpty()) { + // 备货作业节点 + distributionStockService.saveBatch(stockEntityList); + List updatePackageIds = stockEntityList.stream().map(DistributionStockEntity::getParcelListId).collect(Collectors.toList()); + distributionParcelListService.update(Wrappers.update().lambda() + .in(DistributionParcelListEntity::getId,updatePackageIds) + .set(DistributionParcelListEntity::getOrderPackageStockupStatus,OrderPackageStockupStatusConstant.yibeihu.getValue()) + ); + } - List packageData = distributionParcelListEntities.stream().filter(f -> trayPackageIds.contains(f.getId())).collect(Collectors.toList()); - if (packageData.isEmpty()) { - return R.fail("当前托盘无此客户的货物"); - } - warehouseUpdownTypeClient.downTray(trayByTrayCode.getPalletCode(),myCurrentWarehouse.getId()); - //生成扫描数据 - List stockEntityList = generateDeliveryTrayPackageStockEntity(reservationEntity,packageData,myCurrentWarehouse,user,stockupDTO.getStockupId()); - if (!stockEntityList.isEmpty()) { - distributionStockService.saveBatch(stockEntityList); + return Resp.scanSuccess("操作成功",""); + }else { + return Resp.scanFail("订制品备货已完成",""); } - return Resp.scanSuccess("操作成功"," "); } private List generateDeliveryTrayPackageStockEntity(DistributionReservationEntity reservationEntity, List packageData, BasicdataWarehouseEntity warehouse, BladeUser user, - Long stockUpId) { + Long stockUpId, + DistributionStockupEntity stockupEntity) { List list= new ArrayList<>(); for (DistributionParcelListEntity parcelListEntity : packageData) { DistributionStockEntity distributionStockEntity = new DistributionStockEntity(); @@ -4728,6 +4744,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl nodeFanoutMsg = buildStockUpNodeData(stockupEntity, distributionStockEntity, parcelListEntity); + if (ObjectUtils.isNotNull(nodeFanoutMsg)) { + distributionNodeWorkService.planStock(nodeFanoutMsg, AuthUtil.getUser()); + } } return list; } @@ -5071,7 +5091,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl deliveryPackageDetailList = baseMapper.selectDeliveryPackageDetailList(reservationId,orderId); + List deliveryPackageDetailList = baseMapper.selectDeliveryPackageDetailList(reservationId); if (!deliveryPackageDetailList.isEmpty()) { stockUpClientVO.setDeliveryPackageDetailList(deliveryPackageDetailList); } @@ -5674,12 +5694,12 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl billPackageDetailList = baseMapper.selectBillPackageDetailList(reservationId,orderId); + List billPackageDetailList = baseMapper.selectBillPackageDetailList(reservationId); if (!billPackageDetailList.isEmpty()) { stockUpClientVO.setDeliveryPackageDetailList(billPackageDetailList); } @@ -5827,14 +5847,15 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl stockUpScanDetailVO = distributionStockService.selectScanDetail(reservationId,stockupId); - return R.data(stockUpScanDetailVO); + if (!stockUpScanDetailVO.isEmpty()) { + stockUpClientVO.setStockUpScanDetailVO(stockUpScanDetailVO); + return R.data(stockUpClientVO); + } + return R.fail("无备货记录"); } @Override public R newStockupArea(StockupDTO stockupDTO) { - if (Objects.isNull(stockupDTO.getStockupId())){ - return R.fail("StockupId()参数缺失"); - } BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); if (Objects.isNull(myCurrentWarehouse)) { return Resp.scanFail("请选择备货作业仓库","请选择备货作业仓库"); @@ -5843,6 +5864,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl goodsAreaVOList = basicdataGoodsAreaClient.getDepartmentId(deptId); + BasicdataGoodsAllocationEntity entityByQrCode = basicdataGoodsAllocationClient.findEntityByQrCode(myCurrentWarehouse.getId(), allocationCode); + if (Objects.isNull(entityByQrCode)){ + return Resp.scanFail("请扫描库位码","请扫描库位码"); + } + List areaVOList = goodsAreaVOList.stream().filter(f -> "1".equals(f.getAreaType()) && entityByQrCode.getGoodsAreaId().equals(f.getId())).collect(Collectors.toList()); + if (!areaVOList.isEmpty()) { + return Resp.scanFail("当前库位不是备货库位","当前库位不是备货库位"); + } + return R.data(entityByQrCode); }else { return Resp.scanFail("当前操作人无此操作权限","当前操作人无此操作权限"); } } @Override + @Transactional public R upStockUpShelf(StockupDTO stockupDTO) { BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); if (Objects.isNull(myCurrentWarehouse)){ @@ -5887,7 +5919,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl strList = Func.toStrList(stockIds); List distributionStockEntities = distributionStockService.listByIds(strList); int sum = 0; @@ -5959,7 +5992,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl handleStockupBillZeroOrder(DistrilbutionBillLadingEntity billLadingEntity) { @@ -6058,13 +6091,28 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl deliveryTrayDetailList = distributionReservationMapper.deliveryTrayDetailList(reservationId); + if (!deliveryTrayDetailList.isEmpty()) { + stockUpClientVO.setDeliveryTrayList(deliveryTrayDetailList); + } + return R.data(stockUpClientVO); } @Override public R handleBillTrayDetailList(Long reservationId) { - return R.data(distrilbutionBillLadingMapper.billTrayDetailList(reservationId)); + DistributionAppStockUpClientVO stockUpClientVO = baseMapper.selectPlanClientDetailById(reservationId); + if (Objects.isNull(stockUpClientVO)){ + return R.fail("查询备货客户信息错误"); + } + List distributionAppStockUpTrayDetailVOS = distrilbutionBillLadingMapper.billTrayDetailList(reservationId); + if (!distributionAppStockUpTrayDetailVOS.isEmpty()) { + stockUpClientVO.setDeliveryTrayList(distributionAppStockUpTrayDetailVOS); + } + return R.data(stockUpClientVO); } /** @@ -6314,7 +6362,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl 1) { return Resp.scanFail("当前包件计划重复", "当前包件计划重复"); } @@ -6605,8 +6656,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl 1) { return Resp.scanFail("当前包件计划重复", "当前包件计划重复"); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/QualityDeliverServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/QualityDeliverServiceImpl.java index df0b5937e..0f8de634d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/QualityDeliverServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/QualityDeliverServiceImpl.java @@ -116,6 +116,10 @@ public class QualityDeliverServiceImpl extends BaseServiceImpl entities = this.list(Wrappers.lambdaQuery().eq(QualityDeliverEntity::getSignTrainNumber, trainNumber)); - if(CollUtil.isNotEmpty(entities)){ + if (CollUtil.isNotEmpty(entities)) { buildCarExpenseReport(entities); } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-base/src/main/java/com/logpm/factorydata/base/constant/FactoryDatabaseConstants.java b/blade-service/logpm-factory-data/logpm-factory-data-base/src/main/java/com/logpm/factorydata/base/constant/FactoryDatabaseConstants.java index 4a2cac0ea..d9511f3b8 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-base/src/main/java/com/logpm/factorydata/base/constant/FactoryDatabaseConstants.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-base/src/main/java/com/logpm/factorydata/base/constant/FactoryDatabaseConstants.java @@ -10,6 +10,6 @@ public class FactoryDatabaseConstants { /** * 工厂基地对应的始发仓 redis key */ - public static final String FACTORY_DATA_BASE_WAREHOUSE_BIND = "factorydata:base:warehouse_bind"; + public static final String FACTORY_DATA_BASE_WAREHOUSE_BIND = "factory-data:base:warehouse_bind"; } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PushDataJob.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PushDataJob.java index b20224ba2..f03015c6e 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PushDataJob.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PushDataJob.java @@ -45,6 +45,35 @@ public class PushDataJob { return ReturnT.SUCCESS; } + /** + * 补传我乐到达节点数据 + * + * @param param + * @return + * @throws Exception + */ + @XxlJob("rePushOloNodeData") + public ReturnT rePushOloNodeData(String param) throws Exception { + deliveryNoteService.rePushOloNodeData(); + return ReturnT.SUCCESS; + } + + /** + * 补传我乐到达节点数据-指定订单 分单 回传 + * + * @param param + * @return + * @throws Exception + */ + @XxlJob("rePushOloNodeDataByCode") + public ReturnT rePushOloNodeDataByCode(String param) throws Exception { + if (StrUtil.isEmpty(param)) { + return ReturnT.SUCCESS; + } + deliveryNoteService.rePushOloNodeDataByCode(param); + return ReturnT.SUCCESS; + } + /** * 自定义回传工厂节点作业数据 * diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/DeliveryNoteMapper.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/DeliveryNoteMapper.java index 966cc4ecd..c0fb840e9 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/DeliveryNoteMapper.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/DeliveryNoteMapper.java @@ -6,6 +6,8 @@ import com.logpm.factorydata.olo.entity.DeliveryNoteEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 发货单 mapper * @@ -18,4 +20,6 @@ public interface DeliveryNoteMapper extends BaseMapper { JSONObject customPushNodeData(); void updateSustomPushNodeDataStatus(@Param("status") String status, @Param("orderNo") String orderNo, @Param("deliveryNo") String deliveryNo); + + List rePushOloNodeData(@Param("orderCode") String orderCode, @Param("shipmentCode") String shipmentCode, @Param("shipmentSpitCode") String shipmentSpitCode); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.java index b4d260348..0f91841fe 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.java @@ -13,4 +13,6 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface FactoryNodeAllPushMapper extends BaseMapper { + FactoryNodeAllPushEntity rePushOloNodeData(); + } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.xml b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.xml index 2380ff654..d0385901e 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.xml +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeAllPushMapper.xml @@ -2,4 +2,13 @@ + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeOrderMapper.xml b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeOrderMapper.xml index ba7bc0baa..a73724709 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeOrderMapper.xml +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mapper/FactoryNodeOrderMapper.xml @@ -23,4 +23,16 @@ and orderNo = #{orderNo} and deliveryNo = #{deliveryNo} + + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java index 2d1636412..4b9d6061f 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java @@ -33,7 +33,6 @@ import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.QueueBinding; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; @@ -203,7 +202,11 @@ public class NodeDataPushListener { pushAllEntities.add(factoryNodeAllPushEntity); for (Map.Entry stringIntegerEntry : snMap.entrySet()) { JSONObject jsonObject = new JSONObject(); - jsonObject.set("sn", stringIntegerEntry.getKey()); + String key = stringIntegerEntry.getKey(); + if (StrUtil.contains(key, "补")) { + key = key.split("-")[0]; + } + jsonObject.set("sn", key); jsonObject.set("qty", stringIntegerEntry.getValue()); jsonObject.set("scanTime", entries.getStr("operatorTime")); snArray.add(jsonObject); diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/DeliveryNoteService.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/DeliveryNoteService.java index cc0382041..2c0512b5c 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/DeliveryNoteService.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/DeliveryNoteService.java @@ -26,4 +26,7 @@ public interface DeliveryNoteService extends BaseService { **/ void customPushNodeData(); + void rePushOloNodeData(); + + void rePushOloNodeDataByCode(String param); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/FactoryNodeAllPushService.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/FactoryNodeAllPushService.java index 960bba781..25507b82f 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/FactoryNodeAllPushService.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/FactoryNodeAllPushService.java @@ -11,4 +11,6 @@ import org.springblade.core.mp.base.BaseService; **/ public interface FactoryNodeAllPushService extends BaseService { + FactoryNodeAllPushEntity rePushOloNodeData(); + } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java index 20b671209..63567de39 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java @@ -1,9 +1,11 @@ package com.logpm.factorydata.olo.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; @@ -16,10 +18,12 @@ import com.logpm.factorydata.enums.BrandEnums; import com.logpm.factorydata.enums.SaxStatusEnums; import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.olo.entity.DeliveryNoteEntity; +import com.logpm.factorydata.olo.entity.FactoryNodeAllPushEntity; import com.logpm.factorydata.olo.entity.FactoryOrderLogEntity; import com.logpm.factorydata.olo.mapper.DeliveryNoteMapper; import com.logpm.factorydata.olo.pros.OldProperties; import com.logpm.factorydata.olo.service.DeliveryNoteService; +import com.logpm.factorydata.olo.service.FactoryNodeAllPushService; import com.logpm.factorydata.olo.service.FactoryOrderLogService; import com.logpm.factorydata.olo.vo.DeliveryNoteVO; import com.logpm.factorydata.vo.SendMsg; @@ -54,8 +58,11 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * 发货单 业务实现类 @@ -74,6 +81,7 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl vo) { @@ -213,7 +221,7 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl 1) { + if (StrUtil.equals(orderPackageDTO.getType(), "标准台面") || anInt > 1) { advanceDetailEntity.setOrderPackageCode("OLO" + orderPackageDTO.getSn() + "-" + DateUtil.format(new Date(), "yyyyMMddHHmmss") + "-" + num + "-" + StrUtil.padPre(String.valueOf(i + 1), 3, "0")); } else { advanceDetailEntity.setOrderPackageCode(orderPackageDTO.getSn()); @@ -292,6 +300,152 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl packageCodeSet = new HashSet<>(); + for (String s : split) { + if (StrUtil.contains(s, "补")) { + continue; + } + packageCodeSet.add(s); + } + String orderCode = entity.getOrderCode(); + String shipmentCode = entity.getShipmentCode(); + String shipmentSpitCode = entity.getShipmentSpitCode(); + List list = this.baseMapper.rePushOloNodeData(orderCode, shipmentCode, shipmentSpitCode); + if (CollUtil.isNotEmpty(list)) { + List sns = list.stream().filter(s -> !packageCodeSet.contains(s.getSn())).map(deliveryNoteEntity -> { + String sn = deliveryNoteEntity.getSn(); + if (StrUtil.contains(sn, "补")) { + sn = sn.split("-")[0]; + } + deliveryNoteEntity.setSn(sn); + return deliveryNoteEntity; + }).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(sns)) { + JSONArray snArray = new JSONArray(); + for (DeliveryNoteEntity sn : sns) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set("sn", sn.getSn()); + jsonObject.set("qty", sn.getQty()); + jsonObject.set("scanTime", DateUtil.formatDateTime(createTime)); + snArray.add(jsonObject); + } + entries.set("snList", snArray); + JSONArray objects = new JSONArray(); + objects.add(entries); + String post = HttpUtil.post(entity.getSendUrl(), JSONUtil.toJsonStr(objects)); + FactoryNodeAllPushEntity pushAllEntity = new FactoryNodeAllPushEntity(); + BeanUtil.copyProperties(entity, pushAllEntity); + pushAllEntity.setId(null); + try { + JSONObject entries1 = JSONUtil.parseObj(post); + Integer code = entries1.getInt("code"); + String data = entries1.getStr("data"); + // 成功 + Integer successCode = code; + String message = data; + if (NumberUtil.equals(code, 200)) { + if (StrUtil.isNotEmpty(data)) { + JSONObject jsonObject = JSONUtil.parseObj(data); + Integer code1 = jsonObject.getInt("code"); + successCode = code1; + } + } + pushAllEntity.setPackageCode(sns.stream().map(DeliveryNoteEntity::getSn).collect(Collectors.joining(","))); + pushAllEntity.setSendStatus(successCode + ""); + pushAllEntity.setContent(JSONUtil.toJsonStr(entries)); + pushAllEntity.setResultContent(message); + pushAllEntity.setReserve1(Convert.toStr(sns.size())); + pushAllEntity.setReserve2(Convert.toStr(sns.size())); + factoryNodeAllPushService.save(pushAllEntity); + } catch (Exception e) { + log.error("解析返回值失败"); + } + } + } + entity.setReserve1(entity.getReserve2()); + factoryNodeAllPushService.updateById(entity); + } + + } + + @Override + public void rePushOloNodeDataByCode(String param) { + JSONObject entries = JSONUtil.parseObj(param); + String orderCode = entries.getStr("orderNo"); + String shipmentCode = entries.getStr("shipmentNo"); + String shipmentSpitCode = entries.getStr("shipmentSplitNo"); + List list = this.baseMapper.rePushOloNodeData(orderCode, shipmentCode, shipmentSpitCode); + if (CollUtil.isNotEmpty(list)) { + List sns = list.stream().map(deliveryNoteEntity -> { + String sn = deliveryNoteEntity.getSn(); + if (StrUtil.contains(sn, "补")) { + sn = sn.split("-")[0]; + } + deliveryNoteEntity.setSn(sn); + return deliveryNoteEntity; + }).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(sns)) { + JSONArray snArray = new JSONArray(); + for (DeliveryNoteEntity sn : sns) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set("sn", sn.getSn()); + jsonObject.set("qty", sn.getQty()); + jsonObject.set("scanTime", DateUtil.formatDateTime(new Date())); + snArray.add(jsonObject); + } + entries.set("snList", snArray); + JSONArray objects = new JSONArray(); + objects.add(entries); + String post = HttpUtil.post(oldProperties.getPushNodeUrl(), JSONUtil.toJsonStr(objects)); + FactoryNodeAllPushEntity pushAllEntity = new FactoryNodeAllPushEntity(); + pushAllEntity.setWarehouse(entries.getStr("nodeName")); + pushAllEntity.setWorkBatch(orderCode); + pushAllEntity.setSendUrl(oldProperties.getPushNodeUrl()); + pushAllEntity.setOrderCode(orderCode); + pushAllEntity.setShipmentCode(shipmentCode); + pushAllEntity.setShipmentSpitCode(shipmentSpitCode); + pushAllEntity.setType(entries.getStr("content")); + pushAllEntity.setWaybillCode(entries.getStr("deliveryNo")); + pushAllEntity.setTypeCode(entries.getInt("siteLevel")); + try { + JSONObject entries1 = JSONUtil.parseObj(post); + Integer code = entries1.getInt("code"); + String data = entries1.getStr("data"); + // 成功 + Integer successCode = code; + String message = data; + if (NumberUtil.equals(code, 200)) { + if (StrUtil.isNotEmpty(data)) { + JSONObject jsonObject = JSONUtil.parseObj(data); + Integer code1 = jsonObject.getInt("code"); + successCode = code1; + } + } + pushAllEntity.setPackageCode(sns.stream().map(DeliveryNoteEntity::getSn).collect(Collectors.joining(","))); + pushAllEntity.setSendStatus(successCode + ""); + pushAllEntity.setContent(JSONUtil.toJsonStr(entries)); + pushAllEntity.setResultContent(message); + pushAllEntity.setReserve1(Convert.toStr(sns.size())); + pushAllEntity.setReserve2(Convert.toStr(sns.size())); + factoryNodeAllPushService.save(pushAllEntity); + } catch (Exception e) { + log.error("解析返回值失败"); + } + } + } + } + private String uploadFile(String body) { // 文本内容和保存为本地文件 并上传 String logPath = FileLogsUtil.saveFileLogs(body); diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/FactoryNodeAllPushServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/FactoryNodeAllPushServiceImpl.java index d6f91f383..d05c664c0 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/FactoryNodeAllPushServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/FactoryNodeAllPushServiceImpl.java @@ -19,4 +19,8 @@ import org.springframework.stereotype.Service; @AllArgsConstructor public class FactoryNodeAllPushServiceImpl extends BaseServiceImpl implements FactoryNodeAllPushService { + @Override + public FactoryNodeAllPushEntity rePushOloNodeData() { + return this.baseMapper.rePushOloNodeData(); + } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java index 98506e31a..d2789be72 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-suofeiya/src/main/java/com/logpm/factorydata/suofeiya/config/InterceptorAdapterConfig.java @@ -38,10 +38,10 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry interceptorRegistry) { interceptorRegistry.addInterceptor(new FactoryAccountsInterceptor(redis, environment, redisLockClient, mockLoginService, suoFeiYaProperties, deliveryNoteService)) - .addPathPatterns("/order/v1").order(2); + .addPathPatterns("/order/v1").order(3); interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis, environment, redisLockClient, mockLoginService, suoFeiYaProperties, deliveryNoteService)) .addPathPatterns("/**") .excludePathPatterns("/order/v1") - .order(3); + .order(2); } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportIncomingController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportIncomingController.java index 296e4ec4d..8aa69a7c0 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportIncomingController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/ReportIncomingController.java @@ -8,9 +8,7 @@ import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -22,32 +20,32 @@ public class ReportIncomingController extends BladeController { private final IReportIncomingService reportIncomingService; - @GetMapping("/deptIncomingPage") + @PostMapping("/deptIncomingPage") @ApiOperationSupport(order = 1) @ApiOperation(value = "营业部收入报表", notes = "营业部收入报表") - public R deptIncomingPage(ReportIncomingDTO reportIncomingDTO) { + public R deptIncomingPage(@RequestBody ReportIncomingDTO reportIncomingDTO) { return reportIncomingService.deptIncomingPage(reportIncomingDTO); } - @GetMapping("/deptIncomingExport") + @PostMapping("/deptIncomingExport") @ApiOperationSupport(order = 1) @ApiOperation(value = "营业部收入报表导出", notes = "营业部收入报表导出") - public void deptIncomingExport(ReportIncomingDTO reportIncomingDTO, HttpServletResponse response) { + public void deptIncomingExport(@RequestBody ReportIncomingDTO reportIncomingDTO, HttpServletResponse response) { reportIncomingService.deptIncomingExport(reportIncomingDTO,response); } - @GetMapping("/consigineeIncomingPage") + @PostMapping("/consigineeIncomingPage") @ApiOperationSupport(order = 1) @ApiOperation(value = "收货单位收入报表", notes = "收货单位收入报表") - public R consigineeIncomingPage(ReportIncomingDTO reportIncomingDTO) { + public R consigineeIncomingPage(@RequestBody ReportIncomingDTO reportIncomingDTO) { return reportIncomingService.consigineeIncomingPage(reportIncomingDTO); } - @GetMapping("/consigineeIncomingExport") + @PostMapping("/consigineeIncomingExport") @ApiOperationSupport(order = 1) @ApiOperation(value = "收货单位收入报表导出", notes = "收货单位收入报表导出") - public void consigineeIncomingExport(ReportIncomingDTO reportIncomingDTO, HttpServletResponse response) { + public void consigineeIncomingExport(@RequestBody ReportIncomingDTO reportIncomingDTO, HttpServletResponse response) { reportIncomingService.consigineeIncomingExport(reportIncomingDTO,response); } diff --git a/blade-service/logpm-report/src/main/resources/application-prod.yml b/blade-service/logpm-report/src/main/resources/application-prod.yml index e75326109..d2d395e11 100644 --- a/blade-service/logpm-report/src/main/resources/application-prod.yml +++ b/blade-service/logpm-report/src/main/resources/application-prod.yml @@ -22,6 +22,8 @@ spring: proxy-filters: - sqlLogInterceptor query-timeout: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 #设置默认的数据源或者数据源组,默认值即为master primary: master datasource: 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 ca03ccecf..6a168c70a 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,7 +5,8 @@ import cn.hutool.core.util.NumberUtil; 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.basicdata.entity.BasicdataClientEntity; +import com.logpm.basicdata.feign.IBasicdataClientClient; import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.statistics.entity.*; import com.logpm.statistics.service.*; @@ -14,7 +15,6 @@ import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.feign.ITrunklineAdvanceClient; import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient; -import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; import com.logpm.warehouse.entity.WarehouseWayBillDetail; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; @@ -30,7 +30,6 @@ import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.QueueBinding; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.*; @@ -52,6 +51,7 @@ public class WaybillCheckListener { private final IStatisticsDistributionPackageService distributionPackageService; private final IStatisticsBalanceOrderInfoService balanceOrderInfoService; private final IDistributionParcelListClient distributionParcelListClient; + private final IBasicdataClientClient basicdataClientClient; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FanoutConstants.trunkline.CHECKWAYBILL.QUEUE.CHECKWAYBILL_INCOMINGDATA), @@ -200,6 +200,10 @@ public class WaybillCheckListener { Long consigneeId = waybillEntity.getConsigneeId(); String consignee = waybillEntity.getConsignee(); Integer serviceType = waybillEntity.getServiceType(); + BasicdataClientEntity basicdataClient = basicdataClientClient.findEntityById(consigneeId); + if(!Objects.isNull(basicdataClient)){ + serviceType=basicdataClient.getTypeService(); + } String payWay = waybillEntity.getPayWay(); Long departureWarehouseId = waybillEntity.getDepartureWarehouseId(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); @@ -482,6 +486,10 @@ public class WaybillCheckListener { Long consigneeId = waybillEntity.getConsigneeId(); String consignee = waybillEntity.getConsignee(); Integer serviceType = waybillEntity.getServiceType(); + BasicdataClientEntity basicdataClient = basicdataClientClient.findEntityById(consigneeId); + if(!Objects.isNull(basicdataClient)){ + serviceType=basicdataClient.getTypeService(); + } String payWay = waybillEntity.getPayWay(); Long departureWarehouseId = waybillEntity.getDepartureWarehouseId(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); @@ -491,6 +499,8 @@ public class WaybillCheckListener { Integer pickupCompleteOrNot = waybillEntity.getPickupCompleteOrNot(); Date signTime = waybillEntity.getSignTime(); + + //单价计算 // BigDecimal pickupFee = Objects.isNull(waybillEntity.getPickupFee())?BigDecimal.ZERO:waybillEntity.getPickupFee(); BigDecimal warehouseManagementFee = Objects.isNull(waybillEntity.getWarehouseManagementFee()) ? BigDecimal.ZERO : waybillEntity.getWarehouseManagementFee(); @@ -546,6 +556,7 @@ public class WaybillCheckListener { //保存订单信息 List orderInfoEntities = new ArrayList<>(); + Integer finalServiceType = serviceType; advanceEntities.forEach(advanceEntity -> { StatisticsOrderInfoEntity orderInfoEntity = new StatisticsOrderInfoEntity(); orderInfoEntity.setOrderCode(advanceEntity.getOrderCode()); @@ -555,7 +566,7 @@ public class WaybillCheckListener { orderInfoEntity.setBrand(brand); orderInfoEntity.setConsigneeId(consigneeId); orderInfoEntity.setConsignee(consignee); - orderInfoEntity.setTypeService(serviceType); + orderInfoEntity.setTypeService(finalServiceType); orderInfoEntity.setSignDate(signTime); orderInfoEntity.setSignStatus(0); orderInfoEntity.setSyncFeeStatus(0); diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml index b4196e805..b2c8fb0b4 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchTrainDetailMapper.xml @@ -37,6 +37,12 @@ and delivery_date <= #{expenseDispatchTrainDetail.deliveryDateEnd} + + and train_completion_time >= #{expenseDispatchTrainDetail.trainCompletionTimeStart} + + + and train_completion_time <= #{expenseDispatchTrainDetail.trainCompletionTimeEnd} + and distribution_type = #{expenseDispatchTrainDetail.distributionType} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchWarehouseMonthMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchWarehouseMonthMapper.xml index c105a65fd..f24947158 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchWarehouseMonthMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/ExpenseDispatchWarehouseMonthMapper.xml @@ -32,9 +32,9 @@ diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java index 8080f6230..378193f4c 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/query/ExpenseDispatchTrainDetailQuery.java @@ -5,6 +5,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.support.Query; +import java.util.Date; + @Data @EqualsAndHashCode(callSuper = true) public class ExpenseDispatchTrainDetailQuery extends Query { @@ -18,6 +20,16 @@ public class ExpenseDispatchTrainDetailQuery extends Query { */ @ApiModelProperty(value = "配送日期结束") private String deliveryDateEnd; + /** + * 车次完成时间开始 + */ + @ApiModelProperty(value = "车次完成时间开始") + private Date trainCompletionTimeStart; + /** + * 车次完成时间结束 + */ + @ApiModelProperty(value = "车次完成时间结束") + private Date trainCompletionTimeEnd; /** * 配送司机 */ diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/ExpenseDispatchTrainDetailVO.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/ExpenseDispatchTrainDetailVO.java index ab78ca7bf..16803ce32 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/ExpenseDispatchTrainDetailVO.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/ExpenseDispatchTrainDetailVO.java @@ -64,8 +64,14 @@ public class ExpenseDispatchTrainDetailVO { * 配送日期 */ @ApiModelProperty(value = "配送日期") - @ExcelProperty("车次号") + @ExcelProperty("配送日期") private String deliveryDate; + /** + * 车次完成时间 + */ + @ApiModelProperty(value = "车次完成时间") + @ExcelProperty("车次完成时间") + private String trainCompletionTime; /** * 目的仓 */ diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/AdvanceOrderListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/AdvanceOrderListener.java index 268bdaf39..f84943c94 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/AdvanceOrderListener.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/AdvanceOrderListener.java @@ -1,39 +1,20 @@ package com.logpm.trunkline.mq; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.distribution.entity.DistributionParcelListEntity; -import com.logpm.distribution.feign.IDistributionParcelListClient; -import com.logpm.distribution.feign.IDistributionStockArticleClient; -import com.logpm.factorydata.enums.BrandEnums; -import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; -import com.logpm.trunkline.entity.TrunklineAdvanceEntity; -import com.logpm.trunkline.entity.TrunklineDetailProductEntity; -import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; -import com.logpm.trunkline.service.ITrunklineAdvanceService; -import com.logpm.trunkline.service.ITrunklineCarsLoadService; -import com.logpm.trunkline.service.ITrunklineDetailProductService; +import com.logpm.trunkline.service.IAdvanceOrderMqService; +import com.rabbitmq.client.Channel; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.factorydata.FactoryDataConstants; -import org.springblade.core.secure.utils.AuthUtil; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.QueueBinding; import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.support.AmqpHeaders; +import org.springframework.messaging.handler.annotation.Header; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.io.IOException; /** * 监听工厂数据转暂存单 @@ -46,142 +27,26 @@ import java.util.*; @AllArgsConstructor public class AdvanceOrderListener { - private final ITrunklineAdvanceService advanceService; - private final ITrunklineAdvanceDetailService advanceDetailService; - private final ITrunklineDetailProductService detailProductService; - private final ITrunklineCarsLoadService trunklineCarsLoadService; - private final IDistributionStockArticleClient stockArticleClient; - private final IDistributionParcelListClient parcelListClient; + private final IAdvanceOrderMqService advanceOrderMqService; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FactoryDataConstants.Mq.Queues.ADVANCE_ORDER), exchange = @Exchange(name = FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER, type = ExchangeTypes.TOPIC), key = FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER - )) - @Transactional(rollbackFor = Exception.class) - public void advanceOrder(String msg) { + ), ackMode = "MANUAL") + public void advanceOrder(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) { // 新增暂存单 - if (StrUtil.isNotBlank(msg)) { - log.info("收到工厂数据暂存单消息:{}", msg); - JSONObject entries = JSONUtil.parseObj(msg); - JSONArray details = entries.getJSONArray("details"); - TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(entries, TrunklineAdvanceEntity.class); - LambdaQueryWrapper eq = Wrappers.lambdaQuery() - .eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); - if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { - eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); - } - // 暂存单 订单自编号 + 车次号 唯一 - List advanceEntities = advanceService.list(eq); - - // 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上 - // 如果已开单则新增暂存单 - if (CollUtil.isNotEmpty(advanceEntities) && ObjectUtil.equal(advanceEntity.getWaybillStatus(), "0")) { - TrunklineAdvanceEntity entity = advanceEntities.get(0); - if (ObjectUtil.isNotEmpty(entity)) { - advanceEntity.setId(entity.getId()); -// advanceEntity.setTotalNum(entity.getTotalNum() + advanceEntity.getTotalNum()); - } - } - Set packageCodeSet = new HashSet<>(); - if (CollUtil.isNotEmpty(details)) { - // 使用HashSet代替ArrayList以优化内存使用和检查重复值 - Set orderPackageCodes = new HashSet<>(); - details.forEach(detail -> { - try { - // 更具描述性的变量命名 - JSONObject jsonObject = JSONUtil.parseObj(detail); - TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); - // 检查转换后的实体不为null,且其orderPackageCode非null - if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { - orderPackageCodes.add(entity.getOrderPackageCode()); - } - } catch (Exception e) { - // 异常处理,可根据实际情况记录日志或进行其他处理 - log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); - } - }); - // 查询数据库,校验订单包件编码是否重复 - if (CollUtil.isNotEmpty(orderPackageCodes)) { - Map packageCodeByCodes = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); - if (CollUtil.isNotEmpty(packageCodeByCodes)) { - packageCodeSet.addAll(packageCodeByCodes.keySet()); - } - } - } - if (ObjectUtil.isNotNull(advanceEntity)) { - String orderCode = advanceEntity.getOrderCode(); - if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { - advanceEntity.setLegacyStatus("1"); - } - // 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加 - if (ObjectUtil.isEmpty(advanceEntity.getId())) { - advanceEntity.setCreateUserName(AuthUtil.getNickName()); - advanceService.save(advanceEntity); - } else { - advanceService.updateById(advanceEntity); - } - } - if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { - List advanceDetailEntityList = new ArrayList<>(); - List detailProductEntityList = new ArrayList<>(); - for (Object detailObj : details) { - JSONObject detail = JSONUtil.parseObj(detailObj); - TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); - if (ObjectUtil.isNotNull(advanceDetailEntity)) { - if (CollUtil.isNotEmpty(packageCodeSet) && packageCodeSet.contains(advanceDetailEntity.getOrderPackageCode())) { - // 金牌如果是重复包条,则单独处理 - if (ObjectUtil.equal(advanceEntity.getBrand(), BrandEnums.JP.getValue())) { - // 金牌按DD单号+包条确定唯一值 - List list = advanceDetailService.list(Wrappers.lambdaQuery() - .eq(TrunklineAdvanceDetailEntity::getOrderPackageCode, advanceDetailEntity.getOrderPackageCode()) - .eq(TrunklineAdvanceDetailEntity::getOrderCode, advanceEntity.getOrderCode()) - ); - if (CollUtil.isNotEmpty(list)) { - // 订单+包件重复则不处理这条数据 - log.error("金牌,订单+包条码重复,订单:{},包条码:{}", advanceEntity.getOrderCode(), advanceDetailEntity.getOrderPackageCode()); - continue; - } else { - // 包件码重复,订单+包件不重复,设置预留字段1 为 1 - advanceDetailEntity.setReserve1("1"); - } - } else { - log.error("非金牌,包条码重复,包条码:{}", advanceDetailEntity.getOrderPackageCode()); - continue; - } - } - advanceDetailEntity.setAdvanceId(advanceEntity.getId()); - // 设置发货时间为当前时间 - if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { - advanceDetailEntity.setSendDateStr(DateUtil.today()); - } - advanceDetailEntityList.add(advanceDetailEntity); - JSONArray items = detail.getJSONArray("items"); - if (CollUtil.isNotEmpty(items)) { - for (Object itemObj : items) { - JSONObject item = JSONUtil.parseObj(itemObj); - TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); - if (ObjectUtil.isNotNull(detailProductEntity)) { - detailProductEntityList.add(detailProductEntity); - } - } - } - } - - } - advanceDetailService.saveBatch(advanceDetailEntityList); - //发送入库包件处理无数据装车数据 - trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); - detailProductService.saveBatch(detailProductEntityList); - - //发送报表数据广播 - Long warehouseId = advanceEntity.getWarehouseId(); - String warehouseName = advanceEntity.getWarehouseName(); - String dealerCode = advanceEntity.getDealerCode(); - String dealerName = advanceEntity.getDealerName(); - advanceDetailService.sendReportBasicdataFanout(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,new Date(),advanceDetailEntityList,dealerCode,dealerName); - - } + log.info("收到工厂数据暂存单消息:{}", msg); + try { + advanceOrderMqService.advanceOrder(msg); + } catch (Exception e) { + e.printStackTrace(); + log.error("收到工厂数据暂存单消息失败: {}", e.getMessage()); + } + try { + channel.basicAck(tag, false); + } catch (IOException e) { + throw new RuntimeException(e); } } @@ -189,188 +54,20 @@ public class AdvanceOrderListener { value = @Queue(name = FactoryDataConstants.Mq.Queues.ADVANCE_ORDER_OUPAI), exchange = @Exchange(name = FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER_OUPAI, type = ExchangeTypes.TOPIC), key = FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER - )) - @Transactional(rollbackFor = Exception.class) - public void advanceOrderOuPai(String msg) { + ), ackMode = "MANUAL") + public void advanceOrderOuPai(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) { // 新增暂存单 - if (StrUtil.isNotBlank(msg)) { - log.info("收到欧派工厂数据暂存单消息:{}", msg); - JSONObject entries = JSONUtil.parseObj(msg); - JSONArray details = entries.getJSONArray("details"); - TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(entries, TrunklineAdvanceEntity.class); - LambdaQueryWrapper eq = Wrappers.lambdaQuery() - .eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); - if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { - eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); - } - // 暂存单 订单自编号 + 车次号 唯一 - List advanceEntities = advanceService.list(eq); - - // 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上 - // 如果已开单则新增暂存单 - // 订单 修改最终客户信息 - if (CollUtil.isNotEmpty(advanceEntities)) { - TrunklineAdvanceEntity entity = advanceEntities.get(0); - if (ObjectUtil.isNotEmpty(entity)) { - // 如果存在则只修改客户信息 - if (StrUtil.isNotEmpty(advanceEntity.getCustomerName())) { - entity.setCustomerName(advanceEntity.getCustomerName()); - } - if (StrUtil.isNotEmpty(advanceEntity.getCustomerAddress())) { - entity.setCustomerAddress(advanceEntity.getCustomerAddress()); - } - if (StrUtil.isNotEmpty(advanceEntity.getCustomerPhone())) { - entity.setCustomerPhone(advanceEntity.getCustomerPhone()); - } - advanceService.updateById(entity); - // 修改在库订单信息 未预约的数据 reservation_status = 10 才更新 - if (ObjectUtil.isAllNotEmpty(entity.getOrderCode(), advanceEntity.getCustomerName(), advanceEntity.getCustomerAddress(), advanceEntity.getCustomerPhone())) { - try { - JSONObject jsonObject = new JSONObject(); - jsonObject.set("orderCode", entity.getOrderCode()); - jsonObject.set("customerName", advanceEntity.getCustomerName()); - jsonObject.set("customerAddress", advanceEntity.getCustomerAddress()); - jsonObject.set("customerPhone", advanceEntity.getCustomerPhone()); - stockArticleClient.updateCustomerAllByOrderCode(JSONUtil.toJsonStr(jsonObject)); - } catch (Exception e) { - log.error("更新在库订单失败"); - } - } - } - } - if (ObjectUtil.isNotNull(advanceEntity)) { - String orderCode = advanceEntity.getOrderCode(); - if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { - advanceEntity.setLegacyStatus("1"); - } - // 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加 - if (ObjectUtil.isEmpty(advanceEntity.getId())) { - advanceEntity.setCreateUserName(AuthUtil.getNickName()); - advanceService.save(advanceEntity); - } - } - Map packageCodeMap = new HashMap<>(); - Map> parcelListMap = new HashMap<>(); - if (CollUtil.isNotEmpty(details)) { - // 使用HashSet代替ArrayList以优化内存使用和检查重复值 - Set orderPackageCodes = new HashSet<>(); - details.forEach(detail -> { - try { - // 更具描述性的变量命名 - JSONObject jsonObject = JSONUtil.parseObj(detail); - TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); - // 检查转换后的实体不为null,且其orderPackageCode非null - if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { - orderPackageCodes.add(entity.getOrderPackageCode()); - } - } catch (Exception e) { - // 异常处理,可根据实际情况记录日志或进行其他处理 - log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); - } - }); - // 查询数据库,校验订单包件编码是否重复 - if (CollUtil.isNotEmpty(orderPackageCodes)) { - packageCodeMap = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); - try { - if(CollUtil.isNotEmpty(packageCodeMap)){ - parcelListMap = parcelListClient.findPackageCodeByCodes(packageCodeMap.keySet()); - } - }catch (Exception e){ - log.error("查询包件表失败"); - } - } - } - - // 包件 修改 品类信息 物料名称 - if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { - List advanceDetailEntityList = new ArrayList<>(); - List parcelListEntityList = new ArrayList<>(); - List detailProductEntityList = new ArrayList<>(); - Set productCodes = new HashSet<>(); - for (Object detailObj : details) { - JSONObject detail = JSONUtil.parseObj(detailObj); - TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); - if (ObjectUtil.isNotNull(advanceDetailEntity)) { - if (CollUtil.isNotEmpty(packageCodeMap) && StrUtil.isNotEmpty(advanceDetailEntity.getOrderPackageCode()) - && packageCodeMap.containsKey(advanceDetailEntity.getOrderPackageCode())) { - if(!ObjectUtil.isAllEmpty(advanceDetailEntity.getFirstPackName(),advanceDetailEntity.getSecondPackName(), - advanceDetailEntity.getThirdPackName(),advanceDetailEntity.getMaterialName())){ - TrunklineAdvanceDetailEntity updatedetailEntity = new TrunklineAdvanceDetailEntity(); - updatedetailEntity.setId(Convert.toLong(packageCodeMap.get(advanceDetailEntity.getOrderPackageCode()))); - updatedetailEntity.setFirstPackName(advanceDetailEntity.getFirstPackName()); - updatedetailEntity.setFirstPackCode(advanceDetailEntity.getFirstPackCode()); - updatedetailEntity.setSecondPackName(advanceDetailEntity.getSecondPackName()); - updatedetailEntity.setSecondPackCode(advanceDetailEntity.getSecondPackCode()); - updatedetailEntity.setThirdPackName(advanceDetailEntity.getThirdPackName()); - updatedetailEntity.setThirdPackCode(advanceDetailEntity.getThirdPackCode()); - updatedetailEntity.setMaterialName(advanceDetailEntity.getMaterialName()); - updatedetailEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); - advanceDetailEntityList.add(updatedetailEntity); - } - if(CollUtil.isNotEmpty(parcelListMap) && parcelListMap.containsKey(advanceDetailEntity.getOrderPackageCode())){ - Set strings = parcelListMap.get(advanceDetailEntity.getOrderPackageCode()); - for (String string : strings) { - DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); - parcelListEntity.setId(Convert.toLong(string)); - parcelListEntity.setFirsts(advanceDetailEntity.getFirstPackName()); - parcelListEntity.setSecond(advanceDetailEntity.getSecondPackName()); - parcelListEntity.setThirdProduct(advanceDetailEntity.getThirdPackName()); - parcelListEntity.setMaterialName(advanceDetailEntity.getMaterialName()); - parcelListEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); - parcelListEntityList.add(parcelListEntity); - } - - } - } else { - advanceDetailEntity.setAdvanceId(advanceEntity.getId()); - // 设置发货时间为当前时间 - if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { - advanceDetailEntity.setSendDateStr(DateUtil.today()); - } - advanceDetailEntityList.add(advanceDetailEntity); - } - - JSONArray items = detail.getJSONArray("items"); - if (CollUtil.isNotEmpty(items)) { - for (Object itemObj : items) { - JSONObject item = JSONUtil.parseObj(itemObj); - TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); - if (ObjectUtil.isNotNull(detailProductEntity)) { - productCodes.add(detailProductEntity.getProductCode()); - detailProductEntityList.add(detailProductEntity); - } - } - } - } - - } - if(CollUtil.isNotEmpty(parcelListEntityList)){ - parcelListClient.saveorUpdateBatchByOP(parcelListEntityList); - } - if(CollUtil.isNotEmpty(advanceDetailEntityList)){ - advanceDetailService.saveOrUpdateBatch(advanceDetailEntityList); - } - //发送入库包件处理无数据装车数据 - trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); - if(CollUtil.isNotEmpty(detailProductEntityList)){ - if(ObjectUtil.isAllNotEmpty(packageCodeMap,productCodes)){ - List list = detailProductService.list(Wrappers.lambdaQuery() - .in(TrunklineDetailProductEntity::getUnitNo, packageCodeMap.keySet()) - .in(TrunklineDetailProductEntity::getProductCode, productCodes) - ); - if(CollUtil.isNotEmpty(list)){ - for (TrunklineDetailProductEntity productEntity : detailProductEntityList) { - for (TrunklineDetailProductEntity detailProductEntity : list) { - if(ObjectUtil.equal(productEntity.getProductCode(),detailProductEntity.getProductCode())){ - productEntity.setId(detailProductEntity.getId()); - } - } - } - } - } - detailProductService.saveOrUpdateBatch(detailProductEntityList); - } - } + log.info("收到欧派工厂数据暂存单消息:{}", msg); + try { + advanceOrderMqService.advanceOrderOuPai(msg); + } catch (Exception e) { + e.printStackTrace(); + log.error("收到欧派工厂数据暂存单消息失败: {}", e.getMessage()); + } + try { + channel.basicAck(tag, false); + } catch (IOException e) { + throw new RuntimeException(e); } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAdvanceOrderMqService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAdvanceOrderMqService.java new file mode 100644 index 000000000..4f35bb9ca --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAdvanceOrderMqService.java @@ -0,0 +1,8 @@ +package com.logpm.trunkline.service; + +public interface IAdvanceOrderMqService { + + void advanceOrder(String msg); + + void advanceOrderOuPai(String msg); +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java index 5e13956c8..fd53be90a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceService.java @@ -53,4 +53,5 @@ public interface ITrunklineAdvanceService extends BaseService eq = Wrappers.lambdaQuery() + .eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); + if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { + eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); + } + // 暂存单 订单自编号 + 车次号 唯一 + List advanceEntities = advanceService.list(eq); + + // 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上 + // 如果已开单则新增暂存单 + if (CollUtil.isNotEmpty(advanceEntities) && ObjectUtil.equal(advanceEntity.getWaybillStatus(), "0")) { + TrunklineAdvanceEntity entity = advanceEntities.get(0); + if (ObjectUtil.isNotEmpty(entity)) { + advanceEntity.setId(entity.getId()); +// advanceEntity.setTotalNum(entity.getTotalNum() + advanceEntity.getTotalNum()); + } + } + Set packageCodeSet = new HashSet<>(); + if (CollUtil.isNotEmpty(details)) { + // 使用HashSet代替ArrayList以优化内存使用和检查重复值 + Set orderPackageCodes = new HashSet<>(); + details.forEach(detail -> { + try { + // 更具描述性的变量命名 + JSONObject jsonObject = JSONUtil.parseObj(detail); + TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); + // 检查转换后的实体不为null,且其orderPackageCode非null + if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { + orderPackageCodes.add(entity.getOrderPackageCode()); + } + } catch (Exception e) { + // 异常处理,可根据实际情况记录日志或进行其他处理 + log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); + } + }); + // 查询数据库,校验订单包件编码是否重复 + if (CollUtil.isNotEmpty(orderPackageCodes)) { + Map packageCodeByCodes = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); + if (CollUtil.isNotEmpty(packageCodeByCodes)) { + packageCodeSet.addAll(packageCodeByCodes.keySet()); + } + } + } + if (ObjectUtil.isNotNull(advanceEntity)) { + String orderCode = advanceEntity.getOrderCode(); + if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { + advanceEntity.setLegacyStatus("1"); + } + // 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加 + if (ObjectUtil.isEmpty(advanceEntity.getId())) { + advanceEntity.setCreateUserName(AuthUtil.getNickName()); + advanceService.save(advanceEntity); + } else { + advanceService.updateById(advanceEntity); + } + } + if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { + List advanceDetailEntityList = new ArrayList<>(); + List detailProductEntityList = new ArrayList<>(); + for (Object detailObj : details) { + JSONObject detail = JSONUtil.parseObj(detailObj); + TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); + if (ObjectUtil.isNotNull(advanceDetailEntity)) { + if (CollUtil.isNotEmpty(packageCodeSet) && packageCodeSet.contains(advanceDetailEntity.getOrderPackageCode())) { + // 金牌如果是重复包条,则单独处理 + if (ObjectUtil.equal(advanceEntity.getBrand(), BrandEnums.JP.getValue())) { + // 金牌按DD单号+包条确定唯一值 + List list = advanceDetailService.list(Wrappers.lambdaQuery() + .eq(TrunklineAdvanceDetailEntity::getOrderPackageCode, advanceDetailEntity.getOrderPackageCode()) + .eq(TrunklineAdvanceDetailEntity::getOrderCode, advanceEntity.getOrderCode()) + ); + if (CollUtil.isNotEmpty(list)) { + // 订单+包件重复则不处理这条数据 + log.error("金牌,订单+包条码重复,订单:{},包条码:{}", advanceEntity.getOrderCode(), advanceDetailEntity.getOrderPackageCode()); + continue; + } else { + // 包件码重复,订单+包件不重复,设置预留字段1 为 1 + advanceDetailEntity.setReserve1("1"); + } + } else { + log.error("非金牌,包条码重复,包条码:{}", advanceDetailEntity.getOrderPackageCode()); + continue; + } + } + advanceDetailEntity.setAdvanceId(advanceEntity.getId()); + // 设置发货时间为当前时间 + if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { + advanceDetailEntity.setSendDateStr(DateUtil.today()); + } + advanceDetailEntityList.add(advanceDetailEntity); + JSONArray items = detail.getJSONArray("items"); + if (CollUtil.isNotEmpty(items)) { + for (Object itemObj : items) { + JSONObject item = JSONUtil.parseObj(itemObj); + TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); + if (ObjectUtil.isNotNull(detailProductEntity)) { + detailProductEntityList.add(detailProductEntity); + } + } + } + } + + } + advanceDetailService.saveBatch(advanceDetailEntityList); + // 发送入库包件处理无数据装车数据 + trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); + detailProductService.saveBatch(detailProductEntityList); + + // 发送报表数据广播 + Long warehouseId = advanceEntity.getWarehouseId(); + String warehouseName = advanceEntity.getWarehouseName(); + String dealerCode = advanceEntity.getDealerCode(); + String dealerName = advanceEntity.getDealerName(); + advanceDetailService.sendReportBasicdataFanout(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, new Date(), advanceDetailEntityList, dealerCode, dealerName); + + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void advanceOrderOuPai(String msg) { + if (StrUtil.isNotBlank(msg)) { + JSONObject entries = JSONUtil.parseObj(msg); + JSONArray details = entries.getJSONArray("details"); + TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(entries, TrunklineAdvanceEntity.class); + LambdaQueryWrapper eq = Wrappers.lambdaQuery() + .eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); + if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { + eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); + } + // 暂存单 订单自编号 + 车次号 唯一 + List advanceEntities = advanceService.list(eq); + + // 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上 + // 如果已开单则新增暂存单 + // 订单 修改最终客户信息 + if (CollUtil.isNotEmpty(advanceEntities)) { + TrunklineAdvanceEntity entity = advanceEntities.get(0); + if (ObjectUtil.isNotEmpty(entity)) { + // 如果存在则只修改客户信息 + if (StrUtil.isNotEmpty(advanceEntity.getCustomerName())) { + entity.setCustomerName(advanceEntity.getCustomerName()); + } + if (StrUtil.isNotEmpty(advanceEntity.getCustomerAddress())) { + entity.setCustomerAddress(advanceEntity.getCustomerAddress()); + } + if (StrUtil.isNotEmpty(advanceEntity.getCustomerPhone())) { + entity.setCustomerPhone(advanceEntity.getCustomerPhone()); + } + advanceService.updateById(entity); + // 修改在库订单信息 未预约的数据 reservation_status = 10 才更新 + if (ObjectUtil.isAllNotEmpty(entity.getOrderCode(), advanceEntity.getCustomerName(), advanceEntity.getCustomerAddress(), advanceEntity.getCustomerPhone())) { + try { + JSONObject jsonObject = new JSONObject(); + jsonObject.set("orderCode", entity.getOrderCode()); + jsonObject.set("customerName", advanceEntity.getCustomerName()); + jsonObject.set("customerAddress", advanceEntity.getCustomerAddress()); + jsonObject.set("customerPhone", advanceEntity.getCustomerPhone()); + stockArticleClient.updateCustomerAllByOrderCode(JSONUtil.toJsonStr(jsonObject)); + } catch (Exception e) { + log.error("更新在库订单失败"); + } + } + } + } + if (ObjectUtil.isNotNull(advanceEntity)) { + String orderCode = advanceEntity.getOrderCode(); + if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { + advanceEntity.setLegacyStatus("1"); + } + // 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加 + if (ObjectUtil.isEmpty(advanceEntity.getId())) { + advanceEntity.setCreateUserName(AuthUtil.getNickName()); + advanceService.save(advanceEntity); + } + } + Map packageCodeMap = new HashMap<>(); + Map> parcelListMap = new HashMap<>(); + if (CollUtil.isNotEmpty(details)) { + // 使用HashSet代替ArrayList以优化内存使用和检查重复值 + Set orderPackageCodes = new HashSet<>(); + details.forEach(detail -> { + try { + // 更具描述性的变量命名 + JSONObject jsonObject = JSONUtil.parseObj(detail); + TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); + // 检查转换后的实体不为null,且其orderPackageCode非null + if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { + orderPackageCodes.add(entity.getOrderPackageCode()); + } + } catch (Exception e) { + // 异常处理,可根据实际情况记录日志或进行其他处理 + log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); + } + }); + // 查询数据库,校验订单包件编码是否重复 + if (CollUtil.isNotEmpty(orderPackageCodes)) { + packageCodeMap = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); + try { + if (CollUtil.isNotEmpty(packageCodeMap)) { + parcelListMap = parcelListClient.findPackageCodeByCodes(packageCodeMap.keySet()); + } + } catch (Exception e) { + log.error("查询包件表失败"); + } + } + } + + // 包件 修改 品类信息 物料名称 + if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { + List advanceDetailEntityList = new ArrayList<>(); + List parcelListEntityList = new ArrayList<>(); + List detailProductEntityList = new ArrayList<>(); + Set productCodes = new HashSet<>(); + for (Object detailObj : details) { + JSONObject detail = JSONUtil.parseObj(detailObj); + TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); + if (ObjectUtil.isNotNull(advanceDetailEntity)) { + if (CollUtil.isNotEmpty(packageCodeMap) && StrUtil.isNotEmpty(advanceDetailEntity.getOrderPackageCode()) + && packageCodeMap.containsKey(advanceDetailEntity.getOrderPackageCode())) { + if (!ObjectUtil.isAllEmpty(advanceDetailEntity.getFirstPackName(), advanceDetailEntity.getSecondPackName(), + advanceDetailEntity.getThirdPackName(), advanceDetailEntity.getMaterialName())) { + TrunklineAdvanceDetailEntity updatedetailEntity = new TrunklineAdvanceDetailEntity(); + updatedetailEntity.setId(Convert.toLong(packageCodeMap.get(advanceDetailEntity.getOrderPackageCode()))); + updatedetailEntity.setFirstPackName(advanceDetailEntity.getFirstPackName()); + updatedetailEntity.setFirstPackCode(advanceDetailEntity.getFirstPackCode()); + updatedetailEntity.setSecondPackName(advanceDetailEntity.getSecondPackName()); + updatedetailEntity.setSecondPackCode(advanceDetailEntity.getSecondPackCode()); + updatedetailEntity.setThirdPackName(advanceDetailEntity.getThirdPackName()); + updatedetailEntity.setThirdPackCode(advanceDetailEntity.getThirdPackCode()); + updatedetailEntity.setMaterialName(advanceDetailEntity.getMaterialName()); + updatedetailEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); + advanceDetailEntityList.add(updatedetailEntity); + } + if (CollUtil.isNotEmpty(parcelListMap) && parcelListMap.containsKey(advanceDetailEntity.getOrderPackageCode())) { + Set strings = parcelListMap.get(advanceDetailEntity.getOrderPackageCode()); + for (String string : strings) { + DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); + parcelListEntity.setId(Convert.toLong(string)); + parcelListEntity.setFirsts(advanceDetailEntity.getFirstPackName()); + parcelListEntity.setSecond(advanceDetailEntity.getSecondPackName()); + parcelListEntity.setThirdProduct(advanceDetailEntity.getThirdPackName()); + parcelListEntity.setMaterialName(advanceDetailEntity.getMaterialName()); + parcelListEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); + parcelListEntityList.add(parcelListEntity); + } + + } + } else { + advanceDetailEntity.setAdvanceId(advanceEntity.getId()); + // 设置发货时间为当前时间 + if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { + advanceDetailEntity.setSendDateStr(DateUtil.today()); + } + advanceDetailEntityList.add(advanceDetailEntity); + } + + JSONArray items = detail.getJSONArray("items"); + if (CollUtil.isNotEmpty(items)) { + for (Object itemObj : items) { + JSONObject item = JSONUtil.parseObj(itemObj); + TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); + if (ObjectUtil.isNotNull(detailProductEntity)) { + productCodes.add(detailProductEntity.getProductCode()); + detailProductEntityList.add(detailProductEntity); + } + } + } + } + + } + if (CollUtil.isNotEmpty(parcelListEntityList)) { + parcelListClient.saveorUpdateBatchByOP(parcelListEntityList); + } + if (CollUtil.isNotEmpty(advanceDetailEntityList)) { + advanceDetailService.saveOrUpdateBatch(advanceDetailEntityList); + } + // 发送入库包件处理无数据装车数据 + trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); + if (CollUtil.isNotEmpty(detailProductEntityList)) { + if (ObjectUtil.isAllNotEmpty(packageCodeMap, productCodes)) { + List list = detailProductService.list(Wrappers.lambdaQuery() + .in(TrunklineDetailProductEntity::getUnitNo, packageCodeMap.keySet()) + .in(TrunklineDetailProductEntity::getProductCode, productCodes) + ); + if (CollUtil.isNotEmpty(list)) { + for (TrunklineDetailProductEntity productEntity : detailProductEntityList) { + for (TrunklineDetailProductEntity detailProductEntity : list) { + if (ObjectUtil.equal(productEntity.getProductCode(), detailProductEntity.getProductCode())) { + productEntity.setId(detailProductEntity.getId()); + } + } + } + } + } + detailProductService.saveOrUpdateBatch(detailProductEntityList); + } + } + } + } + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 805a58906..9bc2b3f04 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -916,8 +916,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } //修改暂存单明细的结算品类 - advanceDetailService.updateBatchById(updateAdvanceDetailList); - + //把updateAdvanceDetailList分成每300条一组 + List> updateAdvanceDetailListList = CollUtil.split(updateAdvanceDetailList, 300); + updateAdvanceDetailListList.forEach(updateAdvanceDetailList1 -> { + advanceDetailService.updateBatchById(updateAdvanceDetailList1); + }); trunklineWaybillPackageService.updateWaybillStatus(waybillEntity); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index e49179184..bc94ee765 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -13,7 +13,11 @@ import com.logpm.basicdata.entity.BasicdataBrandEntity; import com.logpm.basicdata.entity.BasicdataClientEntity; import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; -import com.logpm.basicdata.feign.*; +import com.logpm.basicdata.feign.IBasicdataBrandClient; +import com.logpm.basicdata.feign.IBasicdataClientClient; +import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient; +import com.logpm.basicdata.feign.IBasicdataTripartiteMallClient; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.distribution.dto.FindParamterDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity; @@ -27,6 +31,8 @@ import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.mapper.TrunklineAdvanceMapper; import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; import com.logpm.trunkline.service.ITrunklineAdvanceService; +import com.logpm.trunkline.service.ITrunklineCarsLoadService; +import com.logpm.trunkline.service.ITrunklineDetailProductService; import com.logpm.trunkline.vo.CustomerInfoVO; import com.logpm.trunkline.vo.OpenOrderVO; import com.logpm.trunkline.vo.TrunklineAdvanceVO; @@ -45,7 +51,14 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -60,14 +73,12 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl zeroList = trunklineCarsOrderService.findZeroList(loadId, warehouseId); - zeroList.forEach(loadZeroListVO -> { - String waybillNo = loadZeroListVO.getWaybillNo(); - String orderCode = loadZeroListVO.getOrderCode(); - List loadingNumVOList = scanZeroDetailService.findGoodsLoadingNum(loadId,warehouseId,waybillNo,orderCode); - //把loadingNumVOList转化成以goodsId作为key的Map - Map map = loadingNumVOList.stream().collect(Collectors.toMap(GoodsLoadingNumVO::getGoodsId, Function.identity())); - List zeroPackageList = distributionParcelListClient.findPackageGoodsListByWaybillNoAndWarehouseId(waybillNo,warehouseId); - List ls = new ArrayList<>(); - zeroPackageList.forEach(jsonObject -> { - ZeroPackageVO javaObject = jsonObject.toJavaObject(ZeroPackageVO.class); - Long goodsId = javaObject.getGoodsId(); - GoodsLoadingNumVO goodsLoadingNumVO = map.get(goodsId); - if(Objects.isNull(goodsLoadingNumVO)){ - javaObject.setLoadingNum(0); - }else{ - javaObject.setLoadingNum(goodsLoadingNumVO.getLoadingNum()); - } - ls.add(javaObject); + if(CollUtil.isNotEmpty(zeroList)){ + zeroList.forEach(loadZeroListVO -> { + String waybillNo = loadZeroListVO.getWaybillNo(); + String orderCode = loadZeroListVO.getOrderCode(); + List loadingNumVOList = scanZeroDetailService.findGoodsLoadingNum(loadId,warehouseId,waybillNo,orderCode); + //把loadingNumVOList转化成以goodsId作为key的Map + Map map = loadingNumVOList.stream().collect(Collectors.toMap(GoodsLoadingNumVO::getGoodsId, Function.identity())); + List zeroPackageList = distributionParcelListClient.findPackageGoodsListByWaybillNoAndWarehouseId(waybillNo,warehouseId); + List ls = new ArrayList<>(); + zeroPackageList.forEach(jsonObject -> { + ZeroPackageVO javaObject = jsonObject.toJavaObject(ZeroPackageVO.class); + Long goodsId = javaObject.getGoodsId(); + GoodsLoadingNumVO goodsLoadingNumVO = map.get(goodsId); + if(Objects.isNull(goodsLoadingNumVO)){ + javaObject.setLoadingNum(0); + }else{ + javaObject.setLoadingNum(goodsLoadingNumVO.getLoadingNum()); + } + ls.add(javaObject); + }); + loadZeroListVO.setZeroPackageList(ls); }); - loadZeroListVO.setZeroPackageList(ls); - }); + } //查询异常列表 diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java index 19cac21f6..c610725cc 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java @@ -438,4 +438,19 @@ public class WarehouseWaybillController extends BladeController { } + @PostMapping("/updateWaybillTypeService") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "修改运单的服务类型 ") + public R updateWaybillTypeService(@RequestBody WarehouseWaybillDTO waybillDTO) { + try { + log.info(">>>>>>>>>>>>>>>>>> updateWaybillTypeService: waybillDTO={}",waybillDTO); + return warehouseWaybillService.updateWaybillTypeService(waybillDTO); + } catch (Exception e) { + return R.fail(e.getMessage()); + } + + } + + + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java index 374ddeb28..1f84fc81b 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.java @@ -83,4 +83,6 @@ public interface WarehouseWaybillMapper extends BaseMapper findWaybillVOByOrderCode(@Param("orderCode") String orderCode); + + void updateWaybillTypeService(@Param("serviceType") Integer serviceType, @Param("waybillId") Long id); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml index 6e9f7785a..a7cd85678 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseWaybillMapper.xml @@ -1286,4 +1286,8 @@ update logpm_warehouse_waybill set consignee_id = null where id = #{waybillId} + + update logpm_warehouse_waybill set service_type = #{serviceType} where id = #{waybillId} + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java index 04e2574a1..d741deee4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWaybillService.java @@ -95,4 +95,6 @@ public interface IWarehouseWaybillService extends BaseService findWaybillVOByOrderCode(String orderCode); + + R updateWaybillTypeService(WarehouseWaybillDTO waybillDTO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java index 3ad53c5f7..146c767eb 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java @@ -62,6 +62,9 @@ import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.DictBizCache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.scripting.support.ResourceScriptSource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -1060,6 +1063,13 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl qw = new QueryWrapper<>(); qw.eq("association_value", orderPackageCode); @@ -1762,9 +1772,19 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl redisScript = new DefaultRedisScript<>(); + redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("luascript/resubmit.lua"))); + redisScript.setResultType(Long.class); + + List keys = Collections.singletonList(key); + List args = Arrays.asList(value, String.valueOf(expireTime)); + + Long result = redis.getRedisTemplate().execute(redisScript, keys, args); - Boolean exists = redis.exists(key); - if(exists){ + if (result == 1) { log.warn("#########orderScanOrderPackageCode: 托盘正在保存打托方式 trayCode={} warehouseId={}", trayCode, warehouseId); throw new CustomerException(405, "托盘信息正在更新,请重试"); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index 1c6da9a3c..ba9010796 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -1234,4 +1234,26 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl findWaybillVOByOrderCode(String orderCode) { return baseMapper.findWaybillVOByOrderCode(orderCode); } + + @Override + public R updateWaybillTypeService(WarehouseWaybillDTO waybillDTO) { + Long id = waybillDTO.getId(); + Integer serviceType = waybillDTO.getServiceType(); + + WarehouseWaybillEntity warehouseWaybillEntity = baseMapper.selectById(id); + if(Objects.isNull(warehouseWaybillEntity)){ + log.warn("###########updateWaybillTypeService: 运单信息为空"); + return R.fail(405,"运单信息为空"); + } + + Integer checkStatus = warehouseWaybillEntity.getCheckStatus(); + if(checkStatus.equals(1)){ + log.warn("###########updateWaybillTypeService: 运单已审核"); + return R.fail(405,"运单已审核"); + } + + baseMapper.updateWaybillTypeService(serviceType,id); + + return R.success("修改成功"); + } } diff --git a/blade-service/logpm-warehouse/src/main/resources/luascript/resubmit.lua b/blade-service/logpm-warehouse/src/main/resources/luascript/resubmit.lua new file mode 100644 index 000000000..990a385f7 --- /dev/null +++ b/blade-service/logpm-warehouse/src/main/resources/luascript/resubmit.lua @@ -0,0 +1,12 @@ +local key = KEYS[1] +local value = ARGV[1] +local expireTime = tonumber(ARGV[2]) + +local exists = redis.call("EXISTS", key) + +if exists == 1 then + return 1 +end + +redis.call("SETEX", key, expireTime, value) +return 0