Browse Source

Merge branch 'dev' of D:\work\workspace\xhm\LogisticsPlatform-Service with conflicts.

fix-sign
zhenghaoyu 4 months ago
parent
commit
6aa2fd4732
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 14
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  3. 4
      blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java
  4. 13
      blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/ReportPackageBasicEntity.java
  5. 176
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/ReportPackageBasicEntity.java
  6. 128
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/ReportPackageTrunklineEntity.java
  7. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java
  8. 23
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageBasicMapper.java
  9. 53
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageBasicMapper.xml
  10. 12
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageTrunklineMapper.java
  11. 13
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageTrunklineMapper.xml
  12. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  13. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  14. 463
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/AdvanceDetailDealListener.java
  15. 251
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java
  16. 22
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IReportPackageBasicService.java
  17. 8
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IReportPackageTrunklineService.java
  18. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  19. 17
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  20. 56
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/ReportPackageBasicServiceImpl.java
  21. 19
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/ReportPackageTrunklineServiceImpl.java
  22. 65
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  23. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -9,7 +9,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="";
public static final String DEVAUTH ="-zhy";
/**
* 工厂对接服务名称

14
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -27,6 +27,20 @@ public abstract class FanoutConstants {
}
interface CARSLOADDATA {
// 交换机
String EXCHANGE = "fanout.trunkline.carsloaddata" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
// 保存基础数据
String REPORT_CARSLOADDATA = "fanout.trunkline.reportdata.report.carsloadData" + ModuleNameConstant.DEVAUTH;
}
}
// 开单
interface OPENWAYBILL {

4
blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java

@ -149,4 +149,8 @@ public class PackageData implements Serializable {
*/
private String signUser;//签收人
private Long finalNodeId;
private String finalNodeName;
}

13
blade-service-api/logpm-report-api/src/main/java/com/logpm/report/entity/ReportPackageBasicEntity.java

