|
|
|
@ -2,6 +2,7 @@ package cn.chjyj.szwh.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.chjyj.szwh.bean.*; |
|
|
|
import cn.chjyj.szwh.exception.ChException; |
|
|
|
import cn.chjyj.szwh.mapper.*; |
|
|
|
import cn.chjyj.szwh.service.AccountCloseService; |
|
|
|
import cn.chjyj.szwh.vo.SettleVo; |
|
|
|
@ -286,21 +287,19 @@ public class AccountCloseServiceImpl implements AccountCloseService { |
|
|
|
public Map<String, Object> doSettRatio(String ruleName, List<String>jslist, int adminId) { |
|
|
|
String msg="成功"; |
|
|
|
int code=200; |
|
|
|
Date now =new Date(); |
|
|
|
|
|
|
|
//组装ratioSetting
|
|
|
|
AccountRatioSetting act = new AccountRatioSetting(); |
|
|
|
act.setUserId(adminId); |
|
|
|
act.setRuleName(ruleName); |
|
|
|
act.setCreatetime(now); |
|
|
|
// 保存成功,并返回自编号
|
|
|
|
accountRatioSettingMapper.addAcrSetting(act); |
|
|
|
|
|
|
|
// accountRatioDetail
|
|
|
|
int sumRation=0;// 统计平台放和委托方的结算比例
|
|
|
|
|
|
|
|
if(sumRation!=100){ |
|
|
|
code=400; |
|
|
|
msg="委托方与平台方比例之和未等于100,创建失败"; |
|
|
|
} |
|
|
|
|
|
|
|
for(int i=0;i<jslist.size();i++){ |
|
|
|
|
|
|
|
AccountRatioDetail acrd = new AccountRatioDetail(); |
|
|
|
@ -314,30 +313,37 @@ public class AccountCloseServiceImpl implements AccountCloseService { |
|
|
|
Integer costType=tmpjson.getInteger("cost_type"); |
|
|
|
acrd.setCostType(costType); |
|
|
|
|
|
|
|
// 分配比例值
|
|
|
|
BigDecimal ratio = new BigDecimal(0); |
|
|
|
String sratio=tmpjson.getString("ratio"); |
|
|
|
if(StringUtils.isNotBlank(sratio)){ |
|
|
|
BigDecimal ratio = new BigDecimal(sratio); |
|
|
|
acrd.setRatio(ratio); |
|
|
|
// 判断处理
|
|
|
|
if(roleType==1 || costType==3){ |
|
|
|
// 仅作整数部分计算
|
|
|
|
sumRation+=ratio.intValue(); |
|
|
|
} |
|
|
|
ratio = new BigDecimal(sratio); |
|
|
|
} |
|
|
|
|
|
|
|
acrd.setRatio(ratio); |
|
|
|
|
|
|
|
Integer calculate =tmpjson.getInteger("calculate"); |
|
|
|
acrd.setCalculate(calculate); |
|
|
|
//金额
|
|
|
|
BigDecimal amount=new BigDecimal(0.00); |
|
|
|
String samount=tmpjson.getString("amount"); |
|
|
|
if(StringUtils.isNotBlank(samount)){ |
|
|
|
BigDecimal amount=new BigDecimal(samount); |
|
|
|
amount=new BigDecimal(samount); |
|
|
|
} |
|
|
|
acrd.setAmount(amount); |
|
|
|
//委托方与平台方比例和
|
|
|
|
if(roleType==1 || roleType == 3){ |
|
|
|
sumRation += ratio.intValue(); |
|
|
|
} |
|
|
|
// 入库
|
|
|
|
accountRatioDetailMapper.addAcDetail(acrd); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查比例分配和 是否为100%
|
|
|
|
if(sumRation!=100){ |
|
|
|
code=400; |
|
|
|
msg="委托方与平台方比例之和未等于100,创建失败"; |
|
|
|
} |
|
|
|
|
|
|
|
Map retmap = new HashMap(); |
|
|
|
retmap.put("code",code); |
|
|
|
retmap.put("msg",msg); |
|
|
|
|