Browse Source

feat(all): 增加节点报表

dist.1.3.0
zhaoqiaobo 4 months ago
parent
commit
3289d0d3da
  1. 44
      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

44
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;
}
}
/**
* 发车
*
* @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;

3
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;
/**
* 司机名
*/

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 = "装车配送单号 包含配送车次和自提车次 直发商家 对应干线车次 三方中转 三方中转车次号")
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.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,62 +63,50 @@ 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<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>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<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>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());
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()
@ -132,8 +117,5 @@ public class LoadingReportListener {
.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.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,41 +88,40 @@ 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());
sendReport(bizOperation, qualityDeliverEntity);
}
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) {
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());
sendReport(bizOperation, qualityDeliverEntity);
}
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) {
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());
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()
@ -132,8 +132,5 @@ public class ReservationPlanReportListener {
.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())
.stockupFinishTime(vo.getStockupDate())
.stockupCreateTime(bean.getOperatorTime())
// 备货区 TODO
// .stockAllocation(vo.get)
.stockAllocation(vo.getStockupArea())
.build();
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
qualityDeliverEntity.setConditions(1);

Loading…
Cancel
Save