|
@@ -1026,8 +1026,6 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
//叠加优惠计算
|
|
|
//叠加倍数
|
|
|
Double floor = Math.floor(MathUtil.div(shopPromotionFee.get(), shopPromotions.getTouchPrice()).doubleValue());
|
|
|
- // 供应商满减金额
|
|
|
- shopOrder.setPromotionFullReduction(MathUtil.add(shopOrder.getPromotionFullReduction(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
|
|
|
// 统计订单总满减金额
|
|
|
promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
|
|
|
// 统计店铺商品总金额
|
|
@@ -1036,9 +1034,12 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
needPayAmount.set(MathUtil.sub(needPayAmount.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
|
|
|
// 统计需要支付金额
|
|
|
shopAmount.set(MathUtil.sub(shopAmount.get(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
|
|
|
- } else {
|
|
|
// 供应商满减金额
|
|
|
- shopOrder.setPromotionFullReduction(MathUtil.add(shopOrder.getPromotionFullReduction(), shopPromotions.getReducedPrice()).doubleValue());
|
|
|
+ log.info("shopOrder.getPromotionFullReduction()---------------------" + shopOrder.getPromotionFullReduction());
|
|
|
+ log.info("setPromotionFullReduction-----------------------" + MathUtil.mul(shopPromotions.getReducedPrice(), floor));
|
|
|
+ ;
|
|
|
+ shopOrder.setPromotionFullReduction(MathUtil.add(shopOrder.getPromotionFullReduction(), MathUtil.mul(shopPromotions.getReducedPrice(), floor)).doubleValue());
|
|
|
+ } else {
|
|
|
// 统计订单总满减金额
|
|
|
promotionFullReduction.set(MathUtil.add(promotionFullReduction.get(), shopPromotions.getReducedPrice()).doubleValue());
|
|
|
// 统计店铺商品总金额
|
|
@@ -1047,6 +1048,10 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
needPayAmount.set(MathUtil.sub(needPayAmount.get(), shopPromotions.getReducedPrice()).doubleValue());
|
|
|
// 统计需要支付金额
|
|
|
shopAmount.set(MathUtil.sub(shopAmount.get(), shopPromotions.getReducedPrice()).doubleValue());
|
|
|
+ // 供应商满减金额
|
|
|
+ log.info("shopOrder.getPromotionFullReduction()---------------------" + shopOrder.getPromotionFullReduction());
|
|
|
+ log.info("setPromotionFullReduction-----------------------" + shopPromotions.getReducedPrice());
|
|
|
+ shopOrder.setPromotionFullReduction(MathUtil.add(shopOrder.getPromotionFullReduction(), shopPromotions.getReducedPrice()).doubleValue());
|
|
|
}
|
|
|
}
|
|
|
// 添加到总促销
|
|
@@ -1358,20 +1363,27 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
onlinePay.set(false);
|
|
|
}
|
|
|
if (onlinePay.get()) {
|
|
|
- //在店铺满减算完之后重新根据商品的splitCode排shopOrderList
|
|
|
+// //在店铺满减算完之后重新根据商品的splitCode排shopOrderList
|
|
|
List<OrderShopPo> shops = submitMapper.findShops(productIdList);
|
|
|
- //子订单分多子订单,满减分摊到原子订单分开的子订单,无满减重算佣金/应付
|
|
|
- //重组订单
|
|
|
- shopOrderList = findSplitShopOrder(orderProductList, shopOrderList, shops, orderParamBo);
|
|
|
- // 分摊优惠前总佣金
|
|
|
- AtomicDouble oldBrokerage = new AtomicDouble(0);
|
|
|
- //超级会员价/复购价/阶梯价/促销活动冲突,只能生效一个
|
|
|
- shopOrderList.forEach(orderShopPo -> {
|
|
|
- orderShopPo.setOldPrice(orderShopPo.getNeedPayAmount());
|
|
|
- orderShopPo.setOldBrokerage(orderShopPo.getBrokerage());
|
|
|
- oldBrokerage.set(MathUtil.add(oldBrokerage.get(), orderShopPo.getOldBrokerage()).doubleValue());
|
|
|
-
|
|
|
- });
|
|
|
+// //子订单分多子订单,满减分摊到原子订单分开的子订单,无满减重算佣金/应付
|
|
|
+// //重组订单
|
|
|
+// shopOrderList = findSplitShopOrder(orderProductList, shopOrderList, shops, orderParamBo);
|
|
|
+ for (OrderShopPo shop : shops) {
|
|
|
+ shopOrderList.forEach(s -> {
|
|
|
+ if (s.getShopId() == shop.getShopId()) {
|
|
|
+ s.setSplitCode(shop.getSplitCode());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+// // 分摊优惠前总佣金
|
|
|
+// AtomicDouble oldBrokerage = new AtomicDouble(0);
|
|
|
+// //超级会员价/复购价/阶梯价/促销活动冲突,只能生效一个
|
|
|
+// shopOrderList.forEach(orderShopPo -> {
|
|
|
+// orderShopPo.setOldPrice(orderShopPo.getNeedPayAmount());
|
|
|
+// orderShopPo.setOldBrokerage(orderShopPo.getBrokerage());
|
|
|
+// oldBrokerage.set(MathUtil.add(oldBrokerage.get(), orderShopPo.getOldBrokerage()).doubleValue());
|
|
|
+//
|
|
|
+// });
|
|
|
// 按分摊前的佣金排序
|
|
|
shopOrderList.sort((o1, o2) -> o2.getOldBrokerage().compareTo(o1.getOldBrokerage()));
|
|
|
// 前面子订单的分摊优惠总和
|
|
@@ -1380,21 +1392,21 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
*/
|
|
|
//无优惠金额
|
|
|
shopOrderList.forEach(so -> {
|
|
|
- //不包含优惠的真实支付金额=子订单应付?
|
|
|
- double realPay = so.getNeedPayAmount();
|
|
|
- so.setRealPay(realPay);
|
|
|
- so.setEachDiscount(0d);
|
|
|
+// //不包含优惠的真实支付金额=子订单应付?
|
|
|
+// double realPay = so.getNeedPayAmount();
|
|
|
+// so.setRealPay(realPay);
|
|
|
+// so.setEachDiscount(0d);
|
|
|
double bro = so.getBrokerage();
|
|
|
- so.setRealPay(realPay);
|
|
|
- so.setEachDiscount(0d);
|
|
|
+// so.setRealPay(realPay);
|
|
|
+// so.setEachDiscount(0d);
|
|
|
//成本>实付不能线上
|
|
|
if (bro < 0) {
|
|
|
onlinePay.set(false);
|
|
|
} else {
|
|
|
- double WXCharge = MathUtil.mul(realPay, 0.0065, 2).doubleValue();
|
|
|
- double QuickCharge = MathUtil.mul(realPay, 0.006, 2).doubleValue();
|
|
|
- double AliCharge = MathUtil.mul(realPay, 0.0025, 2).doubleValue();
|
|
|
- double B2CCharge = MathUtil.mul(realPay, 0.002, 2).doubleValue();
|
|
|
+ double WXCharge = MathUtil.mul(so.getRealPay(), 0.0065, 2).doubleValue();
|
|
|
+ double QuickCharge = MathUtil.mul(so.getRealPay(), 0.006, 2).doubleValue();
|
|
|
+ double AliCharge = MathUtil.mul(so.getRealPay(), 0.0025, 2).doubleValue();
|
|
|
+ double B2CCharge = MathUtil.mul(so.getRealPay(), 0.002, 2).doubleValue();
|
|
|
//佣金和手续费比较,佣金>手续费则可以走当前支付渠道
|
|
|
//支持子订单佣金小于最小手续费时,也能进行线上支付,此时不限制支付方式(佣金大于最大手续费或小于最小手续费支持全渠道付款)
|
|
|
String payWays = "";
|
|
@@ -1409,6 +1421,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
}
|
|
|
so.setOnlinePayWays(payWays);
|
|
|
}
|
|
|
+ log.info("线上重排子订单--------------------------" + so);
|
|
|
});
|
|
|
}
|
|
|
/*
|