|
@@ -60,6 +60,12 @@ public class PayShopServiceImpl implements PayShopService {
|
|
|
OrderPayShopDetail detail = payShopDao.findPayShopDetail(id);
|
|
|
List<NewShopOrder> shopOrders = payShopDao.findPayShopOrders(detail.getPayShopId());
|
|
|
shopOrders.forEach(s -> orderUtils.getShouldPay(s));
|
|
|
+ Double totalPayShop = shopOrders.stream().mapToDouble(NewShopOrder::getPayedShopAmount).sum();
|
|
|
+ // 付供应商
|
|
|
+ detail.setTotalAmount(totalPayShop);
|
|
|
+ Double totalPayCm = shopOrders.stream().mapToDouble(NewShopOrder::getPayCmAmount).sum();
|
|
|
+ // 付采美
|
|
|
+ detail.setPayCmTotalAmount(totalPayCm);
|
|
|
detail.setShopOrders(shopOrders);
|
|
|
return detail;
|
|
|
}
|
|
@@ -217,6 +223,7 @@ public class PayShopServiceImpl implements PayShopService {
|
|
|
PayParamBo payParam = new PayParamBo();
|
|
|
//支付金额
|
|
|
payParam.setAllPay(orderRelation.getAssociateAmount());
|
|
|
+ payParam.setPayType(orderRelation.getPayType().toString());
|
|
|
List<SplitAccountPo> splitBillDetail = new ArrayList<>();
|
|
|
/**
|
|
|
* todo
|
|
@@ -477,6 +484,29 @@ public class PayShopServiceImpl implements PayShopService {
|
|
|
BigDecimal total = MathUtil.mul(orderProduct.getPrice(), orderProduct.getNum());
|
|
|
// 总价 * 供应商百分比 = 成本分账金额
|
|
|
double costPrice = MathUtil.mul(total, MathUtil.div(orderProduct.getShopPercent(), 100)).doubleValue();
|
|
|
+ // 供应商承担手续费 ,减去手续费
|
|
|
+ String payType = payParam.getPayType();
|
|
|
+ double charge = 0d;
|
|
|
+ if ("17".equals(payType)) {
|
|
|
+ // 17 个人网银 0.2% 最低0.1
|
|
|
+ charge = Math.max(MathUtil.mul(splitAmount, 0.002, 2).doubleValue(), 0.1);
|
|
|
+ } else if ("12".equals(payType)) {
|
|
|
+ // 企业网银单笔10元
|
|
|
+ charge = 10;
|
|
|
+ } else if ("13".equals(payType) || "15".equals(payType)) {
|
|
|
+ // 13PC-微信支付 15 微信小程序支付 0.65% 最低0.01
|
|
|
+ charge = Math.max(MathUtil.mul(splitAmount, 0.0065, 2).doubleValue(), 0.01);
|
|
|
+ } else if ("14".equals(payType)) {
|
|
|
+ // 14PC-支付宝 0.25% 最低0.01
|
|
|
+ charge = Math.max(MathUtil.mul(splitAmount, 0.0025, 2).doubleValue(), 0.01);
|
|
|
+ } else if ("29".equals(payType)) {
|
|
|
+ // 29快捷支付借记卡 0.3% 最低0.1
|
|
|
+ charge = Math.max(MathUtil.mul(splitAmount, 0.003, 2).doubleValue(), 0.1);
|
|
|
+ } else if ("30".equals(payType)) {
|
|
|
+ // 30快捷支付贷记卡 0.6% 最低0.1
|
|
|
+ charge = Math.max(MathUtil.mul(splitAmount, 0.006, 2).doubleValue(), 0.1);
|
|
|
+ }
|
|
|
+ costPrice = costPrice - charge;
|
|
|
totalCostPrice.set(MathUtil.add(costPrice, totalCostPrice.get()));
|
|
|
double organize = MathUtil.mul(total, MathUtil.div(orderProduct.getOrganizePercent(), 100), 2).doubleValue();
|
|
|
totalOrganize.set(MathUtil.add(organize, totalOrganize.get()));
|