|
|
@@ -240,7 +240,12 @@ public class GoodsWholesalePayServiceImpl implements GoodsWholesalePayService {
|
|
|
if (payNum >= endConfig.getStart()) {
|
|
|
BigDecimal returnBalance = BigDecimal.ZERO;
|
|
|
for (GoodsWholesale.GoodsWholesaleConfig config : configs) {
|
|
|
- Integer thisPayNum = config.getEnd() - config.getStart() + 1;
|
|
|
+ Integer thisPayNum;
|
|
|
+ if (config.getStart().intValue() == firstConfig.getStart().intValue()) {
|
|
|
+ thisPayNum = config.getEnd();
|
|
|
+ } else {
|
|
|
+ thisPayNum = config.getEnd() - config.getStart() + 1;
|
|
|
+ }
|
|
|
BigDecimal differPrice = config.getSingle().subtract(endConfig.getSingle());
|
|
|
returnBalance = returnBalance.add(BigDecimal.valueOf(thisPayNum).multiply(differPrice));
|
|
|
}
|
|
|
@@ -439,6 +444,9 @@ public class GoodsWholesalePayServiceImpl implements GoodsWholesalePayService {
|
|
|
orderDon.setMoney(BigDecimal.valueOf(thisPayNum).multiply(endConfig.getSingle()));
|
|
|
return;
|
|
|
}
|
|
|
+ if (endConfig.getEnd().intValue() != 999 && endPayNum > endConfig.getEnd()) {
|
|
|
+ throw BusinessRuntimeException.getInstance("您已超过购买该规格批发数量");
|
|
|
+ }
|
|
|
Optional<GoodsWholesale.GoodsWholesaleConfig> first = configs.stream().filter(config -> config.getStart() <= endPayNum && config.getEnd() >= endPayNum).collect(Collectors.toList()).stream().findFirst();
|
|
|
GoodsWholesale.GoodsWholesaleConfig finalLevel = first.get();
|
|
|
|