Commit 996be7ed by zhangxingmin

push

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