@ -94,6 +94,9 @@ public class ReportPackageBasicEntity extends TenantEntity {
@ApiModelProperty(name = "客户车次号",notes = "")
private String customerTrain ;
@ApiModelProperty(name = "物料编码",notes = "")
private String materialCode ;
@ApiModelProperty(name = "物料名称",notes = "")
private String materialName ;
@ -160,4 +163,14 @@ public class ReportPackageBasicEntity extends TenantEntity {
@ApiModelProperty(name = "是否改过单",notes = "")
private Integer isEditWaybill ;
@ApiModelProperty(name = "暂存单id",notes = "")
private Long advanceId;
@ApiModelProperty(name = "数据推送仓库id",notes = "")
private Long warehouseId;
@ApiModelProperty(name = "数据推送仓库",notes = "")
private String warehouse;
}

176
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/ReportPackageBasicEntity.java

@ -0,0 +1,176 @@
package com.logpm.trunkline.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("logpm_report_package_basic")
@ApiModel(value = "ReportPackageBasic对象", description = "报表基础信息类")
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ReportPackageBasicEntity extends TenantEntity {
/** 预留1 */
@ApiModelProperty(name = "预留1",notes = "")
private String reserve1 ;
/** 预留2 */
@ApiModelProperty(name = "预留2",notes = "")
private String reserve2 ;
/** 预留3 */
@ApiModelProperty(name = "预留3",notes = "")
private String reserve3 ;
/** 预留4 */
@ApiModelProperty(name = "预留4",notes = "")
private String reserve4 ;
/** 预留5 */
@ApiModelProperty(name = "预留5",notes = "")
private String reserve5 ;
@ApiModelProperty(name = "运单号",notes = "")
private String waybillNo ;
@ApiModelProperty(name = "服务号",notes = "")
private String serviceNo ;
@ApiModelProperty(name = "订单号",notes = "")
private String orderCode ;
@ApiModelProperty(name = "包件码",notes = "")
private String orderPackageCode ;
@ApiModelProperty(name = "品类名称",notes = "")
private String productName ;
@ApiModelProperty(name = "品类id",notes = "")
private Long productId ;
@ApiModelProperty(name = "数量",notes = "")
private Integer num ;
@ApiModelProperty(name = "重量",notes = "")
private BigDecimal weight ;
@ApiModelProperty(name = "体积",notes = "")
private BigDecimal volume ;
@ApiModelProperty(name = "入库时间",notes = "")
private Date incomingTime ;
@ApiModelProperty(name = "入库人",notes = "")
private String incomingUserName ;
@ApiModelProperty(name = "入库人id",notes = "")
private Long incomingUserId ;
@ApiModelProperty(name = "数据推送时间",notes = "")
private Date pushTime ;
@ApiModelProperty(name = "数据推送人",notes = "")
private String pushUserName ;
@ApiModelProperty(name = "数据推送人id",notes = "")
private Long pushUserId ;
@ApiModelProperty(name = "开单时间",notes = "")
private Date openTime ;
@ApiModelProperty(name = "开单人",notes = "")
private String openUserName ;
@ApiModelProperty(name = "开单人id",notes = "")
private Long openUserId ;
@ApiModelProperty(name = "数据类型 1订制品 2零担",notes = "")
private Integer dataType ;
@ApiModelProperty(name = "客户车次号",notes = "")
private String customerTrain ;
@ApiModelProperty(name = "物料编码",notes = "")
private String materialCode ;
@ApiModelProperty(name = "物料名称",notes = "")
private String materialName ;
@ApiModelProperty(name = "物料id",notes = "")
private Long materialId ;
@ApiModelProperty(name = "批次号",notes = "")
private String incomingBatch ;
@ApiModelProperty(name = "发货单位名称",notes = "")
private String shipper;
@ApiModelProperty(name = "发货单位id",notes = "")
private Long shipperId;
@ApiModelProperty(name = "收货单位名称",notes = "")
private String consignee ;
@ApiModelProperty(name = "收货单位id",notes = "")
private Long consigneeId ;
@ApiModelProperty(name = "发站仓",notes = "")
private String departureWarehouseName ;
@ApiModelProperty(name = "发站仓id",notes = "")
private Long departureWarehouseId ;
@ApiModelProperty(name = "目的仓",notes = "")
private String destinationWarehouseName ;
@ApiModelProperty(name = "目的仓id",notes = "")
private Long destinationWarehouseId ;
@ApiModelProperty(name = "发站",notes = "")
private String departure ;
@ApiModelProperty(name = "到站",notes = "")
private String destination ;
@ApiModelProperty(name = "工厂商场编码",notes = "")
private String dealerCode ;
@ApiModelProperty(name = "工厂商场名称",notes = "")
private String dealerName ;
@ApiModelProperty(name = "合包码",notes = "")
private String mergePackageCode ;
@ApiModelProperty(name = "入库类型",notes = "")
private Integer incomingType ;
@ApiModelProperty(name = "品牌id",notes = "")
private Long brandId ;
@ApiModelProperty(name = "品牌",notes = "")
private String brand ;
@ApiModelProperty(name = "订单来源",notes = "")
private String systemType ;
@ApiModelProperty(name = "入库状态",notes = "")
private Integer incomingStatus ;
@ApiModelProperty(name = "是否改过单",notes = "")
private Integer isEditWaybill ;
@ApiModelProperty(name = "暂存单id",notes = "")
private Long advanceId;
@ApiModelProperty(name = "数据推送仓库id",notes = "")
private Long warehouseId;
@ApiModelProperty(name = "数据推送仓库",notes = "")
private String warehouse;
}

128
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/ReportPackageTrunklineEntity.java

@ -0,0 +1,128 @@
package com.logpm.trunkline.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springblade.core.tenant.mp.TenantEntity;
@Data
@TableName("logpm_report_package_trunkline")
@ApiModel(value = "ReportPackageTrunkline对象", description = "报表干线信息类")
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ReportPackageTrunklineEntity extends TenantEntity {
/** 预留1 */
@ApiModelProperty(name = "预留1",notes = "")
private String reserve1 ;
/** 预留2 */
@ApiModelProperty(name = "预留2",notes = "")
private String reserve2 ;
/** 预留3 */
@ApiModelProperty(name = "预留3",notes = "")
private String reserve3 ;
/** 预留4 */
@ApiModelProperty(name = "预留4",notes = "")
private String reserve4 ;
/** 预留5 */
@ApiModelProperty(name = "预留5",notes = "")
private String reserve5 ;
@ApiModelProperty(name = "基础id",notes = "")
private Long basicId ;
@ApiModelProperty(name = "配载车次号",notes = "")
private String loadNo ;
@ApiModelProperty(name = "运单号",notes = "")
private String waybillNo ;
@ApiModelProperty(name = "服务号",notes = "")
private String serviceNo ;
@ApiModelProperty(name = "订单号",notes = "")
private String orderCode ;
@ApiModelProperty(name = "包件码",notes = "")
private String orderPackageCode ;
@ApiModelProperty(name = "品类名称",notes = "")
private String productName ;
@ApiModelProperty(name = "品类id",notes = "")
private Long productId ;
@ApiModelProperty(name = "品牌",notes = "")
private String brand ;
@ApiModelProperty(name = "品牌id",notes = "")
private Long brandId ;
@ApiModelProperty(name = "发站仓",notes = "")
private String departureWarehouseName ;
@ApiModelProperty(name = "发站仓id",notes = "")
private Long departureWarehouseId ;
@ApiModelProperty(name = "目的仓",notes = "")
private String destinationWarehouseName ;
@ApiModelProperty(name = "目的仓id",notes = "")
private Long destinationWarehouseId ;
@ApiModelProperty(name = "装车仓库id",notes = "")
private Long loadingWarehouseId ;
@ApiModelProperty(name = "装车仓库",notes = "")
private String loadingWarehouseName ;
@ApiModelProperty(name = "装车人id",notes = "")
private Long loadingUserId ;
@ApiModelProperty(name = "装车人名称",notes = "")
private String loadingUserName ;
@ApiModelProperty(name = "是否是始发仓",notes = "")
private Integer isStartWarehouse ;
@ApiModelProperty(name = "计划卸车仓库id",notes = "")
private Long finalNodeId ;
@ApiModelProperty(name = "计划卸车仓库",notes = "")
private String finalNodeName ;
@ApiModelProperty(name = "卸车仓库id",notes = "")
private Long unloadWarehouseId ;
@ApiModelProperty(name = "卸车仓库",notes = "")
private String unloadWarehouseName ;
@ApiModelProperty(name = "卸车人id",notes = "")
private Long unloadUserId ;
@ApiModelProperty(name = "卸车人名称",notes = "")
private String unloadUserName ;
@ApiModelProperty(name = "是否是目的仓仓",notes = "")
private Integer isEndWarehouse ;
@ApiModelProperty(name = "干线状态 1装车 2卸车 3签收",notes = "")
private Integer trunklineStatus ;
@ApiModelProperty(name = "是否是直发商家 0否 1是",notes = "")
private Integer isCustomer ;
@ApiModelProperty(name = "装车数量",notes = "")
private Integer loadingNum ;
@ApiModelProperty(name = "卸车数量",notes = "")
private Integer unloadNum ;
@ApiModelProperty(name = "签收数量",notes = "")
private Integer signNum ;
}

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/AdvanceDetailController.java

@ -88,6 +88,12 @@ public class AdvanceDetailController {
try{
List<Long> advanceDetailIds = advanceDetailDTO.getAdvanceDetailIds();
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(!Objects.isNull(myCurrentWarehouse)){
advanceDetailDTO.setWarehouseId(myCurrentWarehouse.getId());
advanceDetailDTO.setWarehouseName(myCurrentWarehouse.getName());
}
if(CollUtil.isEmpty(advanceDetailIds)){
log.warn(method+"请选择删除的包件");
return R.fail(405,"请选择删除的包件");

23
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageBasicMapper.java

@ -0,0 +1,23 @@
package com.logpm.trunkline.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.trunkline.entity.ReportPackageBasicEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ReportPackageBasicMapper extends BaseMapper<ReportPackageBasicEntity> {
void deleteByOrderPackageCodes(@Param("packageCodes") List<String> packageCodes);
List<ReportPackageBasicEntity> findByOrderPackageCodes(@Param("packageCodes") List<String> packageCodes);
List<ReportPackageBasicEntity> findListByWaybillNo(@Param("waybillNo") String waybillNo);
void deleteByIds(@Param("ids") List<Long> ids);
List<ReportPackageBasicEntity> findListByOrderCode(@Param("orderCode") String orderCode);
List<ReportPackageBasicEntity> findListByOrderCodeList(@Param("orderCodeList") List<String> orderCodeList);
}

53
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageBasicMapper.xml

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.trunkline.mapper.ReportPackageBasicMapper">
<delete id="deleteByOrderPackageCodes">
delete from logpm_report_package_basic
where order_package_code in
<foreach collection="packageCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="findByOrderPackageCodes" resultType="com.logpm.trunkline.entity.ReportPackageBasicEntity">
select *
from logpm_report_package_basic
where order_package_code in
<foreach collection="packageCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="findListByWaybillNo" resultType="com.logpm.trunkline.entity.ReportPackageBasicEntity">
select *
from logpm_report_package_basic
where waybill_no = #{waybillNo}
</select>
<delete id="deleteByIds" >
delete from logpm_report_package_basic
where id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="findListByOrderCode" resultType="com.logpm.trunkline.entity.ReportPackageBasicEntity">
select *
from logpm_report_package_basic
where order_code = #{orderCode}
</select>
<select id="findListByOrderCodeList" resultType="com.logpm.trunkline.entity.ReportPackageBasicEntity">
select *
from logpm_report_package_basic
where order_code in
<foreach collection="orderCodeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

12
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageTrunklineMapper.java

@ -0,0 +1,12 @@
package com.logpm.trunkline.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.trunkline.entity.ReportPackageTrunklineEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ReportPackageTrunklineMapper extends BaseMapper<ReportPackageTrunklineEntity> {
void deleteListByCarsNoAndWarehouseId(@Param("carsNo") String carsNo, @Param("warehouseId") Long warehouseId);
}

13
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/ReportPackageTrunklineMapper.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.trunkline.mapper.ReportPackageTrunklineMapper">
<delete id="deleteListByCarsNoAndWarehouseId">
delete from logpm_report_package_trunkline
where load_no = #{carsNo}
and loading_warehouse_id = #{warehouseId}
</delete>
</mapper>

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -103,6 +103,8 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
IPage<OrderDetailInfoVO> findOrderDetailsAndTrunklineCarsNo(IPage<Object> page, @Param("param") OrderDetailsDTO orderDetailsDTO);
List<TrunklineAdvanceDetailEntity> findListByWaybillId(@Param("waybillId") Long waybillId);
void deleteListByIds(@Param("advanceDetailIdList") List<Long> advanceDetailIdList);
}

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -735,6 +735,13 @@
AND cmax.cupdateTime = ltcls.create_time
</select>
<select id="findListByWaybillId" resultType="com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity">
select *
from logpm_trunkline_advance_detail
where waybill_id = #{waybillId}
and is_deleted = 0
</select>
<delete id="deleteListByIds" >
delete from logpm_trunkline_advance_detail
where id in

463
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/AdvanceDetailDealListener.java

@ -0,0 +1,463 @@
package com.logpm.trunkline.mq.report;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.trunkline.entity.ReportPackageBasicEntity;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.service.IReportPackageBasicService;
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.core.tool.utils.StringUtil;
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.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 监听工厂数据转暂存单
*
* @author zhenghaoyu
* @create 2024-03-26 13:43
*/
@Slf4j
@Component
@AllArgsConstructor
public class AdvanceDetailDealListener {
private final IReportPackageBasicService reportPackageBasicService;
private final IWarehouseWaybillDetailClient warehouseWaybillDetailClient;
private final ITrunklineAdvanceDetailService advanceDetailService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.trunkline.REPORTDATA.QUEUE.REPORT_BASICDATA),
exchange = @Exchange(name = FanoutConstants.trunkline.REPORTDATA.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void advanceDetailDeal(String msg) {
String method = "####################advanceDetailDeal: ";
if(StringUtil.isNotBlank(msg)){
NodeFanoutMsg bean = JSONUtil.toBean(msg, NodeFanoutMsg.class);
WorkNodeEnums node = bean.getNode();
BizOperationEnums bizOperation = bean.getBizOperation();
String operator = bean.getOperator();
Long operatorId = bean.getOperatorId();
Date operatorTime = bean.getOperatorTime();
String warehouse = bean.getWarehouse();
Long warehouseId = bean.getWarehouseId();
Object main = bean.getMain();
if(WorkNodeEnums.INITIAL_DATA_ENTRY.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
//暂存单数据入库
//保存包件基础数据
savePackageBasicData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
deletePackageBasicData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
updateIncomingPackageBasicData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.OPEN_ORDER.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
updateOpenOrderPackageBasicData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.CHANGE_ORDER.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
updateWaybillPackageBasicData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else{
log.warn(method+"未知的操作类型");
}
}else {
log.warn(method+"未知的节点类型");
}
}
}
private void updateWaybillPackageBasicData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################updateWaybillPackageBasicData: ";
WarehouseWaybillEntity waybill = JSONUtil.toBean(JSONUtil.toJsonStr(main), WarehouseWaybillEntity.class);
Long waybillId = waybill.getId();
Integer waybillType = waybill.getWaybillType();
String waybillNo = waybill.getWaybillNo();
List<ReportPackageBasicEntity> updateList = new ArrayList<>();
List<ReportPackageBasicEntity> addList = new ArrayList<>();
List<ReportPackageBasicEntity> deleteList = new ArrayList<>();
if(waybillType == 1){
List<ReportPackageBasicEntity> reportPackageList = reportPackageBasicService.findListByWaybillNo(waybillNo);
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = advanceDetailService.findListByWaybillId(waybillId);
//把advanceDetailEntities转化成以orderPackageCode为key的Map
Map<String, TrunklineAdvanceDetailEntity> advanceDetailEntityMap = advanceDetailEntities.stream().collect(Collectors.toMap(TrunklineAdvanceDetailEntity::getOrderPackageCode, Function.identity()));
reportPackageList.forEach(reportPackageBasicEntity -> {
String orderPackageCode = reportPackageBasicEntity.getOrderPackageCode();
TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity = advanceDetailEntityMap.get(orderPackageCode);
if(!Objects.isNull(trunklineAdvanceDetailEntity)){
ReportPackageBasicEntity updateEntity = new ReportPackageBasicEntity();
updateEntity.setId(reportPackageBasicEntity.getId());
updateEntity.setProductId(trunklineAdvanceDetailEntity.getIncomeCategoryId());
updateEntity.setProductName(trunklineAdvanceDetailEntity.getIncomeCategoryName());
updateEntity.setMaterialId(trunklineAdvanceDetailEntity.getMaterialId());
updateEntity.setMaterialCode(trunklineAdvanceDetailEntity.getMaterialCode());
updateEntity.setMaterialName(trunklineAdvanceDetailEntity.getMaterialName());
updateEntity.setShipperId(waybill.getShipperId());
updateEntity.setShipper(waybill.getShipper());
updateEntity.setConsignee(waybill.getConsignee());
updateEntity.setConsigneeId(waybill.getConsigneeId());
updateEntity.setDepartureWarehouseId(waybill.getDepartureWarehouseId());
updateEntity.setDepartureWarehouseName(waybill.getDepartureWarehouseName());
updateEntity.setDestinationWarehouseId(waybill.getDestinationWarehouseId());
updateEntity.setDestinationWarehouseName(waybill.getDestinationWarehouseName());
updateEntity.setDeparture(waybill.getDeparture());
updateEntity.setDestination(waybill.getDestination());
updateEntity.setIsEditWaybill(1);
updateList.add(updateEntity);
}
});
}else if(waybillType == 2){
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(waybillId);
List<ReportPackageBasicEntity> reportPackageList = reportPackageBasicService.findListByOrderCode(waybillNo);
//把reportPackageList以productName为key的Map
Map<String, ReportPackageBasicEntity> reportPackageBasicEntityMap = reportPackageList.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity()));
wayBillDetailList.forEach(wayBillDetail -> {
String productName = wayBillDetail.getProductName();
ReportPackageBasicEntity reportPackageBasicEntity = reportPackageBasicEntityMap.get(productName);
if(!Objects.isNull(reportPackageBasicEntity)){
ReportPackageBasicEntity updateEntity = new ReportPackageBasicEntity();
updateEntity.setId(reportPackageBasicEntity.getId());
updateEntity.setProductId(wayBillDetail.getProductId());
updateEntity.setProductName(wayBillDetail.getProductName());
updateEntity.setNum(wayBillDetail.getNum());
updateEntity.setWeight(wayBillDetail.getWeight());
updateEntity.setVolume(wayBillDetail.getVolume());
updateEntity.setShipperId(waybill.getShipperId());
updateEntity.setShipper(waybill.getShipper());
updateEntity.setConsignee(waybill.getConsignee());
updateEntity.setConsigneeId(waybill.getConsigneeId());
updateEntity.setDepartureWarehouseId(waybill.getDepartureWarehouseId());
updateEntity.setDepartureWarehouseName(waybill.getDepartureWarehouseName());
updateEntity.setDestinationWarehouseId(waybill.getDestinationWarehouseId());
updateEntity.setDestinationWarehouseName(waybill.getDestinationWarehouseName());
updateEntity.setDeparture(waybill.getDeparture());
updateEntity.setDestination(waybill.getDestination());
updateEntity.setIsEditWaybill(1);
updateList.add(updateEntity);
}else{
ReportPackageBasicEntity addEntity = new ReportPackageBasicEntity();
addEntity.setWaybillNo(waybill.getWaybillNo());
addEntity.setOrderCode(waybill.getWaybillNo());
addEntity.setNum(wayBillDetail.getNum());
addEntity.setWeight(wayBillDetail.getWeight());
addEntity.setVolume(wayBillDetail.getVolume());
addEntity.setPushUserId(operatorId);
addEntity.setPushUserName(operator);
addEntity.setPushTime(operatorTime);
addEntity.setOpenTime(operatorTime);
addEntity.setOpenUserName(operator);
addEntity.setOpenUserId(operatorId);
addEntity.setIncomingTime(operatorTime);
addEntity.setIncomingUserName(operator);
addEntity.setIncomingUserId(operatorId);
addEntity.setDataType(PackageTypeEnums.LTL.getCode());
addEntity.setSystemType("线下");
addEntity.setBrandId(waybill.getBrandId());
addEntity.setBrand(waybill.getBrand());
addEntity.setWarehouse(warehouse);
addEntity.setWarehouseId(warehouseId);
addEntity.setIncomingType(3);
addEntity.setShipper(waybill.getShipper());
addEntity.setShipperId(waybill.getShipperId());
addEntity.setConsignee(waybill.getConsignee());
addEntity.setConsigneeId(waybill.getConsigneeId());
addEntity.setDepartureWarehouseId(waybill.getDepartureWarehouseId());
addEntity.setDepartureWarehouseName(waybill.getDepartureWarehouseName());
addEntity.setDestinationWarehouseId(waybill.getDestinationWarehouseId());
addEntity.setDestinationWarehouseName(waybill.getDestinationWarehouseName());
addEntity.setDeparture(waybill.getDeparture());
addEntity.setDestination(waybill.getDestination());
addEntity.setIncomingStatus(1);
addList.add(addEntity);
}
});
//判断是否有删除的明细数据
reportPackageList.forEach(reportPackageBasicEntity -> {
String productName = reportPackageBasicEntity.getProductName();
Integer flag = 0;
for (WarehouseWayBillDetail warehouseWayBillDetail : wayBillDetailList) {
String productName1 = warehouseWayBillDetail.getProductName();
if(productName.equals(productName1)){
flag = 1;
break;
}
}
if(flag == 1){
deleteList.add(reportPackageBasicEntity);
}
});
}else{
log.warn(method+"未知的运单类型");
}
if(CollUtil.isNotEmpty(updateList)){
reportPackageBasicService.updateBatchById(updateList);
}
if(CollUtil.isNotEmpty(addList)){
reportPackageBasicService.saveBatch(addList);
}
if(CollUtil.isNotEmpty(deleteList)){
//把deleteList中所有元素的id放入一个list
List<Long> ids = deleteList.stream().map(ReportPackageBasicEntity::getId).collect(Collectors.toList());
reportPackageBasicService.deleteByIds(ids);
}
}
private void updateOpenOrderPackageBasicData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class);
JSONArray details = js.getJSONArray("details");
List<PackageData> packageDataList = JSONUtil.toList(details, PackageData.class);
WarehouseWaybillEntity waybill = JSONUtil.toBean(js, WarehouseWaybillEntity.class);
Long waybillId = waybill.getId();
Integer waybillType = waybill.getWaybillType();
if(waybillType == 1){
//订制品开单
//把packageDataList中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataList.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
//把packageDataList转化成以orderPackageCode为key的Map
Map<String, PackageData> packageDataMap = packageDataList.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity()));
List<ReportPackageBasicEntity> updateList = new ArrayList<>();
List<ReportPackageBasicEntity> packageBasicEntities = reportPackageBasicService.findByOrderPackageCodes(packageCodes);
packageBasicEntities.forEach(entity -> {
String orderPackageCode = entity.getOrderPackageCode();
PackageData packageData = packageDataMap.get(orderPackageCode);
if(!Objects.isNull(packageData)){
entity.setWaybillNo(waybill.getWaybillNo());
entity.setProductId(packageData.getProductId());
entity.setProductName(packageData.getProductName());
entity.setWeight(packageData.getWeight());
entity.setVolume(packageData.getVolume());
entity.setNum(packageData.getNumber());
entity.setOpenTime(operatorTime);
entity.setOpenUserName(operator);
entity.setOpenUserId(operatorId);
entity.setShipper(waybill.getShipper());
entity.setShipperId(waybill.getShipperId());
entity.setConsignee(waybill.getConsignee());
entity.setConsigneeId(waybill.getConsigneeId());
entity.setDepartureWarehouseId(waybill.getDepartureWarehouseId());
entity.setDepartureWarehouseName(waybill.getDepartureWarehouseName());
entity.setDestinationWarehouseId(waybill.getDestinationWarehouseId());
entity.setDestinationWarehouseName(waybill.getDestinationWarehouseName());
entity.setDeparture(waybill.getDeparture());
entity.setDestination(waybill.getDestination());
updateList.add(entity);
}
});
if(CollUtil.isNotEmpty(updateList)){
reportPackageBasicService.updateBatchById(updateList);
}
}else if(waybillType == 2){
//零担开单
List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(waybillId);
List<ReportPackageBasicEntity> addList = new ArrayList<>();
wayBillDetailList.forEach(detail -> {
ReportPackageBasicEntity reportPackageBasicEntity = new ReportPackageBasicEntity();
reportPackageBasicEntity.setWaybillNo(waybill.getWaybillNo());
reportPackageBasicEntity.setOrderCode(waybill.getWaybillNo());
reportPackageBasicEntity.setNum(detail.getNum());
reportPackageBasicEntity.setWeight(detail.getWeight());
reportPackageBasicEntity.setVolume(detail.getVolume());
reportPackageBasicEntity.setPushUserId(operatorId);
reportPackageBasicEntity.setPushUserName(operator);
reportPackageBasicEntity.setPushTime(operatorTime);
reportPackageBasicEntity.setOpenTime(operatorTime);
reportPackageBasicEntity.setOpenUserName(operator);
reportPackageBasicEntity.setOpenUserId(operatorId);
reportPackageBasicEntity.setIncomingTime(operatorTime);
reportPackageBasicEntity.setIncomingUserName(operator);
reportPackageBasicEntity.setIncomingUserId(operatorId);
reportPackageBasicEntity.setDataType(PackageTypeEnums.LTL.getCode());
reportPackageBasicEntity.setSystemType("线下");
reportPackageBasicEntity.setBrandId(waybill.getBrandId());
reportPackageBasicEntity.setBrand(waybill.getBrand());
reportPackageBasicEntity.setWarehouse(warehouse);
reportPackageBasicEntity.setWarehouseId(warehouseId);
reportPackageBasicEntity.setIncomingType(3);
reportPackageBasicEntity.setShipper(waybill.getShipper());
reportPackageBasicEntity.setShipperId(waybill.getShipperId());
reportPackageBasicEntity.setConsignee(waybill.getConsignee());
reportPackageBasicEntity.setConsigneeId(waybill.getConsigneeId());
reportPackageBasicEntity.setDepartureWarehouseId(waybill.getDepartureWarehouseId());
reportPackageBasicEntity.setDepartureWarehouseName(waybill.getDepartureWarehouseName());
reportPackageBasicEntity.setDestinationWarehouseId(waybill.getDestinationWarehouseId());
reportPackageBasicEntity.setDestinationWarehouseName(waybill.getDestinationWarehouseName());
reportPackageBasicEntity.setDeparture(waybill.getDeparture());
reportPackageBasicEntity.setDestination(waybill.getDestination());
reportPackageBasicEntity.setIncomingStatus(1);
addList.add(reportPackageBasicEntity);
});
if(CollUtil.isNotEmpty(addList)){
reportPackageBasicService.saveBatch(addList);
}
}
}
private void updateIncomingPackageBasicData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
List<PackageData> packageDataList = JSONUtil.toList(JSONUtil.toJsonStr(main), PackageData.class);
//把packageDataList中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataList.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
//把packageDataList转化成以orderPackageCode为key的Map
Map<String, PackageData> packageDataMap = packageDataList.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity()));
List<ReportPackageBasicEntity> updateList = new ArrayList<>();
List<ReportPackageBasicEntity> packageBasicEntities = reportPackageBasicService.findByOrderPackageCodes(packageCodes);
packageBasicEntities.forEach(entity -> {
String orderPackageCode = entity.getOrderPackageCode();
PackageData packageData = packageDataMap.get(orderPackageCode);
if(!Objects.isNull(packageData)){
entity.setWaybillNo(packageData.getWaybillNumber());
entity.setProductId(packageData.getProductId());
entity.setProductName(packageData.getProductName());
entity.setWeight(packageData.getWeight());
entity.setVolume(packageData.getVolume());
entity.setNum(packageData.getNumber());
entity.setIncomingTime(operatorTime);
entity.setIncomingUserName(operator);
entity.setIncomingUserId(operatorId);
entity.setIncomingStatus(1);
entity.setIncomingType(packageData.getIncomingType());
updateList.add(entity);
}
});
if(CollUtil.isNotEmpty(updateList)){
reportPackageBasicService.updateBatchById(updateList);
}
}
private void deletePackageBasicData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
List<PackageData> packageDataList = JSONUtil.toList(JSONUtil.toJsonStr(main), PackageData.class);
//把packageDataList中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataList.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
reportPackageBasicService.deleteByOrderPackageCodes(packageCodes);
}
private void savePackageBasicData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
List<PackageData> packageDataList = JSONUtil.toList(JSONUtil.toJsonStr(main), PackageData.class);
//把advanceDetailEntityList中所有元素的orderPackageCode放入一个List
// List<String> packageCodes = advanceDetailEntityList.stream().map(TrunklineAdvanceDetailEntity::getOrderPackageCode).collect(java.util.stream.Collectors.toList());
// List<ReportPackageBasicEntity> hasReportPackageBasicEntityList = reportPackageBasicService.findOrderPackageCodeListByPackageCodes(packageCodes);
// //把hasReportPackageBasicEntityList转换为以orderPackageCode为key的Map
// Map<String, ReportPackageBasicEntity> map = hasReportPackageBasicEntityList.stream()
// .collect(Collectors.toMap(
// ReportPackageBasicEntity::getOrderPackageCode, // key
// entity -> entity)); // value
List<ReportPackageBasicEntity> addList = new ArrayList<>();
packageDataList.forEach(entity -> {
ReportPackageBasicEntity reportPackageBasicEntity = new ReportPackageBasicEntity();
reportPackageBasicEntity.setServiceNo(entity.getServiceNo());
reportPackageBasicEntity.setOrderCode(entity.getOrderCode());
reportPackageBasicEntity.setOrderPackageCode(entity.getPackageCode());
reportPackageBasicEntity.setMergePackageCode(entity.getMergePackageCode());
reportPackageBasicEntity.setNum(entity.getNumber());
reportPackageBasicEntity.setWeight(entity.getWeight());
reportPackageBasicEntity.setVolume(entity.getVolume());
reportPackageBasicEntity.setMaterialId(entity.getMaterialId());
reportPackageBasicEntity.setMaterialCode(entity.getMaterialCode());
reportPackageBasicEntity.setMaterialName(entity.getMaterialName());
reportPackageBasicEntity.setDealerCode(entity.getDealerCode());
reportPackageBasicEntity.setDealerName(entity.getDealerName());
reportPackageBasicEntity.setPushUserId(operatorId);
reportPackageBasicEntity.setPushUserName(operator);
reportPackageBasicEntity.setPushTime(operatorTime);
reportPackageBasicEntity.setDataType(entity.getPackageType().getCode());
reportPackageBasicEntity.setSystemType(entity.getSystemType());
reportPackageBasicEntity.setCustomerTrain(entity.getCustomerTrain());
reportPackageBasicEntity.setBrandId(entity.getBrandId());
reportPackageBasicEntity.setBrand(entity.getBrand());
reportPackageBasicEntity.setWarehouse(warehouse);
reportPackageBasicEntity.setWarehouseId(warehouseId);
addList.add(reportPackageBasicEntity);
});
if(CollUtil.isNotEmpty(addList)){
reportPackageBasicService.saveBatch(addList);
}
}
}

