diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java index 12c01e911..4f99a29ef 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/ConsigneeArriveVO.java @@ -3,8 +3,6 @@ package org.springblade.common.model; import lombok.Data; -import java.util.List; - /** * 客户到达 */ @@ -26,8 +24,6 @@ public class ConsigneeArriveVO { */ private String vehicleName; - - /** * 预约单号 */ @@ -64,6 +60,4 @@ public class ConsigneeArriveVO { */ private String positioning; - - } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java index ba57090eb..d50019fe4 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java @@ -12,20 +12,18 @@ import java.util.List; public class DistributionTaskVO implements Serializable { private Long id; + /** 配送种类 */ private String kind; + /** 配送时间 */ private String taskTime; + /** 车次 */ private String trainNumber; + /** 配送类型 */ private String type; + /** 配送公司 */ private String distributionCompany; - /** - * 司机名 - */ - private String driverName; - /** - * 车牌号 - */ - private String vehicleName; + /** 司机和车辆信息 */ private List planDriverbindCars; /** diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java index 0a4cd9cb2..b8942bd46 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java @@ -7,8 +7,10 @@ import java.io.Serializable; @Data public class PlanDriverbindCarVO implements Serializable { + /** 司机 */ private String driverName; + /** 车牌 */ private String carPlate; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java index 19f844250..8159af4c4 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java @@ -144,9 +144,9 @@ public class QualityDeliverEntity extends TenantEntity { @ApiModelProperty(value = "客户车次号") private String trainNumber; /** - * 数据类型 1 定制品 2 库存品 3零担 + * 数据类型 1 定制品 3 库存品 2零担 */ - @ApiModelProperty(value = "数据类型 1 定制品 2 库存品 3零担") + @ApiModelProperty(value = "数据类型 1 定制品 3 库存品 2零担") private Integer conditions; /** * 一级品 @@ -389,6 +389,16 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "到达区/县") private String arriveDistrict; + /** + * 到达街道 + */ + @ApiModelProperty(value = "到达街道") + private String arriveTownship; + /** + * 到达打卡经纬度 + */ + @ApiModelProperty(value = "到达打卡经纬度") + private String arrivePositioning; /** * 到达地址 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java index 0e84bd332..cade33904 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ConsigneeArriveReportListener.java @@ -57,12 +57,18 @@ public class ConsigneeArriveReportListener { Object main = bean.getMain(); JSONObject entries = JSONUtil.parseObj(main); ConsigneeArriveVO vo = JSONUtil.toBean(entries, ConsigneeArriveVO.class); - Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); if (BizOperationEnums.DELETE.equals(bizOperation)) { LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() .set(QualityDeliverEntity::getArriveCarUserName, null) .set(QualityDeliverEntity::getArriveCarTime, null) + .set(QualityDeliverEntity::getArriveProvince, null) + .set(QualityDeliverEntity::getArriveCity, null) + .set(QualityDeliverEntity::getArriveDistrict, null) + .set(QualityDeliverEntity::getArriveTownship, null) + .set(QualityDeliverEntity::getArriveAddress, null) + .set(QualityDeliverEntity::getArrivePositioning, null) + .eq(QualityDeliverEntity::getLoadLicensePlate, vo.getVehicleName()) .eq(QualityDeliverEntity::getLoadTrainNumber, vo.getTrainNumber()) .eq(QualityDeliverEntity::getPlanReservationCode, vo.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); @@ -72,6 +78,12 @@ public class ConsigneeArriveReportListener { LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() .set(QualityDeliverEntity::getArriveCarUserName, vo.getDriverName()) .set(QualityDeliverEntity::getArriveCarTime, bean.getOperatorTime()) + .set(QualityDeliverEntity::getArriveProvince, vo.getProvince()) + .set(QualityDeliverEntity::getArriveCity, vo.getCity()) + .set(QualityDeliverEntity::getArriveDistrict, vo.getDistrict()) + .set(QualityDeliverEntity::getArriveTownship, vo.getTownship()) + .set(QualityDeliverEntity::getArriveAddress, vo.getAddress()) + .set(QualityDeliverEntity::getArrivePositioning, vo.getPositioning()) .eq(QualityDeliverEntity::getLoadTrainNumber, vo.getTrainNumber()) .eq(QualityDeliverEntity::getPlanReservationCode, vo.getReservationCode()) .ne(QualityDeliverEntity::getBizStatus, 110); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java index c4c8ec825..1c881e9b3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java @@ -52,7 +52,7 @@ public class LoadingReportListener { )) @Transactional(rollbackFor = Exception.class) public void buildReport(String msg) { - log.info("备货生成明细报表: {}", msg); + log.info("装车生成明细报表: {}", msg); if (StrUtil.isEmpty(msg)) { return; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java index 391766529..8a080ec8a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java @@ -22,6 +22,7 @@ import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.model.DistributionTaskVO; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; +import org.springblade.common.model.PlanDriverbindCarVO; import org.springblade.common.model.ReservationVO; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; @@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * 配送计划生成明细报表 @@ -68,9 +70,15 @@ public class PlanReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); List reservationVOList = vo.getReservationVOList(); if (CollUtil.isNotEmpty(reservationVOList)) { - Set reservationSet = new HashSet<>(); + List planDriverbindCars = vo.getPlanDriverbindCars(); + String vehicleName = ""; + String driverName = ""; + if(CollUtil.isNotEmpty(planDriverbindCars)){ + // 用逗号拼接 车辆和司机 + vehicleName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getCarPlate).collect(Collectors.joining(",")); + driverName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getDriverName).collect(Collectors.joining(",")); + } Map invMap = new HashMap<>(); - Map ltlMap = new HashMap<>(); for (ReservationVO reservationVO : reservationVOList) { List details = reservationVO.getPackageDataList(); if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { @@ -100,8 +108,8 @@ public class PlanReportListener { .deliveryTime(DateUtil.parseDate(vo.getTaskTime())) .deliveryType(vo.getType()) .deliveryKind(vo.getKind()) - .vehicleName(vo.getVehicleName()) - .driverName(vo.getDriverName()) + .vehicleName(vehicleName) + .driverName(driverName) .distributionCompany(vo.getDistributionCompany()) .deliveryPlanTime(bean.getOperatorTime()) .deliveryCreateUserName(bean.getOperator()) @@ -125,14 +133,13 @@ public class PlanReportListener { qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setPlanNum(detail.getNumber()); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); - ltlMap.put(detail.getOrderCode()+detail.getProductName(), qualityDeliverEntity); + ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) + .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(dto)) + .delay(3000) + .build()); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); @@ -145,13 +152,6 @@ public class PlanReportListener { qualityDeliverEntity.setPlanNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); } } } @@ -168,17 +168,6 @@ public class PlanReportListener { ); } } - if (CollUtil.isNotEmpty(ltlMap)) { - for (Map.Entry entry : ltlMap.entrySet()) { - QualityDeliverEntity qualityDeliverEntity = entry.getValue(); - qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getPlanReservationCode,qualityDeliverEntity.getPlanReservationCode()) - .eq(QualityDeliverEntity::getOrderCode,qualityDeliverEntity.getOrderCode()) - .eq(QualityDeliverEntity::getCostCategory,qualityDeliverEntity.getCostCategory()) - .lt(QualityDeliverEntity::getBizStatus, 110) - ); - } - } } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java index 419d4ef27..9a441f25f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java @@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; @@ -41,7 +40,7 @@ public class QualityDeliverListener { key = ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY )) public void data(String msg) { - log.info("明细报表: {}", msg); + log.info("配送明细基础表处理: {}", msg); if (StrUtil.isEmpty(msg)) { return; } @@ -68,15 +67,39 @@ public class QualityDeliverListener { // 库存品 LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() .lt(QualityDeliverEntity::getBizStatus, 110); - if(StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())){ - wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); - }else{ - wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()) - .eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); + if (ObjectUtil.isNotEmpty(qualityDeliverEntity.getId())) { + // 库存品更新优先按id更新 + wrapper.eq(QualityDeliverEntity::getId, qualityDeliverEntity.getId()); + } else { + if (StrUtil.isNotEmpty(qualityDeliverEntity.getOrderPackageCode())) { + // 没有id,按包条码更新 + wrapper.eq(QualityDeliverEntity::getOrderPackageCode, qualityDeliverEntity.getOrderPackageCode()); + } else { + if (StrUtil.isEmpty(qualityDeliverEntity.getMallName())) { + // 没有id,没有包条码。没有商场,不处理。 + return; + } else { + // 否则加上商场过滤 + wrapper.eq(QualityDeliverEntity::getMallName, qualityDeliverEntity.getMallName()); + } + if (StrUtil.isEmpty(qualityDeliverEntity.getMaterielCode()) && StrUtil.isEmpty(qualityDeliverEntity.getMaterielName())) { + // 没有id,没有包条码,没有商场,没有物料,不处理。 + return; + } + if (StrUtil.isNotEmpty(qualityDeliverEntity.getMaterielCode())) { + // 优先按物料编码更新 + wrapper.eq(QualityDeliverEntity::getMaterielCode, qualityDeliverEntity.getMaterielCode()); + } else { + // 按物料名称更新 + wrapper.eq(QualityDeliverEntity::getMaterielName, qualityDeliverEntity.getMaterielName()); + } + } } - if(StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())){ + if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { + // 有预约单号时加上预约单号过滤:存在同一个库存品在多个预约单中,只根据库存品本身的信息无法查询出对应的数据的情况。 wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); } + // 查询不存在时更新,存在时修改 QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); if (ObjectUtil.isNotEmpty(entity)) { qualityDeliverService.update(qualityDeliverEntity, wrapper); @@ -90,7 +113,7 @@ public class QualityDeliverListener { .eq(QualityDeliverEntity::getOrderCode, qualityDeliverEntity.getOrderCode()) .eq(QualityDeliverEntity::getCostCategory, qualityDeliverEntity.getCostCategory()) .lt(QualityDeliverEntity::getBizStatus, 110); - if(StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())){ + if (StrUtil.isNotEmpty(qualityDeliverEntity.getPlanReservationCode())) { wrapper.eq(QualityDeliverEntity::getPlanReservationCode, qualityDeliverEntity.getPlanReservationCode()); } QualityDeliverEntity entity = qualityDeliverService.getOne(wrapper); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java index 2a579831f..5ab6d279b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java @@ -63,16 +63,6 @@ public class ReViewReportListener { Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); List details = vo.getPackageDataList(); - // if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { - // // 根据预约单号查询出所有这个预约单下的数据 先置空 - // LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - // .set(QualityDeliverEntity::getLoadUserName, null) - // .set(QualityDeliverEntity::getLoadTime, null) - // .set(QualityDeliverEntity::getLoadLicensePlate, null) - // .set(QualityDeliverEntity::getLoadNum, null) - // .ne(QualityDeliverEntity::getBizStatus, 110); - // qualityDeliverService.update(wrapper); - // } if (CollUtil.isNotEmpty(details)) { for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() @@ -81,6 +71,7 @@ public class ReViewReportListener { .orderPackageCode(detail.getPackageCode()) .reviewUserName(bean.getOperator()) .reviewTime(bean.getOperatorTime()) + .bizStatus(100) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java index 4b2d359ef..256208c9e 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java @@ -63,16 +63,6 @@ public class SignforReportListener { Long warehouseId = bean.getWarehouseId(); BizOperationEnums bizOperation = bean.getBizOperation(); List details = vo.getPackageDataList(); - // if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { - // // 根据预约单号查询出所有这个预约单下的数据 先置空 - // LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() - // .set(QualityDeliverEntity::getLoadUserName, null) - // .set(QualityDeliverEntity::getLoadTime, null) - // .set(QualityDeliverEntity::getLoadLicensePlate, null) - // .set(QualityDeliverEntity::getLoadNum, null) - // .ne(QualityDeliverEntity::getBizStatus, 110); - // qualityDeliverService.update(wrapper); - // } if (CollUtil.isNotEmpty(details)) { for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() @@ -82,6 +72,9 @@ public class SignforReportListener { .signUserName(bean.getOperator()) .signTime(bean.getOperatorTime()) .signCarNumber(vo.getVehicleName()) + .signTrainNumber(vo.getTrainNumber()) + .signReservationCode(vo.getReservationCode()) + .bizStatus(90) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java index 53c7d84a7..6ad40554c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java @@ -30,9 +30,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 备货生成明细报表 @@ -68,21 +66,7 @@ public class StockReportListener { BizOperationEnums bizOperation = bean.getBizOperation(); ReservationVO reservationVO = vo.getReservationVO(); List details = reservationVO.getPackageDataList(); -// if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { -// // 根据预约单号查询出所有这个预约单下的数据 先置空 -// LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate() -// .set(QualityDeliverEntity::getStockupCode, null) -// .set(QualityDeliverEntity::getStockupUserName, null) -// .set(QualityDeliverEntity::getStockupFinishTime, null) -// .set(QualityDeliverEntity::getStockNum, null) -// .set(QualityDeliverEntity::getStockAllocation, null) -// .set(QualityDeliverEntity::getStockupCreateTime, null) -// .eq(QualityDeliverEntity::getStockupCode, vo.getStockupCode()) -// .ne(QualityDeliverEntity::getBizStatus, 110); -// qualityDeliverService.update(wrapper); -// } if (CollUtil.isNotEmpty(details)) { - Map invMap = new HashMap<>(); for (PackageData detail : details) { QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() .warehouseName(bean.getWarehouse()) @@ -98,13 +82,7 @@ public class StockReportListener { qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setStockNum(1); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + sendReport(qualityDeliverEntity); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { qualityDeliverEntity.setOrderCode(detail.getOrderCode()); @@ -113,13 +91,7 @@ public class StockReportListener { qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setStockNum(detail.getNumber()); if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { - ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); - factoryDataClient.sendMessage(SendMsg.builder() - .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) - .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) - .message(JSONUtil.toJsonStr(dto)) - .delay(3000) - .build()); + sendReport(qualityDeliverEntity); } } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { qualityDeliverEntity.setPlanReservationCode(reservationVO.getReservationCode()); @@ -140,22 +112,23 @@ public class StockReportListener { .last(" limit 1") ); if(CollUtil.isNotEmpty(list)){ - QualityDeliverEntity qualityDeliverEntity1 = list.get(0); - qualityDeliverService.update(qualityDeliverEntity, Wrappers.lambdaUpdate() - .eq(QualityDeliverEntity::getId,qualityDeliverEntity1.getId()) - ); + qualityDeliverEntity.setId(list.get(0).getId()); + sendReport(qualityDeliverEntity); } -// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); -// factoryDataClient.sendMessage(SendMsg.builder() -// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) -// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) -// .message(JSONUtil.toJsonStr(dto)) -// .delay(3000) -// .build()); } } } } } + private void sendReport(QualityDeliverEntity qualityDeliverEntity) { + ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); + factoryDataClient.sendMessage(SendMsg.builder() + .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) + .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) + .message(JSONUtil.toJsonStr(dto)) + .delay(3000) + .build()); + } + }