|
|
@@ -167,7 +167,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
},BigDecimal::add);//采购金额求和
|
|
|
BigDecimal amount = list.stream().map(OrderItems::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);//金额求和
|
|
|
BigDecimal grossProfit = amount.subtract(reduce);//毛利润
|
|
|
- BigDecimal grossProfitRate = (grossProfit.divide(amount,2)).multiply(new BigDecimal(100));
|
|
|
+ BigDecimal grossProfitRate = new BigDecimal(BigInteger.ZERO);
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ grossProfit = (grossProfit.divide(amount,2)).multiply(new BigDecimal(100));
|
|
|
+ }
|
|
|
orderMessage.setGrossProfit(grossProfit);//毛利额
|
|
|
orderMessage.setGrossProfitRate(grossProfitRate);//毛利率
|
|
|
}else {
|
|
|
@@ -337,10 +340,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
throw new RuntimeException("生成订单编号失败");
|
|
|
}
|
|
|
- selectById.setOrderNo((String) clientBillNo.getData());
|
|
|
- if (!order.getBillType().equals(OrderTypeEnum.IMPORT.getType())){ //进口的orgOrderNo 存的是采购订单号 出口国内存的是本身的订单号码
|
|
|
- selectById.setOrgOrderNo((String) clientBillNo.getData());
|
|
|
+ if (!order.getBillType().equals(OrderTypeEnum.IMPORT.getType())){ //进口的orgOrderNo 存的是采购订单号 出口国内存的是来源的订单号码
|
|
|
+ selectById.setOrgOrderNo((selectById.getOrderNo()));
|
|
|
}
|
|
|
+ selectById.setOrderNo((String) clientBillNo.getData());
|
|
|
}
|
|
|
selectById.setSrcId(order.getId());
|
|
|
selectById.setCorpId(item.getCorpId());
|