|
@@ -75,7 +75,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
}
|
|
|
|
|
|
BigDecimal hasRouteBalance = BigDecimal.ZERO;
|
|
|
- BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
|
|
|
AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
|
|
|
|
|
|
List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIds, accountType);
|
|
@@ -91,7 +91,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
}
|
|
|
goodsPrice = nowGoods.getDiscountPrice();
|
|
|
|
|
|
- BigDecimal goodsBalance = goodsTotalBalance.multiply(goodsPrice).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal goodsBalance = goodsTotalBalance.multiply(goodsPrice).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
if (i == goodsNum) {
|
|
|
goodsBalance = goodsTotalBalance.subtract(hasRouteBalance);
|
|
|
}
|
|
@@ -120,8 +120,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
BigDecimal sellOrderActualAmount = BigDecimal.ZERO;
|
|
|
BigDecimal sellOrderBalance = BigDecimal.ZERO;
|
|
|
if (complementPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsPrice).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- sellOrderBalance = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsBalance).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sellOrderActualAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsPrice).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
+ sellOrderBalance = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(goodsBalance).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
}
|
|
|
|
|
|
complementGoodsNum = complementGoodsNum - sellOrder.getNum();
|
|
@@ -175,7 +175,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
BigDecimal detailTotalPrice = orderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
//商品销售占的余额
|
|
|
BigDecimal detailTotalBalance = detailTotalPrice.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :
|
|
|
- detailTotalPrice.multiply(totalBalance).divide(totalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ detailTotalPrice.multiply(totalBalance).divide(totalPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
int i = 1;
|
|
|
BigDecimal detailRouteBalance = BigDecimal.ZERO;
|
|
@@ -184,7 +184,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
|
|
|
for (StudentPaymentOrderDetail orderDetail : orderDetails) {
|
|
|
BigDecimal detailBalance = orderDetail.getPrice().compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :
|
|
|
- orderDetail.getPrice().multiply(detailTotalBalance).divide(detailTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ orderDetail.getPrice().multiply(detailTotalBalance).divide(detailTotalPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
if (i == orderDetails.size()) {
|
|
|
detailBalance = detailTotalBalance.subtract(detailRouteBalance);
|
|
|
}
|
|
@@ -202,8 +202,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
BigDecimal expectAmount = BigDecimal.ZERO;
|
|
|
BigDecimal balance = BigDecimal.ZERO;
|
|
|
if (goodsTotalPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- expectAmount = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice()).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- balance = goods.getGroupPurchasePrice().multiply(detailBalance).divide(goodsTotalPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ expectAmount = goods.getGroupPurchasePrice().multiply(orderDetail.getPrice()).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
+ balance = goods.getGroupPurchasePrice().multiply(detailBalance).divide(goodsTotalPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
}
|
|
|
if (j == orderDetail.getGoodsList().size()) {
|
|
|
expectAmount = orderDetail.getPrice().subtract(routePrice);
|
|
@@ -235,8 +235,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
|
|
|
BigDecimal sellOrderExpectAmount = BigDecimal.ZERO;
|
|
|
BigDecimal sellOrderBalance = BigDecimal.ZERO;
|
|
|
if (complementPrice.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- sellOrderExpectAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(expectAmount).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- sellOrderBalance = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(balance).divide(complementPrice, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ sellOrderExpectAmount = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(expectAmount).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
+ sellOrderBalance = complementGoodsPrice.get(sellOrder.getGoodsId()).multiply(new BigDecimal(sellOrder.getNum())).multiply(balance).divide(complementPrice, 2, BigDecimal.ROUND_DOWN);
|
|
|
}
|
|
|
complementGoodsNum = complementGoodsNum - sellOrder.getNum();
|
|
|
if (complementGoodsNum <= 0) {
|