251
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java

@ -0,0 +1,251 @@
package com.logpm.trunkline.mq.report;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.trunkline.entity.ReportPackageBasicEntity;
import com.logpm.trunkline.entity.ReportPackageTrunklineEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadEntity;
import com.logpm.trunkline.service.IReportPackageBasicService;
import com.logpm.trunkline.service.IReportPackageTrunklineService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.core.tool.utils.StringUtil;
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.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Component
@AllArgsConstructor
public class CarsLoadDealListener {
private final IReportPackageBasicService reportPackageBasicService;
private final IReportPackageTrunklineService reportPackageTrunklineService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.trunkline.CARSLOADDATA.QUEUE.REPORT_CARSLOADDATA),
exchange = @Exchange(name = FanoutConstants.trunkline.CARSLOADDATA.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void carsLoadDeal(String msg) {
String method = "####################carsLoadDeal: ";
if(StringUtil.isNotBlank(msg)){
NodeFanoutMsg bean = JSONUtil.toBean(msg, NodeFanoutMsg.class);
WorkNodeEnums node = bean.getNode();
BizOperationEnums bizOperation = bean.getBizOperation();
String operator = bean.getOperator();
Long operatorId = bean.getOperatorId();
Date operatorTime = bean.getOperatorTime();
String warehouse = bean.getWarehouse();
Long warehouseId = bean.getWarehouseId();
Object main = bean.getMain();
if(WorkNodeEnums.INITIAL_WAREHOUSE_DEPART.equals(node) || WorkNodeEnums.TRANSFER_WAREHOUSE_DEPART.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
savePackageCarsLoadData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_DEPART.equals(node) || WorkNodeEnums.CANEL_TRANSFER_WAREHOUSE_DEPART.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
deleteCarsLoadData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
}else{
log.warn(method+"未知的操作类型");
}
}else {
log.warn(method+"未知的节点类型");
}
}
}
private void deleteCarsLoadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################deleteCarsLoadData: ";
JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class);
TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class);
String carsNo = carsLoadEntity.getCarsNo();
reportPackageTrunklineService.deleteListByCarsNoAndWarehouseId(carsNo, warehouseId);
}
private void savePackageCarsLoadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################savePackageCarsLoadData: ";
JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class);
JSONArray details = js.getJSONArray("details");
List<PackageData> packageDataList = JSONUtil.toList(details, PackageData.class);
//把packageDataList通过packageType的code进行分组
Map<Integer, List<PackageData>> packageTypeEnumsListMap = packageDataList.stream().collect(Collectors.groupingBy(t->t.getPackageType().getCode()));
TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class);
List<ReportPackageTrunklineEntity> addList = new ArrayList<>();
packageTypeEnumsListMap.keySet().forEach(packageTypeCode -> {
List<PackageData> packageDataListByPackageType = packageTypeEnumsListMap.get(packageTypeCode);
if(NumberUtil.equals(packageTypeCode,1)){
//把packageDataListByPackageType中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataListByPackageType.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
//把packageDataListByPackageType转化成以orderPackageCode为key的Map
Map<String, PackageData> packageDataMap = packageDataListByPackageType.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity()));
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findByOrderPackageCodes(packageCodes);
packageBasicEntityList.forEach(entity -> {
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(entity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(entity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(entity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(entity.getOrderCode());
String orderPackageCode = entity.getOrderPackageCode();
PackageData packageData = packageDataMap.get(orderPackageCode);
reportPackageTrunklineEntity.setOrderPackageCode(orderPackageCode);
reportPackageTrunklineEntity.setProductName(entity.getProductName());
reportPackageTrunklineEntity.setProductId(entity.getProductId());
reportPackageTrunklineEntity.setBrand(entity.getBrand());
reportPackageTrunklineEntity.setBrandId(entity.getBrandId());
Long departureWarehouseId = entity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(entity.getDepartureWarehouseName());
Long destinationWarehouseId = entity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(entity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(1);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(entity.getNum());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
}else if(NumberUtil.equals(packageTypeCode,2)){
//把packageDataListByPackageType中所有元素的orderCode放入一个List
List<String> orderCodeList = packageDataListByPackageType.stream().map(PackageData::getOrderCode).collect(java.util.stream.Collectors.toList());
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findListByOrderCodeList(orderCodeList);
//把packageBasicEntityList通过orderCode进行分组
Map<String, List<ReportPackageBasicEntity>> packageBasicEntityListMap = packageBasicEntityList.stream().collect(Collectors.groupingBy(ReportPackageBasicEntity::getOrderCode));
//把packageDataListByPackageType通过orderCode进行分组
Map<String, List<PackageData>> packageDataListMap = packageDataListByPackageType.stream().collect(Collectors.groupingBy(PackageData::getOrderCode));
packageDataListMap.keySet().forEach(orderCode -> {
List<PackageData> packageDataList1 = packageDataListMap.get(orderCode);
List<ReportPackageBasicEntity> packageBasicEntities = packageBasicEntityListMap.get(orderCode);
//把packageBasicEntities转化成以productName为key的Map
Map<String, ReportPackageBasicEntity> packageBasicEntityMap = packageBasicEntities.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity()));
packageDataList1.forEach(packageData1 -> {
String productName = packageData1.getProductName();
ReportPackageBasicEntity packageBasicEntity = packageBasicEntityMap.get(productName);
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(packageBasicEntity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(packageBasicEntity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(packageBasicEntity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(packageBasicEntity.getOrderCode());
reportPackageTrunklineEntity.setOrderPackageCode(packageBasicEntity.getOrderPackageCode());
reportPackageTrunklineEntity.setProductName(packageBasicEntity.getProductName());
reportPackageTrunklineEntity.setProductId(packageBasicEntity.getProductId());
reportPackageTrunklineEntity.setBrand(packageBasicEntity.getBrand());
reportPackageTrunklineEntity.setBrandId(packageBasicEntity.getBrandId());
Long departureWarehouseId = packageBasicEntity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(packageBasicEntity.getDepartureWarehouseName());
Long destinationWarehouseId = packageBasicEntity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(packageBasicEntity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData1.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData1.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(1);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(packageData1.getNumber());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
});
}
});
if(CollUtil.isNotEmpty(addList)){
reportPackageTrunklineService.saveBatch(addList);
}
}
}

22
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IReportPackageBasicService.java

@ -0,0 +1,22 @@
package com.logpm.trunkline.service;
import com.logpm.trunkline.entity.ReportPackageBasicEntity;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
public interface IReportPackageBasicService extends BaseService<ReportPackageBasicEntity> {
List<ReportPackageBasicEntity> findOrderPackageCodeListByPackageCodes(List<String> packageCodes);
void deleteByOrderPackageCodes(List<String> packageCodes);
List<ReportPackageBasicEntity> findByOrderPackageCodes(List<String> packageCodes);
List<ReportPackageBasicEntity> findListByWaybillNo(String waybillNo);
void deleteByIds(List<Long> ids);
List<ReportPackageBasicEntity> findListByOrderCode(String orderCode);
List<ReportPackageBasicEntity> findListByOrderCodeList(List<String> orderCodeList);
}

8
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IReportPackageTrunklineService.java

@ -0,0 +1,8 @@
package com.logpm.trunkline.service;
import com.logpm.trunkline.entity.ReportPackageTrunklineEntity;
import org.springblade.core.mp.base.BaseService;
public interface IReportPackageTrunklineService extends BaseService<ReportPackageTrunklineEntity> {
void deleteListByCarsNoAndWarehouseId(String carsNo, Long warehouseId);
}

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java

@ -115,4 +115,6 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
List<JSONObject> findAllUnloadData();
void updateSyncUnloadDataStatus(Integer id, int status);
List<TrunklineAdvanceDetailEntity> findListByWaybillId(Long waybillId);
}

17
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java

@ -713,9 +713,15 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
.eq("scan_status", "1");
List<TrunklineCarsLoadScanEntity> carsLoadScanEntityList = trunklineCarsLoadScanService.list(queryWrapper);
Long startWarehouseId = carsLoadEntity.getStartWarehouseId();
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
if(startWarehouseId.equals(warehouseId)){
nodeFanoutMsg.setNode(WorkNodeEnums.INITIAL_WAREHOUSE_DEPART);
}else{
nodeFanoutMsg.setNode(WorkNodeEnums.TRANSFER_WAREHOUSE_DEPART);
}
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setOperator(nickName);
nodeFanoutMsg.setOperatorId(userId);
@ -744,6 +750,8 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
packageData.setWaybillNumber(entity.getWaybillNo());
packageData.setNumber(entity.getNum());
packageData.setPackageType(PackageTypeEnums.CMP);
packageData.setFinalNodeId(entity.getFinalNodeId());
packageData.setFinalNodeName(entity.getFinalNodeName());
packageDataList.add(packageData);
});
@ -765,6 +773,8 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
packageData.setWaybillNumber(carsLoadScanEntity.getWaybillNo());
packageData.setProductId(zeroDetailVO.getGoodsId());
packageData.setProductName(zeroDetailVO.getGoodsName());
packageData.setFinalNodeId(carsLoadScanEntity.getFinalNodeId());
packageData.setFinalNodeName(carsLoadScanEntity.getFinalNodeName());
packageDataList.add(packageData);
});
@ -777,7 +787,7 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
json.put("details", packageDataList);
nodeFanoutMsg.setMain(json);
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.CARSLOADDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@ -794,7 +804,12 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
Long startWarehouseId = carsLoadEntity.getStartWarehouseId();
if(warehouseId.equals(startWarehouseId)){
nodeFanoutMsg.setNode(WorkNodeEnums.CANCEL_INITIAL_WAREHOUSE_DEPART);
}else{
nodeFanoutMsg.setNode(WorkNodeEnums.CANEL_TRANSFER_WAREHOUSE_DEPART);
}
nodeFanoutMsg.setBizOperation(BizOperationEnums.DELETE);
nodeFanoutMsg.setOperator(nickName);
nodeFanoutMsg.setOperatorId(userId);

56
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/ReportPackageBasicServiceImpl.java

@ -0,0 +1,56 @@
package com.logpm.trunkline.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.trunkline.entity.ReportPackageBasicEntity;
import com.logpm.trunkline.mapper.ReportPackageBasicMapper;
import com.logpm.trunkline.service.IReportPackageBasicService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
@AllArgsConstructor
@Slf4j
public class ReportPackageBasicServiceImpl extends BaseServiceImpl<ReportPackageBasicMapper, ReportPackageBasicEntity> implements IReportPackageBasicService {
@Override
public List<ReportPackageBasicEntity> findOrderPackageCodeListByPackageCodes(List<String> packageCodes) {
QueryWrapper<ReportPackageBasicEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_package_code", packageCodes);
return baseMapper.selectList(queryWrapper);
}
@Override
public void deleteByOrderPackageCodes(List<String> packageCodes) {
baseMapper.deleteByOrderPackageCodes(packageCodes);
}
@Override
public List<ReportPackageBasicEntity> findByOrderPackageCodes(List<String> packageCodes) {
return baseMapper.findByOrderPackageCodes(packageCodes);
}
@Override
public List<ReportPackageBasicEntity> findListByWaybillNo(String waybillNo) {
return baseMapper.findListByWaybillNo(waybillNo);
}
@Override
public void deleteByIds(List<Long> ids) {
baseMapper.deleteByIds(ids);
}
@Override
public List<ReportPackageBasicEntity> findListByOrderCode(String orderCode) {
return baseMapper.findListByOrderCode(orderCode);
}
@Override
public List<ReportPackageBasicEntity> findListByOrderCodeList(List<String> orderCodeList) {
return baseMapper.findListByOrderCodeList(orderCodeList);
}
}

19
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/ReportPackageTrunklineServiceImpl.java

@ -0,0 +1,19 @@
package com.logpm.trunkline.service.impl;
import com.logpm.trunkline.entity.ReportPackageTrunklineEntity;
import com.logpm.trunkline.mapper.ReportPackageTrunklineMapper;
import com.logpm.trunkline.service.IReportPackageTrunklineService;
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 ReportPackageTrunklineServiceImpl extends BaseServiceImpl<ReportPackageTrunklineMapper, ReportPackageTrunklineEntity> implements IReportPackageTrunklineService {
@Override
public void deleteListByCarsNoAndWarehouseId(String carsNo, Long warehouseId) {
baseMapper.deleteListByCarsNoAndWarehouseId(carsNo,warehouseId);
}
}

65
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -299,9 +299,67 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, advanceDetailDTO.getWarehouseId(), advanceDetailDTO.getWarehouseName(), WorkNodeEnums.DELETE_DATA_ENTRY.getCode(), "包件删除");
if(CollUtil.isNotEmpty(deleteList)){
//删除发送广播
sendDeleteReportBasicdataFanout(AuthUtil.getNickName(), AuthUtil.getUserId(), new Date(),warehouseId,warehouseName, deleteList);
}
return R.success("删除成功");
}
private void sendDeleteReportBasicdataFanout(String nickName, Long userId, Date date,Long warehouseId, String warehouseName, List<TrunklineAdvanceDetailEntity> deleteList) {
String key = AuthUtil.getTenantId()+":brandList";
Map<String, Long> brandMap = bladeRedis.hGetAll(key);
if(CollUtil.isEmpty(brandMap)){
List<JSONObject> allList = basicdataBrandClient.findAllList();
Map<String, Long> brandIdMap = new HashMap<>();
allList.forEach(jsonObject -> {
brandIdMap.put(jsonObject.getString("brandName"),jsonObject.getLong("brandId"));
});
brandMap.putAll(brandIdMap);
}
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
nodeFanoutMsg.setNode(WorkNodeEnums.INITIAL_DATA_ENTRY);
nodeFanoutMsg.setBizOperation(BizOperationEnums.DELETE);
nodeFanoutMsg.setOperator(nickName);
nodeFanoutMsg.setOperatorId(userId);
nodeFanoutMsg.setWarehouse(warehouseName);
nodeFanoutMsg.setWarehouseId(warehouseId);
nodeFanoutMsg.setOperatorTime(date);
//组装包件数据
List<PackageData> packageDataList = new ArrayList<>();
deleteList.forEach(detailEntity -> {
PackageData packageData = new PackageData();
packageData.setPackageCode(detailEntity.getOrderPackageCode());
packageData.setOrderCode(detailEntity.getOrderCode());
packageData.setServiceNo(detailEntity.getServiceNum());
packageData.setMaterialId(detailEntity.getMaterialId());
packageData.setMaterialCode(detailEntity.getMaterialCode());
packageData.setMaterialName(detailEntity.getMaterialName());
packageData.setNumber(detailEntity.getQuantity());
packageData.setWeight(detailEntity.getWeight());
packageData.setVolume(detailEntity.getVolume());
packageData.setPackageType(PackageTypeEnums.CMP);
packageData.setCustomerTrain(detailEntity.getTrainNumber());
String brand = detailEntity.getBrand();
packageData.setBrandId(brandMap.get(brand));
packageData.setBrandName(brand);
packageData.setSystemType(detailEntity.getSystemType());
packageDataList.add(packageData);
});
nodeFanoutMsg.setMain(packageDataList);
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@Override
public Integer findTotalNumByOrderCode(String orderCode) {
return baseMapper.findTotalNumByOrderCode(orderCode);
@ -594,6 +652,8 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
packageData.setVolume(detailEntity.getVolume());
packageData.setPackageType(PackageTypeEnums.CMP);
packageData.setWaybillNumber(waybillEntity.getWaybillNo());
packageData.setProductId(detailEntity.getIncomeCategoryId());
packageData.setProductName(detailEntity.getIncomeCategoryName());
packageDataList.add(packageData);
});
@ -641,4 +701,9 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
public void updateSyncUnloadDataStatus(Integer id, int status) {
baseMapper.updateSyncUnloadDataStatus(id,status);
}
@Override
public List<TrunklineAdvanceDetailEntity> findListByWaybillId(Long waybillId) {
return baseMapper.findListByWaybillId(waybillId);
}
}

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -686,6 +686,8 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setWarehouseEntryTimeEnd(date);
parcelList.setDealerCode(stockArticleEntity.getDealerCode());
parcelList.setDealerName(stockArticleEntity.getDealerName());
parcelList.setWeight(advanceDetailEntity.getWeight());
parcelList.setVolume(advanceDetailEntity.getVolume());
parcelListEntityList.add(parcelList);
advanceDetailEntity.setPackageStatus("1");
@ -1033,6 +1035,8 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelList.setOrderPackageReservationStatus("10");
parcelList.setOrderPackageLoadingStatus("10");
parcelList.setWarehouseEntryTimeEnd(date);
parcelList.setWeight(ad.getWeight());
parcelList.setVolume(ad.getVolume());
parcelList.setDealerCode(stockArticleEntity.getDealerCode());
parcelList.setDealerName(stockArticleEntity.getDealerName());
parcelListEntityList.add(parcelList);

Loading…
Cancel
Save