From a7d453a0aa781cecaa2c47cd5418d978446b35a0 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Wed, 29 May 2024 00:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=AE=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/RabbitConstant.java | 26 +- .../DistributionBusinessPreCarNumberVO.java | 28 + .../IDistributionBusinessPreOrderClient.java | 18 + ...istributionBusinessPreOrderController.java | 19 +- .../DistributionBusinessPreOrderClient.java | 17 + .../DistributionBusinessPreOrderMapper.java | 19 +- .../DistributionBusinessPreOrderMapper.xml | 40 +- .../mapper/DistrilbutionBillLadingMapper.java | 9 - .../BusinessPreOrderDataQueueHandler.java | 42 -- .../service/IDistributionAsyncService.java | 1 - .../IDistributionBusinessPreOrderService.java | 9 +- .../impl/DistributionAsyncServiceImpl.java | 228 +------ ...stributionBusinessPreOrderServiceImpl.java | 40 +- .../aspect/ChangeAsyncAnnotationAspect.java | 120 ++++ .../config/RabbitMqConfiguration.java | 29 +- .../feign/TrunklineWaybillPackageClient.java | 1 - .../mq/InWarehourseToBusinessListener.java | 53 ++ .../mq/OpenWaybillToBusinessListener.java | 147 +++++ .../trunkline/service/IAsyncService.java | 11 +- .../service/impl/AsyncServiceImpl.java | 317 ++++++++- .../service/impl/InComingServiceImpl.java | 23 + .../service/impl/OpenOrderServiceImpl.java | 614 +++++++++--------- 22 files changed, 1181 insertions(+), 630 deletions(-) create mode 100644 blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumberVO.java create mode 100644 blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionBusinessPreOrderClient.java create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionBusinessPreOrderClient.java create mode 100644 blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/ChangeAsyncAnnotationAspect.java create mode 100644 blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/InWarehourseToBusinessListener.java create mode 100644 blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java index cea0cb2c6..42e3c081e 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java @@ -33,9 +33,9 @@ public interface RabbitConstant { /** * 新系统推送信息 */ - String NEW_SYSTEM_RECEIVE_INFO_QUEUE = "new_system_receive_info_queue"+ ModuleNameConstant.DEVAUTH; - String NEW_SYSTEM_RECEIVE_INFO_EXCHANGE = "new_system_receive_info_exchange"+ ModuleNameConstant.DEVAUTH; - String NEW_SYSTEM_RECEIVE_INFO_ROUTING = "new_system_receive_info_routing"+ ModuleNameConstant.DEVAUTH; + String NEW_SYSTEM_RECEIVE_INFO_QUEUE = "new_system_receive_info_queue" + ModuleNameConstant.DEVAUTH; + String NEW_SYSTEM_RECEIVE_INFO_EXCHANGE = "new_system_receive_info_exchange" + ModuleNameConstant.DEVAUTH; + String NEW_SYSTEM_RECEIVE_INFO_ROUTING = "new_system_receive_info_routing" + ModuleNameConstant.DEVAUTH; /** * 卸车完成确认 */ @@ -108,7 +108,6 @@ public interface RabbitConstant { /****************文员复合签收推送老系统队列 end *************************/ - /****************文员自提复合签收推送老系统队列 start *************************/ String BILL_CLERK_CHECK_PUSH_DATA_QUEUE = "bill_clerk_check_push_data_queue" + ModuleNameConstant.DEVAUTH; @@ -137,8 +136,6 @@ public interface RabbitConstant { /***************************************梦天签收扫描数据推送 end************************************************/ - - /****************************************梦天签收复核数据推送 start***********************************************/ String MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_QUEUE = "mt_business_data_clerk_check_2_factory_queue" + ModuleNameConstant.DEVAUTH; String MT_BUSINESS_DATA_CLERK_CHECK_2_FACTORY_EXCHANGE = "mt_business_data_clerk_check_2_factory_exchange" + ModuleNameConstant.DEVAUTH; @@ -174,7 +171,24 @@ public interface RabbitConstant { String OPEN_ORDER_LOAD_SCAN_ROUTING = "open_order_load_scan_routing" + ModuleNameConstant.DEVAUTH; + /****************运单创建推送商家数据start *************************/ + + String OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE = "open_waybill_to_business_data_queue" + ModuleNameConstant.DEVAUTH; + String OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE = "open_waybill_to_business_data_exchange" + ModuleNameConstant.DEVAUTH; + String OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING = "open_waybill_to_business_data_routing" + ModuleNameConstant.DEVAUTH; + + + /****************运单创建推送商家数据end *************************/ + + + /****************库内入库推送商家数据start *************************/ + + String IN_WAREHOUSE_TO_BUSINESS_DATA_QUEUE = "in_warehouse_to_business_data_queue" + ModuleNameConstant.DEVAUTH; + String IN_WAREHOUSE_TO_BUSINESS_DATA_EXCHANGE = "in_warehouse_to_business_data_exchange" + ModuleNameConstant.DEVAUTH; + String IN_WAREHOUSE_TO_BUSINESS_DATA_ROUTING = "in_warehouse_to_business_data_routing" + ModuleNameConstant.DEVAUTH; + + /****************库内入库推送商家数据end *************************/ /****************创建商家配送计划 start *************************/ diff --git a/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumberVO.java b/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumberVO.java new file mode 100644 index 000000000..3b03f44c0 --- /dev/null +++ b/blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/vo/DistributionBusinessPreCarNumberVO.java @@ -0,0 +1,28 @@ +package com.logpm.business.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class DistributionBusinessPreCarNumberVO { + + @ApiModelProperty(value = "配送车次") + private String distrCarNumber; + + @ApiModelProperty(value = "运单号") + private String waybillNumber; + + @ApiModelProperty(value = "订单号") + private String orderCode; + + + @ApiModelProperty(value = "总件数") + private Integer totalNum; + + @ApiModelProperty(value = "入库件数") + private Integer inNum; + + @ApiModelProperty(value = "待入库件数") + private Integer restNum; + +} diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionBusinessPreOrderClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionBusinessPreOrderClient.java new file mode 100644 index 000000000..244960d14 --- /dev/null +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionBusinessPreOrderClient.java @@ -0,0 +1,18 @@ +package com.logpm.distribution.feign; + +import org.springblade.common.constant.ModuleNameConstant; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME +) +public interface IDistributionBusinessPreOrderClient { + + + String API_PREFIX = "/client"; + String INORDERBYORDERPACKAGECODE = API_PREFIX + "/inOrderByOrderPackageCode"; + @GetMapping(INORDERBYORDERPACKAGECODE) + public Integer inOrderByOrderPackageCode(@RequestParam("orderPackageCode") String orderPackageCode, @RequestParam("carNum")String carNum); +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java index 3930d641a..d0fee3960 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionBusinessPreOrderController.java @@ -3,6 +3,7 @@ package com.logpm.distribution.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; +import com.logpm.business.vo.DistributionBusinessPreCarNumberVO; import com.logpm.business.vo.DistributionBusinessPreOrderVO; import com.logpm.distribution.entity.DistributionDeliveryListEntity; import com.logpm.distribution.service.IDistributionBusinessPreOrderService; @@ -29,7 +30,7 @@ import java.util.Map; @AllArgsConstructor @Slf4j @RequestMapping("/businessPreOrder") -@Api(value = "配送增值服务明细", tags = "预入库信息控制器") +@Api(value = "预入库信息控制器", tags = "预入库信息控制器") public class DistributionBusinessPreOrderController extends BladeController { private final IDistributionBusinessPreOrderService distributionBusinessPreOrderService; @@ -40,12 +41,26 @@ public class DistributionBusinessPreOrderController extends BladeController { @GetMapping("/page") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入distributionDeliveryList") - public R> list(@ApiIgnore @RequestParam Map distributionBusinessPreOrderDTO, Query query) { + public R> page(@ApiIgnore @RequestParam Map distributionBusinessPreOrderDTO, Query query) { IPage page = Condition.getPage(query); IPage data= distributionBusinessPreOrderService.pacgeList(distributionBusinessPreOrderDTO,page); return R.data(data); } + /** + * 预入库信息--配送车次 + */ + @GetMapping("/pageByCarNum") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入distributionDeliveryList") + public R> pageByCarNum(@ApiIgnore @RequestParam Map distributionBusinessPreOrderDTO, Query query) { + IPage page = Condition.getPage(query); + IPage data= distributionBusinessPreOrderService.pageByCarNum(distributionBusinessPreOrderDTO,page); + return R.data(data); + } + + + @GetMapping("/inOrder") @ApiOperationSupport(order = 2) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionBusinessPreOrderClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionBusinessPreOrderClient.java new file mode 100644 index 000000000..5e6f52596 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionBusinessPreOrderClient.java @@ -0,0 +1,17 @@ +package com.logpm.distribution.feign; + +import com.logpm.distribution.service.IDistributionBusinessPreOrderService; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +@ApiIgnore() +@RestController +@AllArgsConstructor +public class DistributionBusinessPreOrderClient implements IDistributionBusinessPreOrderClient { + private final IDistributionBusinessPreOrderService distributionBusinessPreOrderService; + @Override + public Integer inOrderByOrderPackageCode(String orderPackageCode, String carNum) { + return distributionBusinessPreOrderService.inOrderByOrderPackageCode(orderPackageCode,carNum); + } +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java index 42835354c..56957c258 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java @@ -20,19 +20,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.business.dto.BusinessPreListDTO; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; +import com.logpm.business.vo.DistributionBusinessPreCarNumberVO; import com.logpm.business.vo.DistributionBusinessPreOrderVO; import com.logpm.distribution.dto.DistributionBusinessPreOrderDTO; -import com.logpm.distribution.dto.DistributionParcelListDTO; -import com.logpm.distribution.dto.app.StockupDTO; -import com.logpm.distribution.entity.DistributionParcelListEntity; -import com.logpm.distribution.excel.DistributionParcelListExcel; -import com.logpm.distribution.vo.*; import org.apache.ibatis.annotations.Param; -import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Set; /** * 商家预备导入数据信息 Mapper 接口 @@ -45,20 +39,25 @@ public interface DistributionBusinessPreOrderMapper extends BaseMapper pageList(IPage page, DistributionBusinessPreOrderDTO param); + IPage pageList(IPage page, @Param("param") DistributionBusinessPreOrderDTO param); /** * 删除商家端数据 + * * @param k * @param deletedPackageList * @return */ - Integer deleteBusinessPreOrder(String reservationCode, List deletedPackageList); + Integer deleteBusinessPreOrder(String reservationCode, List deletedPackageList); + List listByBusinessPreListDTO(@Param("queryrderDTO") BusinessPreListDTO queryrderDTO); - Integer updateBusinessPreOrderByOrderPackageCode(@Param("orderPackageCode") String orderPackageCode); + Integer updateBusinessPreOrderByOrderPackageCode(@Param("orderPackageCode") String orderPackageCode); + + IPage pageByCarNum(IPage page, Map distributionBusinessPreOrderDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml index c0c32acde..0970ea61a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml @@ -45,7 +45,6 @@ volume, driver_name, vehicle_name, - distr_car_number, in_warehouse FROM logpm_business_pre_order @@ -54,16 +53,9 @@ AND id = #{param.id} - - - - - - AND firsts like concat(#{param.id},'%') - AND `SECOND` like concat(#{param.second},'%') @@ -112,9 +104,11 @@ AND distr_car_number like concat(#{param.distrCarNumber},'%') - + AND in_warehouse = #{param.inWarehouse} + + @@ -161,5 +155,33 @@ + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java index 8af1642ff..f4bfcd04c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java @@ -86,7 +86,6 @@ public interface DistrilbutionBillLadingMapper extends BaseMapper ids); /** * 查询自提单关联包件 - * @param billLodingIds * @return */ List selectBillLadingPackage(@Param("ids")List ids); @@ -121,7 +118,6 @@ public interface DistrilbutionBillLadingMapper extends BaseMapper selectBillLadingZeroPackageList(@Param("bullLadingId")Long bullLadingId); /** * 推送老系统 - * @param billId * @return */ SignPushDataDTO getSignPushDataDTO(@Param("id")Long id); /** * 查询推送老系统自提客户信息 - * @param billId * @return */ List selectPushOldCustomer(@Param("id")Long id); /** * 查询自提签署包件推送老系统 - * @param billId * @return */ List selectPushOldPackageSigning(@Param("id")Long id); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java index ced7a4aa6..1ef63a0dd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java @@ -82,7 +82,6 @@ public class BusinessPreOrderDataQueueHandler { if(2==tenant.getTenantType()){ String mallName = tenant.getTenantName(); // 插入暂存单 - extracted(map, mallName); // 插入预计表 plantA(map,mallName); } @@ -95,48 +94,7 @@ public class BusinessPreOrderDataQueueHandler { } - private void extracted(Map map, String mallName) { - // 查询推送包件 - List distributionParcelListEntities = allList(map, mallName); - if (ObjectUtil.isEmpty(distributionParcelListEntities)) { - return; - } - // 得到下面的包间 - // 假设 orderNumber 是 DistributionParcelListEntity 类中的一个属性 - List uniqueOrderNumbers = distributionParcelListEntities.stream() - .map(DistributionParcelListEntity::getWaybillNumber) // 将每个实体映射到其运单号 - .distinct() // 移除重复的运单号 - .collect(Collectors.toList()); // 收集到一个新的列表中 - - // 查询运单 - List waybillBilllByWaybillNos = warehouseWaybillClient.findWaybillBilllByWaybillNos(uniqueOrderNumbers); - - // 获取运单关联的暂存单信息 - List waybillIds = waybillBilllByWaybillNos.stream().map(WarehouseWaybillEntity::getId).distinct().collect(Collectors.toList()); - - List warehouseWayBillDetails = warehouseWaybillDetailClient.findByWaybillIds(waybillIds); - - List trunklineWaybillOrderEntities = trunklineWaybillOrderClient.findListByWaybillIds(waybillIds); - - List trunklineWaybillPackageEntities = trunklineWaybillPackageClient.findListByWaybillIds(waybillIds); - - // 暂存单ID集合 - List collect = trunklineWaybillOrderEntities.stream().map(TrunklineWaybillOrderEntity::getAdvanceId).distinct().collect(Collectors.toList()); - List trunklineAdvanceEntities = trunklineAdvanceClient.findListByIds(collect); - - // 获取暂存单明细 - List trunklineAdvanceDetailEntities = trunklineAdvanceDetailClient.findListByAdvanceIds(collect); - Tenant tenant = changeDataBase(mallName); - -// saveOtherData(tenant.getTenantId(),waybillBilllByWaybillNos, trunklineAdvanceDetailEntities, trunklineAdvanceEntities, trunklineWaybillPackageEntities, trunklineWaybillOrderEntities, warehouseWayBillDetails, distributionParcelListEntities, mallName); - - CompletableFuture.supplyAsync(() -> { -// saveOtherData(tenant.getTenantId(),waybillBilllByWaybillNos, trunklineAdvanceDetailEntities, trunklineAdvanceEntities, trunklineWaybillPackageEntities, trunklineWaybillOrderEntities, warehouseWayBillDetails, distributionParcelListEntities, mallName); - distributionAsyncService.saveOtherData(tenant.getTenantId(),waybillBilllByWaybillNos, trunklineAdvanceDetailEntities, trunklineAdvanceEntities, trunklineWaybillPackageEntities, trunklineWaybillOrderEntities, warehouseWayBillDetails, distributionParcelListEntities, mallName); - return null; - }); - } private List allList(Map map, String mallName) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index 9a00937c0..104d66dd6 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -333,7 +333,6 @@ public interface IDistributionAsyncService { DistributionStockArticleEntity findDistributionStockArticleEntityByIdForAsync(String tenantId, Long id); - void saveOtherData(String tenantId, List waybillBilllByWaybillNos, List trunklineAdvanceDetailEntities, List trunklineAdvanceEntities, List trunklineWaybillPackageEntities, List trunklineWaybillOrderEntities, List warehouseWayBillDetails, List distributionParcelListEntities, String mallName); void saveOtherDataBaseNew(String tenantId,List dataResult, String mallName); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java index 811f86697..45cf3b8df 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java @@ -3,6 +3,7 @@ package com.logpm.distribution.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.business.dto.BusinessPreListDTO; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; +import com.logpm.business.vo.DistributionBusinessPreCarNumberVO; import com.logpm.business.vo.DistributionBusinessPreOrderListVO; import com.logpm.business.vo.DistributionBusinessPreOrderVO; import com.logpm.distribution.bean.Resp; @@ -27,10 +28,11 @@ public interface IDistributionBusinessPreOrderService extends BaseService pageByCarNum(Map distributionBusinessPreOrderDTO, IPage page); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index 601ce0ac3..48131eec6 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -152,7 +152,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { private final ISysClient sysClient; - private final BladeRedis bladeRedis; + // private final @@ -2834,233 +2834,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { } return null; } - @ChangeAsync() - @Override - public void saveOtherData(String tenantId, List waybillBilllByWaybillNos, List trunklineAdvanceDetailEntities, List trunklineAdvanceEntities, List trunklineWaybillPackageEntities, List trunklineWaybillOrderEntities, List warehouseWayBillDetails, List distributionParcelListEntities, String mallName) { - // 保存暂存单 - Tenant tenant = changeDataBase(mallName); - for (TrunklineAdvanceEntity trunklineAdvanceEntity : trunklineAdvanceEntities) { - - TrunklineAdvanceEntity finalTrunklineAdvanceEntity = trunklineAdvanceEntity; - List t = trunklineAdvanceDetailEntities.stream().filter(trunklineAdvanceDetailEntity -> trunklineAdvanceDetailEntity.getAdvanceId().equals(finalTrunklineAdvanceEntity.getId())).collect(Collectors.toList()); - - saveTrunklineAdvanceEntity(trunklineAdvanceEntity, mallName); - - // 保存暂存子表 - saveTrunklineAdvanceDetailEntity(t, trunklineAdvanceEntity, mallName); - } - List collect = trunklineAdvanceEntities.stream().map(TrunklineAdvanceEntity::getId).distinct().collect(Collectors.toList()); - - // 重新查询trunklineAdvanceDetail - List listByAdvanceIds = trunklineAdvanceDetailClient.findListByAdvanceIds(collect); - - // 保存运单 - BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); - for (WarehouseWaybillEntity waybillBilllByWaybillNo : waybillBilllByWaybillNos) { - List collect1 = trunklineWaybillOrderEntities.stream().filter(trunklineWaybillOrderEntity -> trunklineWaybillOrderEntity.getWaybillId().equals(waybillBilllByWaybillNo.getId())).collect(Collectors.toList()); - List t = warehouseWayBillDetails.stream().filter(warehouseWayBillDetail -> warehouseWayBillDetail.getWaybillId().equals(waybillBilllByWaybillNo.getId())).collect(Collectors.toList()); - - - // 修改运单的起始仓库 和末端仓 - waybillBilllByWaybillNo.setDepartureWarehouseName(waybillBilllByWaybillNo.getDestinationWarehouseName()); - waybillBilllByWaybillNo.setDepartureWarehouseId(null); - - // 目的仓 - if(basicdataWarehouseEntity!=null){ - waybillBilllByWaybillNo.setDestinationWarehouseId(basicdataWarehouseEntity.getId()); - waybillBilllByWaybillNo.setDestinationWarehouseName(basicdataWarehouseEntity.getName()); - } - - - waybillBilllByWaybillNo.setTenantId(tenant.getTenantId()); - - WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo(waybillBilllByWaybillNo.getWaybillNo()); - if(byWaybillNo==null){ - Long l = warehouseWaybillClient.addEnntity(waybillBilllByWaybillNo); - waybillBilllByWaybillNo.setId(l); - }else{ - waybillBilllByWaybillNo.setId(byWaybillNo.getId()); - } - - - List byWaybillId = warehouseWaybillDetailClient.findByWaybillId(waybillBilllByWaybillNo.getId()); - - for (WarehouseWayBillDetail warehouseWayBillDetail : t) { - warehouseWayBillDetail.setId(null); - for (WarehouseWayBillDetail wayBillDetail : byWaybillId) { - - if(wayBillDetail.getProductName().equals(warehouseWayBillDetail.getProductName())){ - // 不执行 - warehouseWayBillDetail.setId(wayBillDetail.getId()); - break; - } - } - - if(warehouseWayBillDetail.getId()==null){ - warehouseWayBillDetail.setWaybillId(waybillBilllByWaybillNo.getId()); - warehouseWaybillDetailClient.addEntity(warehouseWayBillDetail); - } - - - } - - - List listByWaybillNo = trunklineWaybillOrderClient.findListByWaybillNo(waybillBilllByWaybillNo.getWaybillNo()); - - - for (TrunklineWaybillOrderEntity trunklineWaybillOrderEntity : collect1) { - - trunklineWaybillOrderEntity.setId(null); - List collect3 = trunklineWaybillPackageEntities.stream().filter(ts -> { - return ts.getWaybillNo().equals(trunklineWaybillOrderEntity.getWaybillNo()) && ts.getAdvanceId().equals(trunklineWaybillOrderEntity.getAdvanceId()); - }).collect(Collectors.toList()); - - trunklineWaybillOrderEntity.setWaybillId(waybillBilllByWaybillNo.getId()); - trunklineWaybillOrderEntity.setTenantId(tenant.getTenantId()); - - Optional entityWithOrderNumber1123 = trunklineAdvanceEntities.stream() - .filter(entity -> trunklineWaybillOrderEntity.getOrderCode().equals(entity.getOrderCode())) // 过滤出订单号为"1123"的实体 - .findFirst(); // 获取第一个匹配的实体 - - if (entityWithOrderNumber1123.isPresent()) { - TrunklineAdvanceEntity foundEntity = entityWithOrderNumber1123.get(); - // 使用找到的实体 - trunklineWaybillOrderEntity.setAdvanceId(foundEntity.getId()); - - } - - - for (TrunklineWaybillOrderEntity waybillOrderEntity : listByWaybillNo) { - - if(waybillOrderEntity.getOrderCode().equals(trunklineWaybillOrderEntity.getOrderCode())){ - trunklineWaybillOrderEntity.setId(waybillOrderEntity.getId()); - } - - } - if(trunklineWaybillOrderEntity.getId()==null){ - - Long l1 = trunklineWaybillOrderClient.addEntityReturnId(trunklineWaybillOrderEntity); - - trunklineWaybillOrderEntity.setId(l1); - } - - - - List ids = Arrays.asList(waybillBilllByWaybillNo.getId()); - List listByWaybillIds = trunklineWaybillPackageClient.findListByWaybillIds(ids); - - for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : collect3) { - trunklineWaybillPackageEntity.setId(null); - trunklineWaybillPackageEntity.setWaybillId(waybillBilllByWaybillNo.getId()); - trunklineWaybillPackageEntity.setTenantId(tenant.getTenantId()); - trunklineWaybillPackageEntity.setAdvanceId(trunklineWaybillOrderEntity.getAdvanceId()); - - for (TrunklineAdvanceDetailVO listByAdvanceId : listByAdvanceIds) { - if (listByAdvanceId.getAdvanceId().equals(trunklineWaybillOrderEntity.getAdvanceId())) { - - if (listByAdvanceId.getOrderPackageCode().equals(trunklineWaybillPackageEntity.getOrderPackageCode())) { - trunklineWaybillPackageEntity.setAdvanceDetailId(listByAdvanceId.getId()); - - } - } - } - - for (TrunklineWaybillPackageEntity listByWaybillId : listByWaybillIds) { - - if(listByWaybillId.getWaybillId().equals(trunklineWaybillPackageEntity.getWaybillId())){ - if(listByWaybillId.getOrderPackageCode().equals(trunklineWaybillPackageEntity.getOrderPackageCode())){ - trunklineWaybillPackageEntity.setId(listByWaybillId.getId()); - break; - } - } - - } - if(trunklineWaybillPackageEntity.getId()==null){ - trunklineWaybillPackageClient.addEntity(trunklineWaybillPackageEntity); - } - - - } - - } - } - } - - private BasicdataWarehouseEntity getBasicdataWarehouseEntity(String mallName) { - String cacheName =mallName +"仓"; - BasicdataWarehouseEntity basicdataWarehouseEntity = bladeRedis.get(cacheName); - if(basicdataWarehouseEntity==null){ - basicdataWarehouseEntity = warehouseClient.findByName(mallName +"仓"); - bladeRedis.setEx(cacheName,basicdataWarehouseEntity,60*60*24L); - } - return basicdataWarehouseEntity; - } - - private void saveTrunklineAdvanceDetailEntity(List t, TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) { - Tenant tenant = changeDataBase(mallName); - - - - List ids = Arrays.asList(trunklineAdvanceEntity.getId()); - - List listByAdvanceIds = trunklineAdvanceDetailClient.findListByAdvanceIds(ids); - - - List saveObjs = new ArrayList<>(); - - for (TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity : t) { - - trunklineAdvanceDetailEntity.setId(null); - // 检测 保存的对象是否已经存在 - for (TrunklineAdvanceDetailVO listByAdvanceId : listByAdvanceIds) { - if(listByAdvanceId.getOrderPackageCode().equals(trunklineAdvanceDetailEntity.getOrderPackageCode())){ - trunklineAdvanceDetailEntity.setId(listByAdvanceId.getId()); - break; - } - } - - if(trunklineAdvanceDetailEntity.getId()==null){ - trunklineAdvanceDetailEntity.setPackageStatus("0"); - trunklineAdvanceDetailEntity.setAdvanceId(trunklineAdvanceEntity.getId()); - trunklineAdvanceDetailEntity.setTenantId(tenant.getTenantId()); - trunklineAdvanceDetailEntity.setIncomingWarehouseId(null); - trunklineAdvanceDetailEntity.setIncomingWarehouseName(null); - BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); - if(basicdataWarehouseEntity!=null){ - trunklineAdvanceDetailEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - trunklineAdvanceDetailEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - } - saveObjs.add(trunklineAdvanceDetailEntity); - - } - } - trunklineAdvanceDetailClient.addAdvanceBatch(saveObjs); - } - - - private TrunklineAdvanceEntity saveTrunklineAdvanceEntity(TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) { - Tenant tenant = changeDataBase(mallName); - // 查找商户的暂存单是否存在改制 - TrunklineAdvanceEntity trunklineAdvanceEntity1 = trunklineAdvanceClient.findAdvanceLimitOneByOrderCode(trunklineAdvanceEntity.getOrderCode()); - BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); - if (ObjectUtil.isEmpty(trunklineAdvanceEntity1)) { - - // 保存对象 - if(basicdataWarehouseEntity!=null){ - trunklineAdvanceEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - trunklineAdvanceEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - } - trunklineAdvanceEntity.setTenantId(tenant.getTenantId()); - Long l = trunklineAdvanceClient.addAdvanceReturnId(trunklineAdvanceEntity); - trunklineAdvanceEntity.setId(l); - - return trunklineAdvanceEntity; - } else { - return trunklineAdvanceEntity1; - } - - } @ChangeAsync() @Override public void saveOtherDataBaseNew(String tenantId,List dataResult, String mallName) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java index 40e72cbed..e3068030b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java @@ -9,6 +9,7 @@ import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.business.dto.BusinessPreListDTO; import com.logpm.business.entity.DistributionBusinessPreOrderEntity; +import com.logpm.business.vo.DistributionBusinessPreCarNumberVO; import com.logpm.business.vo.DistributionBusinessPreOrderListVO; import com.logpm.business.vo.DistributionBusinessPreOrderVO; import com.logpm.distribution.bean.Resp; @@ -98,24 +99,27 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl list = baseMapper.selectList(wrapper); -// -// for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : data) { -// -// distributionBusinessPreOrderEntity.setInWarehouse(1); -// baseMapper.updateById(distributionBusinessPreOrderEntity); -// } + wrapper.eq("is_deleted","0"); + List list = baseMapper.selectList(wrapper); + if(!list.isEmpty()){ + DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity = list.get(0); + + distributionBusinessPreOrderEntity.setInWarehouse(1); + return baseMapper.updateById(distributionBusinessPreOrderEntity); + } + return 0; + + } @@ -241,11 +245,17 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl pageByCarNum(Map distributionBusinessPreOrderDTO, IPage page) { + IPage pageByCarNum =baseMapper.pageByCarNum(page, distributionBusinessPreOrderDTO); + return pageByCarNum; - return Resp.scanSuccess("扫描成功", "请前往码板打托进行入库!"); } private void buildDistributionParcelListEntity(DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity) { diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/ChangeAsyncAnnotationAspect.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/ChangeAsyncAnnotationAspect.java new file mode 100644 index 000000000..e9f0b4091 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/aspect/ChangeAsyncAnnotationAspect.java @@ -0,0 +1,120 @@ +package com.logpm.trunkline.aspect; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springblade.common.annotations.ChangeAsync; +import org.springblade.common.cache.CacheNames; +import org.springblade.common.component.MockLoginService; +import org.springblade.core.redis.cache.BladeRedis; +import org.springblade.core.redis.lock.LockType; +import org.springblade.core.redis.lock.RedisLockClient; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.core.tool.utils.ThreadLocalUtil; +import org.springframework.core.annotation.Order; +import org.springframework.core.env.Environment; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.lang.reflect.Method; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +@Aspect +@Component +@Slf4j +@Order(-1) +@AllArgsConstructor +public class ChangeAsyncAnnotationAspect { + + private final MockLoginService mockLoginService; + + private final BladeRedis bladeRedis; + private final Environment environment; + private final RedisLockClient redisLockClient; + private final String account = "shujutongbu"; + + /** + * 定义一个切点,匹配所有带有@LogpmAsync("asyncExecutor")注解的方法。 + * 注意:实际上Spring Framework自带对@LogpmAsync("asyncExecutor")的处理,直接这样配置可能会导致预期之外的行为。 + */ + @Around("@annotation(org.springblade.common.annotations.ChangeAsync)") + public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable { + + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + + ChangeAsync myAsync = method.getAnnotation(ChangeAsync.class); + String annotationValue = myAsync.value(); + log.info(">>>>>>>>>>>>>>>>>> ChangeAsync={}", annotationValue); + + // 获取当前拦截方法的入参参数 + Object[] args = joinPoint.getArgs(); + // 获取入参名称 + String[] parameterNames = signature.getParameterNames(); + String tenantId = null; + // 获取参数名称 为tenantId 的值 + for (int i = 0; i < parameterNames.length; i++) { + if ("tenantId".equals(parameterNames[i])) { + tenantId = (String) args[i]; + log.info(">> tenandId {} ", tenantId); + break; + } + } + // 执行模拟登录 + if (StringUtil.isNotBlank(tenantId)) { + JSONObject data = bladeRedis.get(CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account); + if (Objects.isNull(data)) { + boolean flag = redisLockClient.tryLock("local_server_user" + tenantId, LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS); + if (flag) { + data = bladeRedis.get(CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account); + if (Objects.isNull(data)) { + data = mockLoginService.mockToken(tenantId, account); + bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER + tenantId + ":" + account, data, 3200L); + redisLockClient.unLock("local_server_user" + tenantId, LockType.FAIR); + } + } + } + + MockHttpServletRequest mockRequest = new MockHttpServletRequest(); + mockRequest.addHeader("Blade-Auth", "bearer "+data.get("access_token")); + RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(mockRequest)); + + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add("Blade-Auth","bearer "+data.get("access_token") ); + httpHeaders.add( "Authorization", "Basic c2FiZXI6c2FiZXJfc2VjcmV0"); + ThreadLocalUtil.put("bladeContext", httpHeaders); + + DynamicDataSourceContextHolder.push(data.getString("tenant_id")); + // 执行原方法 + Object result = joinPoint.proceed(); + // 在方法执行后,从数据源上下文中移除租户ID + DynamicDataSourceContextHolder.poll(); + return result; + }else{ + return joinPoint.proceed(); + } + + +// // 在方法执行前的操作 +// String tenantId = AuthUtil.getTenantId(); +// log.info(">> tenandId {} ",tenantId); +// DynamicDataSourceContextHolder.push("627683"); +// +// // 执行原方法 +// Object result = joinPoint.proceed(); +// +// // 在方法执行后的操作 +// DynamicDataSourceContextHolder.poll(); +// return result; + } + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java index c218a068a..a5b203311 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/config/RabbitMqConfiguration.java @@ -104,8 +104,35 @@ public class RabbitMqConfiguration { return BindingBuilder.bind(hwyOpenOrderLoadScanQueue).to(hwyOpenOrderLoadScanExchange).with(RabbitConstant.HWY_ORDER_STATUS_ROUTING).noargs(); } + @Bean + public Queue openWaybillToBusinessQueue() { + return new Queue(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE, true); + } + @Bean + public CustomExchange openWaybillToBusinessExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE, "x-delayed-message", true, false, args); + } + @Bean + public Binding openWaybillToBusinessBinding(Queue openWaybillToBusinessQueue, CustomExchange openWaybillToBusinessExchange) { + return BindingBuilder.bind(openWaybillToBusinessQueue).to(openWaybillToBusinessExchange).with(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING).noargs(); + } - + @Bean + public Queue inWarehouseToBusinessQueue() { + return new Queue(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_QUEUE, true); + } + @Bean + public CustomExchange inWarehouseToBusinessExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_EXCHANGE, "x-delayed-message", true, false, args); + } + @Bean + public Binding inWarehouseToBusinessBinding(Queue inWarehouseToBusinessQueue, CustomExchange inWarehouseToBusinessExchange) { + return BindingBuilder.bind(inWarehouseToBusinessQueue).to(inWarehouseToBusinessExchange).with(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_ROUTING).noargs(); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineWaybillPackageClient.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineWaybillPackageClient.java index b4ccab6d0..0b76b097f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineWaybillPackageClient.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/feign/TrunklineWaybillPackageClient.java @@ -20,7 +20,6 @@ public class TrunklineWaybillPackageClient implements ITrunklineWaybillPackageCl LambdaQueryWrapper lambdaQueryWrapper =new LambdaQueryWrapper<>(); lambdaQueryWrapper.in(TrunklineWaybillPackageEntity::getWaybillId,waybillIds); - trunklineWaybillPackageService.list(lambdaQueryWrapper); return trunklineWaybillPackageService.list(lambdaQueryWrapper); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/InWarehourseToBusinessListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/InWarehourseToBusinessListener.java new file mode 100644 index 000000000..6f02cae40 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/InWarehourseToBusinessListener.java @@ -0,0 +1,53 @@ +package com.logpm.trunkline.mq; + +import com.alibaba.fastjson.JSONObject; +import com.logpm.distribution.feign.IDistributionBusinessPreOrderClient; +import com.rabbitmq.client.Channel; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * 码半 + * 入库扫描 + * 触发商家的入库数据 + */ + +@Slf4j +@AllArgsConstructor +@Component +@RabbitListener(queues = RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_QUEUE) +public class InWarehourseToBusinessListener { + + private final IDistributionBusinessPreOrderClient distributionBusinessPreOrderClient; + @RabbitHandler + public void inWarehourseToBusinessDataHandler(Map map, Message message, Channel channel) { + + extracted(map); + + + } + + private void extracted(Map map) { + log.info("入库扫描-触发商家的入库数据-入参:{}", map); + + JSONObject o = (JSONObject) map.get("messageData"); + + String orderPackageCode = o.getString("orderPackageCode"); + String carNum = o.getString("carNum"); + if(carNum==null){ + carNum=""; + } + + Integer i = distributionBusinessPreOrderClient.inOrderByOrderPackageCode(orderPackageCode, carNum); + log.info(">>>>>>>>>>>>>>>>>> 入库操作 执行 {}",i); + + } + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java new file mode 100644 index 000000000..bb561f513 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenWaybillToBusinessListener.java @@ -0,0 +1,147 @@ +package com.logpm.trunkline.mq; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.trunkline.entity.TrunklineAdvanceEntity; +import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; +import com.logpm.trunkline.entity.TrunklineWaybillPackageEntity; +import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; +import com.logpm.trunkline.feign.ITrunklineAdvanceClient; +import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient; +import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient; +import com.logpm.trunkline.feign.ITrunklineWaybillPackageClient; +import com.logpm.trunkline.service.IAsyncService; +import com.logpm.trunkline.service.ITrunklineWaybillTrackService; +import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; +import com.logpm.warehouse.entity.WarehouseWayBillDetail; +import com.logpm.warehouse.entity.WarehouseWaybillEntity; +import com.logpm.warehouse.feign.IWarehouseWaybillClient; +import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; +import com.rabbitmq.client.Channel; +import jodd.util.ArraysUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.entity.Tenant; +import org.springblade.system.feign.ISysClient; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +/** + * 运单开单数据推送商场 + *
+ *
  • 站存单
  • + *
  • 站存单明细
  • + *
  • 运单
  • + *
  • 运单关联信息
  • + *
  • 运单关联暂存单
  • + *
  • 运单关联站存单明细
  • + */ +@Slf4j +@AllArgsConstructor +@Component +@RabbitListener(queues = RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_QUEUE) +public class OpenWaybillToBusinessListener { + + + private final IWarehouseWaybillClient warehouseWaybillClient; + + private final IWarehouseWaybillDetailClient warehouseWaybillDetailClient; + + private final ITrunklineWaybillOrderClient trunklineWaybillOrderClient; + + private final ITrunklineWaybillPackageClient trunklineWaybillPackageClient; + + private final ITrunklineAdvanceClient trunklineAdvanceClient; + + private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient; + private final ISysClient sysClient; + + private final IAsyncService asyncService; + + private ITrunklineWaybillTrackService trunklineWaybillTrackService; + + @RabbitHandler + public void openWaybillToBusinessDataHandler(Map map, Message message, Channel channel) { + + extracted(map); + + + } + + private void extracted(Map map) { + + + Long waybillId = (Long) map.get("messageData"); + if (ObjectUtil.isEmpty(waybillId)) { + log.warn("运单ID为null"); + return; + } + + // 获取运单关联的暂存单信息 + + WarehouseWaybillEntity byWaybillId = warehouseWaybillClient.findByWaybillId(waybillId); + + R> tenantList = sysClient.getTenantList(); + Tenant tenant = null; + if (tenantList.isSuccess()) { + List data = tenantList.getData(); + for (Tenant datum : data) { + if (datum.getTenantType() == 2 && datum.getTenantName().equals(byWaybillId.getConsignee().trim())) { + tenant = datum; + break; + } + } + } + + if (ObjectUtil.isEmpty(tenant)) { + log.warn(">>>>> 租户不存在"); + return; + } + List waybillBilllByWaybillNos = new ArrayList<>(); + waybillBilllByWaybillNos.add(byWaybillId); + + + + List waybillIds = new ArrayList<>(); + waybillIds.add(waybillId); + + List warehouseWayBillDetails = warehouseWaybillDetailClient.findByWaybillId(waybillId); + + List trunklineWaybillOrderEntities = trunklineWaybillOrderClient.findListByWaybillIds(waybillIds); + + List trunklineWaybillPackageEntities = trunklineWaybillPackageClient.findListByWaybillIds(waybillIds); + + // 暂存单ID集合 + List collect = trunklineWaybillOrderEntities.stream().map(TrunklineWaybillOrderEntity::getAdvanceId).distinct().collect(Collectors.toList()); + + List trunklineAdvanceEntities = trunklineAdvanceClient.findListByIds(collect); + + // 获取暂存单明细 + List trunklineAdvanceDetailEntities = trunklineAdvanceDetailClient.findListByAdvanceIds(collect); + + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TrunklineWaybillTrackEntity::getWaybillId, waybillId); + queryWrapper.eq(TrunklineWaybillTrackEntity::getTrackType, "10"); + List list = trunklineWaybillTrackService.list(queryWrapper); + TrunklineWaybillTrackEntity trunklineWaybillTrackEntity = list.get(0); + Tenant finalTenant = tenant; + CompletableFuture.supplyAsync(() -> { + asyncService.saveOtherData(finalTenant.getTenantId(), waybillBilllByWaybillNos, trunklineAdvanceDetailEntities, trunklineAdvanceEntities, trunklineWaybillPackageEntities, trunklineWaybillOrderEntities, warehouseWayBillDetails,trunklineWaybillTrackEntity); + return null; + }); + } + + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java index 00f01fade..1609f4454 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IAsyncService.java @@ -1,7 +1,11 @@ package com.logpm.trunkline.service; -import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; -import com.logpm.trunkline.entity.TrunklineAdvanceEntity; +import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.trunkline.entity.*; +import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; +import com.logpm.warehouse.entity.WarehouseWayBillDetail; +import com.logpm.warehouse.entity.WarehouseWaybillEntity; +import org.springblade.common.annotations.ChangeAsync; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -13,4 +17,7 @@ public interface IAsyncService { CompletableFuture saveAdvanceEntity(List list, int queryType); CompletableFuture updateAdvanceEntity(List list, int queryType); + + + void saveOtherData(String tenantId, List waybillBilllByWaybillNos, List trunklineAdvanceDetailEntities, List trunklineAdvanceEntities, List trunklineWaybillPackageEntities, List trunklineWaybillOrderEntities, List warehouseWayBillDetails, TrunklineWaybillTrackEntity trunklineWaybillTrackEntity ); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java index a88f53a8f..307dbc42f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/AsyncServiceImpl.java @@ -1,24 +1,63 @@ package com.logpm.trunkline.service.impl; -import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; -import com.logpm.trunkline.entity.TrunklineAdvanceEntity; -import com.logpm.trunkline.service.IAsyncService; -import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; -import com.logpm.trunkline.service.ITrunklineAdvanceService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.trunkline.entity.*; +import com.logpm.trunkline.service.*; +import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO; +import com.logpm.warehouse.entity.WarehouseWayBillDetail; +import com.logpm.warehouse.entity.WarehouseWaybillEntity; +import com.logpm.warehouse.feign.IWarehouseWaybillClient; +import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.annotations.ChangeAsync; import org.springblade.common.annotations.LogpmAsync; +import org.springblade.core.redis.cache.BladeRedis; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.entity.Tenant; +import org.springblade.system.feign.ISysClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; @Service +@Slf4j public class AsyncServiceImpl implements IAsyncService { @Autowired private ITrunklineAdvanceService advanceService; @Autowired private ITrunklineAdvanceDetailService advanceDetailService; + @Autowired + private IWarehouseWaybillClient warehouseWaybillClient; + @Autowired + private IWarehouseWaybillDetailClient warehouseWaybillDetailClient; + @Autowired + private ISysClient sysClient; + @Autowired + private BladeRedis bladeRedis; + @Autowired + private ITrunklineWaybillOrderService waybillOrderService; + @Autowired + private ITrunklineWaybillPackageService trunklineWaybillPackageService; + + @Autowired + private IWarehouseWaybillClient waybillClient; + @Autowired + private IBasicdataWarehouseClient warehouseClient; + + @Autowired + private ITrunklineWaybillTrackService trunklineWaybillTrackService; @LogpmAsync("asyncExecutor") @Override @@ -47,4 +86,272 @@ public class AsyncServiceImpl implements IAsyncService { ); } + @ChangeAsync() + @Override + public void saveOtherData(String tenantId, List waybillBilllByWaybillNos, List trunklineAdvanceDetailEntities, List trunklineAdvanceEntities, List trunklineWaybillPackageEntities, List trunklineWaybillOrderEntities, List warehouseWayBillDetails, TrunklineWaybillTrackEntity trunklineWaybillTrackEntity) { + // 保存暂存单 + Tenant tenant = null; + R tenantFeign = sysClient.getTenant(tenantId); + + if (tenantFeign.isSuccess()) { + tenant = tenantFeign.getData(); + } + String mallName = tenant.getTenantName(); + for (TrunklineAdvanceEntity trunklineAdvanceEntity : trunklineAdvanceEntities) { + + TrunklineAdvanceEntity finalTrunklineAdvanceEntity = trunklineAdvanceEntity; + List t = trunklineAdvanceDetailEntities.stream().filter(trunklineAdvanceDetailEntity -> trunklineAdvanceDetailEntity.getAdvanceId().equals(finalTrunklineAdvanceEntity.getId())).collect(Collectors.toList()); + + saveTrunklineAdvanceEntity(trunklineAdvanceEntity, mallName); + + // 保存暂存子表 + saveTrunklineAdvanceDetailEntity(t, trunklineAdvanceEntity, mallName); + } + List collect = trunklineAdvanceEntities.stream().map(TrunklineAdvanceEntity::getId).distinct().collect(Collectors.toList()); + + // 重新查询trunklineAdvanceDetail + List listByAdvanceIds = advanceDetailService.findAdvanceDetailVoByAdvanceIds(collect); + + // 保存运单 + BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); + for (WarehouseWaybillEntity waybillBilllByWaybillNo : waybillBilllByWaybillNos) { + List collect1 = trunklineWaybillOrderEntities.stream().filter(trunklineWaybillOrderEntity -> trunklineWaybillOrderEntity.getWaybillId().equals(waybillBilllByWaybillNo.getId())).collect(Collectors.toList()); + List t = warehouseWayBillDetails.stream().filter(warehouseWayBillDetail -> warehouseWayBillDetail.getWaybillId().equals(waybillBilllByWaybillNo.getId())).collect(Collectors.toList()); + + + // 修改运单的起始仓库 和末端仓 + waybillBilllByWaybillNo.setDepartureWarehouseName(waybillBilllByWaybillNo.getDestinationWarehouseName()); + waybillBilllByWaybillNo.setDepartureWarehouseId(null); + + // 目的仓 + if (basicdataWarehouseEntity != null) { + waybillBilllByWaybillNo.setDestinationWarehouseId(basicdataWarehouseEntity.getId()); + waybillBilllByWaybillNo.setDestinationWarehouseName(basicdataWarehouseEntity.getName()); + } + + + waybillBilllByWaybillNo.setTenantId(tenant.getTenantId()); + + WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo(waybillBilllByWaybillNo.getWaybillNo()); + if (byWaybillNo == null) { + Long l = warehouseWaybillClient.addEnntity(waybillBilllByWaybillNo); + waybillBilllByWaybillNo.setId(l); + } else { + waybillBilllByWaybillNo.setId(byWaybillNo.getId()); + } + + + List byWaybillId = warehouseWaybillDetailClient.findByWaybillId(waybillBilllByWaybillNo.getId()); + + for (WarehouseWayBillDetail warehouseWayBillDetail : t) { + warehouseWayBillDetail.setId(null); + for (WarehouseWayBillDetail wayBillDetail : byWaybillId) { + + if (wayBillDetail.getProductName().equals(warehouseWayBillDetail.getProductName())) { + // 不执行 + warehouseWayBillDetail.setId(wayBillDetail.getId()); + break; + } + } + + if (warehouseWayBillDetail.getId() == null) { + warehouseWayBillDetail.setWaybillId(waybillBilllByWaybillNo.getId()); + warehouseWaybillDetailClient.addEntity(warehouseWayBillDetail); + } + + + } + + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no", waybillBilllByWaybillNo.getWaybillNo()); + List listByWaybillNo = waybillOrderService.list(queryWrapper); + + for (TrunklineWaybillOrderEntity trunklineWaybillOrderEntity : collect1) { + + trunklineWaybillOrderEntity.setId(null); + List collect3 = trunklineWaybillPackageEntities.stream().filter(ts -> { + return ts.getWaybillNo().equals(trunklineWaybillOrderEntity.getWaybillNo()) && ts.getAdvanceId().equals(trunklineWaybillOrderEntity.getAdvanceId()); + }).collect(Collectors.toList()); + + trunklineWaybillOrderEntity.setWaybillId(waybillBilllByWaybillNo.getId()); + trunklineWaybillOrderEntity.setTenantId(tenant.getTenantId()); + + Optional entityWithOrderNumber1123 = trunklineAdvanceEntities.stream() + .filter(entity -> trunklineWaybillOrderEntity.getOrderCode().equals(entity.getOrderCode())) // 过滤出订单号为"1123"的实体 + .findFirst(); // 获取第一个匹配的实体 + + if (entityWithOrderNumber1123.isPresent()) { + TrunklineAdvanceEntity foundEntity = entityWithOrderNumber1123.get(); + // 使用找到的实体 + trunklineWaybillOrderEntity.setAdvanceId(foundEntity.getId()); + + } + + + for (TrunklineWaybillOrderEntity waybillOrderEntity : listByWaybillNo) { + + if (waybillOrderEntity.getOrderCode().equals(trunklineWaybillOrderEntity.getOrderCode())) { + trunklineWaybillOrderEntity.setId(waybillOrderEntity.getId()); + } + + } + if (trunklineWaybillOrderEntity.getId() == null) { + + waybillOrderService.save(trunklineWaybillOrderEntity); + + } + + + List ids = Arrays.asList(waybillBilllByWaybillNo.getId()); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.in(TrunklineWaybillPackageEntity::getWaybillId, ids); + List listByWaybillIds = trunklineWaybillPackageService.list(lambdaQueryWrapper); + + for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : collect3) { + trunklineWaybillPackageEntity.setId(null); + trunklineWaybillPackageEntity.setWaybillId(waybillBilllByWaybillNo.getId()); + trunklineWaybillPackageEntity.setTenantId(tenant.getTenantId()); + + trunklineWaybillPackageEntity.setAdvanceId(trunklineWaybillOrderEntity.getAdvanceId()); + + for (TrunklineAdvanceDetailVO listByAdvanceId : listByAdvanceIds) { + if (listByAdvanceId.getAdvanceId().equals(trunklineWaybillOrderEntity.getAdvanceId())) { + + if (listByAdvanceId.getOrderPackageCode().equals(trunklineWaybillPackageEntity.getOrderPackageCode())) { + trunklineWaybillPackageEntity.setAdvanceDetailId(listByAdvanceId.getId()); + + } + } + } + + for (TrunklineWaybillPackageEntity listByWaybillId : listByWaybillIds) { + + if (listByWaybillId.getWaybillId().equals(trunklineWaybillPackageEntity.getWaybillId())) { + if (listByWaybillId.getOrderPackageCode().equals(trunklineWaybillPackageEntity.getOrderPackageCode())) { + trunklineWaybillPackageEntity.setId(listByWaybillId.getId()); + break; + } + } + + } + if (trunklineWaybillPackageEntity.getId() == null) { + trunklineWaybillPackageService.save(trunklineWaybillPackageEntity); + } + + + } + + } + + + // 查询运单作业节点数据 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(TrunklineWaybillTrackEntity::getWaybillNo, waybillBilllByWaybillNo.getWaybillNo()); + lambdaQueryWrapper.eq(TrunklineWaybillTrackEntity::getTrackType, "10"); + List list = trunklineWaybillTrackService.list(lambdaQueryWrapper); + if (list.isEmpty()) { + + trunklineWaybillTrackEntity.setWaybillId(waybillBilllByWaybillNo.getId()); + trunklineWaybillTrackEntity.setTenantId(tenant.getTenantId()); + BasicdataWarehouseEntity basicdataWarehouseEntity1 = getBasicdataWarehouseEntity(mallName); + trunklineWaybillTrackEntity.setWarehouseId(basicdataWarehouseEntity1.getId()); + trunklineWaybillTrackEntity.setWarehouseName(basicdataWarehouseEntity1.getName()); + trunklineWaybillTrackService.save(trunklineWaybillTrackEntity); + } + + } + } + + private BasicdataWarehouseEntity getBasicdataWarehouseEntity(String mallName) { + String cacheName = mallName + "仓"; + BasicdataWarehouseEntity basicdataWarehouseEntity = bladeRedis.get(cacheName); + if (basicdataWarehouseEntity == null) { + basicdataWarehouseEntity = warehouseClient.findByName(mallName + "仓"); + bladeRedis.setEx(cacheName, basicdataWarehouseEntity, 60 * 60 * 24L); + } + return basicdataWarehouseEntity; + } + + private void saveTrunklineAdvanceDetailEntity(List t, TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) { + Tenant tenant = changeDataBase(mallName); + + + List ids = Arrays.asList(trunklineAdvanceEntity.getId()); + + List listByAdvanceIds = advanceDetailService.findAdvanceDetailVoByAdvanceIds(ids); + + + List saveObjs = new ArrayList<>(); + + for (TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity : t) { + + trunklineAdvanceDetailEntity.setId(null); + // 检测 保存的对象是否已经存在 + for (TrunklineAdvanceDetailVO listByAdvanceId : listByAdvanceIds) { + if (listByAdvanceId.getOrderPackageCode().equals(trunklineAdvanceDetailEntity.getOrderPackageCode())) { + trunklineAdvanceDetailEntity.setId(listByAdvanceId.getId()); + break; + } + } + + if (trunklineAdvanceDetailEntity.getId() == null) { + trunklineAdvanceDetailEntity.setPackageStatus("0"); + trunklineAdvanceDetailEntity.setAdvanceId(trunklineAdvanceEntity.getId()); + trunklineAdvanceDetailEntity.setTenantId(tenant.getTenantId()); + trunklineAdvanceDetailEntity.setIncomingWarehouseId(null); + trunklineAdvanceDetailEntity.setIncomingWarehouseName(null); + BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); + if (basicdataWarehouseEntity != null) { + trunklineAdvanceDetailEntity.setWarehouseId(basicdataWarehouseEntity.getId()); + trunklineAdvanceDetailEntity.setWarehouseName(basicdataWarehouseEntity.getName()); + } + saveObjs.add(trunklineAdvanceDetailEntity); + + } + } + advanceDetailService.saveBatch(saveObjs); + } + + + private TrunklineAdvanceEntity saveTrunklineAdvanceEntity(TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) { + Tenant tenant = changeDataBase(mallName); + // 查找商户的暂存单是否存在改制 + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_code", trunklineAdvanceEntity.getOrderCode()) + .last("limit 1"); + TrunklineAdvanceEntity trunklineAdvanceEntity1 = advanceService.getOne(queryWrapper); + BasicdataWarehouseEntity basicdataWarehouseEntity = getBasicdataWarehouseEntity(mallName); + if (ObjectUtil.isEmpty(trunklineAdvanceEntity1)) { + + // 保存对象 + if (basicdataWarehouseEntity != null) { + trunklineAdvanceEntity.setWarehouseId(basicdataWarehouseEntity.getId()); + trunklineAdvanceEntity.setWarehouseName(basicdataWarehouseEntity.getName()); + } + trunklineAdvanceEntity.setTenantId(tenant.getTenantId()); + advanceService.save(trunklineAdvanceEntity); + + return trunklineAdvanceEntity; + } else { + return trunklineAdvanceEntity1; + } + + } + + private Tenant changeDataBase(String maillName) { + R tenantByName = sysClient.getTenantByName(maillName); + if (tenantByName.isSuccess()) { + Tenant tenant = tenantByName.getData(); + if (ObjectUtil.isEmpty(tenant)) { + log.info(">>>>>>>>>>>>> saveOtherDataBaseNew 租户不存在"); + return null; + } + return tenant; + } + return null; + } + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java index 746934df6..894f7bd26 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java @@ -3,6 +3,7 @@ package com.logpm.trunkline.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; @@ -25,9 +26,11 @@ import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseTrayTypeClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.checkerframework.checker.units.qual.A; import org.springblade.common.constant.IncomingTypeEnum; import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.WorkNodeEnums; +import org.springblade.common.utils.CommonUtil; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; @@ -186,6 +189,26 @@ public class InComingServiceImpl implements IInComingService { // 完结预入库数据状态 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("orderPackageCode", packageCode); + jsonObject.put("carNum", null); + + Map mapState = new HashMap(); + mapState.put("messageId", CommonUtil.getUUID()); + mapState.put("messageData", jsonObject); + mapState.put("createTime", System.currentTimeMillis()); + try { + rabbitTemplate.convertAndSend(RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.IN_WAREHOUSE_TO_BUSINESS_DATA_ROUTING, mapState, message -> { + message.getMessageProperties() + .setHeader("x-delay", 5000); + return message; + }); + } catch (Exception customerException) { + log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException); + + } + + }else{ 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 40ce4c1eb..925b3f887 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 @@ -36,6 +36,7 @@ import org.springblade.common.annotations.RepeatSubmit; import org.springblade.common.constant.CodeNumConstant; import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.IncomingTypeEnum; +import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.order.*; import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.CommonUtil; @@ -46,6 +47,7 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.DictBizCache; import org.springblade.system.feign.IRegionFeign; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -96,6 +98,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { private final IAsyncService asyncService; private final ICarsLoadAsyncService carsLoadAsyncService; + private final RabbitTemplate rabbitTemplate; + @Override public IPage advancePageList(AdvanceDTO advanceDTO) { IPage page = new Page<>(); @@ -146,7 +150,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BeanUtil.copy(infoByIds, openOrderVO); openOrderVO.setAdvanceIds(advanceIds); BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand); - if(!Objects.isNull(basicdataBrandEntity)){ + if (!Objects.isNull(basicdataBrandEntity)) { openOrderVO.setBrandId(basicdataBrandEntity.getId()); } //发站仓-----目前登录人的仓库 @@ -196,7 +200,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { openOrderVO.setConsigneeName(basicdataClientEntity.getLinkman()); openOrderVO.setConsigneeMobile(basicdataClientEntity.getPhone()); openOrderVO.setConsigneeAddress(basicdataClientEntity.getDetailedly()); - if(!Objects.isNull(advanceEntity)){ + if (!Objects.isNull(advanceEntity)) { openOrderVO.setConsigneeName(advanceEntity.getConsigneePerson()); openOrderVO.setConsigneeMobile(advanceEntity.getConsigneeMobile()); openOrderVO.setConsigneeAddress(advanceEntity.getConsigneeAddress()); @@ -238,7 +242,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { basicdataFreightApiVO.setDestination(openOrderVO.getDestinationCode()); basicdataFreightApiVO.setArrivalWarehouse(openOrderVO.getDestinationWarehouseId() + ""); - if(goodsList.isEmpty()){ + if (goodsList.isEmpty()) { List ls = new ArrayList<>(); //把list中的元素通过packName分组如果pickName为空则换为"其他" Map> groupedEntities = list.stream() @@ -260,7 +264,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { ls.add(advanceDetailGoodsVO); }); goodsList = new ArrayList<>(ls); - }else{ + } else { for (AdvanceDetailGoodsVO advanceDetailGoodsVO : goodsList) { String goodsName = advanceDetailGoodsVO.getGoodsName(); BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); @@ -282,7 +286,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } - openOrderVO.setGoodsList(goodsList); //查询支付方式 @@ -370,7 +373,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { WarehouseWaybillEntity waybillEntity = new WarehouseWaybillEntity(); waybillEntity.setWaybillNo(waybillNo); - if(Objects.isNull(brandId)){ + if (Objects.isNull(brandId)) { BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand); if (!Objects.isNull(basicdataBrandEntity)) { brandId = basicdataBrandEntity.getId(); @@ -609,7 +612,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //判断是否是开单及入库的配置 Boolean aBoolean = basicdataOpenIncomingClient.checkOpenIncoming(warehouseId, brandId); if (Boolean.TRUE.equals(aBoolean)) { - openOrderAsyncService.incomingPackageBatch(advanceIds, AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getTenantId(), AuthUtil.getNickName(), IncomingTypeEnum.OPEN_TO_IN.getCode(),warehouseId,warehouseName,waybillEntity); + openOrderAsyncService.incomingPackageBatch(advanceIds, AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getTenantId(), AuthUtil.getNickName(), IncomingTypeEnum.OPEN_TO_IN.getCode(), warehouseId, warehouseName, waybillEntity); waybillEntity.setStockCount(waybillEntity.getTotalCount()); waybillEntity.setWaybillStatus("20"); warehouseWaybillClient.updateEntity(waybillEntity); @@ -635,8 +638,25 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //发布开单广播 openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, advanceIds); - Map map = new HashMap<>(); - map.put("waybillId",waybillId); + + Map mapState = new HashMap(); + mapState.put("messageId", CommonUtil.getUUID()); + mapState.put("messageData", waybillId); + mapState.put("createTime", System.currentTimeMillis()); + try { + rabbitTemplate.convertAndSend(RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_EXCHANGE, RabbitConstant.OPEN_WAYBILL_TO_BUSINESS_DATA_ROUTING, mapState, message -> { + message.getMessageProperties() + .setHeader("x-delay", 5000); + return message; + }); + } catch (Exception customerException) { + log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", customerException); + + } + + + Map map = new HashMap<>(); + map.put("waybillId", waybillId); return R.data(map); } @@ -845,8 +865,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //发布开单广播 openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, null); - Map map = new HashMap<>(); - map.put("waybillId",waybillId); + Map map = new HashMap<>(); + map.put("waybillId", waybillId); return R.data(map); } @@ -892,10 +912,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long warehouseId = advanceDTO.getWarehouseId(); //查询包件是否已经不在库 - List parcelListEntities = distributionParcelListClient.findPackagesByAdvanceIdsAndNoStock(advanceIds,warehouseId); - if(!parcelListEntities.isEmpty()){ + List parcelListEntities = distributionParcelListClient.findPackagesByAdvanceIdsAndNoStock(advanceIds, warehouseId); + if (!parcelListEntities.isEmpty()) { log.warn("############deletedAdvance: 已有包件出库,不能删除"); - throw new CustomerException(405,"已有包件出库,不能删除"); + throw new CustomerException(405, "已有包件出库,不能删除"); } for (Long advanceId : advanceIds) { @@ -904,7 +924,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceService.deletedAdvance(advanceIds); //删除所有在库包件,并更新订单信息 - distributionParcelListClient.findAllOrderCodesAndDeleteByAdvanceIds(advanceIds,warehouseId); + distributionParcelListClient.findAllOrderCodesAndDeleteByAdvanceIds(advanceIds, warehouseId); } @@ -1077,7 +1097,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List batchPackageCodeByType = basicdataCodeClient.getBatchPackageCodeByType(warehouseCode, orderCode, totalNumber); batchPackageCodeByType.forEach(item -> { TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); - BeanUtil.copy(advanceDetailModel,advanceDetailEntity); + BeanUtil.copy(advanceDetailModel, advanceDetailEntity); advanceDetailEntity.setOrderPackageCode(item); detailEntities.add(advanceDetailEntity); }); @@ -1117,9 +1137,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { .map(Map.Entry::getKey) .collect(Collectors.toSet()); - if(!duplicateOrderPackageCodes.isEmpty()){ - log.warn("#####################openLabelHasPacakage: 包条码重复 {}",duplicateOrderPackageCodes); - return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); + if (!duplicateOrderPackageCodes.isEmpty()) { + log.warn("#####################openLabelHasPacakage: 包条码重复 {}", duplicateOrderPackageCodes); + return R.fail(405, "包条码重复" + duplicateOrderPackageCodes); } List orderPackageCodeKeys = new ArrayList<>(pacakgeDetailExcelDTOSet); @@ -1145,8 +1165,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceEntityList = new ArrayList<>(); - if(pacakgeDetailExcelDTOS.isEmpty()){ - log.warn("##################openLabelHasPacakage: 没有需要处理的数据 pacakgeDetailExcelDTOS={}",pacakgeDetailExcelDTOS); + if (pacakgeDetailExcelDTOS.isEmpty()) { + log.warn("##################openLabelHasPacakage: 没有需要处理的数据 pacakgeDetailExcelDTOS={}", pacakgeDetailExcelDTOS); return R.data(advanceEntityList); } @@ -1160,8 +1180,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceDetailEntities = new ArrayList<>(); - - Map advanceEntityMap = new HashMap<>(); + Map advanceEntityMap = new HashMap<>(); List advanceIds = new ArrayList<>(); @@ -1188,8 +1207,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { detailEntities.forEach(advanceEntity -> { String orderCode = advanceEntity.getOrderCode(); String trainNumber = advanceEntity.getTrainNumber(); - String key = orderCode + "&" + (StringUtil.isBlank(trainNumber)?"null":trainNumber); - advanceEntityMap.put(key,advanceEntity); + String key = orderCode + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber); + advanceEntityMap.put(key, advanceEntity); }); List updateAdvanceEntityList = new ArrayList<>(); @@ -1214,12 +1233,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setDealerCode(pacakgeDetailExcelDTO.getDealerCode()); String dealerName = pacakgeDetailExcelDTO.getDealerName(); - if(StringUtil.isBlank(dealerName)){ - if(StringUtil.equals(brand,"欧派")){ + if (StringUtil.isBlank(dealerName)) { + if (StringUtil.equals(brand, "欧派")) { //获取orderCode数字第一次出现的前面字符串截取 int firstDigitIndex = findFirstDigitIndex(orderCode); - if(firstDigitIndex != -1){ - dealerName = orderCode.substring(0,firstDigitIndex); + if (firstDigitIndex != -1) { + dealerName = orderCode.substring(0, firstDigitIndex); } } } @@ -1254,7 +1273,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setTotalNum(advanceEntity.getTotalNum() + excelDTOS.size()); updateAdvanceEntityList.add(advanceEntity); advanceIds.add(advanceEntity.getId()); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); } }); @@ -1264,7 +1283,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1277,7 +1296,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1285,33 +1304,32 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } - advanceEntityList.forEach(advanceEntity -> { advanceIds.add(advanceEntity.getId()); String trainNumber = advanceEntity.getTrainNumber(); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); }); //通过advanceIds查询所有advanceDetail QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.in("advance_id",advanceIds) - .eq("is_deleted",0); + queryWrapper.in("advance_id", advanceIds) + .eq("is_deleted", 0); List advanceDetailEntityList = advanceDetailService.list(queryWrapper); //把advanceDetailEntityList通过advanceId分组并且把集合转化为orderPackageCode的集合 Map> map = advanceDetailEntityList.parallelStream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getAdvanceId, Collectors.mapping(TrunklineAdvanceDetailEntity::getOrderPackageCode, Collectors.toList()))); - Map materialMap = new HashMap<>(); + Map materialMap = new HashMap<>(); listMap.keySet().forEach(str -> { List pacakgeDetailExcelList = listMap.get(str); TrunklineAdvanceEntity advanceEntity = advanceEntityMap.get(str); - if(!Objects.isNull(advanceEntity)){ + if (!Objects.isNull(advanceEntity)) { Long advanceId = advanceEntity.getId(); String orderCode = advanceEntity.getOrderCode(); List orderPackageCodes = map.get(advanceId); pacakgeDetailExcelList.forEach(pacakgeDetailExcelDTO -> { String orderPackageCode = pacakgeDetailExcelDTO.getOrderPackageCode(); - if(Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)){ + if (Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)) { TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); advanceDetailModel.setWarehouseId(warehouseId); advanceDetailModel.setWarehouseName(warehouseName); @@ -1340,7 +1358,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailModel.setPackageStatus("0"); if (!Objects.isNull(pacakgeDetailExcelDTO.getVolume())) { advanceDetailModel.setVolume(new BigDecimal(pacakgeDetailExcelDTO.getVolume())); - }else{ + } else { advanceDetailModel.setVolume(BigDecimal.ZERO); } @@ -1349,21 +1367,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService { if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) { Long materialId = materialMap.get(materialCode); - if(!Objects.isNull(materialId)){ + if (!Objects.isNull(materialId)) { advanceDetailModel.setMaterialId(materialId); advanceDetailModel.setMaterialCode(materialCode); advanceDetailModel.setMaterialName(materialName); - }else{ + } else { BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName); if (Objects.isNull(basicMaterialEntity)) { basicMaterialEntity = new BasicMaterialEntity(); basicMaterialEntity.setProductCode(materialCode); basicMaterialEntity.setName(materialName); BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(pacakgeDetailExcelDTO.getBrand()); - if(Objects.isNull(basicdataBrandEntity)){ + if (Objects.isNull(basicdataBrandEntity)) { basicMaterialEntity.setBrandId("1713382405517201409"); - }else{ - basicMaterialEntity.setBrandId(basicdataBrandEntity.getId()+""); + } else { + basicMaterialEntity.setBrandId(basicdataBrandEntity.getId() + ""); } basicMaterialEntity.setProperty("家配"); basicMaterialEntity.setSpecification("件"); @@ -1374,12 +1392,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { basicMaterialEntity.setHide(1); Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity); basicMaterialEntity.setId(aLong); - materialMap.put(materialCode,aLong); + materialMap.put(materialCode, aLong); advanceDetailModel.setMaterialId(aLong); advanceDetailModel.setMaterialCode(materialCode); advanceDetailModel.setMaterialName(materialName); - }else{ - materialMap.put(materialCode,basicMaterialEntity.getId()); + } else { + materialMap.put(materialCode, basicMaterialEntity.getId()); advanceDetailModel.setMaterialId(basicMaterialEntity.getId()); advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode()); advanceDetailModel.setMaterialName(basicMaterialEntity.getName()); @@ -1399,20 +1417,20 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceDetailEntitiesList.size(); i++) { List list = advanceDetailEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); } - if(!CollUtil.isEmpty(advanceEntityList)){ + if (!CollUtil.isEmpty(advanceEntityList)) { carsLoadAsyncService.sendRabbitMessageLoadScanData(advanceEntityList); } int successNum = advanceDetailEntities.size(); - return R.success("成功处理包件"+successNum+"件"); + return R.success("成功处理包件" + successNum + "件"); } public int findFirstDigitIndex(String str) { @@ -1452,9 +1470,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { .map(Map.Entry::getKey) .collect(Collectors.toSet()); - if(!duplicateOrderPackageCodes.isEmpty()){ - log.warn("#################importCustomizedOuPai: 包条码重复 {}",duplicateOrderPackageCodes); - return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); + if (!duplicateOrderPackageCodes.isEmpty()) { + log.warn("#################importCustomizedOuPai: 包条码重复 {}", duplicateOrderPackageCodes); + return R.fail(405, "包条码重复" + duplicateOrderPackageCodes); } List orderPackageCodeKeys = new ArrayList<>(importCustomizedOuPaiDTOSet); @@ -1481,8 +1499,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceEntityList = new ArrayList<>(); List updateAdvanceEntityList = new ArrayList<>(); - if(importCustomizedOuPaiDTOS.isEmpty()){ - log.warn("##################importCustomizedOuPai: 没有需要处理的数据 importCustomizedOuPaiDTOS={}",importCustomizedOuPaiDTOS); + if (importCustomizedOuPaiDTOS.isEmpty()) { + log.warn("##################importCustomizedOuPai: 没有需要处理的数据 importCustomizedOuPaiDTOS={}", importCustomizedOuPaiDTOS); return R.data(advanceEntityList); } @@ -1507,7 +1525,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceDetailEntities = new ArrayList<>(); - Map advanceEntityMap = new HashMap<>(); + Map advanceEntityMap = new HashMap<>(); List advanceIds = new ArrayList<>(); @@ -1524,8 +1542,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { detailEntities.forEach(advanceEntity -> { String orderCode = advanceEntity.getOrderCode(); String trainNumber = advanceEntity.getTrainNumber(); - String key = orderCode + "&" + (StringUtil.isBlank(trainNumber)?"null":trainNumber); - advanceEntityMap.put(key,advanceEntity); + String key = orderCode + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber); + advanceEntityMap.put(key, advanceEntity); }); listMap.keySet().forEach(str -> { @@ -1547,10 +1565,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setPackName(importCustomizedOuPaiDTO.getFirstsName()); advanceEntity.setDealerCode(importCustomizedOuPaiDTO.getDealerCode()); String dealerName = importCustomizedOuPaiDTO.getDealerName(); - if(StringUtil.isBlank(dealerName)){ + if (StringUtil.isBlank(dealerName)) { int firstDigitIndex = findFirstDigitIndex(orderCode); - if(firstDigitIndex != -1){ - dealerName = orderCode.substring(0,firstDigitIndex); + if (firstDigitIndex != -1) { + dealerName = orderCode.substring(0, firstDigitIndex); } } advanceEntity.setDealerName(dealerName); @@ -1567,7 +1585,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setLegacyStatus("0"); advanceEntity.setIsGcp(0); String isOupai = importCustomizedOuPaiDTO.getIsOupai(); - if("是".equals(isOupai)){ + if ("是".equals(isOupai)) { advanceEntity.setIsGcp(1); } if (orderCode.contains("遗")) { @@ -1583,7 +1601,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { updateAdvanceEntityList.add(advanceEntity); advanceIds.add(advanceEntity.getId()); String trainNumber = advanceEntity.getTrainNumber(); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); } }); @@ -1593,7 +1611,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1606,7 +1624,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1617,30 +1635,30 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntityList.forEach(advanceEntity -> { advanceIds.add(advanceEntity.getId()); String trainNumber = advanceEntity.getTrainNumber(); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); }); //通过advanceIds查询所有advanceDetail QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.in("advance_id",advanceIds) - .eq("is_deleted",0); + queryWrapper.in("advance_id", advanceIds) + .eq("is_deleted", 0); List advanceDetailEntityList = advanceDetailService.list(queryWrapper); //把advanceDetailEntityList通过advanceId分组并且把集合转化为orderPackageCode的集合 Map> map = advanceDetailEntityList.parallelStream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getAdvanceId, Collectors.mapping(TrunklineAdvanceDetailEntity::getOrderPackageCode, Collectors.toList()))); - Map materialMap = new HashMap<>(); + Map materialMap = new HashMap<>(); listMap.keySet().forEach(str -> { List importCustomizedOuPaiDTOList = listMap.get(str); TrunklineAdvanceEntity advanceEntity = advanceEntityMap.get(str); - if(!Objects.isNull(advanceEntity)){ + if (!Objects.isNull(advanceEntity)) { Long advanceId = advanceEntity.getId(); String orderCode = advanceEntity.getOrderCode(); List orderPackageCodes = map.get(advanceId); importCustomizedOuPaiDTOList.forEach(importCustomizedOuPaiDTO -> { String orderPackageCode = importCustomizedOuPaiDTO.getOrderPackageCode(); - if(Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)){ + if (Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)) { TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); advanceDetailModel.setWarehouseId(warehouseId); advanceDetailModel.setWarehouseName(warehouseName); @@ -1687,7 +1705,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceDetailEntitiesList.size(); i++) { List list = advanceDetailEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1700,11 +1718,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService { int size = advanceDetailEntities.size(); - if(!CollUtil.isEmpty(advanceEntityList)){ + if (!CollUtil.isEmpty(advanceEntityList)) { carsLoadAsyncService.sendRabbitMessageLoadScanData(advanceEntityList); } - return R.success("成功导入"+size+"条"); + return R.success("成功导入" + size + "条"); } @Transactional(rollbackFor = Exception.class) @@ -1732,9 +1750,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { .map(Map.Entry::getKey) .collect(Collectors.toSet()); - if(!duplicateOrderPackageCodes.isEmpty()){ - log.warn("#################importStandardOuPai: 包条码重复 {}",duplicateOrderPackageCodes); - return R.fail(405, "包条码重复"+duplicateOrderPackageCodes); + if (!duplicateOrderPackageCodes.isEmpty()) { + log.warn("#################importStandardOuPai: 包条码重复 {}", duplicateOrderPackageCodes); + return R.fail(405, "包条码重复" + duplicateOrderPackageCodes); } List orderPackageCodeKeys = new ArrayList<>(importStandardOuPaiDTOSet); @@ -1761,8 +1779,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceEntityList = new ArrayList<>(); List updateAdvanceEntityList = new ArrayList<>(); - if(importStandardOuPaiDTOS.isEmpty()){ - log.warn("##################importStandardOuPai: 没有需要处理的数据 importStandardOuPaiDTOS={}",importStandardOuPaiDTOS); + if (importStandardOuPaiDTOS.isEmpty()) { + log.warn("##################importStandardOuPai: 没有需要处理的数据 importStandardOuPaiDTOS={}", importStandardOuPaiDTOS); return R.data(advanceEntityList); } @@ -1775,7 +1793,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceDetailEntities = new ArrayList<>(); - Map advanceEntityMap = new HashMap<>(); + Map advanceEntityMap = new HashMap<>(); List advanceIds = new ArrayList<>(); @@ -1800,8 +1818,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService { detailEntities.forEach(advanceEntity -> { String orderCode = advanceEntity.getOrderCode(); String trainNumber = advanceEntity.getTrainNumber(); - String key = orderCode + "&" + (StringUtil.isBlank(trainNumber)?"null":trainNumber); - advanceEntityMap.put(key,advanceEntity); + String key = orderCode + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber); + advanceEntityMap.put(key, advanceEntity); }); listMap.keySet().forEach(str -> { @@ -1823,10 +1841,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setPackName(importStandardOuPaiDTO.getFirstsName()); advanceEntity.setDealerCode(importStandardOuPaiDTO.getDealerCode()); String dealerName = importStandardOuPaiDTO.getDealerName(); - if(StringUtil.isBlank(dealerName)){ + if (StringUtil.isBlank(dealerName)) { int firstDigitIndex = findFirstDigitIndex(orderCode); - if(firstDigitIndex != -1){ - dealerName = orderCode.substring(0,firstDigitIndex); + if (firstDigitIndex != -1) { + dealerName = orderCode.substring(0, firstDigitIndex); } } advanceEntity.setDealerName(dealerName); @@ -1842,7 +1860,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setLegacyStatus("0"); advanceEntity.setIsGcp(0); String isOupai = importStandardOuPaiDTO.getIsOupai(); - if("是".equals(isOupai)){ + if ("是".equals(isOupai)) { advanceEntity.setIsGcp(1); } if (orderCode.contains("遗")) { @@ -1853,12 +1871,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntity.setHasPackage(1); advanceEntityList.add(advanceEntity); } else { - advanceEntity.setTotalNum(advanceEntity.getTotalNum()+excelDTOS.size()); + advanceEntity.setTotalNum(advanceEntity.getTotalNum() + excelDTOS.size()); updateAdvanceEntityList.add(advanceEntity); advanceIds.add(advanceEntity.getId()); String trainNumber = advanceEntity.getTrainNumber(); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); } }); if (!advanceEntityList.isEmpty()) { @@ -1867,7 +1885,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.saveAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1879,7 +1897,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceEntitiesList.size(); i++) { List list = advanceEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.updateAdvanceEntity(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -1889,30 +1907,30 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceEntityList.forEach(advanceEntity -> { advanceIds.add(advanceEntity.getId()); String trainNumber = advanceEntity.getTrainNumber(); - advanceEntityMap.put(advanceEntity.getOrderCode()+"&"+(StringUtil.isBlank(trainNumber)?"null":trainNumber),advanceEntity); + advanceEntityMap.put(advanceEntity.getOrderCode() + "&" + (StringUtil.isBlank(trainNumber) ? "null" : trainNumber), advanceEntity); }); //通过advanceIds查询所有advanceDetail QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.in("advance_id",advanceIds) - .eq("is_deleted",0); + queryWrapper.in("advance_id", advanceIds) + .eq("is_deleted", 0); List advanceDetailEntityList = advanceDetailService.list(queryWrapper); //把advanceDetailEntityList通过advanceId分组并且把集合转化为orderPackageCode的集合 Map> map = advanceDetailEntityList.parallelStream().collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getAdvanceId, Collectors.mapping(TrunklineAdvanceDetailEntity::getOrderPackageCode, Collectors.toList()))); - Map materialMap = new HashMap<>(); + Map materialMap = new HashMap<>(); listMap.keySet().forEach(str -> { List importStandardOuPaiDTOList = listMap.get(str); TrunklineAdvanceEntity advanceEntity = advanceEntityMap.get(str); - if(!Objects.isNull(advanceEntity)){ + if (!Objects.isNull(advanceEntity)) { Long advanceId = advanceEntity.getId(); String orderCode = advanceEntity.getOrderCode(); String brand = advanceEntity.getBrand(); List orderPackageCodes = map.get(advanceId); importStandardOuPaiDTOList.forEach(importStandardOuPaiDTO -> { String orderPackageCode = importStandardOuPaiDTO.getOrderPackageCode(); - if(Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)){ + if (Objects.isNull(orderPackageCodes) || !orderPackageCodes.contains(orderPackageCode)) { TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); advanceDetailModel.setWarehouseId(warehouseId); advanceDetailModel.setWarehouseName(warehouseName); @@ -1926,9 +1944,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailModel.setSendDateStr(importStandardOuPaiDTO.getSendDateStr()); advanceDetailModel.setCarNumber(importStandardOuPaiDTO.getCarNumber()); String volume = importStandardOuPaiDTO.getVolume(); - if(StringUtil.isBlank(volume)){ + if (StringUtil.isBlank(volume)) { advanceDetailModel.setVolume(BigDecimal.ZERO); - }else{ + } else { advanceDetailModel.setVolume(new BigDecimal(importStandardOuPaiDTO.getVolume())); } advanceDetailModel.setTrainNumber(advanceEntity.getTrainNumber()); @@ -1954,21 +1972,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService { if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) { Long materialId = materialMap.get(materialCode); - if(!Objects.isNull(materialId)){ + if (!Objects.isNull(materialId)) { advanceDetailModel.setMaterialId(materialId); advanceDetailModel.setMaterialCode(materialCode); advanceDetailModel.setMaterialName(materialName); - }else{ + } else { BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName); if (Objects.isNull(basicMaterialEntity)) { basicMaterialEntity = new BasicMaterialEntity(); basicMaterialEntity.setProductCode(materialCode); basicMaterialEntity.setName(materialName); BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand); - if(Objects.isNull(basicdataBrandEntity)){ + if (Objects.isNull(basicdataBrandEntity)) { basicMaterialEntity.setBrandId("1713382405517201409"); - }else{ - basicMaterialEntity.setBrandId(basicdataBrandEntity.getId()+""); + } else { + basicMaterialEntity.setBrandId(basicdataBrandEntity.getId() + ""); } basicMaterialEntity.setProperty("家配"); basicMaterialEntity.setSpecification("件"); @@ -1979,12 +1997,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { basicMaterialEntity.setHide(1); Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity); basicMaterialEntity.setId(aLong); - materialMap.put(materialCode,aLong); + materialMap.put(materialCode, aLong); advanceDetailModel.setMaterialId(aLong); advanceDetailModel.setMaterialCode(materialCode); advanceDetailModel.setMaterialName(materialName); - }else{ - materialMap.put(materialCode,basicMaterialEntity.getId()); + } else { + materialMap.put(materialCode, basicMaterialEntity.getId()); advanceDetailModel.setMaterialId(basicMaterialEntity.getId()); advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode()); advanceDetailModel.setMaterialName(basicMaterialEntity.getName()); @@ -2004,19 +2022,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceDetailEntitiesList.size(); i++) { List list = advanceDetailEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i+1); + CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(list, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); } - if(!CollUtil.isEmpty(advanceEntityList)){ + if (!CollUtil.isEmpty(advanceEntityList)) { carsLoadAsyncService.sendRabbitMessageLoadScanData(advanceEntityList); } int successNum = advanceDetailEntities.size(); - return R.success("成功导入"+successNum+"条"); + return R.success("成功导入" + successNum + "条"); } @Override @@ -2025,16 +2043,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer isEdit = openOrderDTO.getIsEdit(); WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); - if(Objects.isNull(waybillEntity)){ - log.warn("#############findWaybillDetail: 运单信息不存在 waybillId={}",waybillId); - return R.fail(405,"运单信息不存在"); + if (Objects.isNull(waybillEntity)) { + log.warn("#############findWaybillDetail: 运单信息不存在 waybillId={}", waybillId); + return R.fail(405, "运单信息不存在"); } - if(isEdit.equals(1)){ + if (isEdit.equals(1)) { Integer abolishStatus = waybillEntity.getAbolishStatus(); - if(abolishStatus.equals(1)){ - log.warn("#############findWaybillDetail: 运单已作废 waybillId={}",waybillId); - return R.fail(405,"运单已作废"); + if (abolishStatus.equals(1)) { + log.warn("#############findWaybillDetail: 运单已作废 waybillId={}", waybillId); + return R.fail(405, "运单已作废"); } } @@ -2047,14 +2065,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Map map = new HashMap<>(); - map.put("warehouseWaybill",warehouseWaybillVO); - map.put("payTypeList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); - map.put("payWayList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_WAY)); - map.put("deliveryWayList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_DELIVERY_WAY)); - map.put("urgencyList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_URGENCY)); - map.put("receiptList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_RECEIPT)); - map.put("transportTypeList",DictBizCache.getList(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE)); - map.put("editWaybillReasonTypeList",DictBizCache.getList(DictBizConstant.EDIT_WAYBILL_REASON_TYPE)); + map.put("warehouseWaybill", warehouseWaybillVO); + map.put("payTypeList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_TYPE)); + map.put("payWayList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_PAY_WAY)); + map.put("deliveryWayList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_DELIVERY_WAY)); + map.put("urgencyList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_URGENCY)); + map.put("receiptList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_RECEIPT)); + map.put("transportTypeList", DictBizCache.getList(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE)); + map.put("editWaybillReasonTypeList", DictBizCache.getList(DictBizConstant.EDIT_WAYBILL_REASON_TYPE)); return R.data(map); } @@ -2073,7 +2091,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.fail(405, "运单信息不存在"); } Integer abolishStatus = waybillEntity.getAbolishStatus(); - if(abolishStatus.equals(1)){ + if (abolishStatus.equals(1)) { log.warn("#############updateWaybill: 运单已作废 waybillId={}", waybillId); return R.fail(405, "运单已作废"); } @@ -2084,7 +2102,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { // String operationRemark = "修改运单"+waybillNo+",时间:"+ CommonUtil.dateToString(waybillEntity.getCreateTime())+","+updateMsg; //异步存入日志 - openOrderAsyncService.saveUpdateLog(waybillId, waybillNo, "888", editReson, "备注:"+refer+" 修改内容:"+updateMsg, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName,waybillEntity); + openOrderAsyncService.saveUpdateLog(waybillId, waybillNo, "888", editReson, "备注:" + refer + " 修改内容:" + updateMsg, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, waybillEntity); List wayBillDetailList = warehouseWaybillDetailClient.findListByWaybillNo(waybillNo); @@ -2093,7 +2111,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { waybillIds.add(waybillId); List advanceIds = trunklineWaybillOrderService.findAdvanceIdsByWaybillIds(waybillIds); - openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity,wayBillDetailList,advanceIds); + openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity, wayBillDetailList, advanceIds); return R.success("改单成功"); } @@ -2107,14 +2125,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.fail(405, "运单信息不存在"); } Integer abolishStatus = waybillEntity.getAbolishStatus(); - if(abolishStatus.equals(1)){ + if (abolishStatus.equals(1)) { log.warn("#############updateWaybill: 运单已作废 waybillId={}", waybillId); return R.fail(405, "运单已作废"); } // String updateMsg = verifyData(openOrderDTO,waybillEntity); - List list = verifyData(openOrderDTO,waybillEntity); + List list = verifyData(openOrderDTO, waybillEntity); return R.data(list); } @@ -2139,16 +2157,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); Map orderCodeCounts = importOrderNoPackageExcelDTOS.stream() - .collect(Collectors.groupingBy(a->(a.getOrderCode()+"&"+a.getFirsts()), Collectors.counting())); + .collect(Collectors.groupingBy(a -> (a.getOrderCode() + "&" + a.getFirsts()), Collectors.counting())); Set duplicateOrderCodes = orderCodeCounts.entrySet().stream() .filter(entry -> entry.getValue() > 1) .map(Map.Entry::getKey) .collect(Collectors.toSet()); - if(!duplicateOrderCodes.isEmpty()){ - log.warn("#################importCustomizedOuPai: 订单号品类重复 {}",duplicateOrderCodes); - return R.fail(405, "包条码重复"+duplicateOrderCodes); + if (!duplicateOrderCodes.isEmpty()) { + log.warn("#################importCustomizedOuPai: 订单号品类重复 {}", duplicateOrderCodes); + return R.fail(405, "包条码重复" + duplicateOrderCodes); } @@ -2178,7 +2196,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { // detailEntities.addAll(entities); // } - Map advanceEntityMap = new HashMap<>(); + Map advanceEntityMap = new HashMap<>(); //把detailEntities转化成以orderCode和trainNumber为key的map // detailEntities.forEach(advanceEntity -> { @@ -2191,7 +2209,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List list = new ArrayList<>(); importOrderNoPackageExcelDTOMap.keySet().forEach(key -> { ImportOrderNoPackageExcelDTO importOrderNoPackageExcelDTO = importOrderNoPackageExcelDTOMap.get(key); - if(Objects.isNull(importOrderNoPackageExcelDTO)){ + if (Objects.isNull(importOrderNoPackageExcelDTO)) { String orderCode = importOrderNoPackageExcelDTO.getOrderCode(); TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceVO(); advanceEntity.setWarehouseId(warehouseId); @@ -2234,7 +2252,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String orderCode = advanceEntity.getOrderCode(); String packName = advanceEntity.getPackName(); ImportOrderNoPackageExcelDTO importOrderNoPackageExcelDTO = importOrderNoPackageExcelDTOMap.get(orderCode + "&" + (StringUtil.isBlank(packName) ? "null" : packName)); - if(!Objects.isNull(importOrderNoPackageExcelDTO)){ + if (!Objects.isNull(importOrderNoPackageExcelDTO)) { String firsts = importOrderNoPackageExcelDTO.getFirsts(); Integer totalNum = advanceEntity.getTotalNum(); TrunklineAdvanceDetailEntity advanceDetailModel = new TrunklineAdvanceDetailEntity(); @@ -2263,15 +2281,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailModel.setMaterialCode(importOrderNoPackageExcelDTO.getMaterialCode()); advanceDetailModel.setMaterialName(importOrderNoPackageExcelDTO.getMaterialName()); String volume = importOrderNoPackageExcelDTO.getVolume(); - if (StringUtil.isBlank(volume)){ + if (StringUtil.isBlank(volume)) { advanceDetailModel.setVolume(BigDecimal.ZERO); - }else{ + } else { advanceDetailModel.setVolume(new BigDecimal(volume)); } String weight = importOrderNoPackageExcelDTO.getWeight(); - if (StringUtil.isBlank(weight)){ + if (StringUtil.isBlank(weight)) { advanceDetailModel.setWeight(BigDecimal.ZERO); - }else{ + } else { advanceDetailModel.setWeight(new BigDecimal(weight)); } advanceDetailModel.setWeight(new BigDecimal(importOrderNoPackageExcelDTO.getWeight())); @@ -2293,7 +2311,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List comlist = new ArrayList<>(); for (int i = 0; i < advanceDetailEntitiesList.size(); i++) { List ls = advanceDetailEntitiesList.get(i); - CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(ls, i+1); + CompletableFuture fromCpFirstReq = asyncService.getResponseFromCp(ls, i + 1); comlist.add(fromCpFirstReq); } CompletableFuture.allOf(comlist.toArray(new CompletableFuture[0])).join(); @@ -2472,7 +2490,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { int successNum = list.size(); - return R.success("成功导入"+successNum+"条"); + return R.success("成功导入" + successNum + "条"); } @Override @@ -2488,14 +2506,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.fail(405, "运单信息不存在"); } Integer abolishStatus = warehouseWaybillEntity.getAbolishStatus(); - if(abolishStatus.equals(1)){ - log.warn("#############checkWaybill: 运单已作废 waybillId={}",waybillId); - return R.fail(405,"运单已作废"); + if (abolishStatus.equals(1)) { + log.warn("#############checkWaybill: 运单已作废 waybillId={}", waybillId); + return R.fail(405, "运单已作废"); } Long checkUserId = warehouseWaybillEntity.getCheckUserId(); - if(!Objects.isNull(checkUserId)){ - log.warn("##############checkWaybill: 运单已经审核 waybillId={}",waybillId); + if (!Objects.isNull(checkUserId)) { + log.warn("##############checkWaybill: 运单已经审核 waybillId={}", waybillId); return R.fail(405, "运单已经审核"); } @@ -2795,7 +2813,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { List advanceEntityList = advanceService.findListByIds(advanceIds); List waybillOrderEntities = new ArrayList<>(); Set orderCodes = new TreeSet<>(); - for (TrunklineAdvanceEntity advanceEntity:advanceEntityList){ + for (TrunklineAdvanceEntity advanceEntity : advanceEntityList) { Long advanceId = advanceEntity.getId(); String waybillStatus = advanceEntity.getWaybillStatus(); if ("1".equals(waybillStatus)) { @@ -2995,7 +3013,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { openOrderDTO.setCheckTimeStart(CommonUtil.getStartByDateStr(openOrderDTO.getCheckTimeStartStr())); openOrderDTO.setCheckTimeEnd(CommonUtil.getEndByDateStr(openOrderDTO.getCheckTimeEndStr())); - IPage pageList = trunklineWaybillTrackService.findUpdateWaybillList(page,openOrderDTO); + IPage pageList = trunklineWaybillTrackService.findUpdateWaybillList(page, openOrderDTO); return R.data(pageList); } @@ -3007,14 +3025,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String waybillNo = waybillEntity.getWaybillNo(); Integer abolishStatus = waybillEntity.getAbolishStatus(); Integer freezeStatus = waybillEntity.getFreezeStatus(); - if(abolishStatus.equals(1)){ - log.warn("##############freezeWaybill: {}运单已经作废",waybillNo); - throw new CustomerException(405,waybillNo+"运单已经作废,不能冻结"); + if (abolishStatus.equals(1)) { + log.warn("##############freezeWaybill: {}运单已经作废", waybillNo); + throw new CustomerException(405, waybillNo + "运单已经作废,不能冻结"); } - if(freezeStatus.equals(1)){ - log.warn("##############freezeWaybill: {}运单已冻结",waybillNo); - throw new CustomerException(405,waybillNo+"运单已冻结,不能冻结"); + if (freezeStatus.equals(1)) { + log.warn("##############freezeWaybill: {}运单已冻结", waybillNo); + throw new CustomerException(405, waybillNo + "运单已冻结,不能冻结"); } waybillEntity.setFreezeStatus(1); @@ -3042,13 +3060,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String waybillNo = waybillEntity.getWaybillNo(); Integer abolishStatus = waybillEntity.getAbolishStatus(); Integer freezeStatus = waybillEntity.getFreezeStatus(); - if(abolishStatus.equals(1)){ - log.warn("##############unFreezeWaybill: {}运单已经作废",waybillNo); - throw new CustomerException(405,waybillNo+"运单已经作废,不能解冻"); + if (abolishStatus.equals(1)) { + log.warn("##############unFreezeWaybill: {}运单已经作废", waybillNo); + throw new CustomerException(405, waybillNo + "运单已经作废,不能解冻"); } - if(freezeStatus.equals(0)){ - log.warn("##############unFreezeWaybill: {}运单未冻结",waybillNo); - throw new CustomerException(405,waybillNo+"运单未冻结,不能解冻"); + if (freezeStatus.equals(0)) { + log.warn("##############unFreezeWaybill: {}运单未冻结", waybillNo); + throw new CustomerException(405, waybillNo + "运单未冻结,不能解冻"); } waybillEntity.setFreezeStatus(0); @@ -3075,19 +3093,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService { waybillList.forEach(waybillEntity -> { String waybillNo = waybillEntity.getWaybillNo(); String waybillStatus = waybillEntity.getWaybillStatus(); - if(StringUtil.isBlank(waybillStatus)){ - log.warn("##############abolishWaybill: {}运单为旧数据不能作废",waybillNo); - throw new CustomerException(405,waybillNo+"运单为旧数据不能作废"); + if (StringUtil.isBlank(waybillStatus)) { + log.warn("##############abolishWaybill: {}运单为旧数据不能作废", waybillNo); + throw new CustomerException(405, waybillNo + "运单为旧数据不能作废"); } Integer waybillStatusNum = Integer.parseInt(waybillStatus); - if(waybillStatusNum >= 30){ - log.warn("##############abolishWaybill: {}运单已经进入配载不能进行作废",waybillNo); - throw new CustomerException(405,waybillNo+"运单已经进入配载不能进行作废"); + if (waybillStatusNum >= 30) { + log.warn("##############abolishWaybill: {}运单已经进入配载不能进行作废", waybillNo); + throw new CustomerException(405, waybillNo + "运单已经进入配载不能进行作废"); } Integer abolishStatus = waybillEntity.getAbolishStatus(); - if(abolishStatus.equals(1)){ - log.warn("##############abolishWaybill: {}运单已经作废",waybillNo); - throw new CustomerException(405,waybillNo+"运单已经作废,不能重复作废"); + if (abolishStatus.equals(1)) { + log.warn("##############abolishWaybill: {}运单已经作废", waybillNo); + throw new CustomerException(405, waybillNo + "运单已经作废,不能重复作废"); } waybillEntity.setAbolishStatus(1); waybillEntity.setAbolishUserName(AuthUtil.getNickName()); @@ -3098,17 +3116,17 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //把装了车的包件取消装车 List carsLoadScanIds = trunklineCarsLoadScanService.findCarsLoadScanIdsByWaybillIds(waybillIds); - if(!CollUtil.isEmpty(carsLoadScanIds)){ + if (!CollUtil.isEmpty(carsLoadScanIds)) { //把carsLoadScanIds中的元素用,拼接起来成为一个字符串 String carsLoadScanIdsStr = CollUtil.join(carsLoadScanIds, ","); - carsLoadService.removeCarsLoadScan(carsLoadScanIdsStr,warehouseId); + carsLoadService.removeCarsLoadScan(carsLoadScanIdsStr, warehouseId); } List advanceIds = trunklineWaybillOrderService.findAdvanceIdsByWaybillIds(waybillIds); - trunklineWaybillOrderService.remove(new QueryWrapper().in("waybill_id",waybillIds)); + trunklineWaybillOrderService.remove(new QueryWrapper().in("waybill_id", waybillIds)); - if(!advanceIds.isEmpty()){ + if (!advanceIds.isEmpty()) { List advanceEntities = advanceService.findListByIds(advanceIds); advanceEntities.forEach(advanceEntity -> { advanceEntity.setWaybillStatus("0"); @@ -3123,7 +3141,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { waybillList.forEach(waybillEntity -> { String createOperationRemark = "作废运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date()); - openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark+" 原因:"+abolishReson, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); + openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark + " 原因:" + abolishReson, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); }); return R.success("作废成功"); } @@ -3135,7 +3153,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newDeparture = openOrderDTO.getDeparture(); String departure = waybillEntity.getDeparture(); - if(!ObjectUtil.equals(newDeparture,departure)){ + if (!ObjectUtil.equals(newDeparture, departure)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("发站"); @@ -3157,52 +3175,52 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newPickupCompleteOrNot = openOrderDTO.getPickupCompleteOrNot(); Integer pickupCompleteOrNot = waybillEntity.getPickupCompleteOrNot(); - if(!ObjectUtil.equals(newPickupCompleteOrNot,pickupCompleteOrNot)){ + if (!ObjectUtil.equals(newPickupCompleteOrNot, pickupCompleteOrNot)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("提货是否整车"); - editOrderMsgVO.setOldValue(pickupCompleteOrNot==1?"是":"否"); - editOrderMsgVO.setNewValue(newPickupCompleteOrNot==1?"是":"否"); + editOrderMsgVO.setOldValue(pickupCompleteOrNot == 1 ? "是" : "否"); + editOrderMsgVO.setNewValue(newPickupCompleteOrNot == 1 ? "是" : "否"); msgList.add(editOrderMsgVO); } Integer newTrunklineCompleteOrNot = openOrderDTO.getTrunklineCompleteOrNot(); Integer trunklineCompleteOrNot = waybillEntity.getTrunklineCompleteOrNot(); - if(!ObjectUtil.equals(newTrunklineCompleteOrNot,trunklineCompleteOrNot)){ + if (!ObjectUtil.equals(newTrunklineCompleteOrNot, trunklineCompleteOrNot)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("干线是否整车"); - editOrderMsgVO.setOldValue(trunklineCompleteOrNot==1?"是":"否"); - editOrderMsgVO.setNewValue(newTrunklineCompleteOrNot==1?"是":"否"); + editOrderMsgVO.setOldValue(trunklineCompleteOrNot == 1 ? "是" : "否"); + editOrderMsgVO.setNewValue(newTrunklineCompleteOrNot == 1 ? "是" : "否"); msgList.add(editOrderMsgVO); } String newTrunklineVehicleType = openOrderDTO.getTrunklineVehicleType(); String trunklineVehicleType = waybillEntity.getTrunklineVehicleType(); - if(!ObjectUtil.equals(newTrunklineVehicleType,trunklineVehicleType)){ + if (!ObjectUtil.equals(newTrunklineVehicleType, trunklineVehicleType)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("干线车型"); - editOrderMsgVO.setOldValue(DictBizCache.getValue("price_vehicle_type",trunklineVehicleType)); - editOrderMsgVO.setNewValue(DictBizCache.getValue("price_vehicle_type",newTrunklineVehicleType)); + editOrderMsgVO.setOldValue(DictBizCache.getValue("price_vehicle_type", trunklineVehicleType)); + editOrderMsgVO.setNewValue(DictBizCache.getValue("price_vehicle_type", newTrunklineVehicleType)); msgList.add(editOrderMsgVO); } String newPickupVehicleType = openOrderDTO.getPickupVehicleType(); String pickupVehicleType = waybillEntity.getPickupVehicleType(); - if(!ObjectUtil.equals(newPickupVehicleType,pickupVehicleType)){ + if (!ObjectUtil.equals(newPickupVehicleType, pickupVehicleType)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("提货车型"); - editOrderMsgVO.setOldValue(DictBizCache.getValue("price_vehicle_type",pickupVehicleType)); - editOrderMsgVO.setNewValue(DictBizCache.getValue("price_vehicle_type",newPickupVehicleType)); + editOrderMsgVO.setOldValue(DictBizCache.getValue("price_vehicle_type", pickupVehicleType)); + editOrderMsgVO.setNewValue(DictBizCache.getValue("price_vehicle_type", newPickupVehicleType)); msgList.add(editOrderMsgVO); } String newDestination = openOrderDTO.getDestination(); String destination = waybillEntity.getDestination(); - if(!ObjectUtil.equals(newDestination,destination)){ + if (!ObjectUtil.equals(newDestination, destination)) { // stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("到站"); @@ -3214,7 +3232,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); - if(!ObjectUtil.equals(destinationWarehouseId,newDestinationWarehouseId)){ + if (!ObjectUtil.equals(destinationWarehouseId, newDestinationWarehouseId)) { // stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("目的仓"); @@ -3226,7 +3244,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newShipper = openOrderDTO.getShipper(); Long shipperId = waybillEntity.getShipperId(); String shipper = waybillEntity.getShipper(); - if(!ObjectUtil.equals(shipperId,newShipperId)){ + if (!ObjectUtil.equals(shipperId, newShipperId)) { // stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("发货单位"); @@ -3237,7 +3255,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newShipperName = openOrderDTO.getShipperName(); String shipperName = waybillEntity.getShipperName(); - if(!ObjectUtil.equals(shipperName,newShipperName)){ + if (!ObjectUtil.equals(shipperName, newShipperName)) { // stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("发货人"); @@ -3248,7 +3266,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newShipperMobile = openOrderDTO.getShipperMobile(); String shipperMobile = waybillEntity.getShipperMobile(); - if(!ObjectUtil.equals(shipperMobile,newShipperMobile)){ + if (!ObjectUtil.equals(shipperMobile, newShipperMobile)) { // stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("发货人电话"); @@ -3259,7 +3277,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newShipperAddress = openOrderDTO.getShipperAddress(); String shipperAddress = waybillEntity.getShipperAddress(); - if(!ObjectUtil.equals(shipperAddress,newShipperAddress)){ + if (!ObjectUtil.equals(shipperAddress, newShipperAddress)) { // stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("发货人地址"); @@ -3272,7 +3290,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsignee = openOrderDTO.getConsignee(); Long consigneeId = waybillEntity.getConsigneeId(); String consignee = waybillEntity.getConsignee(); - if(!ObjectUtil.equals(consigneeId,newConsigneeId)){ + if (!ObjectUtil.equals(consigneeId, newConsigneeId)) { // stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("收货单位"); @@ -3283,7 +3301,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsigneeName = openOrderDTO.getConsigneeName(); String consigneeName = waybillEntity.getConsigneeName(); - if(!ObjectUtil.equals(consigneeName,newConsigneeName)){ + if (!ObjectUtil.equals(consigneeName, newConsigneeName)) { // stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("收货人"); @@ -3294,7 +3312,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); String consigneeMobile = waybillEntity.getConsigneeMobile(); - if(!ObjectUtil.equals(consigneeMobile,newConsigneeMobile)){ + if (!ObjectUtil.equals(consigneeMobile, newConsigneeMobile)) { // stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("收货人电话"); @@ -3305,7 +3323,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); String consigneeAddress = waybillEntity.getConsigneeAddress(); - if(!ObjectUtil.equals(consigneeAddress,newConsigneeAddress)){ + if (!ObjectUtil.equals(consigneeAddress, newConsigneeAddress)) { // stringBuilder.append("收货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("收货人地址"); @@ -3321,19 +3339,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long waybillDetailId = waybillDetailDTO.getId(); WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); - if(Objects.isNull(warehouseWayBillDetail)){ + if (Objects.isNull(warehouseWayBillDetail)) { log.warn("#################verifyUpdateData: 明细不存在"); continue; } - if(StringUtil.isBlank(removeMsg)){ - removeMsg = warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; - }else{ - removeMsg = removeMsg + "," + warehouseWayBillDetail.getProductName()+"("+warehouseWayBillDetail.getNum()+")"; + if (StringUtil.isBlank(removeMsg)) { + removeMsg = warehouseWayBillDetail.getProductName() + "(" + warehouseWayBillDetail.getNum() + ")"; + } else { + removeMsg = removeMsg + "," + warehouseWayBillDetail.getProductName() + "(" + warehouseWayBillDetail.getNum() + ")"; } } - if(StringUtil.isNotBlank(removeMsg)){ + if (StringUtil.isNotBlank(removeMsg)) { // stringBuilder.append("明细移除:").append(removeMsg).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("明细移除"); @@ -3346,40 +3364,40 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer updateType = waybillDetailDTO.getUpdateType(); - if(1 == updateType){ + if (1 == updateType) { //新增 // stringBuilder.append("明细新增:").append(waybillDetailDTO.getGoodsName()).append(" 数量 ").append(waybillDetailDTO.getNum()).append(" 单价 ").append(waybillDetailDTO.getPrice()).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); - editOrderMsgVO.setItemName("明细新增 "+waybillDetailDTO.getGoodsName()); - editOrderMsgVO.setNewValue(" 数量 "+waybillDetailDTO.getNum()+" 单价 "+waybillDetailDTO.getPrice()); + editOrderMsgVO.setItemName("明细新增 " + waybillDetailDTO.getGoodsName()); + editOrderMsgVO.setNewValue(" 数量 " + waybillDetailDTO.getNum() + " 单价 " + waybillDetailDTO.getPrice()); msgList.add(editOrderMsgVO); - }else if(2 == updateType){ + } else if (2 == updateType) { //更新 Long waybillDetailId = waybillDetailDTO.getId(); WarehouseWayBillDetail warehouseWayBillDetail = warehouseWaybillDetailClient.findEntityByWaybillDetailId(waybillDetailId); - if(Objects.isNull(warehouseWayBillDetail)){ + if (Objects.isNull(warehouseWayBillDetail)) { log.warn("#################verifyUpdateData: 明细不存在"); continue; } Integer newNum = waybillDetailDTO.getNum(); Integer num = warehouseWayBillDetail.getNum(); - if(!num.equals(newNum)){ + if (!num.equals(newNum)) { // stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); - editOrderMsgVO.setItemName("明细更新 "+warehouseWayBillDetail.getProductName() +" 数量修改 "); - editOrderMsgVO.setOldValue(num+""); - editOrderMsgVO.setNewValue(newNum+""); + editOrderMsgVO.setItemName("明细更新 " + warehouseWayBillDetail.getProductName() + " 数量修改 "); + editOrderMsgVO.setOldValue(num + ""); + editOrderMsgVO.setNewValue(newNum + ""); msgList.add(editOrderMsgVO); } BigDecimal newPrice = waybillDetailDTO.getPrice(); BigDecimal price = warehouseWayBillDetail.getPrice(); - if(price.compareTo(newPrice) != 0){ + if (price.compareTo(newPrice) != 0) { // stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 单价修改").append(price).append("-->").append(newPrice).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); - editOrderMsgVO.setItemName("明细更新 "+warehouseWayBillDetail.getProductName() +" 单价修改 "); + editOrderMsgVO.setItemName("明细更新 " + warehouseWayBillDetail.getProductName() + " 单价修改 "); editOrderMsgVO.setOldValue(price.toPlainString()); editOrderMsgVO.setNewValue(newPrice.toPlainString()); msgList.add(editOrderMsgVO); @@ -3387,21 +3405,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newChargeType = waybillDetailDTO.getChargeType(); Integer chargeType = warehouseWayBillDetail.getChargeType(); - if(!ObjectUtil.equals(chargeType,newChargeType)){ + if (!ObjectUtil.equals(chargeType, newChargeType)) { // stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); - editOrderMsgVO.setItemName("明细更新 "+warehouseWayBillDetail.getProductName() +" 计价方式修改 "); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE,chargeType+"")); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE,newChargeType+"")); + editOrderMsgVO.setItemName("明细更新 " + warehouseWayBillDetail.getProductName() + " 计价方式修改 "); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE, chargeType + "")); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_CHARGE_TYPE, newChargeType + "")); msgList.add(editOrderMsgVO); } BigDecimal newSubtotalFreight = waybillDetailDTO.getSubtotalFreight(); BigDecimal subtotalFreight = warehouseWayBillDetail.getSubtotalFreight(); - if(subtotalFreight.compareTo(newSubtotalFreight) != 0){ + if (subtotalFreight.compareTo(newSubtotalFreight) != 0) { // stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 单价修改").append(price).append("-->").append(newPrice).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); - editOrderMsgVO.setItemName("明细更新 "+warehouseWayBillDetail.getProductName() +" 运费小计修改 "); + editOrderMsgVO.setItemName("明细更新 " + warehouseWayBillDetail.getProductName() + " 运费小计修改 "); editOrderMsgVO.setOldValue(subtotalFreight.toPlainString()); editOrderMsgVO.setNewValue(newSubtotalFreight.toPlainString()); msgList.add(editOrderMsgVO); @@ -3412,29 +3430,29 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newTotalCount = openOrderDTO.getTotalCount(); Integer totalCount = waybillEntity.getTotalCount(); - if(!ObjectUtil.equals(totalCount,newTotalCount)){ + if (!ObjectUtil.equals(totalCount, newTotalCount)) { // stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("货物总数"); - editOrderMsgVO.setOldValue(totalCount+""); - editOrderMsgVO.setNewValue(newTotalCount+""); + editOrderMsgVO.setOldValue(totalCount + ""); + editOrderMsgVO.setNewValue(newTotalCount + ""); msgList.add(editOrderMsgVO); } BigDecimal newTotalFreight = openOrderDTO.getTotalFreight(); BigDecimal totalFreight = waybillEntity.getTotalFreight(); - if(totalFreight.compareTo(newTotalFreight) != 0){ + if (totalFreight.compareTo(newTotalFreight) != 0) { // stringBuilder.append("运费:").append(totalFreight).append("-->").append(newTotalFreight).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("运费"); - editOrderMsgVO.setOldValue(totalFreight+""); - editOrderMsgVO.setNewValue(newTotalFreight+""); + editOrderMsgVO.setOldValue(totalFreight + ""); + editOrderMsgVO.setNewValue(newTotalFreight + ""); msgList.add(editOrderMsgVO); } BigDecimal newDeliveryFee = openOrderDTO.getDeliveryFee(); BigDecimal deliveryFee = waybillEntity.getDeliveryFee(); - if(deliveryFee.compareTo(newDeliveryFee) != 0){ + if (deliveryFee.compareTo(newDeliveryFee) != 0) { // stringBuilder.append("送货费:").append(deliveryFee).append("-->").append(newDeliveryFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("送货费"); @@ -3445,7 +3463,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newPickupFee = openOrderDTO.getPickupFee(); BigDecimal pickupFee = waybillEntity.getPickupFee(); - if(pickupFee.compareTo(newPickupFee) != 0){ + if (pickupFee.compareTo(newPickupFee) != 0) { // stringBuilder.append("提货费:").append(pickupFee).append("-->").append(newPickupFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("提货费"); @@ -3456,7 +3474,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newWarehouseManagementFee = openOrderDTO.getWarehouseManagementFee(); BigDecimal warehouseManagementFee = waybillEntity.getWarehouseManagementFee(); - if(warehouseManagementFee.compareTo(newWarehouseManagementFee) != 0){ + if (warehouseManagementFee.compareTo(newWarehouseManagementFee) != 0) { // stringBuilder.append("仓库管理费:").append(warehouseManagementFee).append("-->").append(newWarehouseManagementFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("仓库管理费"); @@ -3467,7 +3485,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newStorageFee = openOrderDTO.getStorageFee(); BigDecimal storageFee = waybillEntity.getStorageFee(); - if(storageFee.compareTo(newStorageFee) != 0){ + if (storageFee.compareTo(newStorageFee) != 0) { // stringBuilder.append("仓储费:").append(storageFee).append("-->").append(newStorageFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("仓储费"); @@ -3478,7 +3496,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newHandlingFee = openOrderDTO.getHandlingFee(); BigDecimal handlingFee = waybillEntity.getHandlingFee(); - if(handlingFee.compareTo(newHandlingFee) != 0){ + if (handlingFee.compareTo(newHandlingFee) != 0) { // stringBuilder.append("装卸费:").append(handlingFee).append("-->").append(newHandlingFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("装卸费"); @@ -3489,7 +3507,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newInstallFee = openOrderDTO.getInstallFee(); BigDecimal installFee = waybillEntity.getInstallFee(); - if(installFee.compareTo(newInstallFee) != 0){ + if (installFee.compareTo(newInstallFee) != 0) { // stringBuilder.append("安装费:").append(installFee).append("-->").append(newInstallFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("安装费"); @@ -3500,7 +3518,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newOtherFee = openOrderDTO.getOtherFee(); BigDecimal otherFee = waybillEntity.getOtherFee(); - if(otherFee.compareTo(newOtherFee) != 0){ + if (otherFee.compareTo(newOtherFee) != 0) { // stringBuilder.append("其他费:").append(otherFee).append("-->").append(newOtherFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("其他费"); @@ -3511,7 +3529,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newInsuranceFee = openOrderDTO.getInsuranceFee(); BigDecimal insuranceFee = waybillEntity.getInsuranceFee(); - if(insuranceFee.compareTo(newInsuranceFee) != 0){ + if (insuranceFee.compareTo(newInsuranceFee) != 0) { // stringBuilder.append("保价费:").append(insuranceFee).append("-->").append(newInsuranceFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("保价费"); @@ -3522,7 +3540,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newClaimingValue = openOrderDTO.getClaimingValue(); BigDecimal claimingValue = waybillEntity.getClaimingValue(); - if(claimingValue.compareTo(newClaimingValue) != 0){ + if (claimingValue.compareTo(newClaimingValue) != 0) { // stringBuilder.append("申明价值:").append(claimingValue).append("-->").append(newClaimingValue).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("申明价值"); @@ -3533,29 +3551,29 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newPayType = openOrderDTO.getPayType(); String payType = waybillEntity.getPayType(); - if(!ObjectUtil.equals(payType,newPayType)){ + if (!ObjectUtil.equals(payType, newPayType)) { // stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("支付方式"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_TYPE,payType)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_TYPE,newPayType)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_TYPE, payType)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_TYPE, newPayType)); msgList.add(editOrderMsgVO); } String newPayWay = openOrderDTO.getPayWay(); String payWay = waybillEntity.getPayWay(); - if(!ObjectUtil.equals(payWay,newPayWay)){ + if (!ObjectUtil.equals(payWay, newPayWay)) { // stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("付款方式"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_WAY,payWay)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_WAY,newPayWay)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_WAY, payWay)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_PAY_WAY, newPayWay)); msgList.add(editOrderMsgVO); } BigDecimal xianPay = openOrderDTO.getXianPay(); BigDecimal xPay = waybillEntity.getXPay(); - if(xPay.compareTo(xianPay) != 0){ + if (xPay.compareTo(xianPay) != 0) { // stringBuilder.append("现付:").append(xPay).append("-->").append(xianPay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("现付"); @@ -3566,7 +3584,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal daoPay = openOrderDTO.getDaoPay(); BigDecimal dPay = waybillEntity.getDPay(); - if(dPay.compareTo(daoPay) != 0){ + if (dPay.compareTo(daoPay) != 0) { // stringBuilder.append("到付:").append(dPay).append("-->").append(daoPay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("到付"); @@ -3577,7 +3595,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal yuePay = openOrderDTO.getYuePay(); BigDecimal yPay = waybillEntity.getYPay(); - if(yPay.compareTo(yuePay) != 0){ + if (yPay.compareTo(yuePay) != 0) { // stringBuilder.append("月结:").append(yPay).append("-->").append(yuePay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("月结"); @@ -3588,7 +3606,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal huiPay = openOrderDTO.getHuiPay(); BigDecimal hPay = waybillEntity.getHPay(); - if(hPay.compareTo(huiPay) != 0){ + if (hPay.compareTo(huiPay) != 0) { // stringBuilder.append("回付:").append(hPay).append("-->").append(huiPay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("回付"); @@ -3599,7 +3617,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { BigDecimal newthirdOperationFee = openOrderDTO.getThirdOperationFee(); BigDecimal thirdOperationFee = waybillEntity.getThirdOperationFee(); - if(thirdOperationFee.compareTo(newthirdOperationFee) != 0){ + if (thirdOperationFee.compareTo(newthirdOperationFee) != 0) { // stringBuilder.append("三方操作费:").append(thirdOperationFee).append("-->").append(newthirdOperationFee).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("三方操作费"); @@ -3610,75 +3628,75 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newdeliveryWay = openOrderDTO.getDeliveryWay(); String deliveryWay = waybillEntity.getDeliveryWay(); - if(!ObjectUtil.equals(deliveryWay,newdeliveryWay)){ + if (!ObjectUtil.equals(deliveryWay, newdeliveryWay)) { // stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("送货方式"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY,deliveryWay)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY,newdeliveryWay)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY, deliveryWay)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_DELIVERY_WAY, newdeliveryWay)); msgList.add(editOrderMsgVO); } String newurgency = openOrderDTO.getUrgency(); String urgency = waybillEntity.getUrgency(); - if(!ObjectUtil.equals(urgency,newurgency)){ + if (!ObjectUtil.equals(urgency, newurgency)) { // stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("紧急度"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_URGENCY,urgency)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_URGENCY,newurgency)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_URGENCY, urgency)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_URGENCY, newurgency)); msgList.add(editOrderMsgVO); } String newreceipt = openOrderDTO.getReceipt(); String receipt = waybillEntity.getReceipt(); - if(!ObjectUtil.equals(receipt,newreceipt)){ + if (!ObjectUtil.equals(receipt, newreceipt)) { // stringBuilder.append("回单方式:").append(receipt).append("-->").append(newreceipt).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("回单方式"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_RECEIPT,receipt)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_RECEIPT,newreceipt)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_RECEIPT, receipt)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_RECEIPT, newreceipt)); msgList.add(editOrderMsgVO); } String newtransportType = openOrderDTO.getTransportType(); String transportType = waybillEntity.getTransportType(); - if(!ObjectUtil.equals(transportType,newtransportType)){ + if (!ObjectUtil.equals(transportType, newtransportType)) { // stringBuilder.append("运输方式:").append(transportType).append("-->").append(newtransportType).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("运输方式"); - editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE,transportType)); - editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE,newtransportType)); + editOrderMsgVO.setOldValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE, transportType)); + editOrderMsgVO.setNewValue(DictBizCache.getValue(DictBizConstant.OPEN_ORDER_TRANSPORT_TYPE, newtransportType)); msgList.add(editOrderMsgVO); } Integer newreceiptNum = openOrderDTO.getReceiptNum(); Integer receiptNum = waybillEntity.getReceiptNum(); - if(!ObjectUtil.equals(receiptNum,newreceiptNum)){ + if (!ObjectUtil.equals(receiptNum, newreceiptNum)) { // stringBuilder.append("回单数量:").append(receiptNum).append("-->").append(newreceiptNum).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("回单数量"); - editOrderMsgVO.setOldValue(receiptNum+""); - editOrderMsgVO.setNewValue(newreceiptNum+""); + editOrderMsgVO.setOldValue(receiptNum + ""); + editOrderMsgVO.setNewValue(newreceiptNum + ""); msgList.add(editOrderMsgVO); } BigDecimal newrebate = openOrderDTO.getRebate(); BigDecimal rebate = waybillEntity.getRebate(); - if(!Objects.isNull(rebate)){ - if(rebate.compareTo(newrebate) != 0){ + if (!Objects.isNull(rebate)) { + if (rebate.compareTo(newrebate) != 0) { // stringBuilder.append("回扣:").append(rebate).append("-->").append(newrebate).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("回扣"); - editOrderMsgVO.setOldValue(rebate+""); - editOrderMsgVO.setNewValue(newrebate+""); + editOrderMsgVO.setOldValue(rebate + ""); + editOrderMsgVO.setNewValue(newrebate + ""); msgList.add(editOrderMsgVO); } } String newRemark = openOrderDTO.getRemark(); String remark = waybillEntity.getRemark(); - if(!ObjectUtil.equals(remark,newRemark)){ + if (!ObjectUtil.equals(remark, newRemark)) { stringBuilder.append("备注:").append(remark).append("-->").append(newRemark).append(";"); EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO(); editOrderMsgVO.setItemName("备注"); @@ -3710,7 +3728,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newDeparture = openOrderDTO.getDeparture(); String departure = waybillEntity.getDeparture(); - if(!ObjectUtil.equals(newDeparture,departure)){ + if (!ObjectUtil.equals(newDeparture, departure)) { stringBuilder.append("发站:").append(departure).append("-->").append(newDeparture).append(";"); waybillEntity.setDeparture(newDeparture); waybillEntity.setDepartureCode(openOrderDTO.getDepartureCode()); @@ -3718,36 +3736,36 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newPickupCompleteOrNot = openOrderDTO.getPickupCompleteOrNot(); Integer pickupCompleteOrNot = waybillEntity.getPickupCompleteOrNot(); - if(!ObjectUtil.equals(newPickupCompleteOrNot,pickupCompleteOrNot)){ - stringBuilder.append("提货是否整车:").append(pickupCompleteOrNot==1?"是":"否").append("-->").append(newPickupCompleteOrNot==1?"是":"否").append(";"); + if (!ObjectUtil.equals(newPickupCompleteOrNot, pickupCompleteOrNot)) { + stringBuilder.append("提货是否整车:").append(pickupCompleteOrNot == 1 ? "是" : "否").append("-->").append(newPickupCompleteOrNot == 1 ? "是" : "否").append(";"); waybillEntity.setPickupCompleteOrNot(newPickupCompleteOrNot); } Integer newTrunklineCompleteOrNot = openOrderDTO.getTrunklineCompleteOrNot(); Integer trunklineCompleteOrNot = waybillEntity.getTrunklineCompleteOrNot(); - if(!ObjectUtil.equals(newTrunklineCompleteOrNot,trunklineCompleteOrNot)){ - stringBuilder.append("干线是否整车:").append(trunklineCompleteOrNot==1?"是":"否").append("-->").append(newTrunklineCompleteOrNot==1?"是":"否").append(";"); + if (!ObjectUtil.equals(newTrunklineCompleteOrNot, trunklineCompleteOrNot)) { + stringBuilder.append("干线是否整车:").append(trunklineCompleteOrNot == 1 ? "是" : "否").append("-->").append(newTrunklineCompleteOrNot == 1 ? "是" : "否").append(";"); waybillEntity.setTrunklineCompleteOrNot(newTrunklineCompleteOrNot); } String newTrunklineVehicleType = openOrderDTO.getTrunklineVehicleType(); String trunklineVehicleType = waybillEntity.getTrunklineVehicleType(); - if(!ObjectUtil.equals(newTrunklineVehicleType,trunklineVehicleType)){ - stringBuilder.append("干线车型:").append(DictBizCache.getValue("price_vehicle_type",trunklineVehicleType)).append("-->").append(DictBizCache.getValue("price_vehicle_type",newTrunklineVehicleType)).append(";"); + if (!ObjectUtil.equals(newTrunklineVehicleType, trunklineVehicleType)) { + stringBuilder.append("干线车型:").append(DictBizCache.getValue("price_vehicle_type", trunklineVehicleType)).append("-->").append(DictBizCache.getValue("price_vehicle_type", newTrunklineVehicleType)).append(";"); waybillEntity.setTrunklineVehicleType(newTrunklineVehicleType); } String newPickupVehicleType = openOrderDTO.getPickupVehicleType(); String pickupVehicleType = waybillEntity.getPickupVehicleType(); - if(!ObjectUtil.equals(newPickupVehicleType,pickupVehicleType)){ - stringBuilder.append("提货车型:").append(DictBizCache.getValue("price_vehicle_type",pickupVehicleType)).append("-->").append(DictBizCache.getValue("price_vehicle_type",newPickupVehicleType)).append(";"); + if (!ObjectUtil.equals(newPickupVehicleType, pickupVehicleType)) { + stringBuilder.append("提货车型:").append(DictBizCache.getValue("price_vehicle_type", pickupVehicleType)).append("-->").append(DictBizCache.getValue("price_vehicle_type", newPickupVehicleType)).append(";"); waybillEntity.setPickupVehicleType(newPickupVehicleType); } String newDestination = openOrderDTO.getDestination(); String destination = waybillEntity.getDestination(); - if (!ObjectUtil.equals(destination,newDestination)) { + if (!ObjectUtil.equals(destination, newDestination)) { stringBuilder.append("到站:").append(destination).append("-->").append(newDestination).append(";"); waybillEntity.setDestination(newDestination); waybillEntity.setDestinationCode(openOrderDTO.getDestinationCode()); @@ -3756,7 +3774,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newDestinationWarehouseName = openOrderDTO.getDestinationWarehouseName(); Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); String departureWarehouseName = waybillEntity.getDepartureWarehouseName(); - if (!ObjectUtil.equals(destinationWarehouseId,newDestinationWarehouseId)) { + if (!ObjectUtil.equals(destinationWarehouseId, newDestinationWarehouseId)) { stringBuilder.append("目的仓:").append(departureWarehouseName).append("-->").append(newDestinationWarehouseName).append(";"); waybillEntity.setDestinationWarehouseId(newDestinationWarehouseId); waybillEntity.setDestinationWarehouseName(newDestinationWarehouseName); @@ -3766,9 +3784,9 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Long warehouseId = parcelListEntity.getWarehouseId(); parcelListEntity.setAcceptWarehouseId(newDestinationWarehouseId); parcelListEntity.setAcceptWarehouseName(newDestinationWarehouseName); - if(warehouseId.equals(newDestinationWarehouseId)){ + if (warehouseId.equals(newDestinationWarehouseId)) { parcelListEntity.setIsTransfer(0); - }else{ + } else { parcelListEntity.setIsTransfer(1); } }); @@ -3778,28 +3796,28 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newShipper = openOrderDTO.getShipper(); Long shipperId = waybillEntity.getShipperId(); String shipper = waybillEntity.getShipper(); - if (!ObjectUtil.equals(shipperId,newShipperId)) { + if (!ObjectUtil.equals(shipperId, newShipperId)) { stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";"); waybillEntity.setShipper(newShipper); waybillEntity.setShipperId(newShipperId); } String newShipperName = openOrderDTO.getShipperName(); String shipperName = waybillEntity.getShipperName(); - if (!ObjectUtil.equals(shipperName,newShipperName)) { + if (!ObjectUtil.equals(shipperName, newShipperName)) { stringBuilder.append("发货人:").append(shipperName).append("-->").append(newShipperName).append(";"); waybillEntity.setShipperName(newShipperName); } String newShipperMobile = openOrderDTO.getShipperMobile(); String shipperMobile = waybillEntity.getShipperMobile(); - if (!ObjectUtil.equals(shipperMobile,newShipperMobile)) { + if (!ObjectUtil.equals(shipperMobile, newShipperMobile)) { stringBuilder.append("发货人电话:").append(shipperMobile).append("-->").append(newShipperMobile).append(";"); waybillEntity.setShipperMobile(newShipperMobile); } String newShipperAddress = openOrderDTO.getShipperAddress(); String shipperAddress = waybillEntity.getShipperAddress(); - if (!ObjectUtil.equals(shipperAddress,newShipperAddress)) { + if (!ObjectUtil.equals(shipperAddress, newShipperAddress)) { stringBuilder.append("发货人地址:").append(shipperAddress).append("-->").append(newShipperAddress).append(";"); waybillEntity.setShipperAddress(newShipperAddress); } @@ -3808,7 +3826,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsignee = openOrderDTO.getConsignee(); Long consigneeId = waybillEntity.getConsigneeId(); String consignee = waybillEntity.getConsignee(); - if (!ObjectUtil.equals(consigneeId,newConsigneeId)) { + if (!ObjectUtil.equals(consigneeId, newConsigneeId)) { stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); waybillEntity.setConsignee(newConsignee); waybillEntity.setConsigneeId(newConsigneeId); @@ -3816,21 +3834,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newConsigneeName = openOrderDTO.getConsigneeName(); String consigneeName = waybillEntity.getConsigneeName(); - if (!ObjectUtil.equals(consigneeName,newConsigneeName)) { + if (!ObjectUtil.equals(consigneeName, newConsigneeName)) { stringBuilder.append("收货人:").append(consigneeName).append("-->").append(newConsigneeName).append(";"); waybillEntity.setConsigneeName(newConsigneeName); } String newConsigneeMobile = openOrderDTO.getConsigneeMobile(); String consigneeMobile = waybillEntity.getConsigneeMobile(); - if (!ObjectUtil.equals(consigneeMobile,newConsigneeName)) { + if (!ObjectUtil.equals(consigneeMobile, newConsigneeName)) { stringBuilder.append("收货人电话:").append(consigneeMobile).append("-->").append(newConsigneeMobile).append(";"); waybillEntity.setConsigneeMobile(newConsigneeMobile); } String newConsigneeAddress = openOrderDTO.getConsigneeAddress(); String consigneeAddress = waybillEntity.getConsigneeAddress(); - if (!ObjectUtil.equals(consigneeAddress,newConsigneeAddress)) { + if (!ObjectUtil.equals(consigneeAddress, newConsigneeAddress)) { stringBuilder.append("收货人地址:").append(consigneeAddress).append("-->").append(newConsigneeAddress).append(";"); waybillEntity.setConsigneeAddress(newConsigneeAddress); } @@ -3890,7 +3908,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } Integer newNum = waybillDetailDTO.getNum(); Integer num = warehouseWayBillDetail.getNum(); - if (!ObjectUtil.equals(num,newNum)) { + if (!ObjectUtil.equals(num, newNum)) { stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 数量修改").append(num).append("-->").append(newNum).append(";"); warehouseWayBillDetail.setNum(newNum); } @@ -3904,14 +3922,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newChargeType = waybillDetailDTO.getChargeType(); Integer chargeType = warehouseWayBillDetail.getChargeType(); - if (!ObjectUtil.equals(chargeType,newChargeType)) { + if (!ObjectUtil.equals(chargeType, newChargeType)) { stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 计价方式修改").append(chargeType).append("-->").append(newChargeType).append(";"); warehouseWayBillDetail.setChargeType(newChargeType); } BigDecimal newSubtotalFreight = waybillDetailDTO.getSubtotalFreight(); BigDecimal subtotalFreight = warehouseWayBillDetail.getSubtotalFreight(); - if(subtotalFreight.compareTo(newSubtotalFreight) != 0){ + if (subtotalFreight.compareTo(newSubtotalFreight) != 0) { stringBuilder.append("明细更新:").append(warehouseWayBillDetail.getProductName()).append(" 运费小计修改").append(subtotalFreight).append("-->").append(newSubtotalFreight).append(";"); warehouseWayBillDetail.setSubtotalFreight(newSubtotalFreight); } @@ -3925,7 +3943,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { Integer newTotalCount = openOrderDTO.getTotalCount(); Integer totalCount = waybillEntity.getTotalCount(); - if (!ObjectUtil.equals(totalCount,newTotalCount)) { + if (!ObjectUtil.equals(totalCount, newTotalCount)) { stringBuilder.append("货物总数:").append(totalCount).append("-->").append(newTotalCount).append(";"); waybillEntity.setTotalCount(newTotalCount); } @@ -4002,14 +4020,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newPayType = openOrderDTO.getPayType(); String payType = waybillEntity.getPayType(); - if (!ObjectUtil.equals(payType,newPayType)) { + if (!ObjectUtil.equals(payType, newPayType)) { stringBuilder.append("支付方式:").append(payType).append("-->").append(newPayType).append(";"); waybillEntity.setPayType(newPayType); } String newPayWay = openOrderDTO.getPayWay(); String payWay = waybillEntity.getPayWay(); - if (!ObjectUtil.equals(payType,newPayType)) { + if (!ObjectUtil.equals(payType, newPayType)) { stringBuilder.append("付款方式:").append(payWay).append("-->").append(newPayWay).append(";"); waybillEntity.setPayWay(newPayWay); } @@ -4051,14 +4069,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String newdeliveryWay = openOrderDTO.getDeliveryWay(); String deliveryWay = waybillEntity.getDeliveryWay(); - if (!ObjectUtil.equals(deliveryWay,newdeliveryWay)) { + if (!ObjectUtil.equals(deliveryWay, newdeliveryWay)) { stringBuilder.append("送货方式:").append(deliveryWay).append("-->").append(newdeliveryWay).append(";"); waybillEntity.setDeliveryWay(newdeliveryWay); } String newurgency = openOrderDTO.getUrgency(); String urgency = waybillEntity.getUrgency(); - if (!ObjectUtil.equals(urgency,newurgency)) { + if (!ObjectUtil.equals(urgency, newurgency)) { stringBuilder.append("紧急度:").append(urgency).append("-->").append(newurgency).append(";"); waybillEntity.setUrgency(newurgency); } @@ -4094,7 +4112,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } String newRemark = openOrderDTO.getRemark(); String remark = waybillEntity.getRemark(); - if(!ObjectUtil.equals(remark,newRemark)){ + if (!ObjectUtil.equals(remark, newRemark)) { stringBuilder.append("备注:").append(remark).append("-->").append(newRemark).append(";"); waybillEntity.setRemark(newRemark); }