xuqiang 3 месяцев назад
Родитель
Сommit
202a7418e7

+ 43 - 48
tenant/insurance/quotation-dajia/src/main/java/com/jzg/quotation/dajia/crawler/build/DaJiaCrawlerQuoteResultsVoBuild.java

@@ -1,5 +1,6 @@
 package com.jzg.quotation.dajia.crawler.build;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
@@ -16,8 +17,11 @@ import com.jzg.quotation.dajia.crawler.entity.request.quote.BusinessInsuranceDTO
 import com.jzg.quotation.dajia.crawler.entity.request.quote.CompulsoryInsuranceDTO;
 import com.jzg.quotation.dajia.crawler.entity.response.DaJiaCrawlerOrderListRevisedResponse;
 import com.jzg.quotation.dajia.crawler.entity.response.DaJiaCrawlerSaveResponse;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.springframework.util.ObjectUtils;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -29,6 +33,8 @@ import java.util.stream.Collectors;
  **/
 public final class DaJiaCrawlerQuoteResultsVoBuild {
 
+    private static final Logger log = LogManager.getLogger(DaJiaCrawlerQuoteResultsVoBuild.class);
+
     private DaJiaCrawlerQuoteResultsVoBuild() {
         throw new IllegalStateException("Utility class");
     }
@@ -71,6 +77,7 @@ public final class DaJiaCrawlerQuoteResultsVoBuild {
         quoteResultsVo.setCiEndDate(compulsoryInsuranceProductInfo.getEndDate());
         quoteResultsVo.setBiStartDate(productInfo.getStartDate());
         quoteResultsVo.setBiEndDate(productInfo.getEndDate());
+        log.info("构建返回信息:{}",JSONObject.toJSONString(quoteResultsVo));
         return quoteResultsVo;
     }
 
@@ -156,9 +163,14 @@ public final class DaJiaCrawlerQuoteResultsVoBuild {
         BusinessInsuranceDTO businessInsurance = daJiaCrawlerSaveResponse.getBusinessInsurance(); // 商业险
         if (!ObjectUtils.isEmpty(compulsoryInsurance)) {
             scoreVo.setJqLossRation(StringUtils.isNotEmpty(compulsoryInsurance.getCoefficientInfo().getLossRatioCi()) ? compulsoryInsurance.getCoefficientInfo().getLossRatioCi() : null);
+            scoreVo.setCiClaims(String.valueOf(new BigDecimal(compulsoryInsurance.getCoefficientInfo().getLastPolicyNum()).intValue()));
+            scoreVo.setJqRenewal(compulsoryInsurance.getCoefficientInfo().getRenewalFrequency());
         }
-        if (!ObjectUtils.isEmpty(businessInsurance)) {
+        boolean sy = CollectionUtil.isNotEmpty(businessInsurance.getItemKinds());
+        if (sy) {
             scoreVo.setSyLossRation(StringUtils.isNotEmpty(businessInsurance.getCoefficientInfo().getLossRatioBi()) ? businessInsurance.getCoefficientInfo().getLossRatioBi() : null);
+            scoreVo.setBiClaims(String.valueOf(new BigDecimal(businessInsurance.getCoefficientInfo().getLastPolicyNum()).intValue()));
+            scoreVo.setSyRenewal(businessInsurance.getCoefficientInfo().getRenewalFrequency());
         }
         // 总赔付率 违章评分 高速风险分
         String carIllegalScore;
@@ -175,13 +187,9 @@ public final class DaJiaCrawlerQuoteResultsVoBuild {
         CompulsoryInsuranceDTO.CoefficientInfoDTO coefficientInfo = daJiaCrawlerSaveResponse.getCompulsoryInsurance().getCoefficientInfo();
         JSONArray scoreArray = new JSONArray();
         scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","交强定价评分")
-                .fluentPut("scoreKey","jqPubScores")
-                .fluentPut("score",compulsoryInsurance.getCoefficientInfo().getLossRatioCi()));
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","商业定价评分")
-                .fluentPut("scoreKey","syPubScores")
-                .fluentPut("score",businessInsurance.getCoefficientInfo().getLossRatioBi()));
+                .fluentPut("scoreName","交强类型评分")
+                .fluentPut("scoreKey","pubScores")
+                .fluentPut("score",compulsoryInsurance.getCoefficientInfo().getPubScores()));
         scoreArray.add(new JSONObject()
                 .fluentPut("scoreName","违章评分")
                 .fluentPut("scoreKey","carIllegalScore")
@@ -191,54 +199,41 @@ public final class DaJiaCrawlerQuoteResultsVoBuild {
                 .fluentPut("scoreKey","highwayScore")
                 .fluentPut("score",highwayScore));
         scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","醉酒驾驶行为违法次数")
-                .fluentPut("scoreKey","drunkTotalCoef")
-                .fluentPut("score",coefficientInfo.getDrunkTotalCoef()));
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","理赔调整系数")
-                .fluentPut("scoreKey","claimAdjustValue")
-                .fluentPut("score",coefficientInfo.getClaimAdjustValue()));
-        scoreVo.setScoreJson(scoreArray);
+                .fluentPut("scoreName","上年保单出险次数")
+                .fluentPut("scoreKey","lastPolicyNum")
+                .fluentPut("score",coefficientInfo.getLastPolicyNum()));
         scoreArray.add(new JSONObject()
                 .fluentPut("scoreName","交强险手续费")
                 .fluentPut("scoreKey","handFeeCi")
                 .fluentPut("score",coefficientInfo.getHandFeeCi()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","商业险手续费")
-                .fluentPut("scoreKey","handFeeBi")
-                .fluentPut("score",coefficientInfo.getHandFeeBi()));
-        scoreVo.setScoreJson(scoreArray);
         scoreArray.add(new JSONObject()
                 .fluentPut("scoreName","续保次数")
                 .fluentPut("scoreKey","renewalFrequency")
                 .fluentPut("score",coefficientInfo.getRenewalFrequency()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","违法调整系数")
-                .fluentPut("scoreKey","carIllegalScore")
-                .fluentPut("score",coefficientInfo.getCarIllegalScore()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","商业险连续承保年数")
-                .fluentPut("scoreKey","insureYears")
-                .fluentPut("score",coefficientInfo.getInsureYears()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","商业险建议折扣")
-                .fluentPut("scoreKey","suggestedDiscount")
-                .fluentPut("score",coefficientInfo.getSuggestedDiscount()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","无赔款优待系数")
-                .fluentPut("scoreKey","totalCoefNum")
-                .fluentPut("score",coefficientInfo.getTotalCoefNum()));
-        scoreVo.setScoreJson(scoreArray);
-        scoreArray.add(new JSONObject()
-                .fluentPut("scoreName","无赔优系数级别")
-                .fluentPut("scoreKey","claimAdjustLvl")
-                .fluentPut("score",coefficientInfo.getClaimAdjustLvl()));
-        scoreVo.setScoreJson(scoreArray);
+        if (sy){
+            BusinessInsuranceDTO.CoefficientInfoDTO coefficientInfo1 = businessInsurance.getCoefficientInfo();
+            scoreArray.add(new JSONObject()
+                    .fluentPut("scoreName","商业险建议折扣")
+                    .fluentPut("scoreKey","entireDiscount")
+                    .fluentPut("score",coefficientInfo1.getEntireDiscount()));
+            scoreVo.setScoreJson(scoreArray);
+            scoreArray.add(new JSONObject()
+                    .fluentPut("scoreName","商业险手续费")
+                    .fluentPut("scoreKey","handFeeBi")
+                    .fluentPut("score",coefficientInfo1.getHandFeeBi()));
+            scoreVo.setScoreJson(scoreArray);
+            scoreArray.add(new JSONObject()
+                    .fluentPut("scoreName","无赔款优待系数")
+                    .fluentPut("scoreKey","totalCoefNum")
+                    .fluentPut("score",coefficientInfo1.getTotalCoefNum()));
+            scoreVo.setScoreJson(scoreArray);
+            scoreArray.add(new JSONObject()
+                    .fluentPut("scoreName","商业类型评分")
+                    .fluentPut("scoreKey","pubScores")
+                    .fluentPut("score",coefficientInfo1.getPubScores()));
+            scoreVo.setScoreJson(scoreArray);
+         }
         return scoreVo;
     }
+
 }