|
|
@@ -522,13 +522,23 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
orderMap.setTuiMoneyStatus(1);
|
|
|
storeOrderMapper.updateFsStoreOrder(orderMap);
|
|
|
// order.getPayRemain() 数据库实际没有这个字段了 直接使用 应付金额
|
|
|
- BigDecimal money = order.getPayPrice();
|
|
|
- company.setMoney(company.getMoney().add(money));
|
|
|
+ // 卓美,按照润天进行百分比进行分佣
|
|
|
+ String json =configService.selectConfigByKey("store.config");
|
|
|
+ com.fs.store.config.StoreConfig config= JSONUtil.toBean(json, com.fs.store.config.StoreConfig.class);
|
|
|
+ //支付金额-(订单金额*rate%)
|
|
|
+ BigDecimal tuiMoney = BigDecimal.ZERO;
|
|
|
+ if (config != null && config.getTuiMoneyRate() != null) {
|
|
|
+ Double rate = config.getTuiMoneyRate() / 100d;
|
|
|
+ tuiMoney = order.getPayPrice().subtract(order.getTotalPrice().multiply(new BigDecimal(rate)));
|
|
|
+ } else {
|
|
|
+ tuiMoney = order.getPayPrice();
|
|
|
+ }
|
|
|
+ company.setMoney(company.getMoney().add(tuiMoney));
|
|
|
companyMapper.updateCompany(company);
|
|
|
CompanyMoneyLogs log=new CompanyMoneyLogs();
|
|
|
log.setCompanyId(company.getCompanyId());
|
|
|
log.setRemark("佣金入账");
|
|
|
- log.setMoney(money);
|
|
|
+ log.setMoney(tuiMoney);
|
|
|
log.setLogsType(3);
|
|
|
log.setBalance(company.getMoney());
|
|
|
log.setCreateTime(new Date());
|
|
|
@@ -547,20 +557,34 @@ public class CompanyServiceImpl implements ICompanyService
|
|
|
if(order.getCompanyId()>0){
|
|
|
Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());
|
|
|
if(company!=null){
|
|
|
- company.setMoney(company.getMoney().subtract(order.getTuiMoney()));
|
|
|
- company.setTuiMoney(company.getTuiMoney().subtract(order.getTuiMoney()));
|
|
|
+ // 卓美,按照润天进行百分比进行分佣
|
|
|
+ String json =configService.selectConfigByKey("store.config");
|
|
|
+ com.fs.store.config.StoreConfig config= JSONUtil.toBean(json, com.fs.store.config.StoreConfig.class);
|
|
|
+ //支付金额-(订单金额*rate%)
|
|
|
+ BigDecimal tuiMoney = BigDecimal.ZERO;
|
|
|
+ if (config != null && config.getTuiMoneyRate() != null) {
|
|
|
+ Double rate = config.getTuiMoneyRate() / 100d;
|
|
|
+ tuiMoney = order.getPayPrice().subtract(order.getTotalPrice().multiply(new BigDecimal(rate)));
|
|
|
+ } else {
|
|
|
+ tuiMoney = order.getPayPrice();
|
|
|
+ }
|
|
|
+ company.setMoney(company.getMoney().add(tuiMoney));
|
|
|
companyMapper.updateCompany(company);
|
|
|
//写入日志
|
|
|
CompanyMoneyLogs log=new CompanyMoneyLogs();
|
|
|
log.setCompanyId(order.getCompanyId());
|
|
|
- log.setRemark("订单佣金退款");
|
|
|
- log.setMoney(order.getTuiMoney().multiply(new BigDecimal(-1)));
|
|
|
- log.setLogsType(4);
|
|
|
+ log.setRemark("佣金入账");
|
|
|
+ log.setMoney(tuiMoney);
|
|
|
+ log.setLogsType(3);
|
|
|
log.setBalance(company.getMoney());
|
|
|
log.setCreateTime(new Date());
|
|
|
log.setBusinessId(order.getOrderId().toString());
|
|
|
moneyLogsMapper.insertCompanyMoneyLogs(log);
|
|
|
-
|
|
|
+ LiveOrder liveOrder = new LiveOrder();
|
|
|
+ liveOrder.setOrderId(order.getOrderId());
|
|
|
+ liveOrder.setTuiMoneyStatus(1);
|
|
|
+ liveOrder.setTuiMoney(tuiMoney);
|
|
|
+ liveOrderMapper.updateLiveOrder(liveOrder);
|
|
|
}
|
|
|
}
|
|
|
}
|