Browse Source

fix:增加编辑预约单节点

dist.1.3.0
pref_mail@163.com 7 months ago
parent
commit
20e4ba843d
  1. 1
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  2. 15
      blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java
  3. 81
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/log/ReservationLogListener.java
  4. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java
  5. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  6. 1126
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

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

@ -168,6 +168,7 @@ public abstract class FanoutConstants {
String EXCHANGE = "fanout.reservation.own" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
String OWNRESERVATION_LOG = "fanout.reservation.own.log" + ModuleNameConstant.DEVAUTH;
}
}

15
blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java

@ -24,6 +24,11 @@ public class ReservationVO {
*/
private Date reservationDate;
/**
* 收货单位
*/
private String receivingUnit;
/**
* 收货人
*/
@ -54,6 +59,16 @@ public class ReservationVO {
*/
private String warehouseName;
/**
* 预约库存品数量
*/
private Integer reservationStockListNum;
/**
* 预约定制品数量+预约零担数量
*/
private Integer reservationNum;
/**
* 配送类型1-商配2-市配

81
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/log/ReservationLogListener.java

@ -0,0 +1,81 @@
package com.logpm.distribution.receiver.log;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.logpm.distribution.entity.DistributionPlanLogEntity;
import com.logpm.distribution.service.IDistributionPlanLogService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DistributionTypeConstant;
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.common.model.ReservationVO;
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 java.util.List;
@Slf4j
@Component
@AllArgsConstructor
public class ReservationLogListener {
private final IDistributionPlanLogService distributionPlanLogService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.reservation.OwnReservation.QUEUE.OWNRESERVATION_LOG, durable = "true"),
exchange = @Exchange(name = FanoutConstants.reservation.OwnReservation.EXCHANGE, type = ExchangeTypes.FANOUT)
))
public void reservationLog(String msg) {
log.info("预约日志: {}", msg);
if (StrUtil.isEmpty(msg)) {
return;
}
NodeFanoutMsg<ReservationVO> bean = JSONUtil.toBean(msg, NodeFanoutMsg.class);
if (bean == null) {
return;
}
BizOperationEnums bizOperation = bean.getBizOperation();
if(bizOperation.equals(BizOperationEnums.ADD)){
// addLog(bean);
}else if (bizOperation.equals(BizOperationEnums.MODIFY)){
log.warn("修改预约信息未记录日志");
}
}
private void addLog(NodeFanoutMsg<ReservationVO> bean) {
ReservationVO main = bean.getMain();
if (main == null) {
return;
}
String planContent = bean.getOperator() + "在" + bean.getWarehouse()
+ "创建预约计划;预约计划编号:" + main.getReservationCode()
+ ";收货单位:" + main.getReceivingUnit()
+ ",收货人:" + main.getConsignee()
+ ",联系电话:" + main.getDeliveryPhone()
+ ",收货地址:" + main.getDeliveryAddress()
+ ",计划件数:" + (main.getReservationNum() + main.getReservationStockListNum())
+ ",配送类型:" + (main.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()) ? "商配" : "市配");
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity();
distributionPlanLogEntity.setContent(planContent);
distributionPlanLogEntity.setRefId(main.getId());
distributionPlanLogEntity.setRefCode(main.getReservationCode());
distributionPlanLogEntity.setWarehouseId(bean.getWarehouseId());
distributionPlanLogEntity.setWarehouseName(bean.getWarehouse());
distributionPlanLogEntity.setOperator(bean.getOperator());
distributionPlanLogEntity.setType(1);
distributionPlanLogService.save(distributionPlanLogEntity);
}
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java

@ -24,6 +24,7 @@ import com.logpm.distribution.dto.DistributionReservationDTO;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.excel.DistributionReservationExcel;
import com.logpm.distribution.vo.*;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.ReservationVO;
import org.springblade.core.mp.base.BaseService;
@ -207,7 +208,8 @@ public interface IDistributionReservationService extends BaseService<Distributio
*/
R insertAutonomouslyReservation(DistributionReservationDTO distributionReservationDTO);
NodeFanoutMsg<ReservationVO> buildNodeFanoutMsgByReservation(DistributionReservationEntity reservationEntity, Map<String, List> map);
NodeFanoutMsg<ReservationVO> buildNodeFanoutMsgByReservation(DistributionReservationEntity reservationEntity, Map<String, List> map, BizOperationEnums bizOperation);
/**
* 自提查询库存数量

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -2956,7 +2956,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationMapper.updateById(reservationEntity);
//推送广播
//进行节点推送
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = distributionReservationService.buildNodeFanoutMsgByReservation(reservationEntity,map);
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = distributionReservationService.buildNodeFanoutMsgByReservation(reservationEntity,map,BizOperationEnums.ADD);
distributionNodeWorkService.planReservation(nodeFanoutMsg, user);
deliveryWarehouseName.add(reservationEntity.getWarehouseName());
deliveryPackageTotal.getAndAdd(reservationEntity.getReservationNum());

1126
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save