耗材流水中添加订单信息

This commit is contained in:
牛叉闪闪
2024-07-17 11:19:45 +08:00
parent 35057b4ee7
commit 56d66097c7
3 changed files with 43 additions and 4 deletions

View File

@@ -25,6 +25,12 @@ public class TbConsInfoFlow implements Serializable {
private String bizType;
private Integer orderId;
private String orderNo;
private Date createTime;
private Date updateTime;
@@ -126,4 +132,20 @@ public class TbConsInfoFlow implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
}

View File

@@ -35,6 +35,9 @@ public class ConsService {
@Autowired
TbOrderDetailMapper tbOrderDetailMapper;
@Autowired
TbOrderInfoMapper tbOrderInfoMapper;
@Transactional(rollbackFor = Exception.class)
public void exect(String message) throws Exception {
log.info("耗材信息更新开始:{}",message);
@@ -47,7 +50,11 @@ public class ConsService {
Thread.sleep(1000L);
TbOrderInfo tbOrderInfo=tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
if(Objects.isNull(tbOrderInfo)){
log.info("订单信息不存在");
return;
}
List<TbOrderDetail> orderDetails= tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
if(Objects.isNull(orderDetails)||orderDetails.size()<=0){
@@ -102,10 +109,18 @@ public class ConsService {
// ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),amount);
// consInfoPOS.add(consInfoPO);
flow.setOrderId(tbOrderInfo.getId());
flow.setOrderNo(tbOrderInfo.getOrderNo());
flow.setCreateTime(new Date());
// flow.setUpdateTime(new Date());
// consInfoFlows.add(flow);
if(amount.equals(BigDecimal.ZERO)){
log.info("变动金额为 0:{}",amount);
continue;
}
tbConsInfoMapper.updateByPrimaryKey(tbConsInfo);
tbConsInfoFlowMapper.insert(flow);