Commit f09f1cef by jianan

前端对接问题修复37

parent 21525b6b
...@@ -364,30 +364,37 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -364,30 +364,37 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
.in(ExpectedFortune::getPolicyNo, policyNoSet) .in(ExpectedFortune::getPolicyNo, policyNoSet)
.list(); .list();
// 1.2 根据保单号和期数筛选符合的预计发佣记录 // 1.2 根据保单号和期数筛选符合的预计发佣记录
List<ExpectedFortune> filteredExpectedFortuneList = new ArrayList<>(); List<ExpectedFortune> filteredExpectedFortuneList1 = new ArrayList<>();
for (Commission commission : commissions) { for (Commission commission : commissions) {
String policyNo = commission.getPolicyNo(); String policyNo = commission.getPolicyNo();
Integer commissionPeriod = commission.getCommissionPeriod(); Integer commissionPeriod = commission.getCommissionPeriod();
for (ExpectedFortune expectedFortune : expectedFortuneList) { for (ExpectedFortune expectedFortune : expectedFortuneList) {
if (expectedFortune.getPolicyNo().equals(policyNo) && expectedFortune.getFortunePeriod().equals(commissionPeriod)) { if (expectedFortune.getPolicyNo().equals(policyNo) && expectedFortune.getFortunePeriod().equals(commissionPeriod)) {
filteredExpectedFortuneList.add(expectedFortune); filteredExpectedFortuneList1.add(expectedFortune);
} }
} }
} }
if (CollectionUtils.isEmpty(filteredExpectedFortuneList)) { if (CollectionUtils.isEmpty(filteredExpectedFortuneList1)) {
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "未找到保单对应的预计发佣记录,请先创建预计发佣记录"); throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "未找到保单对应的预计发佣记录,请先创建预计发佣记录");
} }
// 2. 根据本次发佣日期,查询本期待发佣记录 // 2. 根据本次发佣期数,查询是否有已出账的记录
List<Fortune> fortuneList = fortuneService.lambdaQuery() List<Fortune> fortuneList = fortuneService.lambdaQuery()
.in(Fortune::getExpectedFortuneBizId, filteredExpectedFortuneList.stream().map(ExpectedFortune::getExpectedFortuneBizId).collect(Collectors.toList())) .in(Fortune::getExpectedFortuneBizId, filteredExpectedFortuneList1.stream().map(ExpectedFortune::getExpectedFortuneBizId).collect(Collectors.toList()))
.list(); .list();
// 2.1 校验是否有已出账的记录 // 2.1 根据保单号和期数建立映射关系
for (Fortune fortune : fortuneList) { Map<String, Fortune> fortuneMap = fortuneList.stream()
if (!FortuneStatusEnum.WAIT.getItemValue().equals(fortune.getStatus())) { .collect(Collectors.toMap(i -> i.getPolicyNo() + "_" + i.getFortunePeriod(), fortune -> fortune));
Commission commission = policyNoPeriodMap.get(fortune.getPolicyNo() + "_" + fortune.getFortunePeriod()); // 2.2 校验是否有已出账的记录
throw new BusinessException(ResultCode.NULL_ERROR.getCode(), "保单号为" + commission.getPolicyNo() + ",期数为" + commission.getCommissionPeriod() + "已有出账,不能重新出账"); List<ExpectedFortune> filteredExpectedFortuneList2 = new ArrayList<>();
for (ExpectedFortune expectedFortune : filteredExpectedFortuneList1) {
String policyNo = expectedFortune.getPolicyNo();
Integer fortunePeriod = expectedFortune.getFortunePeriod();
// 如果有已出账记录,跳过,表示此次该预计出账已出账
if (fortuneMap.get(policyNo + "_" + fortunePeriod) != null) {
continue;
} }
filteredExpectedFortuneList2.add(expectedFortune);
} }
// 2.2 过滤掉 is_part = 1 的 fortune 记录 // 2.2 过滤掉 is_part = 1 的 fortune 记录
...@@ -396,7 +403,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -396,7 +403,7 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
// .collect(Collectors.toList()); // .collect(Collectors.toList());
// 5. 构建实际的初始发佣记录 // 5. 构建实际的初始发佣记录
List<Fortune> newFortuneList = buildNewFortunes(filteredExpectedFortuneList, commissions); List<Fortune> newFortuneList = buildNewFortunes(filteredExpectedFortuneList2, commissions);
// List<Fortune> newFortuneList = new ArrayList<>(); // List<Fortune> newFortuneList = new ArrayList<>();
// for (ExpectedFortune expectedFortune : filteredExpectedFortuneList) { // for (ExpectedFortune expectedFortune : filteredExpectedFortuneList) {
// Fortune fortune = new Fortune(); // Fortune fortune = new Fortune();
...@@ -593,10 +600,14 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss ...@@ -593,10 +600,14 @@ public class CommissionServiceImpl extends ServiceImpl<CommissionMapper, Commiss
// 查询预计入账信息 // 查询预计入账信息
List<CommissionExpected> commissionExpectedList = commissionExpectedService.lambdaQuery().in(CommissionExpected::getPolicyNo, policyNoSet).list(); List<CommissionExpected> commissionExpectedList = commissionExpectedService.lambdaQuery().in(CommissionExpected::getPolicyNo, policyNoSet).list();
// 预计入账映射, 根据保单号、期数、入账名称、币种映射 // 预计入账映射, 根据保单号、期数、入账名称、币种映射
try {
commissionExpectedMap = commissionExpectedList.stream() commissionExpectedMap = commissionExpectedList.stream()
.collect(Collectors.toMap( .collect(Collectors.toMap(
key -> key.getPolicyNo() + "_" + key.getCommissionPeriod() + "_" + key.getCommissionName() + "_" + key.getCurrency(), key -> key.getPolicyNo() + "_" + key.getCommissionPeriod() + "_" + key.getCommissionName() + "_" + key.getCurrency(),
Function.identity())); Function.identity()));
} catch (Exception e) {
throw new BusinessException(ResultCode.PARAMS_ERROR.getCode(), "该保单已存在当前币种、期数的佣金项目,请勿重复添加");
}
} }
List<Commission> commissionList = new ArrayList<>(); List<Commission> commissionList = new ArrayList<>();
......
...@@ -194,10 +194,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> ...@@ -194,10 +194,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
List<FnaForm> fnaFormList = fnaFormService.list(queryWrapper); List<FnaForm> fnaFormList = fnaFormService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(fnaFormList)) { if (CollectionUtils.isNotEmpty(fnaFormList)) {
FnaForm fnaForm = fnaFormList.get(0); FnaForm fnaForm = fnaFormList.get(0);
if (ObjectUtils.isNotEmpty(fnaForm.getDependantList())) { if (StringUtils.isNotBlank((CharSequence) fnaForm.getDependantList()) && !"null".equals(fnaForm.getDependantList())) {
List<DependantData> dependantList = GSONUtil.fromJson((String) fnaForm.getDependantList(), new TypeToken<List<DependantData>>() { List<DependantData> dependantList = GSONUtil.fromJson((String) fnaForm.getDependantList(), new TypeToken<List<DependantData>>() {
}.getType()); }.getType());
customer.setDependentsNum(dependantList.size()); customer.setDependentsNum(dependantList.size());
} else {
customer.setDependentsNum(0);
} }
} }
} }
......
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