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 228f2e78a..ec0c1f2ab 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 @@ -154,7 +154,6 @@ public abstract class FanoutConstants { // } - } @@ -163,8 +162,13 @@ public abstract class FanoutConstants { */ public interface reservation { - // 自主预约 org.springblade.common.model.ReservationVO + /** + * 自主预约 + * + * @see org.springblade.common.model.ReservationVO + **/ interface OwnReservation { + String EXCHANGE = "fanout.reservation.own" + ModuleNameConstant.DEVAUTH; interface QUEUE { @@ -178,62 +182,76 @@ public abstract class FanoutConstants { } - /** * 配送 */ public interface distribution { - // 配送计划 + /** + * 配送计划 + * + * @see org.springblade.common.model.DistributionTaskVO + **/ interface DeliveryAndPlan { + String EXCHANGE = "fanout.distribution.plan" + ModuleNameConstant.DEVAUTH; - // main: {"distributionCompany":"承运商", "driverName":"司机姓名", "id":"任务ID", "kind":"任务类型 1-自主 2-外协", "taskTime":"任务时间", "trainNumber":"车次号","type":"配送类型 1商配 2市配", "vehicleName":"车牌号"} interface QUEUE { String REPORT = "fanout.distribution.plan.report" + ModuleNameConstant.DEVAUTH; } } - // 备货节点 + /** + * 备货节点 + * + * @see org.springblade.common.model.StockUpVO + **/ interface stock { String EXCHANGE = "fanout.distribution.stock" + ModuleNameConstant.DEVAUTH; - // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { String REPORT = "fanout.distribution.stock.report" + ModuleNameConstant.DEVAUTH; } } - // 装车节点 + /** + * 装车节点 + * + * @see org.springblade.common.model.DistributionLoadVO + **/ interface DeliveryAndLoading { String EXCHANGE = "fanout.distribution.load" + ModuleNameConstant.DEVAUTH; - // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { String REPORT = "fanout.distribution.DeliveryAndLoading.report" + ModuleNameConstant.DEVAUTH; } } - interface DeliveryAndCarStart{ + /** + * 发车 + * + * @see org.springblade.common.model.PlanDriverbindCarVO + **/ + interface DeliveryAndCarStart { String EXCHANGE = "fanout.distribution.carstart" + ModuleNameConstant.DEVAUTH; - // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { - + String REPORT = "fanout.distribution.DeliveryAndCarStart.report" + ModuleNameConstant.DEVAUTH; } } /** * 签收 + * + * @see org.springblade.common.model.DistributionSignforVO */ interface DeliveryAndSignfor { String EXCHANGE = "fanout.distribution.signfor2" + ModuleNameConstant.DEVAUTH; - // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { } @@ -247,14 +265,12 @@ public abstract class FanoutConstants { String EXCHANGE = "fanout.distribution.recheck" + ModuleNameConstant.DEVAUTH; - // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { } } - interface signfor { String EXCHANGE = "fanout.distribution.signfor" + ModuleNameConstant.DEVAUTH; 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 b521aba0d..5186afe8b 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 @@ -1,6 +1,5 @@ package org.springblade.common.model; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.io.Serializable; @@ -11,13 +10,13 @@ import java.util.List; */ @Data public class DistributionTaskVO implements Serializable { - private String distributionCompany; private Long id; private String kind; private String taskTime; private String trainNumber; private String type; + private String distributionCompany; /** * 司机名 */ 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 63d393e74..09f0f2903 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 @@ -339,6 +339,11 @@ public class QualityDeliverEntity extends TenantEntity { */ @ApiModelProperty(value = "装车配送单号 包含配送车次和自提车次 直发商家 对应干线车次 三方中转 三方中转车次号") private String loadTrainNumber; + /** + * 装车车牌 + */ + @ApiModelProperty(value = "装车车牌") + private String loadLicensePlate; /** * 装车数量 */ 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 3f32fbdb3..8e3d67ba3 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 @@ -5,8 +5,6 @@ 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.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.service.IQualityDeliverService; @@ -21,7 +19,6 @@ import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.model.DistributionLoadVO; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; -import org.springblade.common.model.StockUpVO; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; @@ -66,74 +63,59 @@ public class LoadingReportListener { Object main = bean.getMain(); JSONObject entries = JSONUtil.parseObj(main); DistributionLoadVO vo = JSONUtil.toBean(entries, DistributionLoadVO.class); - 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) - .ne(QualityDeliverEntity::getBizStatus, 110); - qualityDeliverService.update(wrapper); - } + // 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() .warehouseName(bean.getWarehouse()) .warehouseId(warehouseId) - .stockupUserName(bean.getOperator()) - .stockupCreateTime(bean.getOperatorTime()) - // 备货区 TODO - // .stockAllocation(vo.get) + .orderPackageCode(detail.getPackageCode()) + .loadUserName(bean.getOperator()) + .loadNum(detail.getNumber()) + .loadTime(bean.getOperatorTime()) + .loadLicensePlate(vo.getVehicleName()) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { 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()); - } + qualityDeliverEntity.setLoadNum(1); + sendReport(bizOperation, qualityDeliverEntity); } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { qualityDeliverEntity.setOrderCode(detail.getOrderCode()); qualityDeliverEntity.setCostCategory(detail.getProductName()); qualityDeliverEntity.setRevenueCategory(detail.getProductName()); 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(bizOperation, qualityDeliverEntity); } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setConditions(3); - 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(bizOperation, qualityDeliverEntity); } } } } + private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity) { + 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()); + } + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java index e996c5e76..e5d368c41 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java @@ -21,6 +21,7 @@ import org.springblade.common.enums.PackageTypeEnums; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; import org.springblade.common.model.ReservationVO; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Queue; @@ -87,53 +88,49 @@ public class ReservationPlanReportListener { .planReservationCode(vo.getReservationCode()) .planReservationTime(vo.getReservationDate()) .planReservationUser(bean.getOperator()) + .planNum(detail.getNumber()) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setPlanNum(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()); - } - } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { + sendReport(bizOperation, qualityDeliverEntity); + } + if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { qualityDeliverEntity.setOrderCode(detail.getOrderCode()); qualityDeliverEntity.setCostCategory(detail.getProductName()); qualityDeliverEntity.setRevenueCategory(detail.getProductName()); 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()); - } - } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { + sendReport(bizOperation, qualityDeliverEntity); + } + if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setConditions(3); - 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()); + Integer number = detail.getNumber(); + for (int i = 0; i < number; i++) { + QualityDeliverEntity entity = new QualityDeliverEntity(); + BeanUtil.copyProperties(qualityDeliverEntity, entity); + entity.setPlanNum(1); + sendReport(bizOperation, entity); } } + } } } + private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity) { + 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()); + } + } + } 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 26e1ad5c9..bbc11f98e 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 @@ -88,8 +88,7 @@ public class StockReportListener { .stockupUserName(bean.getOperator()) .stockupFinishTime(vo.getStockupDate()) .stockupCreateTime(bean.getOperatorTime()) - // 备货区 TODO - // .stockAllocation(vo.get) + .stockAllocation(vo.getStockupArea()) .build(); if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { qualityDeliverEntity.setConditions(1);