Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

lixiaolong 1 bulan lalu
induk
melakukan
d204b2f1d1

+ 45 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/build/DaDiCrawlerQuoteResultVoBuild.java

@@ -6,6 +6,7 @@ import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.RiskInfoVo;
 import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
+import com.jzg.quotation.commons.constant.enums.quote.RenewalEnum;
 import com.jzg.quotation.commons.utils.DateTimeUtil;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiQuoteResponse;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiVehiclePricResponse;
@@ -14,6 +15,7 @@ import org.apache.http.util.TextUtils;
 
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * @author Liub
@@ -65,6 +67,14 @@ public class DaDiCrawlerQuoteResultVoBuild {
 
         // 保司评分数据(用于规则引擎匹配)
         QuoteResultsVo.ScoreVo scoreVo = new QuoteResultsVo.ScoreVo();
+        DaDiQuoteResponse.InsurancePlanDTO insurancePlan = daDiQuoteResponse.getInsurancePlan();
+        // 出险次数、续保标志
+        if (Objects.nonNull(insurancePlan)) {
+            scoreVo.setCiClaims(insurancePlan.getClaimTimes());
+            scoreVo.setBiClaims(insurancePlan.getClaimTimes());
+            scoreVo.setJqRenewal("0".equals(insurancePlan.getTrafficRenewalFlag()) ? String.valueOf(RenewalEnum.Transfer.getCode()) : String.valueOf(RenewalEnum.Renewal.getCode()));
+            scoreVo.setSyRenewal("0".equals(insurancePlan.getBusinessRenewalFlag()) ? String.valueOf(RenewalEnum.Transfer.getCode()) : String.valueOf(RenewalEnum.Renewal.getCode()));
+        }
         JSONArray scoreJson = new JSONArray();
         // 上年保费
         if (daDiQuoteResponse.getLastPremium() != null) {
@@ -108,6 +118,41 @@ public class DaDiCrawlerQuoteResultVoBuild {
                     .fluentPut("scoreKey", "xcarscore")
                     .fluentPut("score", daDiQuoteResponse.getXcarscore()));
         }
+        // 保险计划评分(出险次数、承保年数、续保标志、违章等级等)
+        if (Objects.nonNull(insurancePlan)) {
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "出险次数")
+                    .fluentPut("scoreKey", "claimTimes")
+                    .fluentPut("score", insurancePlan.getClaimTimes()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "承保年数")
+                    .fluentPut("scoreKey", "insureYears")
+                    .fluentPut("score", insurancePlan.getInsureYears()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "交强续保标志")
+                    .fluentPut("scoreKey", "trafficRenewalFlag")
+                    .fluentPut("score", insurancePlan.getTrafficRenewalFlag()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "交强续保类型")
+                    .fluentPut("scoreKey", "trafficRenewalType")
+                    .fluentPut("score", insurancePlan.getTrafficRenewalType()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "商业续保标志")
+                    .fluentPut("scoreKey", "businessRenewalFlag")
+                    .fluentPut("score", insurancePlan.getBusinessRenewalFlag()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "商业续保类型")
+                    .fluentPut("scoreKey", "businessRenewalType")
+                    .fluentPut("score", insurancePlan.getBusinessRenewalType()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "违章等级")
+                    .fluentPut("scoreKey", "violationLevel")
+                    .fluentPut("score", insurancePlan.getViolationLevel()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "商业险折扣率")
+                    .fluentPut("scoreKey", "cDiscountRate")
+                    .fluentPut("score", insurancePlan.getCDiscountRate()));
+        }
         scoreVo.setScoreJson(scoreJson);
         quoteResultsVo.setScoreVo(scoreVo);
 

+ 60 - 11
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/build/GuoRenCrawlerQuoteResultsVoBuild.java

@@ -7,6 +7,7 @@ import com.jzg.commons.constants.quote.enums.quote.KindCode;
 import com.jzg.commons.entity.quote.vo.KindInfoVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
+import com.jzg.quotation.guoren.crawler.entity.dto.CiInsureDemandDTO;
 import com.jzg.quotation.guoren.crawler.entity.response.GuoRenCrawlerBaseResponse;
 import com.jzg.quotation.guoren.crawler.entity.response.GuoRenCrawlerCalculationPremiumData;
 import com.jzg.quotation.guoren.crawler.entity.response.GuoRenCrawlerProposalNoSaveData;
@@ -72,26 +73,74 @@ public final class GuoRenCrawlerQuoteResultsVoBuild {
 
 
         QuoteResultsVo.ScoreVo scoreVo = new QuoteResultsVo.ScoreVo();
-        scoreVo.setLossRation(calculationPremium.getBc().getAutoPriceOutputXOMRespVo().getStrBillELR2());
-        scoreVo.setJqLossRation(calculationPremium.getBc().getAutoPriceOutputXOMRespVo().getStrBillCTPELR2());
-        scoreVo.setSyLossRation(calculationPremium.getBc().getAutoPriceOutputXOMRespVo().getStrBillCOMELR2());
-        scoreVo.setJqRenewal(Integer.parseInt(calculationPremium.getBc().getPrpTitemCar().getOriginalRouteRenewalFlagci()) + 1 + "");
-        scoreVo.setSyRenewal(Integer.parseInt(calculationPremium.getBc().getPrpTitemCar().getOriginalRouteRenewalFlagbi()) + 1 + "");
+        // 赔付率(总/交强/商业)
+        Optional.ofNullable(calculationPremium.getBc())
+                .map(GuoRenCrawlerCalculationPremiumData.BcDTO::getAutoPriceOutputXOMRespVo)
+                .ifPresent(autoPriceOutputXOMRespVo -> {
+                    scoreVo.setLossRation(autoPriceOutputXOMRespVo.getStrBillELR2());
+                    scoreVo.setJqLossRation(autoPriceOutputXOMRespVo.getStrBillCTPELR2());
+                    scoreVo.setSyLossRation(autoPriceOutputXOMRespVo.getStrBillCOMELR2());
+                });
+        // 续保/转保标志
+        Optional.ofNullable(calculationPremium.getBc())
+                .map(GuoRenCrawlerCalculationPremiumData.BcDTO::getPrpTitemCar)
+                .ifPresent(prpTitemCar -> {
+                    scoreVo.setJqRenewal(Integer.parseInt(prpTitemCar.getOriginalRouteRenewalFlagci()) + 1 + "");
+                    scoreVo.setSyRenewal(Integer.parseInt(prpTitemCar.getOriginalRouteRenewalFlagbi()) + 1 + "");
+                });
+        // 交强险出险次数
+        Optional.ofNullable(calculationPremium.getCi())
+                .map(GuoRenCrawlerCalculationPremiumData.CiDTO::getCiInsureDemand)
+                .map(CiInsureDemandDTO::getClaimTimes)
+                .ifPresent(scoreVo::setCiClaims);
+        // 商业险出险次数
+        Optional.ofNullable(calculationPremium.getBi())
+                .map(GuoRenCrawlerCalculationPremiumData.BiDTO::getCiInsureDemand)
+                .map(CiInsureDemandDTO::getClaimTimes)
+                .ifPresent(scoreVo::setBiClaims);
 
         // 保司评分
         JSONArray scoreJson = new JSONArray();
         //光博评分
-        scoreJson.add(new JSONObject()
-                .fluentPut("scoreName", "交强光博分")
-                .fluentPut("scoreKey", "jqScore")
-                .fluentPut("score", calculationPremium.getCi().getPrpTmainRate().getBillcomeGroup()));
-
-        if (calculationPremium.getBi().getPrpTmainRate() != null) {
+        Optional.ofNullable(calculationPremium.getCi())
+                .map(GuoRenCrawlerCalculationPremiumData.CiDTO::getPrpTmainRate)
+                .map(GuoRenCrawlerCalculationPremiumData.CiDTO.PrpTmainRateDTO::getBillcomeGroup)
+                .ifPresent(billcomeGroup -> scoreJson.add(new JSONObject()
+                        .fluentPut("scoreName", "交强光博分")
+                        .fluentPut("scoreKey", "jqScore")
+                        .fluentPut("score", billcomeGroup)));
+
+        if (calculationPremium.getBi() != null && calculationPremium.getBi().getPrpTmainRate() != null) {
             scoreJson.add(new JSONObject()
                     .fluentPut("scoreName", "商业光博分")
                     .fluentPut("scoreKey", "syScore")
                     .fluentPut("score", calculationPremium.getBi().getPrpTmainRate().getBillcomeGroup()));
         }
+        // 保司评分(阳光评分/全保评分/责任险评分/交强险评分/推荐折扣评分)
+        Optional.ofNullable(calculationPremium.getBc())
+                .map(GuoRenCrawlerCalculationPremiumData.BcDTO::getAutoPriceOutputXOMRespVo)
+                .ifPresent(autoPriceOutputXOMRespVo -> {
+                    scoreJson.add(new JSONObject()
+                            .fluentPut("scoreName", "阳光评分")
+                            .fluentPut("scoreKey", "sunlightScore")
+                            .fluentPut("score", autoPriceOutputXOMRespVo.getSunlightScore()));
+                    scoreJson.add(new JSONObject()
+                            .fluentPut("scoreName", "全保评分")
+                            .fluentPut("scoreKey", "fullCoverageScore")
+                            .fluentPut("score", autoPriceOutputXOMRespVo.getFullCoverageScore()));
+                    scoreJson.add(new JSONObject()
+                            .fluentPut("scoreName", "责任险评分")
+                            .fluentPut("scoreKey", "liabilityOnlyScore")
+                            .fluentPut("score", autoPriceOutputXOMRespVo.getLiabilityOnlyScore()));
+                    scoreJson.add(new JSONObject()
+                            .fluentPut("scoreName", "交强险评分")
+                            .fluentPut("scoreKey", "ctpOnlyScore")
+                            .fluentPut("score", autoPriceOutputXOMRespVo.getCtpOnlyScore()));
+                    scoreJson.add(new JSONObject()
+                            .fluentPut("scoreName", "推荐折扣评分")
+                            .fluentPut("scoreKey", "recommenDiscountScore")
+                            .fluentPut("score", autoPriceOutputXOMRespVo.getRecommenDiscountScore()));
+                });
         // 重试成功时,将提前记录的重复投保信息放入评分字段
         if (duplicateMessage != null) {
             scoreJson.add(new JSONObject()

+ 46 - 0
tenant/insurance/quotation-hengbang/src/main/java/com/jzg/quotation/hengbang/crawler/build/HbCrawlerQuoteResultVoBuild.java

@@ -9,6 +9,7 @@ import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.RiskInfoVo;
 import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
 import com.jzg.commons.util.StringUtils;
+import com.jzg.quotation.commons.constant.enums.quote.RenewalEnum;
 import com.jzg.quotation.commons.utils.DateTimeUtil;
 import com.jzg.quotation.hengbang.crawler.entity.response.HbCrawlerProposalResponse;
 import lombok.extern.slf4j.Slf4j;
@@ -57,6 +58,31 @@ public final class HbCrawlerQuoteResultVoBuild {
         quoteResultsVo.setKindInfoVo(buildKindInfoList(proposalResponse, quoteVo));
 
         QuoteResultsVo.ScoreVo scoreVo = new QuoteResultsVo.ScoreVo();
+        HbCrawlerProposalResponse.ForceCarInsureRiskDTO forceCarInsureRisk = proposalResponse.getForceCarInsureRisk();
+        HbCrawlerProposalResponse.BusiCarInsureRiskDTO busiCarInsureRisk = proposalResponse.getBusiCarInsureRisk();
+        // 交强险赔付率、出险次数
+        if (Objects.nonNull(forceCarInsureRisk)) {
+            scoreVo.setJqLossRation(forceCarInsureRisk.getBillctpelr());
+            scoreVo.setCiClaims(forceCarInsureRisk.getClaimTimes());
+        }
+        // 商业险赔付率、出险次数
+        if (Objects.nonNull(busiCarInsureRisk)) {
+            scoreVo.setSyLossRation(busiCarInsureRisk.getBillcomelr());
+            scoreVo.setBiClaims(busiCarInsureRisk.getClaimTimes());
+        }
+        // 总赔付率
+        if (Objects.nonNull(forceCarInsureRisk)) {
+            scoreVo.setLossRation(forceCarInsureRisk.getBillelr());
+        } else if (Objects.nonNull(busiCarInsureRisk)) {
+            scoreVo.setLossRation(busiCarInsureRisk.getBillelr());
+        }
+        // 续保/转保标志(0:转保,其他:续保)
+        HbCrawlerProposalResponse.CarInsureMainDTO carInsureMain = proposalResponse.getCarInsureMain();
+        if (Objects.nonNull(carInsureMain) && StringUtils.isNotBlank(carInsureMain.getRenewind())) {
+            String renewind = carInsureMain.getRenewind();
+            scoreVo.setJqRenewal(String.valueOf("0".equals(renewind) ? RenewalEnum.Transfer.getCode() : RenewalEnum.Renewal.getCode()));
+            scoreVo.setSyRenewal(String.valueOf("0".equals(renewind) ? RenewalEnum.Transfer.getCode() : RenewalEnum.Renewal.getCode()));
+        }
         // 保司评分
         JSONArray scoreJson = new JSONArray();
         if (proposalResponse.getForceLiability() != null && proposalResponse.getCarInsureLiabilityList().size() > 0) {
@@ -70,6 +96,26 @@ public final class HbCrawlerQuoteResultVoBuild {
             scoreJson.add(new JSONObject().fluentPut("scoreName", "交强光博分").fluentPut("scoreKey", "score").fluentPut("score", proposalResponse.getBusiCarInsureRisk().getBillelr2()));
 
         }
+        // 保司评分列表
+        if (CollUtil.isNotEmpty(proposalResponse.getCarInsureScoreList())) {
+            for (HbCrawlerProposalResponse.CarInsureScoreDTO carInsureScoreDTO : proposalResponse.getCarInsureScoreList()) {
+                scoreJson.add(new JSONObject()
+                        .fluentPut("scoreName", carInsureScoreDTO.getScoringType())
+                        .fluentPut("scoreKey", carInsureScoreDTO.getScoringType())
+                        .fluentPut("score", carInsureScoreDTO.getScoring()));
+            }
+        }
+        // 违章评分、承保年数
+        if (Objects.nonNull(forceCarInsureRisk)) {
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "违章评分")
+                    .fluentPut("scoreKey", "trafficViolationValue")
+                    .fluentPut("score", forceCarInsureRisk.getTrafficViolationValue()));
+            scoreJson.add(new JSONObject()
+                    .fluentPut("scoreName", "承保年数")
+                    .fluentPut("scoreKey", "insureYears")
+                    .fluentPut("score", forceCarInsureRisk.getInsureYears()));
+        }
         // 重试成功时,将提前记录的重复投保信息放入评分字段
         if (duplicateMessage != null) {
             scoreJson.add(new JSONObject().fluentPut("scoreName", "重复投保信息").fluentPut("scoreKey", "duplicateInfo").fluentPut("score", duplicateMessage));