提交 b507900c authored 作者: liuhaiquan's avatar liuhaiquan

修改恢复订单吨数逻辑

上级 3dc6abe7
...@@ -241,6 +241,13 @@ public class OrderCancelComponent implements InitializingBean { ...@@ -241,6 +241,13 @@ public class OrderCancelComponent implements InitializingBean {
* @return * @return
**/ **/
public void backFillOrderWeight(OrderGoods orderGoods, BigDecimal weight, Integer updateType) { public void backFillOrderWeight(OrderGoods orderGoods, BigDecimal weight, Integer updateType) {
Integer truckDemand = orderGoods.getTruckDemand();
java.util.Optional<UpdateEnum> byCode1 = UpdateEnum.getByCode(updateType);
String updateTypeMsg = byCode1.isPresent()?byCode1.get().getMsg():"未知调整类型";
java.util.Optional<TruckDemandEnum.TruckType> byCode = TruckDemandEnum.TruckType.getByCode(truckDemand);
String truckDemandValue = byCode.isPresent()?byCode.get().getMsg():"未知用车需求";
log.info("订单号:{},货单号:{},用车需求:{},进行订单剩余吨数{} ,调整吨数:{}",
orderGoods.getOrderNo(),orderGoods.getOrderGoodsNo(),truckDemandValue,updateTypeMsg,weight);
String orderNo = orderGoods.getOrderNo(); String orderNo = orderGoods.getOrderNo();
Optional<FeignOrderInfoVO> optional = orderService.getOrderInfo(orderNo); Optional<FeignOrderInfoVO> optional = orderService.getOrderInfo(orderNo);
if(!optional.isPresent()){ if(!optional.isPresent()){
...@@ -249,14 +256,12 @@ public class OrderCancelComponent implements InitializingBean { ...@@ -249,14 +256,12 @@ public class OrderCancelComponent implements InitializingBean {
} }
FeignOrderInfoVO orderInfo = optional.get(); FeignOrderInfoVO orderInfo = optional.get();
boolean isSub = Objects.equals(UpdateEnum.SUB.getCode(), updateType); boolean isSub = Objects.equals(UpdateEnum.SUB.getCode(), updateType);
Integer truckDemand = orderGoods.getTruckDemand();
RollbackOrderWeightParam rollbackOrderWeightParam = new RollbackOrderWeightParam(); RollbackOrderWeightParam rollbackOrderWeightParam = new RollbackOrderWeightParam();
rollbackOrderWeightParam.setOrderNo(orderGoods.getOrderNo()); rollbackOrderWeightParam.setOrderNo(orderGoods.getOrderNo());
rollbackOrderWeightParam.setResidueWeight(weight); rollbackOrderWeightParam.setResidueWeight(weight);
java.util.Optional<TruckDemandEnum.TruckType> byCode = TruckDemandEnum.TruckType.getByCode(truckDemand); rollbackOrderWeightParam.setUpdateType(updateType);
String truckDemandValue = byCode.isPresent()?byCode.get().getMsg():"未知用车需求";
java.util.Optional<UpdateEnum> byCode1 = UpdateEnum.getByCode(updateType);
String updateTypeMsg = byCode1.isPresent()?byCode1.get().getMsg():"未知调整类型";
//归还吨数 //归还吨数
if (!truckDemand.equals(TruckDemandEnum.TruckType.PLATFORM_ANY_CAR.getCode())) { if (!truckDemand.equals(TruckDemandEnum.TruckType.PLATFORM_ANY_CAR.getCode())) {
if (truckDemand.equals(TruckDemandEnum.TruckType.PLATFORM_CAR.getCode())) { if (truckDemand.equals(TruckDemandEnum.TruckType.PLATFORM_CAR.getCode())) {
...@@ -266,8 +271,6 @@ public class OrderCancelComponent implements InitializingBean { ...@@ -266,8 +271,6 @@ public class OrderCancelComponent implements InitializingBean {
,weight); ,weight);
throw new ServiceSystemException(PerformanceResultEnum.ORDER_WEIGHT_LACK); throw new ServiceSystemException(PerformanceResultEnum.ORDER_WEIGHT_LACK);
} }
rollbackOrderWeightParam.setOwnResidueCarryWeight(BigDecimal.ZERO);
rollbackOrderWeightParam.setPlatformResidueCarryWeight(BigDecimal.ZERO);
} else if (truckDemand.equals(TruckDemandEnum.TruckType.OWNER_CAR.getCode())) { } else if (truckDemand.equals(TruckDemandEnum.TruckType.OWNER_CAR.getCode())) {
if(isSub && weight.compareTo(orderInfo.getResidueWeight()) > 0 ){ if(isSub && weight.compareTo(orderInfo.getResidueWeight()) > 0 ){
log.warn("货单用车需求: {},订单号:{},货单号:{},自有剩余吨数:{},需要扣减吨数:{},不足扣减", log.warn("货单用车需求: {},订单号:{},货单号:{},自有剩余吨数:{},需要扣减吨数:{},不足扣减",
...@@ -275,9 +278,9 @@ public class OrderCancelComponent implements InitializingBean { ...@@ -275,9 +278,9 @@ public class OrderCancelComponent implements InitializingBean {
,weight); ,weight);
throw new ServiceSystemException(PerformanceResultEnum.ORDER_WEIGHT_LACK); throw new ServiceSystemException(PerformanceResultEnum.ORDER_WEIGHT_LACK);
} }
rollbackOrderWeightParam.setOwnResidueCarryWeight(BigDecimal.ZERO);
rollbackOrderWeightParam.setPlatformResidueCarryWeight(BigDecimal.ZERO);
} }
rollbackOrderWeightParam.setOwnResidueCarryWeight(BigDecimal.ZERO);
rollbackOrderWeightParam.setPlatformResidueCarryWeight(BigDecimal.ZERO);
} else { } else {
if (orderGoods.getVehicleUsage().equals(VehicleUsageEnum.Status.OWN.getCode())) { if (orderGoods.getVehicleUsage().equals(VehicleUsageEnum.Status.OWN.getCode())) {
if(isSub && weight.compareTo(orderInfo.getOwnResidueCarryWeight()) > 0 ){ if(isSub && weight.compareTo(orderInfo.getOwnResidueCarryWeight()) > 0 ){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论