Commit 9701c5f6 authored by huyf's avatar huyf

提货箱数、提货率、提货状态回填

parent c6246785
......@@ -124,7 +124,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
orderPickup.setOrderStatus(orderDO.getStatus());
}
orderPickupMapper.insert(orderPickup);
orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
// orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
//升级客户vip等级
updateCustomerLevelUp(orderDO);
......@@ -190,7 +190,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
}
}
}
dealDeliveryRate(createReqVO.getOrderId(),0,orderDO.getSumNum(),PickStateEnum.picked.getPickState());
dealDeliveryRate(createReqVO.getOrderId(),orderDO.getSumNum(),PickStateEnum.picked.getPickState());
// 返回
return orderPickup.getId();
}
......@@ -207,14 +207,13 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
return orderDO.getSumNum() - allPickNum;
}
private void dealDeliveryRate(String orderNo,Integer pickNum,Integer sumNum,Integer pickState) {
private void dealDeliveryRate(String orderNo,Integer sumNum,Integer pickState) {
List<OrderPickupDO> orderPickupDOS = orderPickupMapper.selectList(OrderPickupDO::getOrderId, orderNo);
int pickedSum = orderPickupDOS.stream().mapToInt(OrderPickupDO::getPickNum).sum();
int allPickNum = pickedSum + pickNum;
BigDecimal pickRatio = new BigDecimal((double) (allPickNum / sumNum) * 100 );
BigDecimal pickRatio = new BigDecimal((double) pickedSum / sumNum * 100 );
pickRatio.setScale(2, RoundingMode.HALF_UP);
orderService.update(new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getPickNum, allPickNum)
.set(OrderDO::getPickNum, pickedSum)
.set(OrderDO::getPickRatio, pickRatio)
.set(OrderDO::getPickState,pickState)
.eq(OrderDO::getOrderNo,orderNo)
......@@ -334,14 +333,14 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
// 获取未撤销的提货记录
List<OrderPickupDO> pickupDOList = orderPickupMapper.selectList(new LambdaQueryWrapper<OrderPickupDO>().eq(OrderPickupDO::getOrderId, orderPickupDO.getOrderId()).orderByDesc(OrderPickupDO::getPickTime));
if (CollectionUtil.isNotEmpty(pickupDOList) && pickupDOList.size() > 0) {
orderService.updateStatus(one.getOrderId(), null, OrderStatusEnum.PART_PICKED_UP.getValue(), null, null, null, null, null);
dealDeliveryRate(one.getOrderNo(),-orderPickupDO.getPickNum(),one.getSumNum(),PickStateEnum.partPick.getPickState());
// orderService.updateStatus(one.getOrderId(), null, OrderStatusEnum.PART_PICKED_UP.getValue(), null, null, null, null, null);
dealDeliveryRate(one.getOrderNo(),one.getSumNum(),PickStateEnum.partPick.getPickState());
} else {
// 找到已删除 订单状态大于0的数据来恢复订单状态
OrderPickupDO delOrderPickupDO = orderPickupMapper.selectDeletedPickup(orderPickupDO.getOrderId());
// 这里需要考虑到老数据的空指针异常
orderService.updateStatus(one.getOrderId(), null, Objects.nonNull(delOrderPickupDO) ? delOrderPickupDO.getOrderStatus() : 16, null, null, null, null, null);
dealDeliveryRate(one.getOrderNo(),-orderPickupDO.getPickNum(),one.getSumNum(),PickStateEnum.picked.getPickState());
// orderService.updateStatus(one.getOrderId(), null, Objects.nonNull(delOrderPickupDO) ? delOrderPickupDO.getOrderStatus() : 16, null, null, null, null, null);
dealDeliveryRate(one.getOrderNo(),one.getSumNum(),PickStateEnum.picked.getPickState());
}
if (Objects.equals(one.getTransportId(), TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue())) {
......@@ -492,7 +491,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
orderPickup.setOrderStatus(orderDO.getStatus());
}
orderPickupMapper.insert(orderPickup);
orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
// orderService.updateStatus(null, orderDO.getOrderNo(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
//升级客户vip等级
updateCustomerLevelUp(orderDO);
......@@ -535,7 +534,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
}
}
}
dealDeliveryRate(createReqVO.getOrderId(),0,orderDO.getSumNum(),PickStateEnum.picked.getPickState());
dealDeliveryRate(createReqVO.getOrderId(),orderDO.getSumNum(),PickStateEnum.picked.getPickState());
}
}
}
......@@ -650,7 +649,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
orderPickup.setOrderStatus(orderDO.getStatus());
}
orderPickupMapper.insert(orderPickup);
orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PART_PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
// orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PART_PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
//发送站内信
sendMsg(orderDO.getOrderNo(), orderDO.getMarks(), String.valueOf(orderPickup.getPickNum()), DateUtils.formatDate(orderPickup.getPickTime()), Long.valueOf(orderPickup.getCreator()));
......@@ -658,7 +657,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
OrderDO orderDO1 = new OrderDO();
BeanUtils.copyProperties(orderDO, orderDO1);
insertCustomLevelAndCreditLevelLog(orderPickup, orderDO1, false);
dealDeliveryRate(createReqVO.getOrderId(),0,orderDO.getSumNum(),PickStateEnum.partPick.getPickState());
dealDeliveryRate(createReqVO.getOrderId(),orderDO.getSumNum(),PickStateEnum.partPick.getPickState());
} else if (num < 0) {
//如果分批提的数量加上已分批提的数量超过了总量 则重新计算成剩余的量
throw exception(PICK_UP_TOO_MORE);
......@@ -673,7 +672,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
orderPickup.setOrderStatus(orderDO.getStatus());
}
orderPickupMapper.insert(orderPickup);
orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
// orderService.updateStatus(null, createReqVO.getOrderId(), OrderStatusEnum.PICKED_UP.getValue(), null, null, null, null, null, createReqVO.getPickTime(), false);
//发送站内信
sendMsg(orderDO.getOrderNo(), orderDO.getMarks(), String.valueOf(orderPickup.getPickNum()), DateUtils.formatDate(orderPickup.getPickTime()), Long.valueOf(orderPickup.getCreator()));
......@@ -683,7 +682,7 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
BeanUtils.copyProperties(orderDO, orderDO1);
insertCustomLevelAndCreditLevelLog(orderPickup, orderDO1, true);
updateCustomerLevelUp(orderDO1);
dealDeliveryRate(createReqVO.getOrderId(),0,orderDO.getSumNum(),PickStateEnum.picked.getPickState());
dealDeliveryRate(createReqVO.getOrderId(),orderDO.getSumNum(),PickStateEnum.picked.getPickState());
}
orderBusinessService.addOrderOperateLog(orderDO.getOrderId(), "", "分批提货", "");
if (Objects.equals(orderDO.getTransportId(), TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment