Commit 996be7ed by zhangxingmin

push

parent 371ba432
package com.yd.csf.api.service.impl; package com.yd.csf.api.service.impl;
import com.alibaba.fastjson.JSON;
import com.yd.common.constant.CodeGeneratorConstants; import com.yd.common.constant.CodeGeneratorConstants;
import com.yd.common.enums.CommonEnum; import com.yd.common.enums.CommonEnum;
import com.yd.common.enums.ProjectEnum; import com.yd.common.enums.ProjectEnum;
...@@ -368,6 +369,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -368,6 +369,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
*/ */
@Override @Override
public Result<List<AlgorithmResDto>> policyBrokerAlgorithm(AlgorithmDto algorithmDto) { public Result<List<AlgorithmResDto>> policyBrokerAlgorithm(AlgorithmDto algorithmDto) {
log.info("算法-计算-转介人(销售业务员)绑定的基本法类型(基本法项目列表)对应的积分值->入参:{}", JSON.toJSONString(algorithmDto));
List<AlgorithmResDto> algorithmResDtoList = new ArrayList<>(); List<AlgorithmResDto> algorithmResDtoList = new ArrayList<>();
//校验 - 转介人业务ID(客户端用户表唯一业务ID)不能为空 //校验 - 转介人业务ID(客户端用户表唯一业务ID)不能为空
if (StringUtils.isBlank(algorithmDto.getBrokerBizId())) { if (StringUtils.isBlank(algorithmDto.getBrokerBizId())) {
...@@ -377,6 +379,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -377,6 +379,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
if (CollectionUtils.isEmpty(commissionRuleBindingList)) { if (CollectionUtils.isEmpty(commissionRuleBindingList)) {
throw new BusinessException("获得积分的用户所绑定的基本法信息不存在"); throw new BusinessException("获得积分的用户所绑定的基本法信息不存在");
} }
log.info("执行获得积分的用户绑定的多个基本法类型 (一个基本法类型又有多个基本法项目)->入参:{}", JSON.toJSONString(commissionRuleBindingList));
//执行获得积分的用户绑定的多个基本法类型 (一个基本法类型又有多个基本法项目) //执行获得积分的用户绑定的多个基本法类型 (一个基本法类型又有多个基本法项目)
for (CommissionRuleBinding commissionRuleBinding : commissionRuleBindingList) { for (CommissionRuleBinding commissionRuleBinding : commissionRuleBindingList) {
algorithmDto.setRuleBizId(commissionRuleBinding.getRuleBizId()); algorithmDto.setRuleBizId(commissionRuleBinding.getRuleBizId());
...@@ -384,6 +387,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -384,6 +387,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
//多个基本法类型执行结果列表汇总 //多个基本法类型执行结果列表汇总
algorithmResDtoList.addAll(result.getData()); algorithmResDtoList.addAll(result.getData());
} }
log.info("算法-计算-转介人(销售业务员)绑定的基本法类型(基本法项目列表)对应的积分值->出参:{}", JSON.toJSONString(algorithmResDtoList));
return Result.success(algorithmResDtoList); return Result.success(algorithmResDtoList);
} }
...@@ -393,6 +397,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -393,6 +397,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
* @return * @return
*/ */
public Result<List<AlgorithmResDto>> commissionRuleAlgorithm(AlgorithmDto algorithmDto) { public Result<List<AlgorithmResDto>> commissionRuleAlgorithm(AlgorithmDto algorithmDto) {
log.info("算法-计算-基本法类型->入参:{}", JSON.toJSONString(algorithmDto));
//校验 - 基本法配置表唯一业务ID不能为空 //校验 - 基本法配置表唯一业务ID不能为空
if (StringUtils.isBlank(algorithmDto.getRuleBizId())) { if (StringUtils.isBlank(algorithmDto.getRuleBizId())) {
throw new BusinessException("基本法配置表唯一业务ID不能为空"); throw new BusinessException("基本法配置表唯一业务ID不能为空");
...@@ -402,6 +407,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -402,6 +407,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
if (CollectionUtils.isEmpty(ruleItemConfigList)) { if (CollectionUtils.isEmpty(ruleItemConfigList)) {
throw new BusinessException("基本法项目列表不存在"); throw new BusinessException("基本法项目列表不存在");
} }
log.info("查询基本法类型绑定的基本法项目列表 - 执行顺序,数值越小越先执行,用于控制佣金项目的计算顺序->出参:{}", JSON.toJSONString(algorithmDto));
List<AlgorithmResDto> algorithmResDtoList = new ArrayList<>(); List<AlgorithmResDto> algorithmResDtoList = new ArrayList<>();
//遍历基本法项目 - 计算对应值 //遍历基本法项目 - 计算对应值
for (RuleItemConfig ruleItemConfig : ruleItemConfigList) { for (RuleItemConfig ruleItemConfig : ruleItemConfigList) {
...@@ -418,9 +424,11 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -418,9 +424,11 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
continue; continue;
} }
} }
log.info("遍历基本法项目 - 计算对应值->入参:{}", JSON.toJSONString(ruleItemConfig));
algorithmDto.setRuleItemBizId(ruleItemConfig.getRuleItemBizId()); algorithmDto.setRuleItemBizId(ruleItemConfig.getRuleItemBizId());
//算法-计算-基本法项目 //算法-计算-基本法项目
Result<AlgorithmResDto> result = ruleItemAlgorithm(algorithmDto); Result<AlgorithmResDto> result = ruleItemAlgorithm(algorithmDto);
log.info("算法-计算-基本法项目->出参:{}", JSON.toJSONString(result));
AlgorithmResDto algorithmResDto = result.getData(); AlgorithmResDto algorithmResDto = result.getData();
if (!Objects.isNull(algorithmResDto)) { if (!Objects.isNull(algorithmResDto)) {
//基本法项目名称 //基本法项目名称
...@@ -437,6 +445,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -437,6 +445,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
* @return * @return
*/ */
public Result<AlgorithmResDto> ruleItemAlgorithm(AlgorithmDto algorithmDto) { public Result<AlgorithmResDto> ruleItemAlgorithm(AlgorithmDto algorithmDto) {
log.info("算法-计算-基本法项目->入参:{}", JSON.toJSONString(algorithmDto));
//校验 - 基本法项目配置表唯一业务ID不能为空 //校验 - 基本法项目配置表唯一业务ID不能为空
if (StringUtils.isBlank(algorithmDto.getRuleItemBizId())) { if (StringUtils.isBlank(algorithmDto.getRuleItemBizId())) {
throw new BusinessException("基本法项目配置表唯一业务ID不能为空"); throw new BusinessException("基本法项目配置表唯一业务ID不能为空");
...@@ -446,11 +455,13 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -446,11 +455,13 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
if (CollectionUtils.isEmpty(relObjectFormulaList)) { if (CollectionUtils.isEmpty(relObjectFormulaList)) {
throw new BusinessException("基本法项目和公式关系数据不存在"); throw new BusinessException("基本法项目和公式关系数据不存在");
} }
log.info("查询对象公式关系 - 即基本法项目和公式关系数据->出参:{}", JSON.toJSONString(relObjectFormulaList));
RelObjectFormula relObjectFormula = relObjectFormulaList.get(0); RelObjectFormula relObjectFormula = relObjectFormulaList.get(0);
//公式配置表唯一业务ID //公式配置表唯一业务ID
algorithmDto.setFormulaBizId(relObjectFormula.getFormulaBizId()); algorithmDto.setFormulaBizId(relObjectFormula.getFormulaBizId());
//算法-计算-公式 //算法-计算-公式
Result<AlgorithmResDto> result = calculationFormulaAlgorithm(algorithmDto); Result<AlgorithmResDto> result = calculationFormulaAlgorithm(algorithmDto);
log.info("算法-计算-公式->出参:{}", JSON.toJSONString(result));
AlgorithmResDto dto = result.getData(); AlgorithmResDto dto = result.getData();
dto.setRuleBizId(algorithmDto.getRuleBizId()); dto.setRuleBizId(algorithmDto.getRuleBizId());
dto.setRuleItemBizId(algorithmDto.getRuleItemBizId()); dto.setRuleItemBizId(algorithmDto.getRuleItemBizId());
...@@ -463,6 +474,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -463,6 +474,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
* @return * @return
*/ */
public Result<AlgorithmResDto> calculationFormulaAlgorithm(AlgorithmDto algorithmDto) { public Result<AlgorithmResDto> calculationFormulaAlgorithm(AlgorithmDto algorithmDto) {
log.info("算法-计算-公式->入参:{}", JSON.toJSONString(algorithmDto));
AlgorithmResDto resDto = new AlgorithmResDto(); AlgorithmResDto resDto = new AlgorithmResDto();
//校验算法DTO入参 //校验算法DTO入参
checkAlgorithmDto(algorithmDto); checkAlgorithmDto(algorithmDto);
...@@ -503,7 +515,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -503,7 +515,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
BigDecimal result = evaluateFormula(calculationFormulaBizId, variableValues); BigDecimal result = evaluateFormula(calculationFormulaBizId, variableValues);
resDto.setCalculatedValue(result); resDto.setCalculatedValue(result);
log.info("算法-计算-公式->出参参:{}", JSON.toJSONString(resDto));
//通过计算公式-计算变量绑定的SQL模板计算结果集合列表 //通过计算公式-计算变量绑定的SQL模板计算结果集合列表
// Result<List<SqlAlgorithmResultDto>> listResult = calculateSqlAlgorithmResultDtoList(calculationFormulaBizId,variableValues); // Result<List<SqlAlgorithmResultDto>> listResult = calculateSqlAlgorithmResultDtoList(calculationFormulaBizId,variableValues);
// resDto.setSqlAlgorithmResultDtoList(listResult.getData()); // resDto.setSqlAlgorithmResultDtoList(listResult.getData());
...@@ -654,6 +666,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -654,6 +666,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
* @return * @return
*/ */
public Result<List<VariableAlgorithmDto>> variableAlgorithm(AlgorithmDto algorithmDto) { public Result<List<VariableAlgorithmDto>> variableAlgorithm(AlgorithmDto algorithmDto) {
log.info("算法-计算-变量->入参:{}", JSON.toJSONString(algorithmDto));
//校验算法DTO入参 //校验算法DTO入参
checkAlgorithmDto(algorithmDto); checkAlgorithmDto(algorithmDto);
//查询变量表列表信息 //查询变量表列表信息
...@@ -663,6 +676,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -663,6 +676,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
if (CollectionUtils.isEmpty(variableList)) { if (CollectionUtils.isEmpty(variableList)) {
throw new BusinessException("变量表列表信息不存在"); throw new BusinessException("变量表列表信息不存在");
} }
log.info("查询变量表列表信息->出参:{}", JSON.toJSONString(variableList));
List<VariableAlgorithmDto> variableAlgorithmDtoList = new ArrayList<>(); List<VariableAlgorithmDto> variableAlgorithmDtoList = new ArrayList<>();
//遍历变量列表 - 计算对应的值 //遍历变量列表 - 计算对应的值
for (Variable variable : variableList) { for (Variable variable : variableList) {
...@@ -698,7 +712,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -698,7 +712,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
//执行 - 算法 - SQL模板 //执行 - 算法 - SQL模板
Result<List<SqlAlgorithmResultDto>> result = sqlAlgorithm(algorithmDto); Result<List<SqlAlgorithmResultDto>> result = sqlAlgorithm(algorithmDto);
log.info("执行 - 算法 - SQL模板->出参:{}", JSON.toJSONString(result));
// 设置SQL模板计算结果列表 // 设置SQL模板计算结果列表
dto.setSqlAlgorithmResultDtoList(result.getData()); dto.setSqlAlgorithmResultDtoList(result.getData());
...@@ -722,6 +736,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -722,6 +736,7 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
} }
variableAlgorithmDtoList.add(dto); variableAlgorithmDtoList.add(dto);
} }
log.info("算法-计算-变量->出参:{}", JSON.toJSONString(variableAlgorithmDtoList));
return Result.success(variableAlgorithmDtoList); return Result.success(variableAlgorithmDtoList);
} }
...@@ -750,13 +765,15 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ ...@@ -750,13 +765,15 @@ public class ApiBasicLawCalculateServiceImpl implements ApiBasicLawCalculateServ
//构建SQL模板入参参数Map //构建SQL模板入参参数Map
Map<String, Object> paramMap = buildParamMap(algorithmDto); Map<String, Object> paramMap = buildParamMap(algorithmDto);
log.info("执行SQL查询->入参sqlTemplate,{}",JSON.toJSONString(sqlTemplate));
log.info("执行SQL查询->入参paramMap,{}",JSON.toJSONString(paramMap));
//执行SQL查询 //执行SQL查询
Object result = executeParameterizedQuery(sqlTemplate, paramMap); Object result = executeParameterizedQuery(sqlTemplate, paramMap);
log.info("执行SQL查询->出参,{}",JSON.toJSONString(result));
//将查询结果转换为 List<SqlAlgorithmResultDto> //将查询结果转换为 List<SqlAlgorithmResultDto>
List<SqlAlgorithmResultDto> resultDtoList = convertToSqlAlgorithmResultDto(result); List<SqlAlgorithmResultDto> resultDtoList = convertToSqlAlgorithmResultDto(result);
log.info("将查询结果转换为 List<SqlAlgorithmResultDto>->出参,{}",JSON.toJSONString(resultDtoList));
return Result.success(resultDtoList); return Result.success(resultDtoList);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -347,7 +347,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -347,7 +347,8 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
*/ */
public Result executeSync(List<QueryPolicyAndBrokerDto> queryPolicyAndBrokerDtoList, public Result executeSync(List<QueryPolicyAndBrokerDto> queryPolicyAndBrokerDtoList,
String policyNo) { String policyNo) {
log.info("同步处理-> 遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表->入参queryPolicyAndBrokerDtoList:{}",JSON.toJSONString(queryPolicyAndBrokerDtoList));
log.info("同步处理-> 遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表->入参policyNo:{}",policyNo);
// 使用编程式事务,确保方法内的事务一致性 // 使用编程式事务,确保方法内的事务一致性
return transactionTemplate.execute(status -> { return transactionTemplate.execute(status -> {
try { try {
...@@ -358,7 +359,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -358,7 +359,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
} }
List<CommissionRuleBinding> commissionRuleBindingList = brokerRelUserIdList(brokerDto); List<CommissionRuleBinding> commissionRuleBindingList = brokerRelUserIdList(brokerDto);
log.info("同步处理-> 遍历保单转介人列表信息 -> 调用基本法算出预计发佣列表->commissionRuleBindingList:{}",JSON.toJSONString(commissionRuleBindingList));
for (int i = 1; i <= paymentTerm; i++) { for (int i = 1; i <= paymentTerm; i++) {
executeBilling(ExecuteBillingDto.builder() executeBilling(ExecuteBillingDto.builder()
.name(brokerDto.getBrokerName()) .name(brokerDto.getBrokerName())
...@@ -465,7 +466,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -465,7 +466,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//构造销售佣金基本法项目的顺序下标值执行 //构造销售佣金基本法项目的顺序下标值执行
List<Integer> executionOrderList = new ArrayList<>(); List<Integer> executionOrderList = new ArrayList<>();
executionOrderList.add(1); executionOrderList.add(1);
log.info("执行获得积分用户的非销售佣金基本法项目->入参:{}",JSON.toJSONString(dto));
//执行获得积分用户的非销售佣金基本法项目 //执行获得积分用户的非销售佣金基本法项目
Result<List<AlgorithmResDto>> result = apiBasicLawCalculateService.policyBrokerAlgorithm(AlgorithmDto.builder() Result<List<AlgorithmResDto>> result = apiBasicLawCalculateService.policyBrokerAlgorithm(AlgorithmDto.builder()
.brokerBizId(brokerDto.getBrokerBizId()) .brokerBizId(brokerDto.getBrokerBizId())
...@@ -482,6 +483,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -482,6 +483,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
.executionOrderList(executionOrderList) .executionOrderList(executionOrderList)
.isNegateExecutionOrderList(true) .isNegateExecutionOrderList(true)
.build()); .build());
log.info("执行获得积分用户的非销售佣金基本法项目->出参:{}",JSON.toJSONString(result));
//生成保单预计发佣表记录 (非销售佣金基本法) //生成保单预计发佣表记录 (非销售佣金基本法)
generateExpectedFortune(GenerateExpectedFortuneDto.builder() generateExpectedFortune(GenerateExpectedFortuneDto.builder()
...@@ -529,6 +531,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -529,6 +531,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result executeBilling(ExecuteBillingDto dto) { public Result executeBilling(ExecuteBillingDto dto) {
log.info("执行 - 销售佣金(销售佣金基本法)——>入参:{}", JSON.toJSONString(dto));
QueryPolicyAndBrokerDto brokerDto = dto.getPolicyAndBrokerDto(); QueryPolicyAndBrokerDto brokerDto = dto.getPolicyAndBrokerDto();
//构造销售佣金基本法项目的顺序下标值执行 //构造销售佣金基本法项目的顺序下标值执行
List<Integer> executionOrderList = new ArrayList<>(); List<Integer> executionOrderList = new ArrayList<>();
...@@ -593,6 +596,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -593,6 +596,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result generateExpectedFortune(GenerateExpectedFortuneDto fortuneDto) { public Result generateExpectedFortune(GenerateExpectedFortuneDto fortuneDto) {
log.info("生成保单预计发佣表记录——>入参:{}", JSON.toJSONString(fortuneDto));
List<ExpectedFortune> fortuneList = new ArrayList<>(); List<ExpectedFortune> fortuneList = new ArrayList<>();
if (!CollectionUtils.isEmpty(fortuneDto.getAlgorithmResDtoList())) { if (!CollectionUtils.isEmpty(fortuneDto.getAlgorithmResDtoList())) {
//获得积分业务员绑定的基本法列表对应计算值结果集合 //获得积分业务员绑定的基本法列表对应计算值结果集合
...@@ -602,6 +606,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -602,6 +606,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
//判空判0 //判空判0
continue; continue;
} }
log.info("生成保单预计发佣表记录——>入参algorithmResDto:{}", JSON.toJSONString(algorithmResDto));
PolicyBroker policyBroker = policyBrokerService.queryOne(QueryPolicyBrokerDto.builder() PolicyBroker policyBroker = policyBrokerService.queryOne(QueryPolicyBrokerDto.builder()
.policyNo(fortuneDto.getPolicyNo()) .policyNo(fortuneDto.getPolicyNo())
.brokerBizId(fortuneDto.getBrokerBizId()) .brokerBizId(fortuneDto.getBrokerBizId())
...@@ -670,6 +675,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService ...@@ -670,6 +675,7 @@ public class ApiExpectedFortuneServiceImpl implements ApiExpectedFortuneService
} }
} }
log.info("生成保单预计发佣表记录——>出参fortuneList:{}", JSON.toJSONString(fortuneList));
if (!CollectionUtils.isEmpty(fortuneList)) { if (!CollectionUtils.isEmpty(fortuneList)) {
iExpectedFortuneService.saveOrUpdateBatch(fortuneList); iExpectedFortuneService.saveOrUpdateBatch(fortuneList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment