|
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
@@ -414,29 +415,31 @@ public class CompanyServiceImpl implements ICompanyService
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void addCompanyMoney(FsStoreOrderScrm order) {
|
|
public void addCompanyMoney(FsStoreOrderScrm order) {
|
|
- if(order.getCompanyId()!=null&&order.getCompanyId()>0){
|
|
|
|
|
|
+ if(ObjectUtil.isNotEmpty(order.getCompanyId())&&order.getCompanyId()>0){
|
|
Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());
|
|
Company company=companyMapper.selectCompanyByIdForUpdate(order.getCompanyId());
|
|
if(company!=null){
|
|
if(company!=null){
|
|
- FsStoreOrder orderMap=new FsStoreOrder();
|
|
|
|
- orderMap.setOrderId(order.getId());
|
|
|
|
|
|
+ FsStoreOrderScrm orderMap=new FsStoreOrderScrm();
|
|
|
|
+ orderMap.setId(order.getId());
|
|
orderMap.setTuiMoneyStatus(1);
|
|
orderMap.setTuiMoneyStatus(1);
|
|
- storeOrderMapper.updateFsStoreOrder(orderMap);
|
|
|
|
- BigDecimal money = order.getPayMoney().add(order.getPayRemain());
|
|
|
|
- company.setMoney(company.getMoney().add(money));
|
|
|
|
|
|
+ storeOrderScrmMapper.updateFsStoreOrder(orderMap);
|
|
|
|
+ String json =configService.selectConfigByKey("store.config");
|
|
|
|
+ StoreConfig config= JSONUtil.toBean(json, StoreConfig.class);
|
|
|
|
+ //支付金额-(订单金额*rate%)
|
|
|
|
+ Double rate=config.getTuiMoneyRate()/100d;
|
|
|
|
+ BigDecimal tuiMoney=order.getPayPrice().subtract(order.getTotalPrice().multiply(new BigDecimal(rate)));
|
|
|
|
+ company.setMoney(company.getMoney().add(tuiMoney));
|
|
companyMapper.updateCompany(company);
|
|
companyMapper.updateCompany(company);
|
|
|
|
+ //companyMapper.updateCompanyMoney(company.getCompanyId(),tuiMoney);
|
|
|
|
+ //写入日志
|
|
CompanyMoneyLogs log=new CompanyMoneyLogs();
|
|
CompanyMoneyLogs log=new CompanyMoneyLogs();
|
|
- log.setCompanyId(company.getCompanyId());
|
|
|
|
- log.setRemark("佣金入账");
|
|
|
|
- log.setMoney(money);
|
|
|
|
- log.setLogsType(3);
|
|
|
|
|
|
+ log.setCompanyId(order.getCompanyId());
|
|
|
|
+ log.setRemark("订单佣金入帐");
|
|
|
|
+ log.setMoney(tuiMoney);
|
|
|
|
+ log.setLogsType(4);
|
|
log.setBalance(company.getMoney());
|
|
log.setBalance(company.getMoney());
|
|
log.setCreateTime(new Date());
|
|
log.setCreateTime(new Date());
|
|
log.setBusinessId(order.getId().toString());
|
|
log.setBusinessId(order.getId().toString());
|
|
moneyLogsMapper.insertCompanyMoneyLogs(log);
|
|
moneyLogsMapper.insertCompanyMoneyLogs(log);
|
|
- FsStoreOrderScrm fsStoreOrder = new FsStoreOrderScrm();
|
|
|
|
- fsStoreOrder.setId(order.getId());
|
|
|
|
- fsStoreOrder.setTuiMoneyStatus(1);
|
|
|
|
- storeOrderScrmMapper.updateFsStoreOrder(fsStoreOrder);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|