|
|
@@ -50,9 +50,15 @@ public final class AnShengCrawlerQuoteResultsVoBuild {
|
|
|
String message = calculatePremiumApply.getMessage();
|
|
|
quoteResultsVo.setErrorMessage(message.contains("。") ? message.substring(0, message.indexOf("。")) : message);
|
|
|
return quoteResultsVo;
|
|
|
+ }else {
|
|
|
+ String repeatFlag = calculatePremiumApply.getData().getContracts().stream().map(c -> c.getPolicyBase().getRepeatFlag()).filter(StringUtils::isNotEmpty).findFirst().orElse(null);
|
|
|
+ if (StringUtils.isNotEmpty(repeatFlag)) {
|
|
|
+ quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+ quoteResultsVo.setErrorMessage("重复投保!此次投保与投保单号:" + repeatFlag + "相同,请去核心处理!");
|
|
|
+ return quoteResultsVo;
|
|
|
+ }
|
|
|
}
|
|
|
- List<AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO> contracts = calculatePremiumApply.getData()
|
|
|
- .getContracts();
|
|
|
+ List<AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO> contracts = calculatePremiumApply.getData().getContracts();
|
|
|
|
|
|
contracts.forEach(contract -> {
|
|
|
// 交强险
|
|
|
@@ -148,20 +154,39 @@ public final class AnShengCrawlerQuoteResultsVoBuild {
|
|
|
"scoreKey", "bussinessLevel",
|
|
|
"score", data.getBussinessLevel()
|
|
|
);
|
|
|
- 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);
|
|
|
- }
|
|
|
+
|
|
|
+ AnShengCrawlerCalculatePremiumApplyResponse.DataDTO.ContractsDTO contractsDTO =
|
|
|
+ data.getContracts().stream()
|
|
|
+ .filter(c -> c.getPlanDefine() != null)
|
|
|
+ .filter(c -> "105".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);
|
|
|
+
|
|
|
+ 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(bussinessLevel);
|
|
|
scoreVo.setScoreJson(scoreArray);
|
|
|
return scoreVo;
|