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 ab7ff219e..822cc8771 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 @@ -42,6 +42,9 @@ public interface RabbitConstant { String UNLOAD_CAR_COM_INFO_QUEUE = "unload_car_com_info_quere"; String UNLOAD_CAR_COM_INFO_EXCHANGE = "unload_car_com_info_exchange" + ModuleNameConstant.DEVAUTH; String UNLOAD_CAR_COM_INFO_ROUTING = "unload_car_com_info_routing "; + String HWY_UNLOAD_CAR_COM_INFO_QUEUE = "hwy_unload_car_com_info_quere"; + String HWY_UNLOAD_CAR_COM_INFO_EXCHANGE = "hwy_unload_car_com_info_exchange" + ModuleNameConstant.DEVAUTH; + String HWY_UNLOAD_CAR_COM_INFO_ROUTING = "hwy_unload_car_com_info_routing "; String WAYBILL_DATA_QUEUE = "waybill_data_queue" + ModuleNameConstant.DEVAUTH; diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java index 214083578..49789924d 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java @@ -38,6 +38,19 @@ public abstract class FanoutConstants { } + //包件日志 + interface PACKAGNODE{ + + //交换机 + String EXCHANGE = "fanout.trunkline.packagenode" + ModuleNameConstant.DEVAUTH; + + interface QUEUE { + + String PACKAGE_SIGN = "fanout.trunkline.packagenode.statisticsdata.packagesign" + ModuleNameConstant.DEVAUTH; + + } + + } } diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java index 63c14937e..bb8f7f507 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java @@ -38,6 +38,10 @@ public abstract class FactoryDataConstants { * 工厂数据转暂存单 */ String ADVANCE_ORDER = "factory.data.exchange.topic.advanceOrder" + DEVAUTH; + /** + * 工厂数据转暂存单-欧派 + */ + String ADVANCE_ORDER_OUPAI = "factory.data.exchange.topic.advanceOrder.oupai" + DEVAUTH; } @@ -51,6 +55,10 @@ public abstract class FactoryDataConstants { * 工厂数据转暂存单 */ String ADVANCE_ORDER = "factory.data.queue.advanceOrder" + DEVAUTH; + /** + * 工厂数据转暂存单 + */ + String ADVANCE_ORDER_OUPAI = "factory.data.queue.advanceOrder.oupai" + DEVAUTH; /** * 志邦作业节点数据推送 @@ -68,6 +76,7 @@ public abstract class FactoryDataConstants { /** * 林氏工厂订单 */ + String LINSY_NODE_DATA_PUSH = "factory.data.queue.linsy.nodeDataPush" + DEVAUTH; String LINSY_FACTORY_ORDER = "factory.data.queue.linsy.factoryOrder" + DEVAUTH; /** * 金牌工厂订单 @@ -111,6 +120,7 @@ public abstract class FactoryDataConstants { /** * 林氏工厂订单 */ + String LINSY_NODE_DATA_PUSH = "linsy.nodeDataPush" + DEVAUTH; String LINSY_FACTORY_ORDER = "linsy.factoryOrder" + DEVAUTH; /** * 金牌工厂订单 diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index 5d0971e6f..6cea3aa0c 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.Map; +import java.util.Set; /** * 在库订单包件清单 Feign接口类 @@ -38,15 +39,15 @@ import java.util.Map; * @since 2023-06-13 */ @FeignClient( - value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME + value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME ) public interface IDistributionParcelListClient { - String API_PREFIX = "/client"; - String TOP = API_PREFIX + "/top1"; - String TOPPARCELLIST = API_PREFIX + "/getParcelList"; - String GETPARCELLISTID = API_PREFIX + "/getParcelListId"; - String GETPARCELLISTINFO = API_PREFIX + "/getParcelListInfo"; + String API_PREFIX = "/client"; + String TOP = API_PREFIX + "/top1"; + String TOPPARCELLIST = API_PREFIX + "/getParcelList"; + String GETPARCELLISTID = API_PREFIX + "/getParcelListId"; + String GETPARCELLISTINFO = API_PREFIX + "/getParcelListInfo"; @PostMapping(TOPPARCELLIST) List getParcelList(@RequestBody DistributionParcelListEntity parcelListEntity); @@ -55,127 +56,137 @@ public interface IDistributionParcelListClient { @GetMapping(GETPARCELLISTID) DistributionParcelListEntity getParcelListId(@RequestParam String id); - /** - * 获取在库订单包件清单列表 - * - * @param current 页号 - * @param size 页数 - * @return BladePage - */ - @GetMapping(TOP) - BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); - - @GetMapping(API_PREFIX+"/findByPacketBarCode") + /** + * 获取在库订单包件清单列表 + * + * @param current 页号 + * @param size 页数 + * @return BladePage + */ + @GetMapping(TOP) + BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + + @GetMapping(API_PREFIX + "/findByPacketBarCode") List findByPacketBarCode(@RequestParam String unitNo); - @GetMapping(API_PREFIX+"/findByPacketBarCodeAndWarehouseId") - DistributionParcelListEntity findByPacketBarCodeAndWarehouseId(@RequestParam String unitNo,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findByPacketBarCodeAndWarehouseId") + DistributionParcelListEntity findByPacketBarCodeAndWarehouseId(@RequestParam String unitNo, @RequestParam Long warehouseId); - @PostMapping(API_PREFIX+"/findByPacketBarCodesAndWarehouseId") + @PostMapping(API_PREFIX + "/findByPacketBarCodesAndWarehouseId") List findByPacketBarCodesAndWarehouseId(@RequestBody OrderPackageDTO orderPackageDTO); - @PostMapping(API_PREFIX+"/addBatch") + @PostMapping(API_PREFIX + "/addBatch") boolean addBatch(@RequestBody List parcelListEntityList); - @PostMapping(API_PREFIX+"/add") + @PostMapping(API_PREFIX + "/add") boolean add(@RequestBody DistributionParcelListEntity entity); - @GetMapping(API_PREFIX+"/submitNumByOrderIdAndName") + @GetMapping(API_PREFIX + "/submitNumByOrderIdAndName") boolean submitNumByOrderIdAndName(@RequestParam Long articleId, @RequestParam String productName, @RequestParam Integer num); - @GetMapping(API_PREFIX+"/findEntityListByOrderCode") - List findEntityListByOrderCode(@RequestParam String orderCode,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findEntityListByOrderCode") + List findEntityListByOrderCode(@RequestParam String orderCode, @RequestParam Long warehouseId); + + @GetMapping(API_PREFIX + "/findALLNoUpShelfPackageByOrderCode") + List findALLNoUpShelfPackageByOrderCode(@RequestParam String orderCode, @RequestParam Long warehouseId); - @GetMapping(API_PREFIX+"/findALLNoUpShelfPackageByOrderCode") - List findALLNoUpShelfPackageByOrderCode(@RequestParam String orderCode,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/updatePackageGroundingStatus") + void updatePackageGroundingStatus(@RequestParam String orderPackageCode, @RequestParam String groundingStatus, @RequestParam Long warehouseId); - @GetMapping(API_PREFIX+"/updatePackageGroundingStatus") - void updatePackageGroundingStatus(@RequestParam String orderPackageCode, @RequestParam String groundingStatus,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/getListByOrderCodeAndgroundingStatus") + List getListByOrderCodeAndgroundingStatus(@RequestParam String orderCode, @RequestParam String groundingStatus, @RequestParam Long warehouseId); - @GetMapping(API_PREFIX+"/getListByOrderCodeAndgroundingStatus") - List getListByOrderCodeAndgroundingStatus(@RequestParam String orderCode, @RequestParam String groundingStatus,@RequestParam Long warehouseId); - @PostMapping(API_PREFIX+"/update") + @PostMapping(API_PREFIX + "/update") void update(@RequestBody DistributionParcelListEntity distributionParcelListEntity); - @GetMapping(API_PREFIX+"/SumEntityZkByOrderId") - Integer SumEntityByOrderId(@RequestParam Long orderId,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/SumEntityZkByOrderId") + Integer SumEntityByOrderId(@RequestParam Long orderId, @RequestParam Long warehouseId); /** * 查询订单下所有包件信息 + * * @param id * @return */ - @GetMapping(API_PREFIX+"/getParcelListByStockArticleId") + @GetMapping(API_PREFIX + "/getParcelListByStockArticleId") List getParcelListByStockArticleId(@RequestParam Long id); - @PostMapping(API_PREFIX+"/addReturnId") + @PostMapping(API_PREFIX + "/addReturnId") Long addReturnId(@RequestBody DistributionParcelListEntity entity); - @GetMapping(API_PREFIX+"/updateStockArticleIdByOrderCode") + @GetMapping(API_PREFIX + "/updateStockArticleIdByOrderCode") void updateStockArticleIdByOrderCode(@RequestParam Long orderId, @RequestParam String orderCode); @PostMapping(GETPARCELLISTINFO) List getParcelListInfo(@RequestBody DistributionParcelListVO parcelListVO); - @GetMapping(API_PREFIX+"/findByOrderPackageCodeAndStatus") + @GetMapping(API_PREFIX + "/findByOrderPackageCodeAndStatus") DistributionParcelListEntity findByOrderPackageCodeAndStatus(@RequestParam String orderPackageCode); - @GetMapping(API_PREFIX+"/updateOrderPackageCodeById") - void updateOrderPackageCodeById(@RequestParam Long packageId, @RequestParam String orderPackageStatus); + @GetMapping(API_PREFIX + "/updateOrderPackageCodeById") + void updateOrderPackageCodeById(@RequestParam Long packageId, @RequestParam String orderPackageStatus); /** * 根据包条码和仓库ID查询订单相关信息 + * * @param orderPackCode 包条码 - * @param warehouseId 仓库ID + * @param warehouseId 仓库ID * @return */ - @GetMapping(API_PREFIX+"/findByOrderInfoByOrderPackageCodeAndWarehouseId") - Map findByOrderInfoByOrderPackageCodeAndWarehouseId(@RequestParam String orderPackCode,@RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findByOrderInfoByOrderPackageCodeAndWarehouseId") + Map findByOrderInfoByOrderPackageCodeAndWarehouseId(@RequestParam String orderPackCode, @RequestParam Long warehouseId); - @GetMapping(API_PREFIX+"/queryOrderByOrderPackageCode") - R queryOrderByOrderPackageCode( @RequestParam String orderPackageCode); - @GetMapping(API_PREFIX+"/updateTransferStatus") - void updateTransferStatus(@RequestParam String orderCode, @RequestParam Long warehouseId, @RequestParam Integer isTransfer); + @GetMapping(API_PREFIX + "/queryOrderByOrderPackageCode") + R queryOrderByOrderPackageCode(@RequestParam String orderPackageCode); - @GetMapping(API_PREFIX+"/updateEntityByOpenOrder") + @GetMapping(API_PREFIX + "/updateTransferStatus") + void updateTransferStatus(@RequestParam String orderCode, @RequestParam Long warehouseId, @RequestParam Integer isTransfer); + + @GetMapping(API_PREFIX + "/updateEntityByOpenOrder") void updateEntityByOpenOrder(@RequestParam Long advanceId, @RequestParam Long waybillId); - @GetMapping(API_PREFIX+"/findByWaybillNumber") + @GetMapping(API_PREFIX + "/findByWaybillNumber") List findByWaybillNumber(@RequestParam String waybillNumber); - @GetMapping(API_PREFIX+"/findEntityListByOrderCodeAndStatus") - List findEntityListByOrderCodeAndStatus(@RequestParam String orderCode, @RequestParam Long warehouseId, @RequestParam String packageStatus,@RequestParam String waybillNo); + @GetMapping(API_PREFIX + "/findEntityListByOrderCodeAndStatus") + List findEntityListByOrderCodeAndStatus(@RequestParam String orderCode, @RequestParam Long warehouseId, @RequestParam String packageStatus, @RequestParam String waybillNo); - @GetMapping(API_PREFIX+"/getListByOrderPackageCode") + @GetMapping(API_PREFIX + "/getListByOrderPackageCode") List getListByOrderPackageCode(@RequestParam String orderPackageCode); - @GetMapping(API_PREFIX+"/findAllStockListByOrderPackageCode") + @GetMapping(API_PREFIX + "/findAllStockListByOrderPackageCode") List findAllStockListByOrderPackageCode(String orderPackageCode); - @PostMapping(API_PREFIX+"/updatePackageStatus") + @PostMapping(API_PREFIX + "/updatePackageStatus") void updatePackageStatus(@RequestParam List orderPackageCodes, @RequestParam Long warehouseId, @RequestParam String packageStatus); - @PostMapping(API_PREFIX+"/updateList") + @PostMapping(API_PREFIX + "/updateList") void updateList(@RequestBody List updateParcelList); - @PostMapping(API_PREFIX+"/updateFreezeStatusByWaybillIds") - void updateFreezeStatusByWaybillIds(@RequestBody List waybillIds); + @PostMapping(API_PREFIX + "/updateFreezeStatusByWaybillIds") + void updateFreezeStatusByWaybillIds(@RequestBody List waybillIds); - @PostMapping(API_PREFIX+"/updateUnFreezeStatusByWaybillIds") + @PostMapping(API_PREFIX + "/updateUnFreezeStatusByWaybillIds") void updateUnFreezeStatusByWaybillIds(@RequestBody List waybillIds); - @PostMapping(API_PREFIX+"/clearParceListWaybillByAdvanceIds") + @PostMapping(API_PREFIX + "/clearParceListWaybillByAdvanceIds") void clearParceListWaybillByAdvanceIds(@RequestBody List advanceIds); - @GetMapping(API_PREFIX+"/findListByWaybillId") + @GetMapping(API_PREFIX + "/findListByWaybillId") List findListByWaybillId(@RequestParam Long waybillId); - @PostMapping(API_PREFIX+"/findPackagesByAdvanceIdsAndNoStock") - List findPackagesByAdvanceIdsAndNoStock(@RequestParam List advanceIds, @RequestParam Long warehouseId); + @PostMapping(API_PREFIX + "/findPackagesByAdvanceIdsAndNoStock") + List findPackagesByAdvanceIdsAndNoStock(@RequestParam List advanceIds, @RequestParam Long warehouseId); - @PostMapping(API_PREFIX+"/findAllOrderCodesByAdvanceIds") + @PostMapping(API_PREFIX + "/findAllOrderCodesByAdvanceIds") List findAllOrderCodesAndDeleteByAdvanceIds(@RequestParam List advanceIds, @RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findPackageCodeByCodes") + Map> findPackageCodeByCodes(@RequestBody Set keySet); + + @PostMapping(API_PREFIX + "/saveorUpdateBatchByOP") + void saveorUpdateBatchByOP(@RequestBody List parcelListEntityList); + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java index d1181f7ee..cc430e8ed 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java @@ -24,6 +24,7 @@ import com.logpm.distribution.vo.UpDownStockupAreaVO; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -39,44 +40,44 @@ import java.util.Map; * @since 2023-06-13 */ @FeignClient( - value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME + value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME ) public interface IDistributionStockArticleClient { - String API_PREFIX = "/client"; - String TOP = API_PREFIX + "/top12"; - String GETSTOCKARTICLEINFO = API_PREFIX + "/getStockArticleInfo"; + String API_PREFIX = "/client"; + String TOP = API_PREFIX + "/top12"; + String GETSTOCKARTICLEINFO = API_PREFIX + "/getStockArticleInfo"; - /** - * 获取配送在库订单列表 - * - * @param current 页号 - * @param size 页数 - * @return BladePage - */ - @GetMapping(TOP) - BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + /** + * 获取配送在库订单列表 + * + * @param current 页号 + * @param size 页数 + * @return BladePage + */ + @GetMapping(TOP) + BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); @PostMapping(API_PREFIX + "/addData") - Long addData(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); + Long addData(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); @GetMapping(API_PREFIX + "/findByAdvanceId") - DistributionStockArticleEntity findByAdvanceId(@RequestParam Integer advanceId); + DistributionStockArticleEntity findByAdvanceId(@RequestParam Integer advanceId); @PostMapping(API_PREFIX + "/saveOrUpdate") - void saveOrUpdate(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); + void saveOrUpdate(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); @GetMapping(API_PREFIX + "/addHandQuantity") - void addHandQuantity(@RequestParam("id") Long id,@RequestParam("num") int num); + void addHandQuantity(@RequestParam("id") Long id, @RequestParam("num") int num); @GetMapping(API_PREFIX + "/findByOrderSelfNum") - DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String orderCode,@RequestParam Long warehouseId); + DistributionStockArticleEntity findByOrderSelfNum(@RequestParam String orderCode, @RequestParam Long warehouseId); @GetMapping(API_PREFIX + "/deleteById") void deleteById(@RequestParam Long orderId); @GetMapping(API_PREFIX + "/submitHandQuantity") - void submitHandQuantity(@RequestParam Integer allNum,@RequestParam Long articleId); + void submitHandQuantity(@RequestParam Integer allNum, @RequestParam Long articleId); @GetMapping(API_PREFIX + "/findListByOrderCodeLike") List findListByOrderCodeLike(@RequestParam String orderCode); @@ -85,15 +86,20 @@ public interface IDistributionStockArticleClient { DistributionStockArticleEntity findStockArticleByOrderCode(@RequestParam String orderCode); @GetMapping(API_PREFIX + "/findEntityByStockArticleId") - DistributionStockArticleEntity findEntityByStockArticleId(@RequestParam Long stockArticleId); + DistributionStockArticleEntity findEntityByStockArticleId(@RequestParam Long stockArticleId); + @GetMapping(API_PREFIX + "/fingListByServiceNumber") - List fingListByServiceNumber(@RequestParam String serviceNumber,@RequestParam Long warehouseId); + List fingListByServiceNumber(@RequestParam String serviceNumber, @RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findListByWaybillNumber") - List findListByWaybillNumber(@RequestParam String waybillNumber); + List findListByWaybillNumber(@RequestParam String waybillNumber); + @GetMapping(API_PREFIX + "/findStockArticleByOrderCodeAndWarehouseId") DistributionStockArticleEntity findStockArticleByOrderCodeAndWarehouseId(@RequestParam String orderCode, @RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/findListByWaybillNumberAndWarehouseId") List findListByWaybillNumberAndWarehouseId(@RequestParam String waybillNumber, @RequestParam Long warehouseId); + @GetMapping(API_PREFIX + "/updateGroundingStatus") void updateGroundingStatus(@RequestParam String orderCode, @RequestParam String groundingStatus, @RequestParam Long warehouseId); @@ -105,35 +111,37 @@ public interface IDistributionStockArticleClient { @GetMapping(API_PREFIX + "/findStockArticleByCodeAndMarketAndWarehouseId") - List findStockArticleByCodeAndMarketAndWarehouseId(@RequestParam String incomingBatch,@RequestParam String marketNames,@RequestParam Long warehouseId); + List findStockArticleByCodeAndMarketAndWarehouseId(@RequestParam String incomingBatch, @RequestParam String marketNames, @RequestParam Long warehouseId); @GetMapping(API_PREFIX + "/findShelfNumByOrderCodeAndWarehouseId") Map findShelfNumByOrderCodeAndWarehouseId(@RequestParam String orderCode, @RequestParam Long warehouseId); @GetMapping(API_PREFIX + "/submitHandleNumByOrderId") - void submitHandleNumByOrderId(@RequestParam Integer subNum, @RequestParam Long articleId); + void submitHandleNumByOrderId(@RequestParam Integer subNum, @RequestParam Long articleId); /** * 查询订单信息数据 + * * @return */ @PostMapping(GETSTOCKARTICLEINFO) - List getStockArticleInfo(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); + List getStockArticleInfo(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); @GetMapping(API_PREFIX + "/updateCustomerInfoByOrderCode") - void updateCustomerInfoByOrderCode(@RequestParam String customerName, @RequestParam String customerPhone, @RequestParam String customerAddress, @RequestParam String orderCode); + void updateCustomerInfoByOrderCode(@RequestParam String customerName, @RequestParam String customerPhone, @RequestParam String customerAddress, @RequestParam String orderCode); @GetMapping(API_PREFIX + "/freezeByOrderCode") - void freezeByOrderCode(@RequestParam String orderCode,@RequestParam String freezeStatus); + void freezeByOrderCode(@RequestParam String orderCode, @RequestParam String freezeStatus); @GetMapping(API_PREFIX + "/addCarsLoadNum") void addCarsLoadNum(@RequestParam Integer planNum, @RequestParam String orderCode, @RequestParam Long warehouseId); @GetMapping(API_PREFIX + "/addIncomingNum") - void addIncomingNum(@RequestParam Long orderId, @RequestParam Integer num); + void addIncomingNum(@RequestParam Long orderId, @RequestParam Integer num); @GetMapping(API_PREFIX + "/updateOrderInfo") - void updateOrderInfo(@RequestParam String orderCode, @RequestParam Long warehouseId); + void updateOrderInfo(@RequestParam String orderCode, @RequestParam Long warehouseId); + @PostMapping(API_PREFIX + "/updateOrdersInfo") void updateOrdersInfo(@RequestBody OrderPackageDTO orderPackageDTO); @@ -147,15 +155,24 @@ public interface IDistributionStockArticleClient { List findListByOrderCode(@RequestParam String orderCode); @GetMapping(API_PREFIX + "/maintenanceOrderStatus") - Boolean maintenanceOrderStatus(String warehouseId); + Boolean maintenanceOrderStatus(String warehouseId); @PostMapping(API_PREFIX + "/updateByBatchId") void updateByBatchId(@RequestBody List stockArticleEntities); @GetMapping(API_PREFIX + "/updateAllOrderTotalNum") - void updateAllOrderTotalNum(@RequestParam String orderCode, @RequestParam Integer total); + void updateAllOrderTotalNum(@RequestParam String orderCode, @RequestParam Integer total); @GetMapping(API_PREFIX + "/maintenanceOrderMall") Boolean maintenanceOrderMall(@RequestParam String orderIds); + + /** + * 全仓更新未预约的在库定单的客户信息 + * + * @param data 更新信息 + * @return + */ + @PostMapping(value = API_PREFIX + "/updateCustomerAllByOrderCode",consumes = MediaType.APPLICATION_JSON_VALUE) + void updateCustomerAllByOrderCode(@RequestBody String data); } diff --git a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java index da57fe852..3cec54208 100644 --- a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java +++ b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java @@ -16,11 +16,14 @@ import java.util.concurrent.ConcurrentHashMap; public class FactoryDataUtil { static Map factorys = new ConcurrentHashMap(); - private FactoryDataUtil(){ + + private FactoryDataUtil() { } + static { factorys.put(BrandEnums.ZB.getValue(), FactoryDataConstants.Mq.RoutingKeys.ZBOM_NODE_DATA_PUSH); + factorys.put(BrandEnums.LINSY.getValue(), FactoryDataConstants.Mq.RoutingKeys.LINSY_NODE_DATA_PUSH); } diff --git a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/PushData.java b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/PushData.java new file mode 100644 index 000000000..280e55086 --- /dev/null +++ b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/PushData.java @@ -0,0 +1,33 @@ +package com.logpm.factorydata.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.logpm.factorydata.enums.BrandEnums; +import com.logpm.factorydata.enums.SignForStatusEnums; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springblade.common.constant.WorkNodeEnums; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 提送数据 + * + * @author zhaoqiaobo + * @create 2024-03-18 0:45 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PushData implements Serializable { + + /** + * 包件 + */ + private String packageCode; + +} diff --git a/blade-service-api/logpm-factory-data-zbom-api/pom.xml b/blade-service-api/logpm-factory-data-zbom-api/pom.xml new file mode 100644 index 000000000..80bc8d10a --- /dev/null +++ b/blade-service-api/logpm-factory-data-zbom-api/pom.xml @@ -0,0 +1,16 @@ + +blade-service-apiorg.springblade3.2.0.RELEASE + 4.0.0 + + com.logpm + logpm-factory-data-zbom-api + ${bladex.project.version} + jar + + 8 + 8 + + + diff --git a/blade-service-api/logpm-factory-data-zbom-api/src/main/java/com/logpm/factorydata/zbom/feign/IFactoryDataZbomClient.java b/blade-service-api/logpm-factory-data-zbom-api/src/main/java/com/logpm/factorydata/zbom/feign/IFactoryDataZbomClient.java new file mode 100644 index 000000000..cfcfb0d66 --- /dev/null +++ b/blade-service-api/logpm-factory-data-zbom-api/src/main/java/com/logpm/factorydata/zbom/feign/IFactoryDataZbomClient.java @@ -0,0 +1,30 @@ +package com.logpm.factorydata.zbom.feign; + +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author zhaoqiaobo + * @create 2024-03-16 15:04 + */ +@FeignClient(value = ModuleNameConstant.LOGPM_FACTORY_DATA_ZBOM_NAME) +public interface IFactoryDataZbomClient { + + String API_PREFIX = "/client/factoryDataZbom"; + String ORDER = API_PREFIX + "/order"; + + + /** + * 保存志邦的订单数据 + * + * @param data + * @return org.springblade.core.tool.api.R + * @author zqb 2024/5/25 + **/ + @PostMapping(ORDER) + R order(@RequestBody String data); + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java new file mode 100644 index 000000000..f07a72b21 --- /dev/null +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java @@ -0,0 +1,17 @@ +package com.logpm.statistics.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class MerchantStatisticsDTO implements Serializable { + + private Integer pageSize; + private Integer pageNum; + + private Long waybillInfoId; + + private Long orderInfoId; + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java new file mode 100644 index 000000000..f86ed09d1 --- /dev/null +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java @@ -0,0 +1,132 @@ +package com.logpm.statistics.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.math.BigDecimal; + +@Data +@TableName("logpm_statistics_distribution_package") +@ApiModel(value = "StatisticsDistributionPackage对象", description = "结算配送包件明细表") +@EqualsAndHashCode(callSuper = true) +public class StatisticsDistributionPackageEntity extends TenantEntity { + + /** + * 预留1 + */ + @ApiModelProperty(value = "预留1") + private String reserve1; + /** + * 预留2 + */ + @ApiModelProperty(value = "预留2") + private String reserve2; + /** + * 预留3 + */ + @ApiModelProperty(value = "预留3") + private String reserve3; + /** + * 预留4 + */ + @ApiModelProperty(value = "预留4") + private String reserve4; + /** + * 预留5 + */ + @ApiModelProperty(value = "预留5") + private String reserve5; + + /** + * 仓库id + */ + @ApiModelProperty(value = "仓库id") + private Long warehouseId; + + /** + * 仓库名称 + */ + @ApiModelProperty(value = "仓库名称") + private String warehouseName; + + /** + * 运单id + */ + @ApiModelProperty(value = "运单id") + private Long waybillId; + + /** + * 运单号 + */ + @ApiModelProperty(value = "运单号") + private String waybillNo; + + /** + * 订单号 + */ + @ApiModelProperty(value = "订单号") + private String orderCode; + + /** + * 包件码 + */ + @ApiModelProperty(value = "包件码") + private String orderPackageCode; + + /** + * 品类名称 + */ + @ApiModelProperty(value = "品类名称") + private String productName; + + /** + * 件数 + */ + @ApiModelProperty(value = "件数") + private Integer totalNum; + + /** + * 重量 + */ + @ApiModelProperty(value = "重量") + private BigDecimal totalWeight; + + @ApiModelProperty(value = "体积") + private BigDecimal totalVolume; + + private BigDecimal openPrice; + private BigDecimal totalPrice; + private BigDecimal deliveryServiceFee; + private BigDecimal deliveryFee; + private BigDecimal deliveryLoadingFee; + private BigDecimal deliverySortingFee; + private BigDecimal deliveryUpfloorFee; + private BigDecimal deliveryMoveFee; + private BigDecimal deliveryDistance; + private BigDecimal deliveryCrossingFee; + private Integer isAftersales; + private BigDecimal aftersalesPrice; + private Integer hasStatement; + private Long statementCreateTime; + private String statementCreateUser; + private Integer isZero; + private BigDecimal realDeliveryServiceFee; + private BigDecimal realDeliveryFee; + private BigDecimal realDeliveryLoadingFee; + private BigDecimal realDeliverySortingFee; + private BigDecimal realDeliveryUpfloorFee; + private BigDecimal realDeliveryMoveFee; + private BigDecimal realDeliveryDistance; + private BigDecimal realDeliveryCrossingFee; + private Integer goodsType; //1 订制品 2零担 3库存品 + private String typeService; //1 商配 2市配 3自提 4三方中转 + + private Long orderInfoId; + + private Integer isSign;//是否签收 0否 1是 + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsOrderInfoEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsOrderInfoEntity.java index 0569f6671..1436a4dd8 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsOrderInfoEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsOrderInfoEntity.java @@ -43,6 +43,12 @@ public class StatisticsOrderInfoEntity extends TenantEntity { private String orderCode; private Long waybillId; private String waybillNo; + private String typeService; + private Integer signStatus;// 签收状态 0未签收 1部分签收 2已签收 + private Integer confirmStatisticsOrder;//0未确认 1已确认 + + private Long waybillInfoId;//运单维度id + private Long statisticsOrderId;//结算单id } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsPackageInfoEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsTrunklinePackageEntity.java similarity index 66% rename from blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsPackageInfoEntity.java rename to blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsTrunklinePackageEntity.java index 6a45b3241..47090521e 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsPackageInfoEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsTrunklinePackageEntity.java @@ -8,13 +8,12 @@ import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; import java.math.BigDecimal; -import java.util.Date; @Data -@TableName("logpm_statistics_package_info") -@ApiModel(value = "StatisticsPackageInfo对象", description = "结算包件明细表") +@TableName("logpm_statistics_trunkline_package") +@ApiModel(value = "StatisticsTrunklinePackage对象", description = "结算干线包件明细表") @EqualsAndHashCode(callSuper = true) -public class StatisticsPackageInfoEntity extends TenantEntity { +public class StatisticsTrunklinePackageEntity extends TenantEntity { /** * 预留1 @@ -103,22 +102,6 @@ public class StatisticsPackageInfoEntity extends TenantEntity { private BigDecimal totalPrice; private BigDecimal pickupFee; private BigDecimal freightFee; - private Date incomingTime; - private Date outingTime; - private String warehouseFeeInterval; - private BigDecimal warehouseServiceFee; - private BigDecimal warehouseFee; - private BigDecimal warehouseManageFee; - private BigDecimal warehouseSortingFee; - private BigDecimal warehouseOperatingFee; - private BigDecimal deliveryServiceFee; - private BigDecimal deliveryFee; - private BigDecimal deliveryLoadingFee; - private BigDecimal deliverySortingFee; - private BigDecimal deliveryUpfloorFee; - private BigDecimal deliveryMoveFee; - private BigDecimal deliveryDistance; - private BigDecimal deliveryCrossingFee; private BigDecimal installFee; private BigDecimal quotationFee; private BigDecimal claimingValue; @@ -137,20 +120,6 @@ public class StatisticsPackageInfoEntity extends TenantEntity { private Integer isZero; private BigDecimal realPickupFee; private BigDecimal realFreightFee; - private String realWarehouseFeeInterval; - private BigDecimal realWarehouseServiceFee; - private BigDecimal realWarehouseFee; - private BigDecimal realWarehouseManageFee; - private BigDecimal realWarehouseSortingFee; - private BigDecimal realWarehouseOperatingFee; - private BigDecimal realDeliveryServiceFee; - private BigDecimal realDeliveryFee; - private BigDecimal realDeliveryLoadingFee; - private BigDecimal realDeliverySortingFee; - private BigDecimal realDeliveryUpfloorFee; - private BigDecimal realDeliveryMoveFee; - private BigDecimal realDeliveryDistance; - private BigDecimal realDeliveryCrossingFee; private BigDecimal realInstallFee; private BigDecimal realQuotationFee; private BigDecimal realClaimingValue; @@ -165,4 +134,6 @@ public class StatisticsPackageInfoEntity extends TenantEntity { private Integer goodsType; //1 订制品 2零担 3库存品 private String typeService; //1 商配 2市配 3自提 4三方中转 + private Long orderInfoId; + } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWarehousePackageEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWarehousePackageEntity.java new file mode 100644 index 000000000..72af3167a --- /dev/null +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWarehousePackageEntity.java @@ -0,0 +1,130 @@ +package com.logpm.statistics.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +@TableName("logpm_statistics_warehouse_package") +@ApiModel(value = "StatisticsWarehousePackage对象", description = "结算仓库包件明细表") +@EqualsAndHashCode(callSuper = true) +public class StatisticsWarehousePackageEntity extends TenantEntity { + + /** + * 预留1 + */ + @ApiModelProperty(value = "预留1") + private String reserve1; + /** + * 预留2 + */ + @ApiModelProperty(value = "预留2") + private String reserve2; + /** + * 预留3 + */ + @ApiModelProperty(value = "预留3") + private String reserve3; + /** + * 预留4 + */ + @ApiModelProperty(value = "预留4") + private String reserve4; + /** + * 预留5 + */ + @ApiModelProperty(value = "预留5") + private String reserve5; + + /** + * 仓库id + */ + @ApiModelProperty(value = "仓库id") + private Long warehouseId; + + /** + * 仓库名称 + */ + @ApiModelProperty(value = "仓库名称") + private String warehouseName; + + /** + * 运单id + */ + @ApiModelProperty(value = "运单id") + private Long waybillId; + + /** + * 运单号 + */ + @ApiModelProperty(value = "运单号") + private String waybillNo; + + /** + * 订单号 + */ + @ApiModelProperty(value = "订单号") + private String orderCode; + + /** + * 包件码 + */ + @ApiModelProperty(value = "包件码") + private String orderPackageCode; + + /** + * 品类名称 + */ + @ApiModelProperty(value = "品类名称") + private String productName; + + /** + * 件数 + */ + @ApiModelProperty(value = "件数") + private Integer totalNum; + + /** + * 重量 + */ + @ApiModelProperty(value = "重量") + private BigDecimal totalWeight; + + @ApiModelProperty(value = "体积") + private BigDecimal totalVolume; + + private BigDecimal openPrice; + private BigDecimal totalPrice; + private Date incomingTime; + private Date outingTime; + private String warehouseFeeInterval; + private BigDecimal warehouseServiceFee; + private BigDecimal warehouseFee; + private BigDecimal warehouseManageFee; + private BigDecimal warehouseSortingFee; + private BigDecimal warehouseOperatingFee; + private Integer isAftersales; + private BigDecimal aftersalesPrice; + private Integer hasStatement; + private Long statementCreateTime; + private String statementCreateUser; + private Integer isZero; + private String realWarehouseFeeInterval; + private BigDecimal realWarehouseServiceFee; + private BigDecimal realWarehouseFee; + private BigDecimal realWarehouseManageFee; + private BigDecimal realWarehouseSortingFee; + private BigDecimal realWarehouseOperatingFee; + + private Integer goodsType; //1 订制品 2零担 3库存品 + private String typeService; //1 商配 2市配 3自提 4三方中转 + + private Long orderInfoId; + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWaybillInfoEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWaybillInfoEntity.java new file mode 100644 index 000000000..40a2e0246 --- /dev/null +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsWaybillInfoEntity.java @@ -0,0 +1,48 @@ +package com.logpm.statistics.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +@Data +@TableName("logpm_statistics_waybill_info") +@ApiModel(value = "StatisticsWaybillInfo对象", description = "结算运单明细表") +@EqualsAndHashCode(callSuper = true) +public class StatisticsWaybillInfoEntity extends TenantEntity { + + /** + * 预留1 + */ + @ApiModelProperty(value = "预留1") + private String reserve1; + /** + * 预留2 + */ + @ApiModelProperty(value = "预留2") + private String reserve2; + /** + * 预留3 + */ + @ApiModelProperty(value = "预留3") + private String reserve3; + /** + * 预留4 + */ + @ApiModelProperty(value = "预留4") + private String reserve4; + /** + * 预留5 + */ + @ApiModelProperty(value = "预留5") + private String reserve5; + + private Long waybillId; + private String waybillNo; + private String typeService; + + private Integer confirmStatisticsOrder;//0未确认 1部分确认 2已确认 + +} diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/StatisticsWaybillInfoVO.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/StatisticsWaybillInfoVO.java new file mode 100644 index 000000000..1fa7beb73 --- /dev/null +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/vo/StatisticsWaybillInfoVO.java @@ -0,0 +1,117 @@ +package com.logpm.statistics.vo; + +import com.logpm.statistics.entity.StatisticsWaybillInfoEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class StatisticsWaybillInfoVO extends StatisticsWaybillInfoEntity { + + private String brand; + private String orderNo; + private String shipper; + private String shipperPerson; + private String shipperMobile; + private String shipperAddress; + private String consignee; + private String consigneePerson; + private String consigneeMobile; + private String consigneeAddress; + private String departure; + private String destination; + private String departureWarehouseName; + private String destinationWarehouseName; + private String deliveryMethod; + private String customerTrain; + private String receiptStatus; + private String waybillRemark; + private String statisticsFang; + private String payType; + private String payWay; + private String isAftersales; + private BigDecimal aftersalesFee; + private BigDecimal totalStatementFee; + private String statementStatus; + private BigDecimal hasStatementFee; + private String statementCreateUser; + private Integer isChanges; + private BigDecimal changesFee; + private String changesItems; + private String changesRemark; + private String changesTime;//最晚一条 + private Integer signNum; + private Date signTime;//最晚一条 + private String statisticsStatus;//结算状态 +// private String statisticsStatus;//结算状态 + + private String storeBusiness; + private String waybillStatus; + private Integer isEdit; + private Integer isCheck; + private Date openTime; + private String goodsName; + private String goodsTypeNum; + private Integer productTypeNum; + private Integer totalcount; + private BigDecimal totalWeight; + private BigDecimal totalVolume; + private BigDecimal totalFee; + private BigDecimal openFee; + private BigDecimal pickupFee; + private BigDecimal realPickupFee; + private BigDecimal freightFee; + private BigDecimal realFreightFee; + private BigDecimal installFee; + private BigDecimal realInstallFee; + private BigDecimal quotationFee; + private BigDecimal realQuotationFee; + private BigDecimal claimingValue; + private BigDecimal realClaimingValue; + private BigDecimal otherFee; + private BigDecimal realOtherFee; + private BigDecimal returnFee; + private BigDecimal realReturnFee; + private BigDecimal thirdOprationFee; + private BigDecimal realThirdOprationFee; + private BigDecimal xPay; + private BigDecimal realXPay; + private BigDecimal dPay; + private BigDecimal realDPay; + private BigDecimal hPay; + private BigDecimal realHPay; + private BigDecimal yPay; + private BigDecimal realYPay; + private Date incomingTime; + private Date outingTime; + private String warehouseFeeInterval; + private BigDecimal warehouseServiceFee; + private BigDecimal realWarehouseServiceFee; + private BigDecimal warehouseFee; + private BigDecimal realWarehouseFee; + private BigDecimal warehouseManageFee; + private BigDecimal realWarehouseManageFee; + private BigDecimal warehouseSortingFee; + private BigDecimal realWarehouseSortingFee; + private BigDecimal warehouseOperatingFee; + private BigDecimal realWarehouseOperatingFee; + private BigDecimal deliveryServiceFee; + private BigDecimal realDeliveryServiceFee; + private BigDecimal deliveryFee; + private BigDecimal realDeliveryFee; + private BigDecimal deliveryLoadingFee; + private BigDecimal realDeliveryLoadingFee; + private BigDecimal deliverySortingFee; + private BigDecimal realDeliverySortingFee; + private BigDecimal deliveryUpfloorFee; + private BigDecimal realDeliveryUpfloorFee; + private BigDecimal deliveryMoveFee; + private BigDecimal realDeliveryMoveFee; + private BigDecimal deliveryDistance; + private BigDecimal realDeliveryDistance; + private BigDecimal deliveryCrossingFee; + private BigDecimal realDeliveryCrossingFee; + + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceDetailVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceDetailVO.java index 0804e05a1..f5b0cca4d 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceDetailVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineAdvanceDetailVO.java @@ -12,5 +12,6 @@ public class TrunklineAdvanceDetailVO extends TrunklineAdvanceDetailEntity { private String trayName; private String goodsName; + private Long goodsId; } diff --git a/blade-service-api/pom.xml b/blade-service-api/pom.xml index 235761346..b7b10a21b 100644 --- a/blade-service-api/pom.xml +++ b/blade-service-api/pom.xml @@ -44,6 +44,7 @@ logpm-factory-data-base-api logpm-business-conversion-api + logpm-factory-data-zbom-api diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml index a1eedfaeb..3ff0cfc9a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml @@ -172,23 +172,23 @@ + delete from logpm_distribution_parcel_list diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java index eab24d0a8..d1d2757c3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java @@ -195,4 +195,6 @@ public interface DistributionStockArticleMapper extends BaseMapper> selectAdvance(@Param("orderCode")String orderCode); + + void updateCustomerAllByOrderCode(@Param("data") cn.hutool.json.JSONObject data); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml index be1ad87da..fe6ef1260 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml @@ -52,36 +52,44 @@ - update logpm_distribution_stock_article set hand_quantity = hand_quantity + #{num} where id = #{id} + update logpm_distribution_stock_article + set hand_quantity = hand_quantity + #{num} + where id = #{id} - update logpm_distribution_stock_article set hand_quantity = hand_quantity - #{allNum} where id = #{articleId} and hand_quantity - #{allNum} >= 0 + update logpm_distribution_stock_article + set hand_quantity = hand_quantity - #{allNum} + where id = #{articleId} + and hand_quantity - #{allNum} >= 0 - select ldsa.waybill_number waybillNo, - ldsa.order_code orderCode, - lww.create_time createTime, - lww.destination destination, - lww.destination_warehouse_name destinationWarehouseName, - lww.shipper shipper, - lww.shipper_name shipperName, - lww.consignee consignee, - lww.consignee_name consigneeName, - lww.goods_name goodsName, - lww.total_count totalNum, - lww.total_weight weight, - lww.total_volume volume, - ldsa.hand_quantity stockNum, - lww.customer_train customerTrain, + select ldsa.waybill_number waybillNo, + ldsa.order_code orderCode, + lww.create_time createTime, + lww.destination destination, + lww.destination_warehouse_name destinationWarehouseName, + lww.shipper shipper, + lww.shipper_name shipperName, + lww.consignee consignee, + lww.consignee_name consigneeName, + lww.goods_name goodsName, + lww.total_count totalNum, + lww.total_weight weight, + lww.total_volume volume, + ldsa.hand_quantity stockNum, + lww.customer_train customerTrain, lww.total_freight, lww.total_count, - lww.remark remark, - ROUND(lww.total_freight/lww.total_count,2) price + lww.remark remark, + ROUND(lww.total_freight / lww.total_count, 2) price from logpm_distribution_stock_article ldsa left join logpm_warehouse_waybill lww on lww.waybill_no = ldsa.waybill_number where ldsa.is_zero = 1 - and ldsa.warehouse_id = #{warehouseId} + and ldsa.warehouse_id = #{warehouseId} - - select sum(( + select sum(( select COUNT(ldl.id) from logpm_distribution_loadscan ldl - where ldl.package_id = ldpl.id and ldl.signfor_state = 2 - ) ) signinQuantity, - sum(( - select COUNT(ldl.id) - from logpm_distribution_loadscan ldl - where ldl.package_id = ldpl.id and ldl.signfor_state = 1 - )) deliveryQuantity - from logpm_distribution_parcel_list ldpl + where ldl.package_id = ldpl.id + and ldl.signfor_state = 2 + )) signinQuantity, + sum(( + select COUNT(ldl.id) + from logpm_distribution_loadscan ldl + where ldl.package_id = ldpl.id + and ldl.signfor_state = 1 + )) deliveryQuantity + from logpm_distribution_parcel_list ldpl where ldpl.stock_article_id = #{id} - + update logpm_distribution_stock_article - set total_number = total_number - #{subNum}, + set total_number = total_number - #{subNum}, hand_quantity = hand_quantity - #{subNum}, - incoming_num = incoming_num - #{subNum} + incoming_num = incoming_num - #{subNum} where id = #{articleId} @@ -1145,7 +1189,7 @@ ELSE '未知' END orderStatusName, - CASE ldsa.is_zero + CASE ldsa.is_zero WHEN 0 THEN '否' WHEN 1 THEN '是' ELSE @@ -1157,8 +1201,10 @@ WHEN 30 THEN '已预约' END orderReservationStatusName, CASE ldsa.is_zero - WHEN 0 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_list WHERE stock_article_id = ldsa.id),'是','否') - WHEN 1 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_number WHERE stock_article_id = ldsa.id),'是','否') + WHEN 0 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_list WHERE + stock_article_id = ldsa.id),'是','否') + WHEN 1 THEN IF(ldsa.total_number =(SELECT SUM(quantity) FROM logpm_distribution_parcel_number WHERE + stock_article_id = ldsa.id),'是','否') END isCompleteSet, CASE ldsa.type_service WHEN 1 THEN '商配' @@ -1166,10 +1212,14 @@ WHEN 3 THEN '自提' WHEN 4 THEN '三方中转' END typeServiceName, - IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND scan_status != 1 ), 0 ) AS deliveryNumber, - IFNULL(( SELECT SUM( received_quantity ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND scan_status != 1 ), 0 ) AS signForNumber, - IFNULL(( SELECT SUM( stock_quantity ) FROM logpm_distribution_stock WHERE stock_article = ldsa.id ), 0 ) AS stockUpNumber, - IFNULL(( SELECT SUM( reservation_num ) FROM logpm_distribution_reservation_stockarticle WHERE stock_article_id = ldsa.id AND stock_article_status!= 2), 0 ) AS reservationNumber, + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND scan_status != 1 + ), 0 ) AS deliveryNumber, + IFNULL(( SELECT SUM( received_quantity ) FROM logpm_distribution_loadscan WHERE order_id = ldsa.id AND + scan_status != 1 ), 0 ) AS signForNumber, + IFNULL(( SELECT SUM( stock_quantity ) FROM logpm_distribution_stock WHERE stock_article = ldsa.id ), 0 ) AS + stockUpNumber, + IFNULL(( SELECT SUM( reservation_num ) FROM logpm_distribution_reservation_stockarticle WHERE stock_article_id = + ldsa.id AND stock_article_status!= 2), 0 ) AS reservationNumber, IF(GROUP_CONCAT(t.msg) is not null,GROUP_CONCAT(t.msg),IFNULL(GROUP_CONCAT(y.msg),null)) AS reservationInfo, GROUP_CONCAT(DISTINCT IFNULL( m.mssg,'')) AS deliveryListInfo, ldsa.create_time As createTime, @@ -1177,7 +1227,7 @@ m.signing_time AS signinTime, GROUP_CONCAT(DISTINCT IFNULL( m.driverName,'')) AS driverName, GROUP_CONCAT(DISTINCT IFNULL( m.vehicleName,'')) AS vehicleName, - GROUP_CONCAT(DISTINCT IFNULL( m.examine_user_name,'')) AS examineUserNames, + GROUP_CONCAT(DISTINCT IFNULL( m.examine_user_name,'')) AS examineUserNames, k.earliestWarehouseEntryTime AS earliestWarehouseEntryTime, GROUP_CONCAT(t.reservation_id) AS reservationIds, j.scanSigningTime AS scanSigningTime @@ -1224,18 +1274,20 @@ LEFT JOIN logpm_distribution_delivery_list AS lddl ON lds.delivery_id = lddl.id GROUP BY ldr.id ) AS m ON ldsa.id = m.stock_article_id AND t.reservation_id = m.reservation_id - LEFT JOIN ( SELECT stock_article_id, min( create_time ) AS earliestWarehouseEntryTime FROM logpm_distribution_parcel_list GROUP BY stock_article_id) AS k ON k.stock_article_id = ldsa.id - LEFT JOIN ( SELECT order_id, max( signing_time ) AS scanSigningTime FROM logpm_distribution_loadscan WHERE scan_status != 1 AND signfor_state = 2 GROUP BY order_id ) AS j ON j.order_id = ldsa.id + LEFT JOIN ( SELECT stock_article_id, min( create_time ) AS earliestWarehouseEntryTime FROM + logpm_distribution_parcel_list GROUP BY stock_article_id) AS k ON k.stock_article_id = ldsa.id + LEFT JOIN ( SELECT order_id, max( signing_time ) AS scanSigningTime FROM logpm_distribution_loadscan WHERE + scan_status != 1 AND signfor_state = 2 GROUP BY order_id ) AS j ON j.order_id = ldsa.id ldsa.order_status in ('70','80') - AND ldsa.waybill_number like concat(#{param.waybillNumber},"%") + AND ldsa.waybill_number like concat(#{param.waybillNumber},"%") AND ldsa.service_number like concat(#{param.serviceNumber},"%") - AND ldsa.order_code like concat(#{param.orderCode},"%") + AND ldsa.order_code like concat(#{param.orderCode},"%") AND ldsa.warehouse like concat(#{param.warehouseName},"%") @@ -1269,7 +1321,7 @@ AND ldsa.warehouse_id = #{param.warehouseId} - AND ldsa.warehouse_id IN + AND ldsa.warehouse_id IN #{item} @@ -1327,7 +1379,9 @@ ldsa.id @@ -1335,5 +1389,16 @@ set total_number = #{total} where order_code = #{orderCode} + + update logpm_distribution_stock_article + set + customer_name = #{data.customerName}, + customer_telephone=#{data.customerPhone}, + customer_address=#{data.customerAddress} + where reservation_status = '10' + + and order_code = #{data.orderCode} + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml index 47ddf2a77..74c399114 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml @@ -819,9 +819,9 @@ stockupCode,lds.type_service typeService, lds.stockup_status stockupStatus,lds.stockup_area stockupArea from logpm_distribution_stockup lds - LEFT JOIN logpm_distribution_stockup_info ldsi on ldsi.stockup_id = lds.id + LEFT JOIN logpm_distribution_stockup_info ldsi on ldsi.stockup_id = lds.id AND ldsi.stock_status != 4 - lds.id = #{param.stockupId} AND ldsi.stock_status != 4 + lds.id = #{param.stockupId} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java index 4224e98d2..d39754577 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java @@ -235,4 +235,11 @@ public interface IDistributionParcelListService extends BaseService findAllOrderCodesByAdvanceIds(List advanceIds, Long warehouseId); void removePakcageByAdvanceIds(List advanceIds, Long warehouseId); + + /** + * 根据包件码查询包件 + * @param keySet + * @return + */ + Map> findPackageCodeByCodes(Set keySet); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java index 83c68309b..c935b13c8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java @@ -282,4 +282,10 @@ public interface IDistributionStockArticleService extends BaseService>>>>>>>>>> 签收推送 对象 {}", "signingId:=" + signingId + "warehouseName:=" + warehouseName + "warehouseId:=" + warehouseId); //查询签收信息 DistributionSignforEntity distributionSignforEntity = distributionSignforMapper.selectById(signingId); @@ -1592,6 +1596,28 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { factoryDataMessageSender.sendNodeDataByBrand(msg); } + if (Func.isNotEmpty(brand.get("皮阿诺"))) { + List zb = brand.get("皮阿诺"); + if (CollUtil.isNotEmpty(zb)) { + for (MtReceiveContentDTO mtReceiveContentDTO : zb) { + try { + // 发送入库消息 + com.logpm.distribution.dto.OrderStatusDTO orderStatusDTO = new com.logpm.distribution.dto.OrderStatusDTO(); + // 通过包件id 查询包件 + orderStatusDTO.setUnitNo(mtReceiveContentDTO.getUnitNo()); + orderStatusDTO.setOrderNo(mtReceiveContentDTO.getOrderCode()); + orderStatusDTO.setStatus("7"); + orderStatusDTO.setOperationTime(DateUtil.now()); + orderStatusDTO.setCurrentWarehouse(warehouseId.toString()); + Map map = new HashMap<>(); + map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO)); + rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map); + } catch (Exception e) { + log.error("入库推送失败:{}", e); + } + } + } + } //....工厂 } catch (Exception e) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index b14a86a74..1cfc18620 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -3631,6 +3631,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { DistributionDeliverySelfEntity deliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); @@ -4047,6 +4052,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl { DistributionDeliverySelfEntity deliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); if (a.getDriverName().equals(deliveryListDTO.getMasterDriverName()) && a.getVehicleNub().equals(deliveryListDTO.getMasterVehicleNub())) { @@ -6696,7 +6706,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl Integer.parseInt(map1.get("数量").toString())).sum()); - + log.info(">>>>>>>>>>>>>>>>>>预约打印模板查看备货信息》》》》》》》》》》》》:{}",distributionReservationEntity.getRemarks()); map.put("备注", distributionReservationEntity.getRemarks()); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java index c3e17623c..f2ba7bd7f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java @@ -89,6 +89,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -1265,4 +1266,24 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl> findPackageCodeByCodes(Set keySet) { + Map> resultMap = new HashMap<>(); + List> map = baseMapper.findPackageCodeByCodes(keySet); + if(CollUtil.isNotEmpty(map)){ + for (Map stringStringMap : map) { + String code = stringStringMap.get("code"); + String id = stringStringMap.get("id"); + if(resultMap.containsKey(code)){ + resultMap.get(code).add(id); + }else{ + Set set = new HashSet<>(); + set.add(id); + resultMap.put(code,set); + } + } + } + return resultMap; + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 9f66ece6f..b24b5e045 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -16,6 +16,7 @@ */ package com.logpm.distribution.service.impl; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -2668,7 +2669,13 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index 51d073145..9a5fcdfc5 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -3426,7 +3426,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl map = new HashMap<>(); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java index 651cac449..50ecc4bae 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java @@ -24,12 +24,14 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.dto.app.StockupDTO; +import com.logpm.distribution.entity.DistributionBillLadingScanEntity; import com.logpm.distribution.entity.DistrilbutionBillPackageEntity; import com.logpm.distribution.entity.DistrilbutionBillStockEntity; import com.logpm.distribution.excel.DistributionBillOrderExcel; import com.logpm.distribution.excel.DistributionBillOrderPackExcel; import com.logpm.distribution.excel.DistrilbutionBillStockExcel; import com.logpm.distribution.mapper.DistrilbutionBillStockMapper; +import com.logpm.distribution.service.IDistributionBillLadingScanService; import com.logpm.distribution.service.IDistrilbutionBillPackageService; import com.logpm.distribution.service.IDistrilbutionBillStockService; import com.logpm.distribution.vo.*; @@ -64,6 +66,8 @@ public class DistrilbutionBillStockServiceImpl extends BaseServiceImpl selectDistrilbutionBillStockPage(IPage page, DistrilbutionBillStockVO distrilbutionBillStock) { return page.setRecords(baseMapper.selectDistrilbutionBillStockPage(page, distrilbutionBillStock)); @@ -253,4 +257,17 @@ public class DistrilbutionBillStockServiceImpl extends BaseServiceImpl ladingScanEntities = distributionBillLadingScanService.list(Wrappers.query().lambda() + .eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) + .eq(DistributionBillLadingScanEntity::getStockArticleId, orderId) + ); + if (ladingScanEntities.isEmpty()) { + return true; + } + return false; + } + } 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 22b391ddd..931ce53bc 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 @@ -205,6 +205,11 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl3.2.0.RELEASE compile + + com.logpm + logpm-factory-data-zbom-api + 3.2.0.RELEASE + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/config/InterceptorAdapterConfig.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/config/InterceptorAdapterConfig.java index 6ee97e0d1..545afdee9 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/config/InterceptorAdapterConfig.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/config/InterceptorAdapterConfig.java @@ -21,8 +21,8 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry interceptorRegistry) { - interceptorRegistry.addInterceptor(new ZbFactoryAccountsInterceptor(zbFactoryProperties)) - .addPathPatterns("/**").order(2); +// interceptorRegistry.addInterceptor(new ZbFactoryAccountsInterceptor(zbFactoryProperties)) +// .addPathPatterns("/**").order(2); interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis, environment)) .addPathPatterns("/**").order(3); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/controller/OrderController.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/controller/OrderController.java index 0e348ef7d..c9047b0cb 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/controller/OrderController.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/controller/OrderController.java @@ -1,21 +1,16 @@ package com.logpm.factorydata.zbom.controller; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factorydata.enums.SaxStatusEnums; import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.vo.SendMsg; import com.logpm.factorydata.zbom.constants.ZbomConstants; import com.logpm.factorydata.zbom.entity.FactoryLogEntity; -import com.logpm.factorydata.zbom.entity.ZbFactoryOrderLogEntity; -import com.logpm.factorydata.zbom.entity.ZbReceiptEntity; import com.logpm.factorydata.zbom.service.FactoryLogService; -import com.logpm.factorydata.zbom.service.IFactoryOrderLogService; -import com.logpm.factorydata.zbom.service.IReceiptService; import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; import com.logpm.factorydata.zbom.vo.ZbResp; import io.swagger.annotations.Api; @@ -31,6 +26,7 @@ import org.springblade.common.utils.FileLogsUtil; import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springblade.resource.feign.IOssClient; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -63,8 +59,22 @@ public class OrderController { private final FactoryLogService factoryLogService; private final IOssClient ossClient; + private final RabbitTemplate rabbitTemplate; + @ResponseBody + @PostMapping("pushData") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "推送志邦工厂节点数据", notes = "推送志邦工厂节点数据") + public ZbResp pushData(@RequestBody String msg, HttpServletRequest request) { + log.info("推送志邦工厂节点数据:{}", msg); + if (StrUtil.isNotEmpty(msg)) { + rabbitTemplate.convertAndSend(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH, + FactoryDataConstants.Mq.RoutingKeys.ZBOM_NODE_DATA_PUSH, msg); + } + return ZbResp.success("成功"); + } + @ResponseBody @PostMapping @ApiOperationSupport(order = 1) @@ -79,60 +89,12 @@ public class OrderController { String corpId = request.getHeader("corpId"); zbReceiptDTO.setCorpId(corpId); - // 1 上传数据到 minio 获取到地址 - String url = uploadFile(JSONUtil.toJsonStr(zbReceiptDTO)); - // 2 保存地址到数据库 - FactoryLogEntity logEntity = new FactoryLogEntity(); - logEntity.setType(1); - logEntity.setSaxStatus(SaxStatusEnums.NOMAL.getCode()); - logEntity.setLogUrl(url); - factoryLogService.save(logEntity); + factoryLogService.orderData(zbReceiptDTO); - // 3 将消息发送给 mq,解析保存 - SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.FACTORY_ORDER) - .routingKey(FactoryDataConstants.Mq.RoutingKeys.ZBOM_FACTORY_ORDER) - .message(JSONUtil.toJsonStr(logEntity)).build(); - factoryDataClient.sendMessage(build); return ZbResp.success("成功"); } - private String uploadFile(String body) { - //文本内容和保存为本地文件 并上传 - String logPath = FileLogsUtil.saveFileLogs(body); - log.info(">>> 文件路径 {}", logPath); - MultipartFile multi = getMultipartFile(logPath); - //上传到服务器 - R r = ossClient.fileUpload(multi, "zb-order-logs"); - if (r.isSuccess()) { - BladeFile data = (BladeFile) r.getData(); - // 删除本地文件 - FileUtil.del(logPath); - return data.getLink(); - } - return null; - } - - @NotNull - private MultipartFile getMultipartFile(String logPath) { - File file = new File(logPath); - - // File 转 MultipartFile - FileItem item = new DiskFileItemFactory().createItem("file" - , MediaType.MULTIPART_FORM_DATA_VALUE - , true - , file.getName()); - try ( - InputStream input = Files.newInputStream(file.toPath()); - OutputStream os = item.getOutputStream()) { - // 流转移 - IOUtils.copy(input, os); - } catch (Exception e) { - throw new IllegalArgumentException("Invalid file: " + e, e); - } - - return new CommonsMultipartFile(item); - } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/feign/FactoryDataZbomClient.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/feign/FactoryDataZbomClient.java new file mode 100644 index 000000000..b621af8f4 --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/feign/FactoryDataZbomClient.java @@ -0,0 +1,26 @@ +package com.logpm.factorydata.zbom.feign; + +import cn.hutool.json.JSONUtil; +import com.logpm.factorydata.zbom.service.FactoryLogService; +import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author zhaoqiaobo + * @create 2024-05-25 + */ +@RestController +@AllArgsConstructor +public class FactoryDataZbomClient implements IFactoryDataZbomClient { + + private final FactoryLogService factoryLogService; + + @Override + public R order(String data) { + factoryLogService.orderData(JSONUtil.toBean(data, ZBReceiptDTO.class)); + return R.success("成功"); + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java index 9ddd2a182..73e879cd1 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/mq/ZbomFactoryOrderListener.java @@ -10,8 +10,6 @@ import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; -import cn.hutool.json.JSONArray; -import cn.hutool.json.JSONConfig; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -26,6 +24,7 @@ import com.logpm.factorydata.zbom.entity.ZbOrderPackageEntity; import com.logpm.factorydata.zbom.entity.ZbPackageInfoEntity; import com.logpm.factorydata.zbom.entity.ZbReceiptEntity; import com.logpm.factorydata.zbom.mapper.ZbCategoryContrastMapper; +import com.logpm.factorydata.zbom.pros.ZbFactoryProperties; import com.logpm.factorydata.zbom.service.IOrderPackageService; import com.logpm.factorydata.zbom.service.IPackageInfoService; import com.logpm.factorydata.zbom.service.IReceiptService; @@ -50,7 +49,6 @@ import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.QueueBinding; import org.springframework.amqp.rabbit.annotation.RabbitListener; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -81,10 +79,7 @@ public class ZbomFactoryOrderListener { private final IReceiptService receiptService; private final IPackageInfoService packageInfoService; private final IOrderPackageService orderPackageService; - private final BladeRedis bladeRedis; - private final ZbCategoryContrastMapper zbCategoryContrastMapper; - private final IFactoryDataBaseClient baseClient; - private final IFactoryDataClient factoryDataClient; + private final ZbFactoryProperties zbFactoryProperties; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FactoryDataConstants.Mq.Queues.ZBOM_FACTORY_ORDER), @@ -148,8 +143,8 @@ public class ZbomFactoryOrderListener { } } ZbReceiptEntity zbReceiptEntity = new ZbReceiptEntity(); - zbReceiptEntity.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null); BeanUtil.copyProperties(zbReceiptDTO, zbReceiptEntity); + zbReceiptEntity.setLogId(ObjectUtil.isNotEmpty(logId) ? logId.toString() : null); // 保存订单数据 receiptService.save(zbReceiptEntity); if (CollUtil.isNotEmpty(details)) { @@ -193,211 +188,9 @@ public class ZbomFactoryOrderListener { packageInfoService.saveBatch(packageInfoEntities); } // 处理暂存单 - buildAdvance(zbReceiptDTO, packageCode); - } - - @LogpmAsync("asyncExecutor") - public void buildAdvance(ZBReceiptDTO zbReceiptDTO, Set packageCode) { - // 新起线程构建暂存单发送mq - Long startWarehouseId = null; - String startWarehouseName = null; - String tenantId = null; - // 获取工厂基地绑定的始发仓信息 - R warehouseByBrandAndSiteName = baseClient.getWarehouseByBrandAndSiteName(zbReceiptDTO.getSenderName(), zbReceiptDTO.getSenderName()); - if (ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) { - FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData(); - if (ObjectUtil.isNotNull(data)) { - startWarehouseId = data.getWarehouseId(); - startWarehouseName = data.getWarehouseName(); - tenantId = data.getTenantId(); - } - } - Map> advanceMap = new HashMap<>(); - List details = zbReceiptDTO.getDetails(); - // 入库单号 + 订单自编号 + 发车单号 一个暂存单 - for (OrderPackageDTO detail : details) { - if (packageCode.contains(detail.getPackageCode())) { - log.info(" 接收志邦数据:包条码 {} 已存在数据库中,不生成暂存单。", detail.getPackageCode()); - continue; - } - String taskCode = zbReceiptDTO.getTaskCode(); - String departCode = zbReceiptDTO.getDepartCode(); - String platformOrderCode = detail.getPlatformOrderCode(); - String advanceKey = taskCode + departCode + platformOrderCode; - if (advanceMap.containsKey(advanceKey)) { - advanceMap.get(advanceKey).add(detail); - } else { - ArrayList orderPackageDTOS = new ArrayList<>(); - orderPackageDTOS.add(detail); - advanceMap.put(advanceKey, orderPackageDTOS); - } + if(zbFactoryProperties.isAdvance()){ + receiptService.buildAdvance(zbReceiptDTO, packageCode); } - // 组装暂存单数据 - List advances = new ArrayList<>(); - for (Map.Entry> stringListEntry : advanceMap.entrySet()) { - List value = stringListEntry.getValue(); - TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity(); - advanceEntity.setTenantId(tenantId); - advanceEntity.setStatus(0); - advanceEntity.setIsDeleted(0); - advanceEntity.setHasPackage(CollUtil.isNotEmpty(zbReceiptDTO.getDetails()) ? 1 : 0); - advanceEntity.setOrderType(zbReceiptDTO.getOrderType()); - advanceEntity.setBrand(zbReceiptDTO.getSenderName()); - advanceEntity.setSiteName(""); - advanceEntity.setArea(""); - advanceEntity.setTotalNum(CollUtil.isNotEmpty(value) ? value.size() : 0); - advanceEntity.setPackName(""); - advanceEntity.setPackCode(""); - advanceEntity.setWarehouseId(startWarehouseId); - advanceEntity.setWarehouseName(startWarehouseName); - - advanceEntity.setIsGcp(0); - advanceEntity.setCarrierName(zbReceiptDTO.getVendorName()); - advanceEntity.setSystemType("线上"); - advanceEntity.setMatingType("1"); - advanceEntity.setSenderName(zbReceiptDTO.getSenderName()); - advanceEntity.setSenderPhone(zbReceiptDTO.getSenderTel()); - advanceEntity.setSenderAddress(zbReceiptDTO.getSenderAddress()); - advanceEntity.setWaybillStatus("0"); - advanceEntity.setWaybillNo(""); - advanceEntity.setTrainNumber(zbReceiptDTO.getDepartCode()); - advanceEntity.setFreezeStatus("0"); - - advanceEntity.setSenderFactory(zbReceiptDTO.getSenderName()); - List packageList = new ArrayList<>(); - for (OrderPackageDTO orderPackageDTO : value) { - advanceEntity.setOrderCode(orderPackageDTO.getPlatformOrderCode()); - advanceEntity.setDealerCode(orderPackageDTO.getCustomerCode()); - advanceEntity.setDealerName(orderPackageDTO.getCustomerName()); - advanceEntity.setStoreCode(orderPackageDTO.getCustomerCode()); - advanceEntity.setStoreName(orderPackageDTO.getCustomerName()); - advanceEntity.setServiceNum(orderPackageDTO.getRelationOrderCode()); - advanceEntity.setCustomerName(orderPackageDTO.getReceiverName()); - advanceEntity.setCustomerPhone(orderPackageDTO.getReceiverMobile()); - advanceEntity.setCustomerAddress(orderPackageDTO.getReceiverAddress()); - - // 封装包件 - TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); - advanceDetailEntity.setWarehouseId(startWarehouseId); - advanceDetailEntity.setWarehouseName(startWarehouseName); -// advanceDetailEntity.setIncomingWarehouseId(0L); -// advanceDetailEntity.setIncomingWarehouseName(""); - // 根据志邦的一流单标识赋值 - advanceEntity.setLegacyStatus("0"); - if (ObjectUtil.equal(orderPackageDTO.getLegacyFlag(), "Y")) { - advanceEntity.setLegacyStatus("1"); - } - - advanceDetailEntity.setOrderCode(orderPackageDTO.getPlatformOrderCode()); - advanceDetailEntity.setBrand(zbReceiptDTO.getSenderName()); - advanceDetailEntity.setSystemType("线上"); - advanceDetailEntity.setFirstPackName(orderPackageDTO.getPackageTypeName()); - advanceDetailEntity.setFirstPackCode(orderPackageDTO.getPackageType()); - // 获取映射志邦映射品类信息 - ZbCategoryContrastEntity zbCategoryContrastEntity = buildZbCategoryContrastEntityCache(orderPackageDTO.getPackageClass()); - if (zbCategoryContrastEntity != null) { - advanceDetailEntity.setSecondPackName(zbCategoryContrastEntity.getSecondName());//二级品类名称 - advanceDetailEntity.setSecondPackCode(zbCategoryContrastEntity.getSecondCode());//二级品类 - advanceDetailEntity.setThirdPackName(zbCategoryContrastEntity.getThirdName());//三级品类名称 - advanceDetailEntity.setThirdPackCode(zbCategoryContrastEntity.getThirdCode());//三级品类 - } else { - advanceDetailEntity.setSecondPackName(StringUtil.isBlank(orderPackageDTO.getPackageClass()) ? "" : orderPackageDTO.getPackageClass());//二级品类名称 - advanceDetailEntity.setSecondPackCode("");//二级品类 - advanceDetailEntity.setThirdPackName(StringUtil.isBlank(orderPackageDTO.getPackageClass()) ? "" : orderPackageDTO.getPackageClass());//三级品类名称 - advanceDetailEntity.setThirdPackCode("");//三级品类 - } - advanceDetailEntity.setSiteName(""); - advanceDetailEntity.setSiteCode(""); - String planQty = orderPackageDTO.getPlanQty(); - advanceDetailEntity.setQuantity((StrUtil.isNotBlank(planQty) && NumberUtil.isNumber(planQty)) ? Convert.toInt(planQty) : 0); - advanceDetailEntity.setOrderPackageCode(orderPackageDTO.getPackageCode()); - advanceDetailEntity.setTrainNumber(zbReceiptDTO.getDepartCode()); - advanceDetailEntity.setServiceNum(orderPackageDTO.getRelationOrderCode()); - advanceDetailEntity.setWaybillNo(""); - advanceDetailEntity.setPackageStatus("0"); - advanceDetailEntity.setWeight(StrUtil.isNotBlank(orderPackageDTO.getTotalGrossWeight()) ? new BigDecimal(orderPackageDTO.getTotalGrossWeight()) : BigDecimal.ZERO); - advanceDetailEntity.setVolume(StrUtil.isNotBlank(orderPackageDTO.getTotalVolume()) ? new BigDecimal(orderPackageDTO.getTotalVolume()) : BigDecimal.ZERO); -// advanceDetailEntity.setChargeType(0); - advanceDetailEntity.setSupple(""); - advanceDetailEntity.setManifest(""); - advanceDetailEntity.setReturnNum(""); - advanceDetailEntity.setSendDateStr(DateUtil.formatLocalDateTime(LocalDateTime.now())); - advanceDetailEntity.setCarNumber(""); - advanceDetailEntity.setGoodsMan(""); - advanceDetailEntity.setTenantId(tenantId); - advanceDetailEntity.setStatus(0); - advanceDetailEntity.setIsDeleted(0); - List itemJsons = new ArrayList<>(); - List items = orderPackageDTO.getItems(); - for (PackageInfoDTO item : items) { - TrunklineDetailProductEntity detailProductEntity = new TrunklineDetailProductEntity(); - detailProductEntity.setTenantId(tenantId); - detailProductEntity.setWarehouseId(startWarehouseId); - detailProductEntity.setWarehouseName(startWarehouseName); - detailProductEntity.setUnitNo(orderPackageDTO.getPackageCode()); - detailProductEntity.setProductCode(item.getItemCode()); - detailProductEntity.setProductName(item.getItemName()); - detailProductEntity.setQuantity(item.getPlanQty()); - detailProductEntity.setStatus(0); - detailProductEntity.setIsDeleted(0); - itemJsons.add(JSONUtil.parseObj(detailProductEntity)); - } - JSONObject entries = JSONUtil.parseObj(advanceDetailEntity); - entries.set("items", itemJsons); - packageList.add(entries); - } - // 转成json对象,然后将包件明细放到detail中 - JSONObject entries = JSONUtil.parseObj(advanceEntity); - entries.set("details", JSONUtil.toJsonStr(packageList)); - advances.add(entries); - } - // 将组装好的暂存单发送到 MQ ,由暂存单服务统一消费SendMsg. - if (CollUtil.isNotEmpty(advances)) { - for (JSONObject advance : advances) { - SendMsg sendMsg = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER) - .routingKey(FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER).message(JSONUtil.toJsonStr(advance)).build(); - factoryDataClient.sendMessage(sendMsg); - } - } - } - - private ZbCategoryContrastEntity buildZbCategoryContrastEntityCache(String packageClass) { - - - if (StringUtil.isBlank(packageClass)) { - return null; - } - if (containsChinese(packageClass)) { - return null; - } - - String key = TenantNum.HUITONGCODE + ":" + ZbCategoryContrastEntity.class.getName() + ":" + packageClass; - ZbCategoryContrastEntity zbCategoryContrastEntity = bladeRedis.get(key); - if (zbCategoryContrastEntity == null) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("source_code", packageClass); - queryWrapper.eq("status", "1"); - zbCategoryContrastEntity = zbCategoryContrastMapper.selectOne(queryWrapper); - if (!Objects.isNull(zbCategoryContrastEntity)) { - // 缓存起来 - bladeRedis.setEx(key, zbCategoryContrastEntity, 3600 * 24L); - } - } - return zbCategoryContrastEntity; - - - } - - /** - * 验证参数中是否包含中文 - * - * @param str 匹配参数 - * @return true 包含中文 false 不包含中文 - */ - private boolean containsChinese(String str) { - Pattern pattern = Pattern.compile(PatternConstant.REGEX_CHINESE); - Matcher matcher = pattern.matcher(str); - return matcher.find(); } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/pros/ZbFactoryProperties.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/pros/ZbFactoryProperties.java index f9a7f21b3..4692f73cf 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/pros/ZbFactoryProperties.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/pros/ZbFactoryProperties.java @@ -19,6 +19,7 @@ public class ZbFactoryProperties { private String customerid; private String secretkey; private String url; + private boolean isAdvance = false; private boolean enable = true; } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/FactoryLogService.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/FactoryLogService.java index 97fb2001c..a541316f7 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/FactoryLogService.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/FactoryLogService.java @@ -1,6 +1,7 @@ package com.logpm.factorydata.zbom.service; import com.logpm.factorydata.zbom.entity.FactoryLogEntity; +import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; import org.springblade.core.mp.base.BaseService; /** @@ -11,4 +12,5 @@ import org.springblade.core.mp.base.BaseService; **/ public interface FactoryLogService extends BaseService { + void orderData(ZBReceiptDTO zbReceiptDTO); } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/IReceiptService.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/IReceiptService.java index f7ebdee19..f2cd4e869 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/IReceiptService.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/IReceiptService.java @@ -17,8 +17,11 @@ package com.logpm.factorydata.zbom.service; import com.logpm.factorydata.zbom.entity.ZbReceiptEntity; +import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; import org.springblade.core.mp.base.BaseService; +import java.util.Set; + /** * 志邦入库单 服务类 * @@ -27,4 +30,6 @@ import org.springblade.core.mp.base.BaseService; */ public interface IReceiptService extends BaseService { + void buildAdvance(ZBReceiptDTO zbReceiptDTO, Set packageCode); + } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/FactoryLogServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/FactoryLogServiceImpl.java index 95f402004..fd35e8e87 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/FactoryLogServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/FactoryLogServiceImpl.java @@ -1,12 +1,35 @@ package com.logpm.factorydata.zbom.service.impl; +import cn.hutool.core.io.FileUtil; +import cn.hutool.json.JSONUtil; +import com.logpm.factorydata.enums.SaxStatusEnums; +import com.logpm.factorydata.feign.IFactoryDataClient; +import com.logpm.factorydata.vo.SendMsg; import com.logpm.factorydata.zbom.entity.FactoryLogEntity; import com.logpm.factorydata.zbom.mapper.FactoryLogMapper; import com.logpm.factorydata.zbom.service.FactoryLogService; +import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.NotNull; +import org.springblade.common.constant.factorydata.FactoryDataConstants; +import org.springblade.common.utils.FileLogsUtil; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.oss.model.BladeFile; +import org.springblade.core.tool.api.R; +import org.springblade.resource.feign.IOssClient; +import org.springframework.http.MediaType; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; /** * 工厂订单日志 业务实现类 @@ -19,4 +42,64 @@ import org.springframework.stereotype.Service; @AllArgsConstructor public class FactoryLogServiceImpl extends BaseServiceImpl implements FactoryLogService { + + private final IFactoryDataClient factoryDataClient; + + private final IOssClient ossClient; + + @Override + public void orderData(ZBReceiptDTO zbReceiptDTO) { + // 1 上传数据到 minio 获取到地址 + String url = uploadFile(JSONUtil.toJsonStr(zbReceiptDTO)); + // 2 保存地址到数据库 + FactoryLogEntity logEntity = new FactoryLogEntity(); + logEntity.setType(1); + logEntity.setSaxStatus(SaxStatusEnums.NOMAL.getCode()); + logEntity.setLogUrl(url); + this.save(logEntity); + + // 3 将消息发送给 mq,解析保存 + SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.FACTORY_ORDER) + .routingKey(FactoryDataConstants.Mq.RoutingKeys.ZBOM_FACTORY_ORDER) + .message(JSONUtil.toJsonStr(logEntity)).build(); + factoryDataClient.sendMessage(build); + } + + private String uploadFile(String body) { + //文本内容和保存为本地文件 并上传 + String logPath = FileLogsUtil.saveFileLogs(body); + log.info(">>> 文件路径 {}", logPath); + + MultipartFile multi = getMultipartFile(logPath); + //上传到服务器 + R r = ossClient.fileUpload(multi, "zb-order-logs"); + if (r.isSuccess()) { + BladeFile data = (BladeFile) r.getData(); + // 删除本地文件 + FileUtil.del(logPath); + return data.getLink(); + } + return null; + } + + @NotNull + private MultipartFile getMultipartFile(String logPath) { + File file = new File(logPath); + + // File 转 MultipartFile + FileItem item = new DiskFileItemFactory().createItem("file" + , MediaType.MULTIPART_FORM_DATA_VALUE + , true + , file.getName()); + try ( + InputStream input = Files.newInputStream(file.toPath()); + OutputStream os = item.getOutputStream()) { + // 流转移 + IOUtils.copy(input, os); + } catch (Exception e) { + throw new IllegalArgumentException("Invalid file: " + e, e); + } + + return new CommonsMultipartFile(item); + } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/ReceiptServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/ReceiptServiceImpl.java index 11878d7fb..5a84b31de 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/ReceiptServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-zbom/src/main/java/com/logpm/factorydata/zbom/service/impl/ReceiptServiceImpl.java @@ -16,14 +16,54 @@ */ package com.logpm.factorydata.zbom.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.factorydata.base.feign.IFactoryDataBaseClient; +import com.logpm.factorydata.base.vo.FactoryWarehouseBindVO; +import com.logpm.factorydata.feign.IFactoryDataClient; +import com.logpm.factorydata.vo.SendMsg; +import com.logpm.factorydata.zbom.entity.ZbCategoryContrastEntity; import com.logpm.factorydata.zbom.entity.ZbReceiptEntity; import com.logpm.factorydata.zbom.mapper.ReceiptMapper; +import com.logpm.factorydata.zbom.mapper.ZbCategoryContrastMapper; import com.logpm.factorydata.zbom.service.IReceiptService; +import com.logpm.factorydata.zbom.vo.OrderPackageDTO; +import com.logpm.factorydata.zbom.vo.PackageInfoDTO; +import com.logpm.factorydata.zbom.vo.ZBReceiptDTO; +import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; +import com.logpm.trunkline.entity.TrunklineAdvanceEntity; +import com.logpm.trunkline.entity.TrunklineDetailProductEntity; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.annotations.LogpmAsync; +import org.springblade.common.constant.HttpConstants; +import org.springblade.common.constant.PatternConstant; +import org.springblade.common.constant.TenantNum; +import org.springblade.common.constant.factorydata.FactoryDataConstants; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.redis.cache.BladeRedis; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * 志邦入库单 服务实现类 * @@ -35,4 +75,209 @@ import org.springframework.stereotype.Service; @AllArgsConstructor public class ReceiptServiceImpl extends BaseServiceImpl implements IReceiptService { + private final BladeRedis bladeRedis; + private final ZbCategoryContrastMapper zbCategoryContrastMapper; + private final IFactoryDataBaseClient baseClient; + private final IFactoryDataClient factoryDataClient; + + @Override + @LogpmAsync("asyncExecutor") + public void buildAdvance(ZBReceiptDTO zbReceiptDTO, Set packageCode) { + // 新起线程构建暂存单发送mq + Long startWarehouseId = null; + String startWarehouseName = null; + String tenantId = null; + // 获取工厂基地绑定的始发仓信息 + R warehouseByBrandAndSiteName = baseClient.getWarehouseByBrandAndSiteName(zbReceiptDTO.getSenderName(), zbReceiptDTO.getSenderName()); + if (ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) { + FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData(); + if (ObjectUtil.isNotNull(data)) { + startWarehouseId = data.getWarehouseId(); + startWarehouseName = data.getWarehouseName(); + tenantId = data.getTenantId(); + } + } + Map> advanceMap = new HashMap<>(); + List details = zbReceiptDTO.getDetails(); + // 入库单号 + 订单自编号 + 发车单号 一个暂存单 + for (OrderPackageDTO detail : details) { + if (packageCode.contains(detail.getPackageCode())) { + log.info(" 接收志邦数据:包条码 {} 已存在数据库中,不生成暂存单。", detail.getPackageCode()); + continue; + } + String taskCode = zbReceiptDTO.getTaskCode(); + String departCode = zbReceiptDTO.getDepartCode(); + String platformOrderCode = detail.getPlatformOrderCode(); + String advanceKey = taskCode + departCode + platformOrderCode; + if (advanceMap.containsKey(advanceKey)) { + advanceMap.get(advanceKey).add(detail); + } else { + ArrayList orderPackageDTOS = new ArrayList<>(); + orderPackageDTOS.add(detail); + advanceMap.put(advanceKey, orderPackageDTOS); + } + } + // 组装暂存单数据 + List advances = new ArrayList<>(); + for (Map.Entry> stringListEntry : advanceMap.entrySet()) { + List value = stringListEntry.getValue(); + TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity(); + advanceEntity.setTenantId(tenantId); + advanceEntity.setStatus(0); + advanceEntity.setIsDeleted(0); + advanceEntity.setHasPackage(CollUtil.isNotEmpty(zbReceiptDTO.getDetails()) ? 1 : 0); + advanceEntity.setOrderType(zbReceiptDTO.getOrderType()); + advanceEntity.setBrand(zbReceiptDTO.getSenderName()); + advanceEntity.setSiteName(""); + advanceEntity.setArea(""); + advanceEntity.setTotalNum(CollUtil.isNotEmpty(value) ? value.size() : 0); + advanceEntity.setPackName(""); + advanceEntity.setPackCode(""); + advanceEntity.setWarehouseId(startWarehouseId); + advanceEntity.setWarehouseName(startWarehouseName); + + advanceEntity.setIsGcp(0); + advanceEntity.setCarrierName(zbReceiptDTO.getVendorName()); + advanceEntity.setSystemType("线上"); + advanceEntity.setMatingType("1"); + advanceEntity.setSenderName(zbReceiptDTO.getSenderName()); + advanceEntity.setSenderPhone(zbReceiptDTO.getSenderTel()); + advanceEntity.setSenderAddress(zbReceiptDTO.getSenderAddress()); + advanceEntity.setWaybillStatus("0"); + advanceEntity.setWaybillNo(""); + advanceEntity.setTrainNumber(zbReceiptDTO.getDepartCode()); + advanceEntity.setFreezeStatus("0"); + + advanceEntity.setSenderFactory(zbReceiptDTO.getSenderName()); + List packageList = new ArrayList<>(); + for (OrderPackageDTO orderPackageDTO : value) { + advanceEntity.setOrderCode(orderPackageDTO.getPlatformOrderCode()); + advanceEntity.setDealerCode(orderPackageDTO.getCustomerCode()); + advanceEntity.setDealerName(orderPackageDTO.getCustomerName()); + advanceEntity.setStoreCode(orderPackageDTO.getCustomerCode()); + advanceEntity.setStoreName(orderPackageDTO.getCustomerName()); + advanceEntity.setServiceNum(orderPackageDTO.getRelationOrderCode()); + advanceEntity.setCustomerName(orderPackageDTO.getReceiverName()); + advanceEntity.setCustomerPhone(orderPackageDTO.getReceiverMobile()); + advanceEntity.setCustomerAddress(orderPackageDTO.getReceiverAddress()); + // 根据志邦的一流单标识赋值 + advanceEntity.setLegacyStatus("0"); + if (ObjectUtil.equal(orderPackageDTO.getLegacyFlag(), "Y")) { + advanceEntity.setLegacyStatus("1"); + } + // 封装包件 + TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); + advanceDetailEntity.setWarehouseId(startWarehouseId); + advanceDetailEntity.setWarehouseName(startWarehouseName); + advanceDetailEntity.setOrderCode(orderPackageDTO.getPlatformOrderCode()); + advanceDetailEntity.setBrand(zbReceiptDTO.getSenderName()); + advanceDetailEntity.setSystemType("线上"); + advanceDetailEntity.setFirstPackName(orderPackageDTO.getPackageTypeName()); + advanceDetailEntity.setFirstPackCode(orderPackageDTO.getPackageType()); + // 获取映射志邦映射品类信息 + ZbCategoryContrastEntity zbCategoryContrastEntity = buildZbCategoryContrastEntityCache(orderPackageDTO.getPackageClass()); + if (zbCategoryContrastEntity != null) { + advanceDetailEntity.setSecondPackName(zbCategoryContrastEntity.getSecondName());//二级品类名称 + advanceDetailEntity.setSecondPackCode(zbCategoryContrastEntity.getSecondCode());//二级品类 + advanceDetailEntity.setThirdPackName(zbCategoryContrastEntity.getThirdName());//三级品类名称 + advanceDetailEntity.setThirdPackCode(zbCategoryContrastEntity.getThirdCode());//三级品类 + } else { + advanceDetailEntity.setSecondPackName(StringUtil.isBlank(orderPackageDTO.getPackageClass()) ? "" : orderPackageDTO.getPackageClass());//二级品类名称 + advanceDetailEntity.setSecondPackCode("");//二级品类 + advanceDetailEntity.setThirdPackName(StringUtil.isBlank(orderPackageDTO.getPackageClass()) ? "" : orderPackageDTO.getPackageClass());//三级品类名称 + advanceDetailEntity.setThirdPackCode("");//三级品类 + } + advanceDetailEntity.setSiteName(""); + advanceDetailEntity.setSiteCode(""); + String planQty = orderPackageDTO.getPlanQty(); + advanceDetailEntity.setQuantity((StrUtil.isNotBlank(planQty) && NumberUtil.isNumber(planQty)) ? Convert.toInt(planQty) : 0); + advanceDetailEntity.setOrderPackageCode(orderPackageDTO.getPackageCode()); + advanceDetailEntity.setTrainNumber(zbReceiptDTO.getDepartCode()); + advanceDetailEntity.setServiceNum(orderPackageDTO.getRelationOrderCode()); + advanceDetailEntity.setWaybillNo(""); + advanceDetailEntity.setPackageStatus("0"); + advanceDetailEntity.setWeight(StrUtil.isNotBlank(orderPackageDTO.getTotalGrossWeight()) ? new BigDecimal(orderPackageDTO.getTotalGrossWeight()) : BigDecimal.ZERO); + advanceDetailEntity.setVolume(StrUtil.isNotBlank(orderPackageDTO.getTotalVolume()) ? new BigDecimal(orderPackageDTO.getTotalVolume()) : BigDecimal.ZERO); +// advanceDetailEntity.setChargeType(0); + advanceDetailEntity.setSupple(""); + advanceDetailEntity.setManifest(""); + advanceDetailEntity.setReturnNum(""); + advanceDetailEntity.setSendDateStr(DateUtil.formatLocalDateTime(LocalDateTime.now())); + advanceDetailEntity.setCarNumber(""); + advanceDetailEntity.setGoodsMan(""); + advanceDetailEntity.setTenantId(tenantId); + advanceDetailEntity.setStatus(0); + advanceDetailEntity.setIsDeleted(0); + List itemJsons = new ArrayList<>(); + List items = orderPackageDTO.getItems(); + for (PackageInfoDTO item : items) { + TrunklineDetailProductEntity detailProductEntity = new TrunklineDetailProductEntity(); + detailProductEntity.setTenantId(tenantId); + detailProductEntity.setWarehouseId(startWarehouseId); + detailProductEntity.setWarehouseName(startWarehouseName); + detailProductEntity.setUnitNo(orderPackageDTO.getPackageCode()); + detailProductEntity.setProductCode(item.getItemCode()); + detailProductEntity.setProductName(item.getItemName()); + detailProductEntity.setQuantity(item.getPlanQty()); + detailProductEntity.setStatus(0); + detailProductEntity.setIsDeleted(0); + itemJsons.add(JSONUtil.parseObj(detailProductEntity)); + } + JSONObject entries = JSONUtil.parseObj(advanceDetailEntity); + entries.set("items", itemJsons); + packageList.add(entries); + } + // 转成json对象,然后将包件明细放到detail中 + JSONObject entries = JSONUtil.parseObj(advanceEntity); + entries.set("details", JSONUtil.toJsonStr(packageList)); + advances.add(entries); + } + // 将组装好的暂存单发送到 MQ ,由暂存单服务统一消费SendMsg. + if (CollUtil.isNotEmpty(advances)) { + for (JSONObject advance : advances) { + SendMsg sendMsg = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER) + .routingKey(FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER).message(JSONUtil.toJsonStr(advance)).build(); + factoryDataClient.sendMessage(sendMsg); + } + } + } + + private ZbCategoryContrastEntity buildZbCategoryContrastEntityCache(String packageClass) { + + + if (StringUtil.isBlank(packageClass)) { + return null; + } + if (containsChinese(packageClass)) { + return null; + } + + String key = TenantNum.HUITONGCODE + ":" + ZbCategoryContrastEntity.class.getName() + ":" + packageClass; + ZbCategoryContrastEntity zbCategoryContrastEntity = bladeRedis.get(key); + if (zbCategoryContrastEntity == null) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("source_code", packageClass); + queryWrapper.eq("status", "1"); + zbCategoryContrastEntity = zbCategoryContrastMapper.selectOne(queryWrapper); + if (!Objects.isNull(zbCategoryContrastEntity)) { + // 缓存起来 + bladeRedis.setEx(key, zbCategoryContrastEntity, 3600 * 24L); + } + } + return zbCategoryContrastEntity; + + + } + + /** + * 验证参数中是否包含中文 + * + * @param str 匹配参数 + * @return true 包含中文 false 不包含中文 + */ + private boolean containsChinese(String str) { + Pattern pattern = Pattern.compile(PatternConstant.REGEX_CHINESE); + Matcher matcher = pattern.matcher(str); + return matcher.find(); + } } diff --git a/blade-service/logpm-factory/pom.xml b/blade-service/logpm-factory/pom.xml index 7cb61d98f..a441e8eb8 100644 --- a/blade-service/logpm-factory/pom.xml +++ b/blade-service/logpm-factory/pom.xml @@ -129,6 +129,11 @@ logpm-factory-data-api 3.2.0.RELEASE + + com.logpm + logpm-factory-data-zbom-api + 3.2.0.RELEASE + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java index c0c988862..301d2ff42 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java @@ -10,24 +10,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; -import org.springblade.common.annotations.LocalServerUser; import org.springblade.common.constant.RabbitConstant; import org.springblade.common.exception.CustomerException; 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.DateUtil; import org.springblade.core.tool.utils.StringUtil; -import org.springblade.core.tool.utils.ThreadLocalUtil; -import org.springblade.core.tool.utils.WebUtil; import org.springframework.amqp.rabbit.connection.CorrelationData; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import javax.servlet.http.HttpServletRequest; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -104,7 +97,10 @@ public class FactoryCommonController { //将消息携带绑定键值 rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); map.put("type", "DealWith"); - rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING, map); + rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING, map,message->{ + message.getMessageProperties().setHeader("x-delay",2000); + return message; + }); // R r = factoryDataService.handleStatusData(orderStatusDTO); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java index 75ec8e9f7..d70d6360a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java @@ -64,7 +64,6 @@ import lombok.extern.log4j.Log4j2; import org.jetbrains.annotations.Nullable; import org.springblade.common.annotations.LogpmAsync; import org.springblade.common.constant.HttpConstants; -import org.springblade.common.constant.PackagesTypeEnum; import org.springblade.common.constant.PatternConstant; import org.springblade.common.constant.TenantNum; import org.springblade.common.constant.factorydata.FactoryDataConstants; @@ -72,9 +71,7 @@ import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; import java.math.BigDecimal; import java.sql.Timestamp; @@ -770,9 +767,9 @@ public class AsyncDataServiceImpl implements IAsyncDataService { List factoryOrderEntities = factoryOrderService.lambdaQuery().eq(FactoryOrderEntity::getReceivingId, receivingOrderEntity.getId()).eq(FactoryOrderEntity::getTurnStatus, 0).list(); log.info(">>>>>>>>>>>>>>>>>>>>>handlerOuPaiDataToHt 派车单 {} 派车单下面订单集合长度 {}", receivingOrderEntity.getCode(), factoryOrderEntities.size()); - addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities); - // TODO 走新系统暂存单,暂时不写后面再写 -// addAdvanceEntityBtOuPaiNew(receivingOrderEntity, factoryOrderEntities); +// addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities); + // 走新系统暂存单 + addAdvanceEntityBtOuPaiNew(receivingOrderEntity, factoryOrderEntities); receivingOrderEntity.setTurnStatus(1); log.info(">>>>>>>>>>>>>>>>>>>>>handlerOuPaiDataToHt 更新收货单状态 收货单号 {}", receivingOrderEntity.getCode()); receivingOrderService.updateById(receivingOrderEntity); @@ -781,6 +778,149 @@ public class AsyncDataServiceImpl implements IAsyncDataService { } + private void addAdvanceEntityBtOuPaiNew(ReceivingOrderEntity receivingOrderEntity, List factoryOrderEntities) { + log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> addAdvanceEntityBtOuPai 派车单数据推送到新系统,更新物料信息 单号{}", receivingOrderEntity.getCode()); + String carNumber = receivingOrderEntity.getCarNumber(); + // 欧派只更新物料信息 不管暂存单信息 + String fromWarehouseName = receivingOrderEntity.getFromWarehouseName(); + // 只处理 已配置的基地的数据 其他基地无法确认,暂时不处理 + Long startWarehouseId = null; + String startWarehouseName = null; + String tenantId = null; + // 获取工厂基地绑定的始发仓信息 + R warehouseByBrandAndSiteName = factoryDataBaseClient.getWarehouseByBrandAndSiteName(BrandEnums.OP.getValue(), fromWarehouseName); + if (cn.hutool.core.util.ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) { + FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData(); + if (cn.hutool.core.util.ObjectUtil.isNotNull(data)) { + startWarehouseId = data.getWarehouseId(); + startWarehouseName = data.getWarehouseName(); + tenantId = data.getTenantId(); + } + } + if (cn.hutool.core.util.ObjectUtil.isAllNotEmpty(startWarehouseId, startWarehouseName, tenantId)) { + // 订单 + List advances = new ArrayList<>(); + for (FactoryOrderEntity factoryOrderEntity : factoryOrderEntities) { + factoryOrderEntity.setTurnStatus(1); + + TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity(); + advanceEntity.setTenantId(tenantId); + advanceEntity.setStatus(0); + advanceEntity.setIsDeleted(0); + advanceEntity.setOrderType(factoryOrderEntity.getOrderType()); + advanceEntity.setBrand(BrandEnums.OP.getValue()); + advanceEntity.setSiteName(fromWarehouseName); + advanceEntity.setArea(""); + advanceEntity.setPackName(""); + advanceEntity.setPackCode(""); + advanceEntity.setWarehouseId(startWarehouseId); + advanceEntity.setWarehouseName(startWarehouseName); + advanceEntity.setIsGcp(0); + advanceEntity.setCarrierName("汇通物流"); + advanceEntity.setSystemType("线上"); + advanceEntity.setMatingType("1"); + advanceEntity.setWaybillStatus("0"); + advanceEntity.setWaybillNo(""); + advanceEntity.setTrainNumber(receivingOrderEntity.getCarNumber()); + advanceEntity.setFreezeStatus("0"); + + advanceEntity.setSenderFactory(""); + advanceEntity.setOrderCode(factoryOrderEntity.getSelfCode()); + advanceEntity.setDealerCode(factoryOrderEntity.getShopCode()); + advanceEntity.setDealerName(factoryOrderEntity.getShopName()); + advanceEntity.setStoreCode(factoryOrderEntity.getShopCode()); + advanceEntity.setStoreName(factoryOrderEntity.getShopName()); + advanceEntity.setServiceNum(factoryOrderEntity.getServiceNumber()); + advanceEntity.setCustomerName(factoryOrderEntity.getCustomer()); + advanceEntity.setCustomerPhone(factoryOrderEntity.getCustomerPhone()); + advanceEntity.setCustomerAddress(factoryOrderEntity.getCustomerAddress()); + advanceEntity.setConsigneePerson(factoryOrderEntity.getShopReceiver()); + // 处理订单下面的包件数据 + List list = factoryPackageService.lambdaQuery() + .eq(FactoryPackageEntity::getOrderId, factoryOrderEntity.getId()).eq(FactoryPackageEntity::getTurnStatus, 0).list(); + advanceEntity.setHasPackage(CollUtil.isNotEmpty(list) ? 1 : 0); + advanceEntity.setTotalNum(CollUtil.isNotEmpty(list) ? list.size() : 0); + List packageList = new ArrayList<>(); + for (FactoryPackageEntity factoryPackageEntity : list) { + TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); + advanceDetailEntity.setWarehouseId(startWarehouseId); + advanceDetailEntity.setWarehouseName(startWarehouseName); + advanceDetailEntity.setOrderCode(factoryOrderEntity.getSelfCode()); + advanceDetailEntity.setBrand(BrandEnums.OP.getValue()); + advanceDetailEntity.setSystemType("线上"); + advanceDetailEntity.setFirstPackName(factoryPackageEntity.getFirstClassName()); + advanceDetailEntity.setFirstPackCode(factoryPackageEntity.getFirstClassCode()); + advanceDetailEntity.setSecondPackName(factoryPackageEntity.getSecondClassName());//二级品类名称 + advanceDetailEntity.setSecondPackCode(factoryPackageEntity.getSecondClassCode());//二级品类 + advanceDetailEntity.setThirdPackName(factoryPackageEntity.getThirdClassName());//三级品类名称 + advanceDetailEntity.setThirdPackCode(factoryPackageEntity.getThirdClassCode());//三级品类 + advanceDetailEntity.setMaterialName(factoryPackageEntity.getPackageDetailNames()); + advanceDetailEntity.setSiteName(fromWarehouseName); + advanceDetailEntity.setSiteCode(""); + advanceDetailEntity.setQuantity(1); + advanceDetailEntity.setOrderPackageCode(factoryPackageEntity.getCode()); + advanceDetailEntity.setTrainNumber(receivingOrderEntity.getCarNumber()); + advanceDetailEntity.setServiceNum(factoryOrderEntity.getServiceNumber()); + advanceDetailEntity.setWaybillNo(""); + advanceDetailEntity.setPackageStatus("0"); + advanceDetailEntity.setWeight(factoryPackageEntity.getWeight()); + if (cn.hutool.core.util.ObjectUtil.isAllNotEmpty(factoryPackageEntity.getHeight(), factoryPackageEntity.getWidth(), factoryPackageEntity.getLength())) { + advanceDetailEntity.setVolume(factoryPackageEntity.getHeight().multiply(factoryPackageEntity.getWidth()).multiply(factoryPackageEntity.getLength())); + } + advanceDetailEntity.setSupple(""); + advanceDetailEntity.setManifest(""); + advanceDetailEntity.setReturnNum(""); + advanceDetailEntity.setSendDateStr(DateUtil.formatLocalDateTime(LocalDateTime.now())); + advanceDetailEntity.setCarNumber(""); + advanceDetailEntity.setGoodsMan(""); + advanceDetailEntity.setTenantId(tenantId); + advanceDetailEntity.setStatus(0); + advanceDetailEntity.setIsDeleted(0); + // 物料 + List factoryPackageDetailEntities = factoryPackageDetailService.lambdaQuery() + .eq(FactoryPackageDetailEntity::getPackageId, factoryPackageEntity.getId()).list(); + List itemJsons = new ArrayList<>(); + if (CollUtil.isNotEmpty(factoryPackageDetailEntities)) { + for (FactoryPackageDetailEntity factoryPackageDetailEntity : factoryPackageDetailEntities) { + if(cn.hutool.core.util.ObjectUtil.equal(factoryPackageEntity.getPackageDetailNames(),factoryPackageDetailEntity.getName())){ + advanceDetailEntity.setMaterialCode(factoryPackageDetailEntity.getCode()); + } + TrunklineDetailProductEntity detailProductEntity = new TrunklineDetailProductEntity(); + detailProductEntity.setTenantId(tenantId); + detailProductEntity.setWarehouseId(startWarehouseId); + detailProductEntity.setWarehouseName(startWarehouseName); + detailProductEntity.setUnitNo(factoryPackageEntity.getCode()); + detailProductEntity.setProductCode(factoryPackageDetailEntity.getCode()); + detailProductEntity.setProductName(factoryPackageDetailEntity.getName()); + detailProductEntity.setReserve1(factoryPackageDetailEntity.getType()); + detailProductEntity.setReserve2(factoryPackageDetailEntity.getUnit()); + detailProductEntity.setQuantity(1); + detailProductEntity.setStatus(0); + detailProductEntity.setIsDeleted(0); + itemJsons.add(JSONUtil.parseObj(detailProductEntity)); + } + } + JSONObject entries = JSONUtil.parseObj(advanceDetailEntity); + entries.set("items", itemJsons); + packageList.add(entries); + } + JSONObject entries = JSONUtil.parseObj(advanceEntity); + entries.set("details", JSONUtil.toJsonStr(packageList)); + advances.add(entries); + } + factoryOrderService.updateBatchById(factoryOrderEntities); + // 发送消息 + if (CollUtil.isNotEmpty(advances)) { + for (JSONObject advance : advances) { + SendMsg sendMsg = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER_OUPAI) + .routingKey(FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER).message(JSONUtil.toJsonStr(advance)).build(); + factoryDataClient.sendMessage(sendMsg); + } + } + } + + } + /** * 欧派数据保存到老系统 * diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java index 32bd182a2..bbf7d1256 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java @@ -129,7 +129,8 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService { @Override public void extracted(String status, String unitNo, String currentWarehouseId, String operationTime, Integer trayId) { log.info("#############extracted: 当前处理的数据为 status={} unitNo={} currentWarehouseId={} operationTime={} trayId={}",status,unitNo,currentWarehouseId,operationTime,trayId); - if ("4".equals(status) || "2".equals(status)) { + String redisKey = "extracted:"+unitNo; + if ("4".equals(status) || "2".equals(status) || "1".equals(status)) { //继续判断是否到达目的仓 //查询destinationWarehouse logiBillNo plantId数据 @@ -152,8 +153,12 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService { if (OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)) { try { if ("1".equals(status) || "4".equals(status)) { - // 始发仓和目的仓入库 - panFactoryDataService.handleDataToPlatform(unitNo, operationTime,Integer.parseInt(currentWarehouseId)); + Boolean exists = bladeRedis.exists(redisKey); + if(Boolean.FALSE.equals(exists)){ + bladeRedis.setEx(redisKey, "1", 60L); + // 始发仓和目的仓入库 + panFactoryDataService.handleDataToPlatform(unitNo, operationTime,Integer.parseInt(currentWarehouseId)); + } } else { log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态"); } @@ -162,6 +167,10 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService { } catch (Exception e) { log.error(">>>> 数据推送异常", e); + Boolean exists = bladeRedis.exists(redisKey); + if(Boolean.TRUE.equals(exists)){ + bladeRedis.del(redisKey); + } orderPackageStatusPushFailLogService.saveOrderPackageStatusFaleLog(unitNo, currentWarehouseId, status, operationTime, trayId); log.error(">>>> 保存到错误数据推送记录 {}", unitNo); } @@ -169,6 +178,10 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService { } } } else { + Boolean exists = bladeRedis.exists(redisKey); + if(Boolean.TRUE.equals(exists)){ + bladeRedis.del(redisKey); + } orderPackageStatusPushFailLogService.saveOrderPackageStatusFaleLog(unitNo, currentWarehouseId, status, operationTime, trayId); } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java index 8171a6d3c..d979f2111 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java @@ -222,6 +222,22 @@ public class RabbitMqConfiguration { public Binding unloadCarNumBinding(Queue unloadCarNumQueue, CustomExchange unloadCarNumExchange) { return BindingBuilder.bind(unloadCarNumQueue).to(unloadCarNumExchange).with(RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING).noargs(); } + @Bean + public Queue hwyUnloadCarNumQueue() { + return new Queue(RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_QUEUE, true); + } + + @Bean + public CustomExchange hwyUnloadCarNumExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_EXCHANGE, "x-delayed-message", true, false, args); + } + + @Bean + public Binding hwyUnloadCarNumBinding(Queue hwyUnloadCarNumQueue, CustomExchange hwyUnloadCarNumExchange) { + return BindingBuilder.bind(hwyUnloadCarNumQueue).to(hwyUnloadCarNumExchange).with(RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_ROUTING).noargs(); + } @Bean diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java index a3b5ed937..28cc15b2c 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java @@ -4,21 +4,19 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.factory.comfac.dto.OrderStatusDTO; import com.logpm.factory.oupai.mapper.FactoryOrderMapper; import com.logpm.factory.oupai.service.IOuPaiFactoryService; +import com.logpm.factory.props.SendDataProperties; import com.logpm.factory.snm.dto.GroupByPackagesDTO; import com.logpm.factory.snm.entity.OrderLogEntity; import com.logpm.factory.snm.entity.StaorderPackagesEntity; import com.logpm.factory.snm.entity.StationOrderEntity; import com.logpm.factory.snm.entity.StationlinenumEntity; import com.logpm.factory.snm.service.*; -import com.logpm.factory.zb.vo.PackageInfoVO; import com.logpm.factorydata.base.feign.IFactoryDataBaseClient; import com.logpm.factorydata.base.vo.FactoryWarehouseBindVO; import com.logpm.factorydata.enums.BrandEnums; @@ -35,6 +33,7 @@ import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.common.constant.HttpConstants; @@ -43,7 +42,6 @@ import org.springblade.common.constant.PackagesTypeEnum; import org.springblade.common.constant.factorydata.FactoryDataConstants; import org.springblade.common.utils.CommonUtil; import org.springblade.core.tool.api.R; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; @@ -64,6 +62,7 @@ import java.util.stream.Collectors; * * @author xuxueli */ +@Slf4j @AllArgsConstructor @Component public class FactoryXxlJob { @@ -91,6 +90,8 @@ public class FactoryXxlJob { private final IFactoryDataBaseClient factoryDataBaseClient; private final IFactoryDataClient factoryDataClient; + private final SendDataProperties sendDataProperties; + /** * snm工厂数据任务调度 @@ -194,9 +195,15 @@ public class FactoryXxlJob { }); // 调用接口写入到老系统的数据库 - resoveFactoryData(); + if (ObjectUtil.equal(sendDataProperties.getSend(), "old")) { + log.info("推送到老系统"); + resoveFactoryData(); + } // 走新系统暂存单 -// resoveFactoryDataNew(); + if (ObjectUtil.equal(sendDataProperties.getSend(), "new")) { + log.info("推送到新系统"); + resoveFactoryDataNew(); + } return ReturnT.SUCCESS; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java index 24963ea7c..01f76ad73 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java @@ -16,20 +16,31 @@ */ package com.logpm.factory.mt.controller; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.EnumUtil; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.comfac.service.IAsyncDataService; import com.logpm.factory.comfac.service.IOrderStatusLogService; import com.logpm.factory.mt.dto.MtFactoryDataDTO; import com.logpm.factory.mt.service.IMtFactoryDataService; +import com.logpm.factory.props.SendDataProperties; import com.logpm.factory.snm.entity.OrderStatusLog; +import com.logpm.factorydata.enums.BrandEnums; +import com.logpm.factorydata.vo.NodePushMsg; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.exception.CustomerException; import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -38,6 +49,9 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -58,6 +72,34 @@ public class MtFactoryDataController extends BladeController { private final IMtFactoryDataService mtFactoryDataService; private final IAsyncDataService asyncDataService; + private final RabbitTemplate rabbitTemplate; + private final SendDataProperties sendDataProperties; + + @ResponseBody + @PostMapping("/sendMsg") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "发送消息", notes = "传入factoryOrderDTO") + public R sendMsg(@Validated @RequestBody cn.hutool.json.JSONObject mtFactoryDataDTO, HttpServletRequest request) { + log.info("############data:{} ", mtFactoryDataDTO); + String corpId = request.getHeader("corpId"); + NodePushMsg msg = new NodePushMsg(); + msg.setNode(EnumUtil.fromString(WorkNodeEnums.class, mtFactoryDataDTO.getStr("node"))); + msg.setBrand(BrandEnums.MTMM); + msg.setOperator(AuthUtil.getUser().getNickName()); + msg.setOperatorTime(new Date()); + List contents = new ArrayList<>(); + ArrayList codes = CollUtil.newArrayList(mtFactoryDataDTO.getStr("packageCode").split(",")); + if (CollUtil.isNotEmpty(codes)) { + for (String code : codes) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("packageCode", code); + contents.add(jsonObject); + } + } + msg.setContent(contents); + rabbitTemplate.convertAndSend(RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_ROUTING, msg); + return R.success("1"); + } /** * 工厂数据推送接口 @@ -91,9 +133,15 @@ public class MtFactoryDataController extends BladeController { orderStatusLog.setStatus(0); //开启异步线程处理数据 if (!Objects.isNull(mainId)) { - asyncDataService.handlerMtDataToHt(map.get("mainId")); + if (ObjectUtil.equal(sendDataProperties.getSend(), "old")) { + log.info("推送到老系统"); + asyncDataService.handlerMtDataToHt(map.get("mainId")); + } // 走新系统暂存单 -// asyncDataService.handlerMtDataToHtNew(map.get("mainId")); + if (ObjectUtil.equal(sendDataProperties.getSend(), "new")) { + log.info("推送到新系统"); + asyncDataService.handlerMtDataToHtNew(map.get("mainId")); + } } } else { orderStatusLog.setStatus(2); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 674a74f4a..f9e70f040 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -1,5 +1,6 @@ package com.logpm.factory.oupai.service.impl; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONArray; @@ -17,6 +18,7 @@ import com.logpm.factory.oupai.entity.*; import com.logpm.factory.oupai.mapper.ReceivingOrderMapper; import com.logpm.factory.oupai.service.*; import com.logpm.factory.props.OuPaiProperties; +import com.logpm.factory.props.SendDataProperties; import com.logpm.factory.snm.bean.Resp; import com.logpm.oldproject.feign.IAdvanceClient; import com.logpm.oldproject.feign.IAdvanceDetailClient; @@ -39,6 +41,7 @@ import org.springblade.system.cache.DictCache; import org.springblade.system.entity.Dict; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -96,6 +99,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { @Autowired private OpPushFailedPackageRecordService opPushFailedPackageRecordService; + @Autowired + private SendDataProperties sendDataProperties; @Override public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) { @@ -111,7 +116,10 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { handleData(code); if (ObjectUtils.isNotNull(code)) { // 暂停推送 -// asyncDataService.handlerOuPaiDataToHt(code); + if(ObjectUtil.equal(sendDataProperties.getSend(), "new")){ + log.info("推送新系统"); + asyncDataService.handlerOuPaiDataToHt(code); + } } return code; diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java index 0839dad5c..0dd8dfa24 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java @@ -16,6 +16,7 @@ */ package com.logpm.factory.pan.controller; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.comfac.service.IAsyncDataService; @@ -25,6 +26,7 @@ import com.logpm.factory.pan.service.IPanFactoryDataService; import com.logpm.factory.pan.service.IPanFactoryOrderService; import com.logpm.factory.pan.service.IPanPackageInfoService; import com.logpm.factory.pan.service.IPanPackageListService; +import com.logpm.factory.props.SendDataProperties; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.entity.OrderStatusLog; import io.swagger.annotations.Api; @@ -32,9 +34,13 @@ import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springblade.core.boot.ctrl.BladeController; -import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.util.Objects; @@ -57,8 +63,8 @@ public class PanFactoryDataController extends BladeController { private final IPanPackageListService packageListService; private final IPanFactoryDataService panFactoryDataService; private final IAsyncDataService syncDataService; - private RabbitTemplate rabbitTemplate; private final IOrderStatusLogService panOrderStatusLogService; + private final SendDataProperties sendDataProperties; // @ResponseBody // @PostMapping("/token") @@ -87,7 +93,6 @@ public class PanFactoryDataController extends BladeController { // } - /** * 工厂数据推送接口 */ @@ -111,26 +116,32 @@ public class PanFactoryDataController extends BladeController { //判断数据是否已存入 String orderNo = factoryOrderDTO.getOrderNo(); Long orderId = null; - try{ + try { orderId = panFactoryDataService.saveData(factoryOrderDTO); panOrderStatusLog.setStatus(0); - }catch (Exception e){ - log.warn("############data: 保存数据失败 orderNo={}",orderNo); - log.error("############data: 保存数据失败",e); + } catch (Exception e) { + log.warn("############data: 保存数据失败 orderNo={}", orderNo); + log.error("############data: 保存数据失败", e); //修改保存数据的状态 panOrderStatusLog.setStatus(2); } panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); //开启异步线程处理数据 - if(!Objects.isNull(orderId)){ - syncDataService.handlerPanDataToHt(orderId); + if (!Objects.isNull(orderId)) { + if (ObjectUtil.equal(sendDataProperties.getSend(), "old")) { + log.info("推送到老系统"); + syncDataService.handlerPanDataToHt(orderId); + } // 走新系统暂存单 -// syncDataService.handlerPanDataToHtNew(orderId); + if (ObjectUtil.equal(sendDataProperties.getSend(), "new")) { + log.info("推送到新系统"); + syncDataService.handlerPanDataToHtNew(orderId); + } } - return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS"); + return Resp.successOrderNo(factoryOrderDTO.getOrderNo(), factoryOrderDTO.getDeliveryNumber(), "SUCCESS"); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/SendDataProperties.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/SendDataProperties.java new file mode 100644 index 000000000..623e39b80 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/SendDataProperties.java @@ -0,0 +1,23 @@ +package com.logpm.factory.props; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * FactoryProperties + * + * @author pref + */ +@Component +@Data +@ConfigurationProperties(prefix = "factory.data") +public class SendDataProperties { + /** + * 名称 + */ + private String send = "old"; + + + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/HwyUnloadCarComHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/HwyUnloadCarComHandler.java new file mode 100644 index 000000000..cdf04f883 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/HwyUnloadCarComHandler.java @@ -0,0 +1,179 @@ +package com.logpm.factory.receiver; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.logpm.factory.mt.entity.MtPushData; +import com.logpm.factory.mt.service.IMtFactoryDataService; +import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +import com.logpm.factory.mt.service.IMtPushDataService; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; +import com.logpm.factorydata.enums.BrandEnums; +import com.logpm.factorydata.vo.NodePushMsg; +import com.logpm.oldproject.feign.IAdvanceDetailClient; +import com.rabbitmq.client.Channel; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.constant.WorkNodeEnums; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.security.NoSuchAlgorithmException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 卸车完成处理队列 + */ +@Slf4j +@RabbitListener(queues = RabbitConstant.HWY_UNLOAD_CAR_COM_INFO_QUEUE) +@Component +public class HwyUnloadCarComHandler { + + @Autowired + private IAdvanceDetailClient advanceDetailClient; + + + @Autowired + private IMtFactoryOrderMainService mtFactoryOrderMainService; + + @Autowired + private IMtFactoryDataService mtFactoryDataService; + + @Autowired + private IMtPushDataService mtPushDataService; + + + @RabbitHandler + public void unloadCarComDataHandler(NodePushMsg nodePushMsg, Message message, Channel channel) { +// NodePushMsg nodePushMsg = JSONUtil.toBean(msg, NodePushMsg.class); + BrandEnums brand = nodePushMsg.getBrand(); + switch (brand) { + case MTMM: + pushMentTian(nodePushMsg); + break; + } + } + + private void pushMentTian(NodePushMsg nodePushMsg) { + if (!ObjectUtil.equals(WorkNodeEnums.END_WAREHOUSE_UNLOADING, nodePushMsg.getNode())) { + return; + } + // 根据包件获取车次 + List content = nodePushMsg.getContent(); + List carNumList = new ArrayList<>(); + if (CollUtil.isNotEmpty(content)) { + for (Object s : content) { + JSONObject jsonObject = JSONUtil.parseObj(s); + String packageCode = (String) jsonObject.get("packageCode"); + carNumList.add(packageCode); + } + } + + try { + + List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); + // 对这个集合内进行分组 + Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); + Set set = stringListMap.keySet(); + String carNum = null; + + Set r = new HashSet<>(); + for (String s : set) { + // 得到某个工厂运输批次的集合 + List t = stringListMap.get(s); + //得到这个批次下面所有的包件 + List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); + // 当前批次的包件 在 这个配载计划中存在一个 则进行通知 + for (String mtStr : carNumList) { + if (strs.contains(mtStr)) { + carNum = s; + break; + } + } + if (StringUtil.isNoneBlank(carNum)) { + r.add(carNum); + } + } + + r.forEach(t -> { + sendDataCarNum(t, DateUtil.formatDateTime(nodePushMsg.getOperatorTime())); + }); + + + } catch (Exception e) { + log.error("##################unloadCarComDataHandler 解析数据出错:{}", e.getMessage()); + } + } + + /** + * 根基匹配到的发货单编号 推送梦天 + * + * @param carNum 车次号 + * @param completeDate 完成时间 + * @throws ParseException + * @throws NoSuchAlgorithmException + * @throws JsonProcessingException + */ + private void sendDataCarNum(String carNum, String completeDate) { + log.info("##################sendDataCarNum carNum:{},completeDate{}", carNum, completeDate); + + // 需要判断这个发货单编号是否推送过 + QueryWrapper lambdaQueryChainWrapper = new QueryWrapper(); + lambdaQueryChainWrapper.eq("ref_code", carNum); + MtPushData ms = mtPushDataService.getOne(lambdaQueryChainWrapper); + if (ObjectUtils.isNotNull(ms)) { + log.info("##################{} 车次已经推送过", carNum); + return; + } + try { + + R r = mtFactoryDataService.sendUnloadCarNum(carNum, completeDate); + + log.info("MT 数据卸车推送 {}", r.getMsg()); + } catch (Exception e) { + + + log.error(">>>> 梦天数据卸车推送异常", e); + } + log.info("##################{} 梦天确认签收数据推送1", carNum); + + } + + @Nullable + private List getBizData(JSONObject entries) { + List content = entries.getBeanList("content", JSONObject.class); + List packageCodeList = null; + if (CollUtil.isNotEmpty(content)) { + // 查询这次操作的所有包件和运单号 + packageCodeList = new ArrayList<>(); + for (JSONObject obj : content) { + String packageCode = obj.getStr("packageCode"); + if (StrUtil.isNotBlank(packageCode)) { + packageCodeList.add(packageCode); + } + } + } + return packageCodeList; + } + + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/controller/ZbFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/controller/ZbFactoryDataController.java index 053398d46..ff332bdd9 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/controller/ZbFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/controller/ZbFactoryDataController.java @@ -21,13 +21,16 @@ import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springblade.resource.feign.IOssClient; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletRequest; import java.io.File; -import java.io.FileInputStream; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; @@ -35,6 +38,7 @@ import java.util.Objects; /** * 志邦工厂数据推送 + * * @author pref * @data 2023-02-21 */ @@ -55,6 +59,7 @@ public class ZbFactoryDataController { private final IOssClient ossClient; + /** * 工厂数据推送接口 */ @@ -62,15 +67,15 @@ public class ZbFactoryDataController { @PostMapping("/data") @ApiOperationSupport(order = 1) @ApiOperation(value = "工厂数据推送", notes = "传入factoryOrderDTO") - public ZbResp data(@RequestBody ZBReceiptDTO zbReceiptDTO, HttpServletRequest request) { + public ZbResp data(@RequestBody ZBReceiptDTO zbReceiptDTO, HttpServletRequest request) { - log.info("############zbReceiptDTO: {}",zbReceiptDTO); + log.info("############zbReceiptDTO: {}", zbReceiptDTO); String corpId = request.getHeader("corpId"); zbReceiptDTO.setCorpId(corpId); String method = request.getParameter("method"); - if(!"entry.order.create".equals(method)){ - log.warn("############data: 暂不支持该功能 method={}",method); + if (!"entry.order.create".equals(method)) { + log.warn("############data: 暂不支持该功能 method={}", method); return ZbResp.fail("暂不支持该功能"); } @@ -99,12 +104,12 @@ public class ZbFactoryDataController { // //判断数据是否已存入 Long orderId = null; - try{ + try { orderId = zbFactoryDataService.saveData(zbReceiptDTO); // orderStatusLog.setStatus(0); zbFactoryLogEntity.setSaxStatus(1); - }catch (Exception e){ - log.error("############data: 保存数据失败",e); + } catch (Exception e) { + log.error("############data: 保存数据失败", e); //修改保存数据的状态 // orderStatusLog.setStatus(2); zbFactoryLogEntity.setSaxStatus(2); @@ -113,9 +118,15 @@ public class ZbFactoryDataController { zbFactoryLogService.saveOrUpdate(zbFactoryLogEntity); //开启异步线程处理数据 - if(!Objects.isNull(orderId)){ + if (!Objects.isNull(orderId)) { syncDataService.handlerZbDataToHt(orderId); } + // 推送数据到新系统 + try { + zbFactoryDataService.saveDataNew(zbReceiptDTO); + } catch (Exception e) { + log.error("志邦数据传新系统失败"); + } return ZbResp.success("成功"); } @@ -126,7 +137,7 @@ public class ZbFactoryDataController { MultipartFile multi = getMultipartFile(logPath); //上传到服务器 - R r = ossClient.fileUpload(multi,"zb-logs"); + R r = ossClient.fileUpload(multi, "zb-logs"); if (r.isSuccess()) { BladeFile data = (BladeFile) r.getData(); return data.getLink(); @@ -147,8 +158,8 @@ public class ZbFactoryDataController { , true , file.getName()); try ( - InputStream input = Files.newInputStream(file.toPath()); - OutputStream os = item.getOutputStream()) { + InputStream input = Files.newInputStream(file.toPath()); + OutputStream os = item.getOutputStream()) { // 流转移 IOUtils.copy(input, os); } catch (Exception e) { diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/IZbFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/IZbFactoryDataService.java index be748a7f6..ccd0c0c97 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/IZbFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/IZbFactoryDataService.java @@ -16,4 +16,6 @@ public interface IZbFactoryDataService { R handleStatusData(OrderStatusDTO orderStatusDTO); + void saveDataNew(ZBReceiptDTO zbReceiptDTO); + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java index 074f2e2b9..e9c24b8e3 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/zb/service/impl/ZbFactoryDataServiceImpl.java @@ -17,12 +17,14 @@ import com.logpm.factory.zb.entity.ZbPackageInfoEntity; import com.logpm.factory.zb.entity.ZbReceiptEntity; import com.logpm.factory.zb.service.*; import com.logpm.factory.zb.untils.QmSignUntil; +import com.logpm.factorydata.zbom.feign.IFactoryDataZbomClient; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.feign.IAdvanceClient; import com.logpm.oldproject.feign.IAdvanceDetailClient; import com.logpm.oldproject.feign.IOrderDetailClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.annotations.LogpmAsync; import org.springblade.common.utils.CommonUtil; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; @@ -46,6 +48,7 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService { private final IPackageInfoService packageInfoService; private final ZbFactoryProperties zbFactoryProperties; private final IZbOrderLogService zbOrderLogService; + private final IFactoryDataZbomClient zbomClient; @Override public Long saveData(ZBReceiptDTO zbReceiptDTO) { @@ -218,6 +221,12 @@ public class ZbFactoryDataServiceImpl implements IZbFactoryDataService { } } + @Override + @LogpmAsync("asyncExecutor") + public void saveDataNew(ZBReceiptDTO zbReceiptDTO) { + zbomClient.order(JSONObject.toJSONString(zbReceiptDTO)); + } + private String getZbUrl(String url, Map params, String sign) { String[] keys = params.keySet().toArray(new String[0]); diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java new file mode 100644 index 000000000..93ecfa04f --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java @@ -0,0 +1,48 @@ +package com.logpm.statistics.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.statistics.dto.MerchantStatisticsDTO; +import com.logpm.statistics.service.IStatisticsOrderInfoService; +import com.logpm.statistics.service.IStatisticsWaybillInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@RestController +@AllArgsConstructor +@RequestMapping("/merchantStatistics") +@Api(value = "商户结算控制类", tags = "珊瑚结算接口") +public class MerchantStatisticsController { + + private final IStatisticsOrderInfoService statisticsOrderInfoService; + private final IStatisticsWaybillInfoService statisticsWaybillInfoService; + + @ResponseBody + @PostMapping("/pageToBussesList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "运单维度对账单", notes = "传入waybillDTO") + public R pageToBussesList(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) { + String method = "############pageToBussesList: "; + log.info(method+"请求参数{}",merchantStatisticsDTO); + try{ + +// IPage pages = statisticsWaybillInfoService.pageToBussesList(merchantStatisticsDTO); +// +// return R.data(pages); + return R.data(null); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error("############sendOrders: 系统异常",e); + return R.fail(500,"############sendOrders: 系统异常"); + } + } + + +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java new file mode 100644 index 000000000..764d1ffe3 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java @@ -0,0 +1,114 @@ +package com.logpm.statistics.listener.mq; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.logpm.statistics.entity.StatisticsDistributionPackageEntity; +import com.logpm.statistics.entity.StatisticsOrderInfoEntity; +import com.logpm.statistics.service.IStatisticsDistributionPackageService; +import com.logpm.statistics.service.IStatisticsOrderInfoService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.WorkNodeEnums; +import org.springblade.common.constant.broadcast.FanoutConstants; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +@Slf4j +@Component +@AllArgsConstructor +public class PackageFanoutListener { + + private final IStatisticsDistributionPackageService statisticsDistributionPackageService; + private final IStatisticsOrderInfoService statisticsOrderInfoService; + + @RabbitListener(bindings = @QueueBinding( + value = @Queue(name = FanoutConstants.trunkline.PACKAGNODE.QUEUE.PACKAGE_SIGN), + exchange = @Exchange(name = FanoutConstants.trunkline.PACKAGNODE.EXCHANGE, type = ExchangeTypes.FANOUT) + )) + @Transactional(rollbackFor = Exception.class) + public void packageSignFanout(String msg) { + JSONObject jsonObject = JSONUtil.parseObj(msg); + Integer workNode = jsonObject.getInt("workNode"); + if(WorkNodeEnums.SIGN_DIRECT_SHIPPER.getCode().equals(workNode) + || WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART.getCode().equals(workNode) + || WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode().equals(workNode)){ + + JSONArray orderPackageCodes = jsonObject.getJSONArray("orderPackageCodes"); + List orderPackageCodeList = orderPackageCodes.toList(String.class); + + //如果是签收 + List statisticsDistributionList = statisticsDistributionPackageService.findListByOrderPackageCodes(orderPackageCodeList); + //修改statisticsDistributionList中所有元素的isSign为1 + Set orderInfoSet = new HashSet<>(); + statisticsDistributionList.forEach(statisticsDistributionPackageEntity -> { + statisticsDistributionPackageEntity.setIsSign(1); + String typeService = statisticsDistributionPackageEntity.getTypeService(); + if("3".equals(typeService)){ + statisticsDistributionPackageEntity.setRealDeliveryFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryDistance(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryCrossingFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryLoadingFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryMoveFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryServiceFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliverySortingFee(BigDecimal.ZERO); + statisticsDistributionPackageEntity.setRealDeliveryUpfloorFee(BigDecimal.ZERO); + } + orderInfoSet.add(statisticsDistributionPackageEntity.getOrderInfoId()); + }); + statisticsDistributionPackageService.updateBatchById(statisticsDistributionList); + + List statisticsList = statisticsDistributionPackageService.findListByOrderInfoSet(orderInfoSet); + //把statisticsList通过元素的orderInfoId进行map分组 + Map> groupedStatisticsList = statisticsList.stream() + .collect(Collectors.groupingBy(StatisticsDistributionPackageEntity::getOrderInfoId)); + + List orderInfoList = statisticsOrderInfoService.findListByOrderInfoIdsSet(orderInfoSet); + //把orderInfoList转成以id为key的map + Map orderInfoMap = orderInfoList.stream() + .collect(Collectors.toMap(StatisticsOrderInfoEntity::getId, statisticsOrderInfoEntity -> statisticsOrderInfoEntity)); + + List updateOrderInfoList = new ArrayList<>(); + groupedStatisticsList.keySet().forEach(orderInfoId -> { + StatisticsOrderInfoEntity statisticsOrderInfoEntity = orderInfoMap.get(orderInfoId); + Integer signStatus = statisticsOrderInfoEntity.getSignStatus(); + List statisticsDistributionPackageEntities = groupedStatisticsList.get(orderInfoId); + int allSize = statisticsDistributionPackageEntities.size(); + + //过滤出statisticsDistributionPackageEntities中isSign等于0的元素 + List unSignStatisticsDistributionPackageEntities = statisticsDistributionPackageEntities.stream() + .filter(statisticsDistributionPackageEntity -> !statisticsDistributionPackageEntity.getIsSign().equals(1)) + .collect(Collectors.toList()); + + int unSignSize = unSignStatisticsDistributionPackageEntities.size(); + + if(unSignSize == 0){ + if(signStatus != 2){ + statisticsOrderInfoEntity.setSignStatus(2); + } + }else{ + if(unSignSize != allSize){ + if(signStatus != 1){ + statisticsOrderInfoEntity.setSignStatus(1); + } + } + } + updateOrderInfoList.add(statisticsOrderInfoEntity); + }); + + statisticsOrderInfoService.updateBatchById(updateOrderInfoList); + + } + } + + +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java index f942d90b0..c958044f6 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java @@ -3,8 +3,8 @@ package com.logpm.statistics.listener.mq; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.logpm.statistics.entity.StatisticsPackageInfoEntity; -import com.logpm.statistics.service.IStatisticsPackageInfoService; +import com.logpm.statistics.entity.*; +import com.logpm.statistics.service.*; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.broadcast.FanoutConstants; @@ -18,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; @Slf4j @@ -25,7 +27,11 @@ import java.util.stream.Collectors; @AllArgsConstructor public class WaybillFanoutListener { - private final IStatisticsPackageInfoService statisticsPackageInfoService; + private final IStatisticsTrunklinePackageService statisticsTrunklinePackageService; + private final IStatisticsWarehousePackageService statisticsWarehousePackageService; + private final IStatisticsDistributionPackageService statisticsDistributionPackageService; + private final IStatisticsOrderInfoService statisticsOrderInfoService; + private final IStatisticsWaybillInfoService statisticsWaybillInfoService; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FanoutConstants.trunkline.OPENWAYBILL.QUEUE.STATISTICSDATA_CREATEPACKAGEINFO), @@ -34,113 +40,216 @@ public class WaybillFanoutListener { @Transactional(rollbackFor = Exception.class) public void createPackageInfo(String msg) { -// if(StringUtil.isBlank(msg)){ -// log.warn("############createPackageInfo: 接收参数为空 msg={}",msg); -// -// } - JSONObject jsonObject = JSONUtil.parseObj(msg); Long warehouseId = jsonObject.getLong("warehouseId"); String warehouseName = jsonObject.getStr("warehouseName"); Long waybillId = jsonObject.getLong("waybillId"); String waybillNo = jsonObject.getStr("waybillNo"); + String typeService = jsonObject.getStr("typeService");//服务类型 + + List statisticsTrunklinePackageEntities = new ArrayList<>(); + List statisticsWarehousePackageEntities = new ArrayList<>(); + List statisticsDistributionPackageEntities = new ArrayList<>(); - List ls = new ArrayList<>(); JSONArray orderPackageCodes = jsonObject.getJSONArray("orderPackageCodes"); for (int i = 0; i < orderPackageCodes.size(); i++) { JSONObject json = orderPackageCodes.getJSONObject(i); - StatisticsPackageInfoEntity statisticsPackageInfoEntity = new StatisticsPackageInfoEntity(); - statisticsPackageInfoEntity.setWarehouseId(warehouseId); - statisticsPackageInfoEntity.setWarehouseName(warehouseName); - statisticsPackageInfoEntity.setTypeService(json.getStr("typeService")); - statisticsPackageInfoEntity.setWaybillId(waybillId); - statisticsPackageInfoEntity.setWaybillNo(waybillNo); + + //干线 + StatisticsTrunklinePackageEntity statisticsTrunklinePackageEntity = new StatisticsTrunklinePackageEntity(); + statisticsTrunklinePackageEntity.setWarehouseId(warehouseId); + statisticsTrunklinePackageEntity.setWarehouseName(warehouseName); + statisticsTrunklinePackageEntity.setTypeService(typeService); + statisticsTrunklinePackageEntity.setWaybillId(waybillId); + statisticsTrunklinePackageEntity.setWaybillNo(waybillNo); Integer waybillType = json.getInt("waybillType"); if(waybillType.equals(1)){ - statisticsPackageInfoEntity.setGoodsType(1); + statisticsTrunklinePackageEntity.setGoodsType(1); + }else if (waybillType.equals(2)){ + statisticsTrunklinePackageEntity.setGoodsType(2); + }else{ + statisticsTrunklinePackageEntity.setGoodsType(3); + } + statisticsTrunklinePackageEntity.setOrderCode(json.getStr("orderCode")); + statisticsTrunklinePackageEntity.setOrderPackageCode(json.getStr("orderPackageCode")); + statisticsTrunklinePackageEntity.setProductName(json.getStr("productName")); + statisticsTrunklinePackageEntity.setTotalNum(json.getInt("totalNum")); + statisticsTrunklinePackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); + statisticsTrunklinePackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsTrunklinePackageEntity.setOpenPrice(json.getBigDecimal("openPrice")); + statisticsTrunklinePackageEntity.setTotalPrice(json.getBigDecimal("openPrice")); + statisticsTrunklinePackageEntity.setPickupFee(json.getBigDecimal("pickupFee")); + statisticsTrunklinePackageEntity.setRealPickupFee(json.getBigDecimal("pickupFee")); + statisticsTrunklinePackageEntity.setFreightFee(json.getBigDecimal("freightFee")); + statisticsTrunklinePackageEntity.setRealFreightFee(json.getBigDecimal("freightFee")); + statisticsTrunklinePackageEntity.setInstallFee(json.getBigDecimal("installFee")); + statisticsTrunklinePackageEntity.setRealInstallFee(json.getBigDecimal("installFee")); + statisticsTrunklinePackageEntity.setQuotationFee(json.getBigDecimal("quotationFee")); + statisticsTrunklinePackageEntity.setRealQuotationFee(json.getBigDecimal("quotationFee")); + statisticsTrunklinePackageEntity.setClaimingValue(json.getBigDecimal("claimingValue")); + statisticsTrunklinePackageEntity.setRealClaimingValue(json.getBigDecimal("claimingValue")); + statisticsTrunklinePackageEntity.setOtherFee(json.getBigDecimal("otherFee")); + statisticsTrunklinePackageEntity.setRealOtherFee(json.getBigDecimal("otherFee")); + statisticsTrunklinePackageEntity.setReturnFee(json.getBigDecimal("returnFee")); + statisticsTrunklinePackageEntity.setRealReturnFee(json.getBigDecimal("returnFee")); + statisticsTrunklinePackageEntity.setThirdOprationFee(json.getBigDecimal("thirdOprationFee")); + statisticsTrunklinePackageEntity.setRealThirdOprationFee(json.getBigDecimal("thirdOprationFee")); + statisticsTrunklinePackageEntity.setXPay(json.getBigDecimal("xPay")); + statisticsTrunklinePackageEntity.setRealXPay(json.getBigDecimal("xPay")); + statisticsTrunklinePackageEntity.setDPay(json.getBigDecimal("dPay")); + statisticsTrunklinePackageEntity.setRealDPay(json.getBigDecimal("dPay")); + statisticsTrunklinePackageEntity.setHPay(json.getBigDecimal("hPay")); + statisticsTrunklinePackageEntity.setRealHPay(json.getBigDecimal("hPay")); + statisticsTrunklinePackageEntity.setYPay(json.getBigDecimal("yPay")); + statisticsTrunklinePackageEntity.setRealYPay(json.getBigDecimal("yPay")); + statisticsTrunklinePackageEntities.add(statisticsTrunklinePackageEntity); + + //仓库 + StatisticsWarehousePackageEntity statisticsWarehousePackageEntity = new StatisticsWarehousePackageEntity(); + statisticsWarehousePackageEntity.setWarehouseId(warehouseId); + statisticsWarehousePackageEntity.setWarehouseName(warehouseName); + statisticsWarehousePackageEntity.setTypeService(typeService); + statisticsWarehousePackageEntity.setWaybillId(waybillId); + statisticsWarehousePackageEntity.setWaybillNo(waybillNo); + if(waybillType.equals(1)){ + statisticsWarehousePackageEntity.setGoodsType(1); + }else if (waybillType.equals(2)){ + statisticsWarehousePackageEntity.setGoodsType(2); + }else{ + statisticsWarehousePackageEntity.setGoodsType(3); + } + statisticsWarehousePackageEntity.setOrderCode(json.getStr("orderCode")); + statisticsWarehousePackageEntity.setOrderPackageCode(json.getStr("orderPackageCode")); + statisticsWarehousePackageEntity.setProductName(json.getStr("productName")); + statisticsWarehousePackageEntity.setTotalNum(json.getInt("totalNum")); + statisticsWarehousePackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); + statisticsWarehousePackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsWarehousePackageEntity.setWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); + statisticsWarehousePackageEntity.setRealWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); + statisticsWarehousePackageEntity.setWarehouseFee(json.getBigDecimal("warehouseFee")); + statisticsWarehousePackageEntity.setRealWarehouseFee(json.getBigDecimal("warehouseFee")); + statisticsWarehousePackageEntity.setWarehouseManageFee(json.getBigDecimal("warehouseManageFee")); + statisticsWarehousePackageEntity.setRealWarehouseManageFee(json.getBigDecimal("warehouseManageFee")); + statisticsWarehousePackageEntity.setWarehouseSortingFee(json.getBigDecimal("warehouseSortingFee")); + statisticsWarehousePackageEntity.setRealWarehouseSortingFee(json.getBigDecimal("warehouseSortingFee")); + statisticsWarehousePackageEntity.setWarehouseOperatingFee(json.getBigDecimal("warehouseOperatingFee")); + statisticsWarehousePackageEntity.setRealWarehouseOperatingFee(json.getBigDecimal("warehouseOperatingFee")); + statisticsWarehousePackageEntities.add(statisticsWarehousePackageEntity); + + + //配送 + StatisticsDistributionPackageEntity statisticsDistributionPackageEntity = new StatisticsDistributionPackageEntity(); + statisticsDistributionPackageEntity.setWarehouseId(warehouseId); + statisticsDistributionPackageEntity.setWarehouseName(warehouseName); + statisticsDistributionPackageEntity.setTypeService(typeService); + statisticsDistributionPackageEntity.setWaybillId(waybillId); + statisticsDistributionPackageEntity.setWaybillNo(waybillNo); + if(waybillType.equals(1)){ + statisticsDistributionPackageEntity.setGoodsType(1); }else if (waybillType.equals(2)){ - statisticsPackageInfoEntity.setGoodsType(2); + statisticsDistributionPackageEntity.setGoodsType(2); }else{ - statisticsPackageInfoEntity.setGoodsType(3); + statisticsDistributionPackageEntity.setGoodsType(3); } - statisticsPackageInfoEntity.setOrderCode(json.getStr("orderCode")); - statisticsPackageInfoEntity.setOrderPackageCode(json.getStr("orderPackageCode")); - statisticsPackageInfoEntity.setProductName(json.getStr("productName")); - statisticsPackageInfoEntity.setTotalNum(json.getInt("totalNum")); - statisticsPackageInfoEntity.setTotalWeight(json.getBigDecimal("totalWeight")); - statisticsPackageInfoEntity.setTotalVolume(json.getBigDecimal("totalVolume")); - statisticsPackageInfoEntity.setOpenPrice(json.getBigDecimal("openPrice")); - statisticsPackageInfoEntity.setTotalPrice(json.getBigDecimal("openPrice")); - statisticsPackageInfoEntity.setPickupFee(json.getBigDecimal("pickupFee")); - statisticsPackageInfoEntity.setRealPickupFee(json.getBigDecimal("pickupFee")); - statisticsPackageInfoEntity.setFreightFee(json.getBigDecimal("freightFee")); - statisticsPackageInfoEntity.setRealFreightFee(json.getBigDecimal("freightFee")); - statisticsPackageInfoEntity.setWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); - statisticsPackageInfoEntity.setRealWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); - statisticsPackageInfoEntity.setWarehouseFee(json.getBigDecimal("warehouseFee")); - statisticsPackageInfoEntity.setRealWarehouseFee(json.getBigDecimal("warehouseFee")); - statisticsPackageInfoEntity.setWarehouseManageFee(json.getBigDecimal("warehouseManageFee")); - statisticsPackageInfoEntity.setRealWarehouseManageFee(json.getBigDecimal("warehouseManageFee")); - statisticsPackageInfoEntity.setWarehouseSortingFee(json.getBigDecimal("warehouseSortingFee")); - statisticsPackageInfoEntity.setRealWarehouseSortingFee(json.getBigDecimal("warehouseSortingFee")); - statisticsPackageInfoEntity.setWarehouseOperatingFee(json.getBigDecimal("warehouseOperatingFee")); - statisticsPackageInfoEntity.setRealWarehouseOperatingFee(json.getBigDecimal("warehouseOperatingFee")); - statisticsPackageInfoEntity.setDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); - statisticsPackageInfoEntity.setRealDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); - statisticsPackageInfoEntity.setDeliveryFee(json.getBigDecimal("deliveryFee")); - statisticsPackageInfoEntity.setRealDeliveryFee(json.getBigDecimal("deliveryFee")); - statisticsPackageInfoEntity.setDeliveryLoadingFee(json.getBigDecimal("deliveryLoadingFee")); - statisticsPackageInfoEntity.setRealDeliveryLoadingFee(json.getBigDecimal("deliveryLoadingFee")); - statisticsPackageInfoEntity.setDeliverySortingFee(json.getBigDecimal("deliverySortingFee")); - statisticsPackageInfoEntity.setRealDeliverySortingFee(json.getBigDecimal("deliverySortingFee")); - statisticsPackageInfoEntity.setDeliveryUpfloorFee(json.getBigDecimal("deliveryUpfloorFee")); - statisticsPackageInfoEntity.setRealDeliveryUpfloorFee(json.getBigDecimal("deliveryUpfloorFee")); - statisticsPackageInfoEntity.setDeliveryMoveFee(json.getBigDecimal("deliveryMoveFee")); - statisticsPackageInfoEntity.setRealDeliveryMoveFee(json.getBigDecimal("deliveryMoveFee")); - statisticsPackageInfoEntity.setDeliveryDistance(json.getBigDecimal("deliveryDistance")); - statisticsPackageInfoEntity.setRealDeliveryDistance(json.getBigDecimal("deliveryDistance")); - statisticsPackageInfoEntity.setDeliveryCrossingFee(json.getBigDecimal("deliveryCrossingFee")); - statisticsPackageInfoEntity.setRealDeliveryCrossingFee(json.getBigDecimal("deliveryCrossingFee")); - statisticsPackageInfoEntity.setInstallFee(json.getBigDecimal("installFee")); - statisticsPackageInfoEntity.setRealInstallFee(json.getBigDecimal("installFee")); - statisticsPackageInfoEntity.setQuotationFee(json.getBigDecimal("quotationFee")); - statisticsPackageInfoEntity.setRealQuotationFee(json.getBigDecimal("quotationFee")); - statisticsPackageInfoEntity.setClaimingValue(json.getBigDecimal("claimingValue")); - statisticsPackageInfoEntity.setRealClaimingValue(json.getBigDecimal("claimingValue")); - statisticsPackageInfoEntity.setOtherFee(json.getBigDecimal("otherFee")); - statisticsPackageInfoEntity.setRealOtherFee(json.getBigDecimal("otherFee")); - statisticsPackageInfoEntity.setReturnFee(json.getBigDecimal("returnFee")); - statisticsPackageInfoEntity.setRealReturnFee(json.getBigDecimal("returnFee")); - statisticsPackageInfoEntity.setThirdOprationFee(json.getBigDecimal("thirdOprationFee")); - statisticsPackageInfoEntity.setRealThirdOprationFee(json.getBigDecimal("thirdOprationFee")); - statisticsPackageInfoEntity.setXPay(json.getBigDecimal("xPay")); - statisticsPackageInfoEntity.setRealXPay(json.getBigDecimal("xPay")); - statisticsPackageInfoEntity.setDPay(json.getBigDecimal("dPay")); - statisticsPackageInfoEntity.setRealDPay(json.getBigDecimal("dPay")); - statisticsPackageInfoEntity.setHPay(json.getBigDecimal("hPay")); - statisticsPackageInfoEntity.setRealHPay(json.getBigDecimal("hPay")); - statisticsPackageInfoEntity.setYPay(json.getBigDecimal("yPay")); - statisticsPackageInfoEntity.setRealYPay(json.getBigDecimal("yPay")); - statisticsPackageInfoEntity.setIsAftersales(0); - statisticsPackageInfoEntity.setHasStatement(0); - ls.add(statisticsPackageInfoEntity); + statisticsDistributionPackageEntity.setOrderCode(json.getStr("orderCode")); + statisticsDistributionPackageEntity.setOrderPackageCode(json.getStr("orderPackageCode")); + statisticsDistributionPackageEntity.setProductName(json.getStr("productName")); + statisticsDistributionPackageEntity.setTotalNum(json.getInt("totalNum")); + statisticsDistributionPackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); + statisticsDistributionPackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsDistributionPackageEntity.setDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); + statisticsDistributionPackageEntity.setRealDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); + statisticsDistributionPackageEntity.setDeliveryFee(json.getBigDecimal("deliveryFee")); + statisticsDistributionPackageEntity.setRealDeliveryFee(json.getBigDecimal("deliveryFee")); + statisticsDistributionPackageEntity.setDeliveryLoadingFee(json.getBigDecimal("deliveryLoadingFee")); + statisticsDistributionPackageEntity.setRealDeliveryLoadingFee(json.getBigDecimal("deliveryLoadingFee")); + statisticsDistributionPackageEntity.setDeliverySortingFee(json.getBigDecimal("deliverySortingFee")); + statisticsDistributionPackageEntity.setRealDeliverySortingFee(json.getBigDecimal("deliverySortingFee")); + statisticsDistributionPackageEntity.setDeliveryUpfloorFee(json.getBigDecimal("deliveryUpfloorFee")); + statisticsDistributionPackageEntity.setRealDeliveryUpfloorFee(json.getBigDecimal("deliveryUpfloorFee")); + statisticsDistributionPackageEntity.setDeliveryMoveFee(json.getBigDecimal("deliveryMoveFee")); + statisticsDistributionPackageEntity.setRealDeliveryMoveFee(json.getBigDecimal("deliveryMoveFee")); + statisticsDistributionPackageEntity.setDeliveryDistance(json.getBigDecimal("deliveryDistance")); + statisticsDistributionPackageEntity.setRealDeliveryDistance(json.getBigDecimal("deliveryDistance")); + statisticsDistributionPackageEntity.setDeliveryCrossingFee(json.getBigDecimal("deliveryCrossingFee")); + statisticsDistributionPackageEntity.setRealDeliveryCrossingFee(json.getBigDecimal("deliveryCrossingFee")); + statisticsDistributionPackageEntities.add(statisticsDistributionPackageEntity); + + } + + Long waybillInfoId = null; + //生成运单维度 + if(!"2".equals(typeService)){ + StatisticsWaybillInfoEntity statisticsWaybillInfoEntity = new StatisticsWaybillInfoEntity(); + statisticsWaybillInfoEntity.setWaybillNo(waybillNo); + statisticsWaybillInfoEntity.setWaybillId(waybillId); + statisticsWaybillInfoEntity.setTypeService(typeService); + statisticsWaybillInfoEntity.setConfirmStatisticsOrder(0); + statisticsWaybillInfoService.save(statisticsWaybillInfoEntity); + waybillInfoId = statisticsWaybillInfoEntity.getId(); } - statisticsPackageInfoService.saveBatch(ls); - //把ls通过typeService=2过滤为一个新的list - List shipeiList = ls.stream().filter(item -> item.getTypeService().equals("2")).collect(Collectors.toList()); - //toC维度 + //把statisticsPackageInfoEntities的orderCode作为key进行分组 + Map> trunklineMap = statisticsTrunklinePackageEntities.stream().collect(Collectors.groupingBy(StatisticsTrunklinePackageEntity::getOrderCode)); + Map> warehouseMap = statisticsWarehousePackageEntities.stream().collect(Collectors.groupingBy(StatisticsWarehousePackageEntity::getOrderCode)); + Map> distributionMap = statisticsDistributionPackageEntities.stream().collect(Collectors.groupingBy(StatisticsDistributionPackageEntity::getOrderCode)); + List orderInfoEntities = new ArrayList<>(); + Long finalWaybillInfoId = waybillInfoId; + trunklineMap.keySet().forEach(key -> { + StatisticsOrderInfoEntity statisticsOrderInfoEntity = new StatisticsOrderInfoEntity(); + statisticsOrderInfoEntity.setWaybillId(waybillId); + statisticsOrderInfoEntity.setWaybillNo(waybillNo); + statisticsOrderInfoEntity.setOrderCode(key); + statisticsOrderInfoEntity.setTypeService(typeService); + if(!Objects.isNull(finalWaybillInfoId)){ + statisticsOrderInfoEntity.setWaybillInfoId(finalWaybillInfoId); + } +// statisticsOrderInfoEntity.setConfirmStatus(0); + orderInfoEntities.add(statisticsOrderInfoEntity); + }); + statisticsOrderInfoService.saveBatch(orderInfoEntities); - List otherList = ls.stream().filter(item -> !item.getTypeService().equals("2")).collect(Collectors.toList()); - //toB维度 + List statisticsTrunklinePackageSaveList = new ArrayList<>(); + List statisticsWarehousePackageSaveList = new ArrayList<>(); + List statisticsDistributionPackageSaveList = new ArrayList<>(); + orderInfoEntities.forEach(statisticsOrderInfoEntity -> { + String orderCode = statisticsOrderInfoEntity.getOrderCode(); + Long orderInfoId = statisticsOrderInfoEntity.getId(); + List statisticsTrunklinePackageEntityList= trunklineMap.get(orderCode); + statisticsTrunklinePackageEntityList.forEach(statisticsTrunklinePackageEntity -> { + statisticsTrunklinePackageEntity.setOrderInfoId(orderInfoId); + }); + statisticsTrunklinePackageSaveList.addAll(statisticsTrunklinePackageEntityList); + }); + statisticsTrunklinePackageService.saveBatch(statisticsTrunklinePackageSaveList); + orderInfoEntities.forEach(statisticsOrderInfoEntity -> { + String orderCode = statisticsOrderInfoEntity.getOrderCode(); + Long orderInfoId = statisticsOrderInfoEntity.getId(); + List statisticsWarehousePackageEntityList= warehouseMap.get(orderCode); + statisticsWarehousePackageEntityList.forEach(statisticsWarehousePackageEntity -> { + statisticsWarehousePackageEntity.setOrderInfoId(orderInfoId); + }); + statisticsWarehousePackageSaveList.addAll(statisticsWarehousePackageEntityList); + }); + statisticsWarehousePackageService.saveBatch(statisticsWarehousePackageSaveList); + orderInfoEntities.forEach(statisticsOrderInfoEntity -> { + String orderCode = statisticsOrderInfoEntity.getOrderCode(); + Long orderInfoId = statisticsOrderInfoEntity.getId(); + List statisticsDistributionPackageEntityList= distributionMap.get(orderCode); + statisticsDistributionPackageEntityList.forEach(statisticsDistributionPackageEntity -> { + statisticsDistributionPackageEntity.setOrderInfoId(orderInfoId); + }); + statisticsDistributionPackageSaveList.addAll(statisticsDistributionPackageEntityList); + }); + statisticsDistributionPackageService.saveBatch(statisticsDistributionPackageSaveList); log.info("处理完成:{}", msg); @@ -155,6 +264,84 @@ public class WaybillFanoutListener { @Transactional(rollbackFor = Exception.class) public void updateWaybillData(String msg) { log.info("接收到消息:{}", msg); + + JSONObject jsonObject = JSONUtil.parseObj(msg); + Long warehouseId = jsonObject.getLong("warehouseId"); + String warehouseName = jsonObject.getStr("warehouseName"); + Long waybillId = jsonObject.getLong("waybillId"); + String waybillNo = jsonObject.getStr("waybillNo"); + String typeService = jsonObject.getStr("typeService");//服务类型 + + statisticsTrunklinePackageService.deleteListByWaybillId(waybillId); + + List orderInfoEntities = statisticsOrderInfoService.findListByWaybillId(waybillId); + //把orderInfoEntities以orderCode未key,元素本身为value转成Map + Map orderInfoMap = orderInfoEntities.stream() + .collect(Collectors.toMap( + StatisticsOrderInfoEntity::getOrderCode, + entity -> entity + )); + List statisticsTrunklinePackageEntities = new ArrayList<>(); + + JSONArray orderPackageCodes = jsonObject.getJSONArray("orderPackageCodes"); + for (int i = 0; i < orderPackageCodes.size(); i++) { + JSONObject json = orderPackageCodes.getJSONObject(i); + + //干线 + StatisticsTrunklinePackageEntity statisticsTrunklinePackageEntity = new StatisticsTrunklinePackageEntity(); + statisticsTrunklinePackageEntity.setWarehouseId(warehouseId); + statisticsTrunklinePackageEntity.setWarehouseName(warehouseName); + statisticsTrunklinePackageEntity.setTypeService(typeService); + statisticsTrunklinePackageEntity.setWaybillId(waybillId); + statisticsTrunklinePackageEntity.setWaybillNo(waybillNo); + Integer waybillType = json.getInt("waybillType"); + if(waybillType.equals(1)){ + statisticsTrunklinePackageEntity.setGoodsType(1); + }else if (waybillType.equals(2)){ + statisticsTrunklinePackageEntity.setGoodsType(2); + }else{ + statisticsTrunklinePackageEntity.setGoodsType(3); + } + String orderCode = json.getStr("orderCode"); + StatisticsOrderInfoEntity statisticsOrderInfoEntity = orderInfoMap.get(orderCode); + statisticsTrunklinePackageEntity.setOrderInfoId(statisticsOrderInfoEntity.getId()); + statisticsTrunklinePackageEntity.setOrderCode(orderCode); + statisticsTrunklinePackageEntity.setOrderPackageCode(json.getStr("orderPackageCode")); + statisticsTrunklinePackageEntity.setProductName(json.getStr("productName")); + statisticsTrunklinePackageEntity.setTotalNum(json.getInt("totalNum")); + statisticsTrunklinePackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); + statisticsTrunklinePackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsTrunklinePackageEntity.setOpenPrice(json.getBigDecimal("openPrice")); + statisticsTrunklinePackageEntity.setTotalPrice(json.getBigDecimal("openPrice")); + statisticsTrunklinePackageEntity.setPickupFee(json.getBigDecimal("pickupFee")); + statisticsTrunklinePackageEntity.setRealPickupFee(json.getBigDecimal("pickupFee")); + statisticsTrunklinePackageEntity.setFreightFee(json.getBigDecimal("freightFee")); + statisticsTrunklinePackageEntity.setRealFreightFee(json.getBigDecimal("freightFee")); + statisticsTrunklinePackageEntity.setInstallFee(json.getBigDecimal("installFee")); + statisticsTrunklinePackageEntity.setRealInstallFee(json.getBigDecimal("installFee")); + statisticsTrunklinePackageEntity.setQuotationFee(json.getBigDecimal("quotationFee")); + statisticsTrunklinePackageEntity.setRealQuotationFee(json.getBigDecimal("quotationFee")); + statisticsTrunklinePackageEntity.setClaimingValue(json.getBigDecimal("claimingValue")); + statisticsTrunklinePackageEntity.setRealClaimingValue(json.getBigDecimal("claimingValue")); + statisticsTrunklinePackageEntity.setOtherFee(json.getBigDecimal("otherFee")); + statisticsTrunklinePackageEntity.setRealOtherFee(json.getBigDecimal("otherFee")); + statisticsTrunklinePackageEntity.setReturnFee(json.getBigDecimal("returnFee")); + statisticsTrunklinePackageEntity.setRealReturnFee(json.getBigDecimal("returnFee")); + statisticsTrunklinePackageEntity.setThirdOprationFee(json.getBigDecimal("thirdOprationFee")); + statisticsTrunklinePackageEntity.setRealThirdOprationFee(json.getBigDecimal("thirdOprationFee")); + statisticsTrunklinePackageEntity.setXPay(json.getBigDecimal("xPay")); + statisticsTrunklinePackageEntity.setRealXPay(json.getBigDecimal("xPay")); + statisticsTrunklinePackageEntity.setDPay(json.getBigDecimal("dPay")); + statisticsTrunklinePackageEntity.setRealDPay(json.getBigDecimal("dPay")); + statisticsTrunklinePackageEntity.setHPay(json.getBigDecimal("hPay")); + statisticsTrunklinePackageEntity.setRealHPay(json.getBigDecimal("hPay")); + statisticsTrunklinePackageEntity.setYPay(json.getBigDecimal("yPay")); + statisticsTrunklinePackageEntity.setRealYPay(json.getBigDecimal("yPay")); + statisticsTrunklinePackageEntities.add(statisticsTrunklinePackageEntity); + + } + statisticsTrunklinePackageService.saveBatch(statisticsTrunklinePackageEntities); + } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsDistributionPackageMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsDistributionPackageMapper.java new file mode 100644 index 000000000..d77df8e77 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsDistributionPackageMapper.java @@ -0,0 +1,9 @@ +package com.logpm.statistics.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.statistics.entity.StatisticsDistributionPackageEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface StatisticsDistributionPackageMapper extends BaseMapper { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java new file mode 100644 index 000000000..29b17b8ab --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java @@ -0,0 +1,9 @@ +package com.logpm.statistics.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.statistics.entity.StatisticsOrderInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface StatisticsOrderInfoMapper extends BaseMapper { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.java deleted file mode 100644 index bebba398d..000000000 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.logpm.statistics.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.logpm.statistics.entity.StatisticsPackageInfoEntity; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface StatisticsPackageInfoMapper extends BaseMapper { -} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.xml deleted file mode 100644 index 4950ecfc9..000000000 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsPackageInfoMapper.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.java new file mode 100644 index 000000000..bcfb01986 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.java @@ -0,0 +1,11 @@ +package com.logpm.statistics.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.statistics.entity.StatisticsTrunklinePackageEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +@Mapper +public interface StatisticsTrunklinePackageMapper extends BaseMapper { + void deleteListByWaybillId(@Param("waybillId") Long waybillId); +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.xml new file mode 100644 index 000000000..608fa792e --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsTrunklinePackageMapper.xml @@ -0,0 +1,10 @@ + + + + + + delete from logpm_statistics_trunkline_package + where waybill_id = #{waybillId} + + + diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWarehousePackageMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWarehousePackageMapper.java new file mode 100644 index 000000000..ea64a49fd --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWarehousePackageMapper.java @@ -0,0 +1,9 @@ +package com.logpm.statistics.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.statistics.entity.StatisticsWarehousePackageEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface StatisticsWarehousePackageMapper extends BaseMapper { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWaybillInfoMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWaybillInfoMapper.java new file mode 100644 index 000000000..2c48810fe --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsWaybillInfoMapper.java @@ -0,0 +1,9 @@ +package com.logpm.statistics.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.statistics.entity.StatisticsWaybillInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface StatisticsWaybillInfoMapper extends BaseMapper { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsDistributionPackageService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsDistributionPackageService.java new file mode 100644 index 000000000..bd1091536 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsDistributionPackageService.java @@ -0,0 +1,13 @@ +package com.logpm.statistics.service; + +import com.logpm.statistics.entity.StatisticsDistributionPackageEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; +import java.util.Set; + +public interface IStatisticsDistributionPackageService extends BaseService { + List findListByOrderPackageCodes(List orderPackageCodeList); + + List findListByOrderInfoSet(Set orderInfoSet); +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java new file mode 100644 index 000000000..2f9daae0c --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java @@ -0,0 +1,13 @@ +package com.logpm.statistics.service; + +import com.logpm.statistics.entity.StatisticsOrderInfoEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; +import java.util.Set; + +public interface IStatisticsOrderInfoService extends BaseService { + List findListByWaybillId(Long waybillId); + + List findListByOrderInfoIdsSet(Set orderInfoSet); +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsPackageInfoService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsPackageInfoService.java deleted file mode 100644 index 1d612ff60..000000000 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsPackageInfoService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.logpm.statistics.service; - -import com.logpm.statistics.entity.StatisticsPackageInfoEntity; -import org.springblade.core.mp.base.BaseService; - -public interface IStatisticsPackageInfoService extends BaseService { -} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsTrunklinePackageService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsTrunklinePackageService.java new file mode 100644 index 000000000..48e4c63d1 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsTrunklinePackageService.java @@ -0,0 +1,8 @@ +package com.logpm.statistics.service; + +import com.logpm.statistics.entity.StatisticsTrunklinePackageEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IStatisticsTrunklinePackageService extends BaseService { + void deleteListByWaybillId(Long waybillId); +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWarehousePackageService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWarehousePackageService.java new file mode 100644 index 000000000..548822224 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWarehousePackageService.java @@ -0,0 +1,7 @@ +package com.logpm.statistics.service; + +import com.logpm.statistics.entity.StatisticsWarehousePackageEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IStatisticsWarehousePackageService extends BaseService { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWaybillInfoService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWaybillInfoService.java new file mode 100644 index 000000000..4b0f40e44 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsWaybillInfoService.java @@ -0,0 +1,7 @@ +package com.logpm.statistics.service; + +import com.logpm.statistics.entity.StatisticsWaybillInfoEntity; +import org.springblade.core.mp.base.BaseService; + +public interface IStatisticsWaybillInfoService extends BaseService { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsDistributionPackageServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsDistributionPackageServiceImpl.java new file mode 100644 index 000000000..fad19ef2b --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsDistributionPackageServiceImpl.java @@ -0,0 +1,34 @@ +package com.logpm.statistics.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.statistics.entity.StatisticsDistributionPackageEntity; +import com.logpm.statistics.mapper.StatisticsDistributionPackageMapper; +import com.logpm.statistics.service.IStatisticsDistributionPackageService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Set; + +@Slf4j +@Service +@AllArgsConstructor +public class StatisticsDistributionPackageServiceImpl extends BaseServiceImpl implements IStatisticsDistributionPackageService { + @Override + public List findListByOrderPackageCodes(List orderPackageCodeList) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("order_package_code", orderPackageCodeList); + + return baseMapper.selectList(queryWrapper); + } + + @Override + public List findListByOrderInfoSet(Set orderInfoSet) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("order_info_id", orderInfoSet); + + return baseMapper.selectList(queryWrapper); + } +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java new file mode 100644 index 000000000..49fffbd4c --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java @@ -0,0 +1,32 @@ +package com.logpm.statistics.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.statistics.entity.StatisticsOrderInfoEntity; +import com.logpm.statistics.mapper.StatisticsOrderInfoMapper; +import com.logpm.statistics.service.IStatisticsOrderInfoService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Set; + +@Slf4j +@Service +@AllArgsConstructor +public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl implements IStatisticsOrderInfoService { + @Override + public List findListByWaybillId(Long waybillId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_id",waybillId); + return baseMapper.selectList(queryWrapper); + } + + @Override + public List findListByOrderInfoIdsSet(Set orderInfoSet) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("id",orderInfoSet); + return baseMapper.selectList(queryWrapper); + } +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsPackageInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsPackageInfoServiceImpl.java deleted file mode 100644 index a03fffd56..000000000 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsPackageInfoServiceImpl.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.logpm.statistics.service.impl; - -import com.logpm.statistics.entity.StatisticsPackageInfoEntity; -import com.logpm.statistics.mapper.StatisticsPackageInfoMapper; -import com.logpm.statistics.service.IStatisticsPackageInfoService; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -@Service -@AllArgsConstructor -@Slf4j -public class StatisticsPackageInfoServiceImpl extends BaseServiceImpl implements IStatisticsPackageInfoService { -} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsTrunklinePackageServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsTrunklinePackageServiceImpl.java new file mode 100644 index 000000000..35fad7f45 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsTrunklinePackageServiceImpl.java @@ -0,0 +1,19 @@ +package com.logpm.statistics.service.impl; + +import com.logpm.statistics.entity.StatisticsTrunklinePackageEntity; +import com.logpm.statistics.mapper.StatisticsTrunklinePackageMapper; +import com.logpm.statistics.service.IStatisticsTrunklinePackageService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +@Slf4j +public class StatisticsTrunklinePackageServiceImpl extends BaseServiceImpl implements IStatisticsTrunklinePackageService { + @Override + public void deleteListByWaybillId(Long waybillId) { + baseMapper.deleteListByWaybillId(waybillId); + } +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWarehousePackageServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWarehousePackageServiceImpl.java new file mode 100644 index 000000000..47d6198f0 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWarehousePackageServiceImpl.java @@ -0,0 +1,15 @@ +package com.logpm.statistics.service.impl; + +import com.logpm.statistics.entity.StatisticsWarehousePackageEntity; +import com.logpm.statistics.mapper.StatisticsWarehousePackageMapper; +import com.logpm.statistics.service.IStatisticsWarehousePackageService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@AllArgsConstructor +public class StatisticsWarehousePackageServiceImpl extends BaseServiceImpl implements IStatisticsWarehousePackageService { +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWaybillInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWaybillInfoServiceImpl.java new file mode 100644 index 000000000..31777f266 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsWaybillInfoServiceImpl.java @@ -0,0 +1,15 @@ +package com.logpm.statistics.service.impl; + +import com.logpm.statistics.entity.StatisticsWaybillInfoEntity; +import com.logpm.statistics.mapper.StatisticsWaybillInfoMapper; +import com.logpm.statistics.service.IStatisticsWaybillInfoService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@AllArgsConstructor +public class StatisticsWaybillInfoServiceImpl extends BaseServiceImpl implements IStatisticsWaybillInfoService { +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java index 81e594af5..8101d6b3f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java @@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; import java.util.Set; @Mapper @@ -55,7 +56,7 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper类型的集合,包含与输入订单包裹代码相匹配的包裹编码。 * 如果没有找到匹配的包裹编码,则返回一个空集合。 */ - List findPackageCodeByCodes(@Param("orderPackageCodes") Set orderPackageCodes); + List> findPackageCodeByCodes(@Param("orderPackageCodes") Set orderPackageCodes); IPage findOrderDetails(IPage page, @Param("param") OrderDetailsDTO orderDetailsDTO); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index 6653c1724..91e2a84fc 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -198,8 +198,8 @@ and package_status = #{packageStatus} and is_deleted = 0 - + select t.order_package_code code,t.id id from logpm_trunkline_advance_detail t where exists( select 1 from ( @@ -358,7 +358,8 @@