|
@@ -464,6 +464,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
AtomicReference<BigDecimal> totalBrokerage = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
shopOrderList.forEach(shopOrder-> totalBrokerage.set(MathUtil.add(totalBrokerage, shopOrder.getBrokerage())));
|
|
|
shopOrderList.sort((o1, o2) -> o2.getBrokerage().compareTo(o1.getBrokerage()));
|
|
|
+ log.info(">>>>>>>>>>>>>>>分摊前总佣金:" + totalBrokerage);
|
|
|
// 前面子订单的分摊优惠总和
|
|
|
AtomicDouble allReduction = new AtomicDouble(0);
|
|
|
if (MathUtil.compare(allDiscount, BigDecimal.ZERO) > 0) {
|
|
@@ -476,17 +477,18 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
//子订单真实支付金额
|
|
|
double realPay = MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue();
|
|
|
shopOrderList.get(i).setRealPay(realPay);
|
|
|
- allReduction.set(MathUtil.add(v, allReduction.get()).doubleValue());
|
|
|
+ allReduction.set(MathUtil.add(discount, allReduction.get()).doubleValue());
|
|
|
}
|
|
|
if (i == shopOrderList.size() - 1) {
|
|
|
//最后一个子订单的分摊优惠金额=全优惠allDiscount-已分摊
|
|
|
double discount = MathUtil.sub(allDiscount, allReduction.get()).doubleValue();
|
|
|
shopOrderList.get(i).setEachDiscount(discount);
|
|
|
- shopOrderList.get(i).setRealPay(MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue());
|
|
|
+ double realPay = MathUtil.round(MathUtil.sub(shopOrderList.get(i).getNeedPayAmount(), discount), 2).doubleValue();
|
|
|
+ shopOrderList.get(i).setRealPay(realPay);
|
|
|
}
|
|
|
//有优惠金额,最高手续费=支付金额*0.65%>10取0.65,不大于取10(合利宝最高0.65%)
|
|
|
double realPay = shopOrderList.get(i).getRealPay();
|
|
|
- double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
|
|
|
+ double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue();
|
|
|
//佣金>最高手续费可以线上,否则线下
|
|
|
double bro = MathUtil.sub(realPay, shopOrderList.get(i).getShouldPayShopAmount()).doubleValue();
|
|
|
if (bro < charge) {
|
|
@@ -497,7 +499,7 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
//无优惠金额
|
|
|
shopOrderList.forEach(so -> {
|
|
|
BigDecimal realPay = so.getNeedPayAmount();
|
|
|
- BigDecimal charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2) : new BigDecimal(10);
|
|
|
+ BigDecimal charge = MathUtil.mul(realPay, 0.0065, 2);
|
|
|
BigDecimal bro = so.getBrokerage();
|
|
|
so.setRealPay(realPay.doubleValue());
|
|
|
so.setEachDiscount(0d);
|
|
@@ -510,7 +512,13 @@ public class OrderSubmitServiceImpl implements OrderSubmitService {
|
|
|
if (!onlinePay.get()) {
|
|
|
//设置手动回滚事务
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return ResponseJson.success("抱歉,部分商品支付正在调整,暂不支持下单", null);
|
|
|
+ String msg = "";
|
|
|
+ if (productCount > 1) {
|
|
|
+ msg = "抱歉,部分商品支付正在调整,暂不支持下单";
|
|
|
+ } else {
|
|
|
+ msg = "抱歉,该商品支付正在调整,暂不支持下单";
|
|
|
+ }
|
|
|
+ return ResponseJson.error(-1,msg, null);
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < shopOrderList.size(); i++) {
|