Browse Source

feat(all): 增加节点报表

dist.1.3.0
zhaoqiaobo 5 months ago
parent
commit
3289d0d3da
  1. 46
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  2. 3
      blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java
  3. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java
  4. 68
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java
  5. 43
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java
  6. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java

46
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 { public interface reservation {
// 自主预约 org.springblade.common.model.ReservationVO /**
* 自主预约
*
* @see org.springblade.common.model.ReservationVO
**/
interface OwnReservation { interface OwnReservation {
String EXCHANGE = "fanout.reservation.own" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.reservation.own" + ModuleNameConstant.DEVAUTH;
interface QUEUE { interface QUEUE {
@ -178,62 +182,76 @@ public abstract class FanoutConstants {
} }
/** /**
* 配送 * 配送
*/ */
public interface distribution { public interface distribution {
// 配送计划 /**
* 配送计划
*
* @see org.springblade.common.model.DistributionTaskVO
**/
interface DeliveryAndPlan { interface DeliveryAndPlan {
String EXCHANGE = "fanout.distribution.plan" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.plan" + ModuleNameConstant.DEVAUTH;
// main: {"distributionCompany":"承运商", "driverName":"司机姓名", "id":"任务ID", "kind":"任务类型 1-自主 2-外协", "taskTime":"任务时间", "trainNumber":"车次号","type":"配送类型 1商配 2市配", "vehicleName":"车牌号"}
interface QUEUE { interface QUEUE {
String REPORT = "fanout.distribution.plan.report" + ModuleNameConstant.DEVAUTH; String REPORT = "fanout.distribution.plan.report" + ModuleNameConstant.DEVAUTH;
} }
} }
// 备货节点 /**
* 备货节点
*
* @see org.springblade.common.model.StockUpVO
**/
interface stock { interface stock {
String EXCHANGE = "fanout.distribution.stock" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.stock" + ModuleNameConstant.DEVAUTH;
// main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"}
interface QUEUE { interface QUEUE {
String REPORT = "fanout.distribution.stock.report" + ModuleNameConstant.DEVAUTH; String REPORT = "fanout.distribution.stock.report" + ModuleNameConstant.DEVAUTH;
} }
} }
// 装车节点 /**
* 装车节点
*
* @see org.springblade.common.model.DistributionLoadVO
**/
interface DeliveryAndLoading { interface DeliveryAndLoading {
String EXCHANGE = "fanout.distribution.load" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.load" + ModuleNameConstant.DEVAUTH;
// main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"}
interface QUEUE { interface QUEUE {
String REPORT = "fanout.distribution.DeliveryAndLoading.report" + ModuleNameConstant.DEVAUTH; 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; String EXCHANGE = "fanout.distribution.carstart" + ModuleNameConstant.DEVAUTH;
// main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"}
interface QUEUE { interface QUEUE {
String REPORT = "fanout.distribution.DeliveryAndCarStart.report" + ModuleNameConstant.DEVAUTH;
} }
} }
/** /**
* 签收 * 签收
*
* @see org.springblade.common.model.DistributionSignforVO
*/ */
interface DeliveryAndSignfor { interface DeliveryAndSignfor {
String EXCHANGE = "fanout.distribution.signfor2" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.signfor2" + ModuleNameConstant.DEVAUTH;
// main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"}
interface QUEUE { interface QUEUE {
} }
@ -247,14 +265,12 @@ public abstract class FanoutConstants {
String EXCHANGE = "fanout.distribution.recheck" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.recheck" + ModuleNameConstant.DEVAUTH;
// main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"}
interface QUEUE { interface QUEUE {
} }
} }
interface signfor { interface signfor {
String EXCHANGE = "fanout.distribution.signfor" + ModuleNameConstant.DEVAUTH; String EXCHANGE = "fanout.distribution.signfor" + ModuleNameConstant.DEVAUTH;

3
blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java

@ -1,6 +1,5 @@
package org.springblade.common.model; package org.springblade.common.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -11,13 +10,13 @@ import java.util.List;
*/ */
@Data @Data
public class DistributionTaskVO implements Serializable { public class DistributionTaskVO implements Serializable {
private String distributionCompany;
private Long id; private Long id;
private String kind; private String kind;
private String taskTime; private String taskTime;
private String trainNumber; private String trainNumber;
private String type; private String type;
private String distributionCompany;
/** /**
* 司机名 * 司机名
*/ */

5
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 = "装车配送单号 包含配送车次和自提车次 直发商家 对应干线车次 三方中转 三方中转车次号") @ApiModelProperty(value = "装车配送单号 包含配送车次和自提车次 直发商家 对应干线车次 三方中转 三方中转车次号")
private String loadTrainNumber; private String loadTrainNumber;
/**
* 装车车牌
*/
@ApiModelProperty(value = "装车车牌")
private String loadLicensePlate;
/** /**
* 装车数量 * 装车数量
*/ */

68
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.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; 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.dto.ReportQualityDeliverDTO;
import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.entity.QualityDeliverEntity;
import com.logpm.distribution.service.IQualityDeliverService; 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.DistributionLoadVO;
import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData; import org.springblade.common.model.PackageData;
import org.springblade.common.model.StockUpVO;
import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.Queue;
@ -66,62 +63,50 @@ public class LoadingReportListener {
Object main = bean.getMain(); Object main = bean.getMain();
JSONObject entries = JSONUtil.parseObj(main); JSONObject entries = JSONUtil.parseObj(main);
DistributionLoadVO vo = JSONUtil.toBean(entries, DistributionLoadVO.class); DistributionLoadVO vo = JSONUtil.toBean(entries, DistributionLoadVO.class);
if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { // if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) {
// 根据预约单号查询出所有这个预约单下的数据 先置空 // // 根据预约单号查询出所有这个预约单下的数据 先置空
LambdaUpdateWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaUpdate() // LambdaUpdateWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaUpdate()
.set(QualityDeliverEntity::getStockupCode, null) // .set(QualityDeliverEntity::getLoadUserName, null)
.set(QualityDeliverEntity::getStockupUserName, null) // .set(QualityDeliverEntity::getLoadTime, null)
.set(QualityDeliverEntity::getStockupFinishTime, null) // .set(QualityDeliverEntity::getLoadLicensePlate, null)
.set(QualityDeliverEntity::getStockNum, null) // .set(QualityDeliverEntity::getLoadNum, null)
.set(QualityDeliverEntity::getStockAllocation, null) // .ne(QualityDeliverEntity::getBizStatus, 110);
.set(QualityDeliverEntity::getStockupCreateTime, null) // qualityDeliverService.update(wrapper);
.ne(QualityDeliverEntity::getBizStatus, 110); // }
qualityDeliverService.update(wrapper);
}
if (CollUtil.isNotEmpty(details)) { if (CollUtil.isNotEmpty(details)) {
for (PackageData detail : details) { for (PackageData detail : details) {
QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder()
.warehouseName(bean.getWarehouse()) .warehouseName(bean.getWarehouse())
.warehouseId(warehouseId) .warehouseId(warehouseId)
.stockupUserName(bean.getOperator()) .orderPackageCode(detail.getPackageCode())
.stockupCreateTime(bean.getOperatorTime()) .loadUserName(bean.getOperator())
// 备货区 TODO .loadNum(detail.getNumber())
// .stockAllocation(vo.get) .loadTime(bean.getOperatorTime())
.loadLicensePlate(vo.getVehicleName())
.build(); .build();
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setConditions(1);
qualityDeliverEntity.setStockNum(1); qualityDeliverEntity.setLoadNum(1);
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { sendReport(bizOperation, 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.LTL)) { } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) {
qualityDeliverEntity.setOrderCode(detail.getOrderCode()); qualityDeliverEntity.setOrderCode(detail.getOrderCode());
qualityDeliverEntity.setCostCategory(detail.getProductName()); qualityDeliverEntity.setCostCategory(detail.getProductName());
qualityDeliverEntity.setRevenueCategory(detail.getProductName()); qualityDeliverEntity.setRevenueCategory(detail.getProductName());
qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setConditions(2);
qualityDeliverEntity.setStockNum(detail.getNumber()); sendReport(bizOperation, 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());
}
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { } else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) {
qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch());
qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMallName(detail.getMallName());
qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode());
qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setMaterielName(detail.getMaterialName());
qualityDeliverEntity.setConditions(3); qualityDeliverEntity.setConditions(3);
qualityDeliverEntity.setStockNum(detail.getNumber()); sendReport(bizOperation, qualityDeliverEntity);
}
}
}
}
private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity) {
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) {
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build();
factoryDataClient.sendMessage(SendMsg.builder() factoryDataClient.sendMessage(SendMsg.builder()
@ -132,8 +117,5 @@ public class LoadingReportListener {
.build()); .build());
} }
} }
}
}
}
} }

43
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.NodeFanoutMsg;
import org.springblade.common.model.PackageData; import org.springblade.common.model.PackageData;
import org.springblade.common.model.ReservationVO; import org.springblade.common.model.ReservationVO;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.amqp.core.ExchangeTypes; import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange; import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.Queue;
@ -87,41 +88,40 @@ public class ReservationPlanReportListener {
.planReservationCode(vo.getReservationCode()) .planReservationCode(vo.getReservationCode())
.planReservationTime(vo.getReservationDate()) .planReservationTime(vo.getReservationDate())
.planReservationUser(bean.getOperator()) .planReservationUser(bean.getOperator())
.planNum(detail.getNumber())
.build(); .build();
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setConditions(1);
qualityDeliverEntity.setPlanNum(1); qualityDeliverEntity.setPlanNum(1);
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { sendReport(bizOperation, 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.LTL)) { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) {
qualityDeliverEntity.setOrderCode(detail.getOrderCode()); qualityDeliverEntity.setOrderCode(detail.getOrderCode());
qualityDeliverEntity.setCostCategory(detail.getProductName()); qualityDeliverEntity.setCostCategory(detail.getProductName());
qualityDeliverEntity.setRevenueCategory(detail.getProductName()); qualityDeliverEntity.setRevenueCategory(detail.getProductName());
qualityDeliverEntity.setConditions(2); qualityDeliverEntity.setConditions(2);
qualityDeliverEntity.setPlanNum(detail.getNumber()); sendReport(bizOperation, 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());
} }
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) {
qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch());
qualityDeliverEntity.setMallName(detail.getMallName()); qualityDeliverEntity.setMallName(detail.getMallName());
qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); qualityDeliverEntity.setMaterielCode(detail.getMaterialCode());
qualityDeliverEntity.setMaterielName(detail.getMaterialName()); qualityDeliverEntity.setMaterielName(detail.getMaterialName());
qualityDeliverEntity.setConditions(3); qualityDeliverEntity.setConditions(3);
qualityDeliverEntity.setPlanNum(detail.getNumber()); 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)) { if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) {
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build();
factoryDataClient.sendMessage(SendMsg.builder() factoryDataClient.sendMessage(SendMsg.builder()
@ -132,8 +132,5 @@ public class ReservationPlanReportListener {
.build()); .build());
} }
} }
}
}
}
} }

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java

@ -88,8 +88,7 @@ public class StockReportListener {
.stockupUserName(bean.getOperator()) .stockupUserName(bean.getOperator())
.stockupFinishTime(vo.getStockupDate()) .stockupFinishTime(vo.getStockupDate())
.stockupCreateTime(bean.getOperatorTime()) .stockupCreateTime(bean.getOperatorTime())
// 备货区 TODO .stockAllocation(vo.getStockupArea())
// .stockAllocation(vo.get)
.build(); .build();
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
qualityDeliverEntity.setConditions(1); qualityDeliverEntity.setConditions(1);

Loading…
Cancel
Save