提交 07d4dd9e authored 作者: huyufan's avatar huyufan

修改bug

上级 eb366661
......@@ -32,6 +32,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 全部平台
*/
@Component("OneGoodsOrderStrategy")
@Slf4j
public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBean {
......@@ -66,7 +69,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
List<OrderGoodsChildParams> childParamsList = orderGoodsParams.getOrderGoodsChildParams();
BigDecimal childSum = childParamsList.stream().map(OrderGoodsChildParams::getExtractWeight).reduce(
BigDecimal.ZERO, BigDecimal::add);
if (orderInfo.getResidueWeight().compareTo(childSum) < 0) {
BigDecimal residueWeight = new BigDecimal(orderInfo.getResidueWeight());
if (residueWeight.compareTo(childSum) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货单总吨数已超订单总吨数");
}
long beginOrderGoodsId = orderGoodsIdGenerate.getOrderGoodsId(OrderGoodsTypeEnum.Status.PLATFORM.getCode(), childParamsList.size());
......@@ -140,9 +144,8 @@ public class OneGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
beginOrderGoodsId = beginOrderGoodsId + 1;
orderGoodsMapper.insert(orderGoods);
}
BigDecimal subtract = orderInfo.getResidueWeight().subtract(childSum);
log.info("更新剩余订单量{}", subtract);
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), subtract);
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), 1, null, residueWeight.subtract(childSum));
sendMq(mqMap, now);
return sendLazyTime;
......
......@@ -35,6 +35,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 自由车辆
*/
@Component("ThreeGoodsOrderStrategy")
@Slf4j
public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBean {
......@@ -70,7 +73,8 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
List<OrderGoodsChildParams> childParamsList = orderGoodsParams.getOrderGoodsChildParams();
BigDecimal childSum = childParamsList.stream().map(OrderGoodsChildParams::getExtractWeight).reduce(
BigDecimal.ZERO, BigDecimal::add);
if (orderInfo.getResidueWeight().compareTo(childSum) < 0) {
BigDecimal residueWeight = new BigDecimal(orderInfo.getResidueWeight());
if (residueWeight.compareTo(childSum) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货单总吨数已超订单总吨数");
}
if (childParamsList.size() > 1) {
......@@ -144,14 +148,14 @@ public class ThreeGoodsOrderStrategy implements GoodsOrderStrategy, Initializing
orderGoodsMapper.insert(orderGoods);
}
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(),orderInfo.getResidueWeight().subtract(childSum));
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), 1, null, residueWeight.subtract(childSum));
sendMq(mqMap, now);
return sendLazyTime;
}
@Override
public void afterPropertiesSet() throws Exception {
goodsOrderStrategyContext.strategyContext.put(TruckDemandEnum.TruckType.OWNER_CAR.getCode(),this);
goodsOrderStrategyContext.strategyContext.put(TruckDemandEnum.TruckType.OWNER_CAR.getCode(), this);
}
public void sendMq(Map<String, LocalDateTime> mqMap, LocalDateTime now) {
......
......@@ -35,6 +35,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 部分平台
*/
@Component("TwoGoodsOrderStrategy")
@Slf4j
public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBean {
......@@ -71,7 +74,8 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
List<OrderGoodsChildParams> childParamsList = orderGoodsParams.getOrderGoodsChildParams();
BigDecimal childSum = childParamsList.stream().map(OrderGoodsChildParams::getExtractWeight).reduce(
BigDecimal.ZERO, BigDecimal::add);
if (orderInfo.getResidueWeight().compareTo(childSum) < 0) {
BigDecimal residueWeight = new BigDecimal(orderInfo.getResidueWeight());
if (residueWeight.compareTo(childSum) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货单总吨数已超订单总吨数");
}
Map<String, LocalDateTime> mqMap = new HashMap<>();
......@@ -148,7 +152,13 @@ public class TwoGoodsOrderStrategy implements GoodsOrderStrategy, InitializingBe
orderGoodsMapper.insert(orderGoods);
}
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), orderInfo.getResidueWeight().subtract(childSum));
if (childParamsList.size() > 1) {
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), 2, new BigDecimal(orderInfo.getPlatformResidueCarryWeight()).subtract(childSum), residueWeight.subtract(childSum));
} else {
orderFeign.updateOrderInfoResidueWeight(orderInfo.getId(), 3, new BigDecimal(orderInfo.getOwnResidueCarryWeight()).subtract(childSum), residueWeight.subtract(childSum));
}
sendMq(mqMap, now);
return sendLazyTime;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论