|
|
@@ -3967,7 +3967,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
}, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
order.setSalesAmount(totalMoney);
|
|
|
order.setTotalMoney(totalMoney);
|
|
|
- if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {//只有一条轮胎加5元运费
|
|
|
+ BigDecimal one = new BigDecimal(CommonEnum.ONE.info);
|
|
|
+ String freight = sysClient.getParamService("freight");
|
|
|
+ BigDecimal freightAmount = ObjectUtils.isNotNull(freight) ? new BigDecimal(freight) : BigDecimal.ZERO;
|
|
|
+ BigDecimal goodsTotalNum = order.getGoodsTotalNum();
|
|
|
+ if (StringUtils.isNotBlank(order.getSrcOrdNo()) && !Objects.equals(order.getSrcOrdNo(), order.getOrdNo())) {
|
|
|
+ // srcorderno != orderno 时代表是小程序单, 小程单则加上拆分出去订单的数量
|
|
|
+ BigDecimal orderItemSum = orderMapper.selectGoodsNumBySrcOrderNo(order.getSrcOrdNo(), order.getId());
|
|
|
+ goodsTotalNum = goodsTotalNum.add(orderItemSum);
|
|
|
+ }
|
|
|
+ order.setTotalMoney(goodsTotalNum.compareTo(one) == 0 ? totalMoney.add(freightAmount): totalMoney);
|
|
|
+ order.setFreight(goodsTotalNum.compareTo(one) == 0 ? freightAmount : BigDecimal.ZERO);
|
|
|
+/* if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {//只有一条轮胎加5元运费
|
|
|
String freight = sysClient.getParamService("freight");
|
|
|
if (ObjectUtils.isNotNull(freight)) {
|
|
|
try {
|
|
|
@@ -3980,7 +3991,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
|
|
|
}
|
|
|
} else {
|
|
|
order.setFreight(new BigDecimal(0));
|
|
|
- }
|
|
|
+ }*/
|
|
|
//毛利
|
|
|
order.setGrossProfit(order.getOrderItemsList().stream().map(PjOrderItems::getGrossProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
//成本
|