Commit 13dbdee7 by jianan

新单跟进同步预约信息17-预计来佣比例根据保单生效日期筛选

parent 72c73c8d
...@@ -47,6 +47,8 @@ import java.io.IOException; ...@@ -47,6 +47,8 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -514,7 +516,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte ...@@ -514,7 +516,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
// 匹配规格并获取不匹配的条件 // 匹配规格并获取不匹配的条件
MatchResult matchResult = matchExpectedSpecies( MatchResult matchResult = matchExpectedSpecies(
expectedSpeciesList, paymentTerm, reconciliationCompanyBizId, expectedSpeciesList, paymentTerm, reconciliationCompanyBizId,
policyHolderAge, paymentPremium); policyHolderAge, paymentPremium, effectiveDate);
if (matchResult.getMatchedList().isEmpty()) { if (matchResult.getMatchedList().isEmpty()) {
String errorMsg = matchResult.getUnmatchedConditions().isEmpty() String errorMsg = matchResult.getUnmatchedConditions().isEmpty()
...@@ -611,7 +613,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte ...@@ -611,7 +613,7 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
*/ */
private MatchResult matchExpectedSpecies(List<ApiExpectedSpeciesListResponse> expectedSpeciesList, private MatchResult matchExpectedSpecies(List<ApiExpectedSpeciesListResponse> expectedSpeciesList,
String paymentTerm, String reconciliationCompanyId, String paymentTerm, String reconciliationCompanyId,
Integer policyHolderAge, BigDecimal paymentPremium) { Integer policyHolderAge, BigDecimal paymentPremium, Date effectiveDate) {
List<String> unmatchedConditions = new ArrayList<>(); List<String> unmatchedConditions = new ArrayList<>();
List<ApiExpectedSpeciesListResponse> currentList = expectedSpeciesList; List<ApiExpectedSpeciesListResponse> currentList = expectedSpeciesList;
...@@ -644,9 +646,22 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte ...@@ -644,9 +646,22 @@ public class CommissionExpectedServiceImpl extends ServiceImpl<CommissionExpecte
i -> containsValue(i.getSpeciesJson(), "PREMIUM", Convert.toStr(paymentPremium)), i -> containsValue(i.getSpeciesJson(), "PREMIUM", Convert.toStr(paymentPremium)),
unmatchedConditions, "保费[" + paymentPremium + "]"); unmatchedConditions, "保费[" + paymentPremium + "]");
// 检查生效日期
currentList = filterAndCheck(currentList,
i -> isEffective(i.getEffectiveStart(), i.getEffectiveEnd(), effectiveDate),
unmatchedConditions, "生效日期[" + effectiveDate + "]");
if (unmatchedConditions.size() > 0) {
return new MatchResult(Collections.emptyList(), unmatchedConditions);
}
return new MatchResult(currentList, unmatchedConditions); return new MatchResult(currentList, unmatchedConditions);
} }
private boolean isEffective(LocalDateTime effectiveStart, LocalDateTime effectiveEnd, Date effectiveDate) {
LocalDateTime effectiveDateLocal = effectiveDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
return effectiveDateLocal.isAfter(effectiveStart) && effectiveDateLocal.isBefore(effectiveEnd);
}
/** /**
* 过滤列表并检查是否为空 * 过滤列表并检查是否为空
* *
......
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