|
|
@@ -21,6 +21,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
@@ -154,39 +155,33 @@ public final class AnShengCrawlerQuoteResultsVoBuild {
|
|
|
"scoreKey", "bussinessLevel",
|
|
|
"score", data.getBussinessLevel()
|
|
|
);
|
|
|
-
|
|
|
-
|
|
|
AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO contractsDTO =
|
|
|
data.getContracts().stream()
|
|
|
.filter(c -> c.getPlanDefine() != null)
|
|
|
- .filter(c -> "105".equals(c.getPlanDefine().getPlanCode()))
|
|
|
+ .filter(c -> "109".equals(c.getPlanDefine().getPlanCode()))
|
|
|
.findAny()
|
|
|
- .orElseThrow(() -> new IllegalStateException("未找到 planCode=105 的合约"));
|
|
|
- JSONObject compulsoryInsure = new JSONObject();
|
|
|
- compulsoryInsure.put("scoreName","交强存在费用");
|
|
|
- compulsoryInsure.put("scoreKey","compulsoryInsure");
|
|
|
- compulsoryInsure.put("score",contractsDTO.getPlanDefine().getCompulsoryInsure() ? "是" : "否");
|
|
|
- scoreArray.add(compulsoryInsure);
|
|
|
+ .orElse(null);
|
|
|
+ for (AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO contract : data.getContracts()) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (StringUtils.equals("105",contract.getPlanDefine().getPlanCode())){
|
|
|
+ jsonObject.put("scoreName","交强存在费用");
|
|
|
+ jsonObject.put("scoreKey","compulsoryInsure");
|
|
|
+ jsonObject.put("score",contract.getPlanDefine().getCompulsoryInsure() ? "是" : "否");
|
|
|
+ }else if (StringUtils.equals("109",contract.getPlanDefine().getPlanCode())){
|
|
|
+ jsonObject.put("scoreName","商业存在费用");
|
|
|
+ jsonObject.put("scoreKey","businessInsure");
|
|
|
+ jsonObject.put("score",contract.getPlanDefine().getBusinessInsure() ? "是" : "否");
|
|
|
+ }
|
|
|
|
|
|
- JSONObject businessInsure = new JSONObject();
|
|
|
- businessInsure.put("scoreName","商业存在费用");
|
|
|
- businessInsure.put("scoreKey","businessInsure");
|
|
|
- businessInsure.put("score",contractsDTO.getPlanDefine().getBusinessInsure() ? "是" : "否");
|
|
|
- scoreArray.add(businessInsure);
|
|
|
-// for (AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO contract : data.getContracts()) {
|
|
|
-// JSONObject jsonObject = new JSONObject();
|
|
|
-// if (StringUtils.equals("105",contract.getPlanDefine().getPlanCode())){
|
|
|
-// jsonObject.put("scoreName","交强存在费用");
|
|
|
-// jsonObject.put("scoreKey","compulsoryInsure");
|
|
|
-// jsonObject.put("score",contract.getPlanDefine().getCompulsoryInsure() ? "是" : "否");
|
|
|
-// }else if (StringUtils.equals("109",contract.getPlanDefine().getPlanCode())){
|
|
|
-// jsonObject.put("scoreName","商业存在费用");
|
|
|
-// jsonObject.put("scoreKey","businessInsure");
|
|
|
-// jsonObject.put("score",contract.getPlanDefine().getBusinessInsure() ? "是" : "否");
|
|
|
-// }
|
|
|
-//
|
|
|
-// scoreArray.add(jsonObject);
|
|
|
-// }
|
|
|
+ scoreArray.add(jsonObject);
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(contractsDTO)){
|
|
|
+ JSONObject claimTimes = new JSONObject();
|
|
|
+ claimTimes.put("scoreName","连续承保期间出险次数");
|
|
|
+ claimTimes.put("scoreKey","claimTimes");
|
|
|
+ claimTimes.put("score",contractsDTO.getVehicle().getPolicyPricing().getClaimTimes());
|
|
|
+ scoreArray.add(claimTimes);
|
|
|
+ }
|
|
|
scoreArray.add(bussinessLevel);
|
|
|
scoreVo.setScoreJson(scoreArray);
|
|
|
return scoreVo;
|