Просмотр исходного кода

人保驾意险相关代码提交

wanghao 1 месяц назад
Родитель
Сommit
d090cd4279

+ 4 - 0
tenant/insurance/quotation-renbaonew/src/main/java/com/jzg/quotation/renbaonew/crawler/entity/response/RenBaoNewCrawlerQuoteResponse.java

@@ -148,6 +148,10 @@ public class RenBaoNewCrawlerQuoteResponse {
          * 上一年保险
          */
         private List<Map<String, Object>> ReInsureItems;
+        /**
+         * 驾意险详情
+         */
+        private List<Map<String, Object>> UnionRMsgVoList;
     }
 
     /**

+ 67 - 15
tenant/insurance/quotation-renbaonew/src/main/java/com/jzg/quotation/renbaonew/crawler/service/impl/RenBaoNewCrawlerRequestBuilder.java

@@ -2,6 +2,7 @@ package com.jzg.quotation.renbaonew.crawler.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.google.common.collect.Lists;
+import com.jzg.commons.entity.quote.vo.AccidentalDrivingVo;
 import com.jzg.commons.entity.quote.vo.CarInfoVo;
 import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
@@ -498,7 +499,12 @@ public class RenBaoNewCrawlerRequestBuilder {
         request.setOcrList(idList);
 
         // 驾意险处理 - 构建 prpCunion(如果没有驾意险则设置为null)
-        List<Map<String, Object>> prpCunion = buildPrpCunion(quoteVo, carInfo, gscomCode, headers, username);
+        List<Map<String, Object>> prpCunion = buildPrpCunion(
+                quoteVo, carInfo, gscomCode, comCodeDes,
+                handler1Code, handler1CodeUni, handler1CodeDes,
+                handlerCode, handlerCodeUni, handlerCodeDes,
+                businessNature, agentCode, agentName,
+                carChecker, carCheckerTranslate, headers, loginInfo.getUserCode());
         if (prpCunion != null && !prpCunion.isEmpty()) {
             request.setPrpCunion(prpCunion);
         }
@@ -922,27 +928,42 @@ public class RenBaoNewCrawlerRequestBuilder {
      * @param quoteVo 报价请求VO,包含险种列表
      * @param carInfo 车辆信息,用于获取座位数(EBS需要)
      * @param comCode 归属部门代码
+     * @param comCodeDes 归属部门名称
+     * @param handler1Code 归属人账号
+     * @param handler1CodeUni 归属人统一工号
+     * @param handler1CodeDes 归属人名称
+     * @param handlerCode 经办人账号
+     * @param handlerCodeUni 经办人统一工号
+     * @param handlerCodeDes 经办人名称
+     * @param businessNature 业务性质
+     * @param agentCode 渠道代码
+     * @param agentName 渠道名称
+     * @param serviceManager 服务经理代码
+     * @param serviceManagerDes 服务经理名称
      * @param headers 请求头
-     * @param username 用户名
+     * @param userCode 当前登录账号
      * @return 非车险列表,为空表示不需要投保非车险
      */
-    private List<Map<String, Object>> buildPrpCunion(QuoteVo quoteVo, CarInfoVo carInfo,
-                                                     String comCode, HttpHeaders headers, String username) {
+    private List<Map<String, Object>> buildPrpCunion(
+            QuoteVo quoteVo, CarInfoVo carInfo, String comCode, String comCodeDes,
+            String handler1Code, String handler1CodeUni, String handler1CodeDes,
+            String handlerCode, String handlerCodeUni, String handlerCodeDes,
+            String businessNature, String agentCode, String agentName,
+            String serviceManager, String serviceManagerDes,
+            HttpHeaders headers, String userCode) {
+        List<AccidentalDrivingVo> accidentalDrivings = quoteVo.getAccidentalDrivings();
         List<Map<String, Object>> prpCunion = new ArrayList<>();
 
-        // 获取驾意险列表(从 quoteVo 中的 kindInfoVo 中筛选驾意险险种)
-        List<Map<String, Object>> kindMapList = convertKindInfoToMapList(quoteVo.getKindInfoVo());
-        if (kindMapList == null || kindMapList.isEmpty()) {
+        // 获取驾意险列表
+        if(accidentalDrivings == null || accidentalDrivings.isEmpty()){
             return prpCunion;
         }
-
-
-        for (Map<String, Object> kindMap : kindMapList) {
-            if (kindMap == null) {
+        for (AccidentalDrivingVo accidentalDriving : quoteVo.getAccidentalDrivings()) {
+            if (accidentalDriving == null) {
                 continue;
             }
 
-            String kindCode = getStringValue(kindMap, "kindCode");
+            String kindCode = accidentalDriving.getProductCode();
             if (kindCode == null || kindCode.isEmpty()) {
                 continue;
             }
@@ -985,11 +1006,31 @@ public class RenBaoNewCrawlerRequestBuilder {
                 continue;
             }
 
-            // 构建驾意险项
+            // 构建驾意险项,字段与Python版本Cunion保持一致
             Map<String, Object> unionItem = new HashMap<>();
+            unionItem.put("uCalculation", 1);
+            unionItem.put("uProposalNo", "");
             unionItem.put("uRiskPlanCode", rideRiskCode);
             unionItem.put("uRiskCode", unionRiskCode);
             unionItem.put("uRiskPlanInfo", uPlanInfos);
+            unionItem.put("uUserCode", userCode);
+            unionItem.put("comCodeDes", comCodeDes);
+            unionItem.put("comCode", comCode);
+            unionItem.put("handler1Code", handler1Code);
+            unionItem.put("handler1code_uni", handler1CodeUni);
+            unionItem.put("handler1CodeDes", handler1CodeDes);
+            unionItem.put("handlerCode", handlerCode);
+            unionItem.put("handlercode_uni", handlerCodeUni);
+            unionItem.put("handlerCodeDes", handlerCodeDes);
+            unionItem.put("businessNature", businessNature);
+            unionItem.put("agentCode", agentCode);
+            unionItem.put("agentName", agentName);
+            unionItem.put("makeCom", comCode);
+            unionItem.put("makeComDes", comCodeDes);
+            unionItem.put("serviceManager", serviceManager);
+            unionItem.put("serviceManagerDes", serviceManagerDes);
+            unionItem.put("isAccredit", "1");
+            unionItem.put("policyType", "1");
 
             // EAD(驾意险)数量固定为1,EBS(乘客意外险)数量为座位数
             if ("EAD".equals(unionRiskCode)) {
@@ -998,7 +1039,6 @@ public class RenBaoNewCrawlerRequestBuilder {
                 int seatCount = carInfo.getSeatCount() != null ? Integer.parseInt(carInfo.getSeatCount()) : 5;
                 unionItem.put("uNumPer", seatCount);
             }
-
             prpCunion.add(unionItem);
             log.info("Added union risk item: {}, count: {}", unionRiskCode, unionItem.get("uNumPer"));
         }
@@ -1073,7 +1113,7 @@ public class RenBaoNewCrawlerRequestBuilder {
         if (response == null) {
             return false;
         }
-        String status = (String) response.get("status");
+        String status = response.get("status").toString();
         String message = (String) response.get("message");
         return "0".equals(status) && "Success".equals(message);
     }
@@ -3680,6 +3720,18 @@ public class RenBaoNewCrawlerRequestBuilder {
                 }
             }
         }
+        // 驾意险处理
+        List<Map<String, Object>> unionRMsgVoList = data.getUnionRMsgVoList();
+        if(!unionRMsgVoList.isEmpty()){
+            List<Map<String, Object>> newPrpCunion =new ArrayList<>();
+            for(Map<String, Object> map :unionRMsgVoList){
+                Map m = new HashMap<>();
+                m.put("uProposalNo",map.get("uProposalNo"));
+                newPrpCunion.add(m);
+            }
+
+            request.setPrpCunion(newPrpCunion);
+        }
 
         prpCmain.put("sumPrem", sumPrem);
         prpCmain.put("sumPremTotal", sumPrem);

+ 20 - 0
tenant/insurance/quotation-renbaonew/src/main/java/com/jzg/quotation/renbaonew/crawler/service/impl/RenBaoNewCrawlerRequestImpl.java

@@ -836,6 +836,7 @@ public class RenBaoNewCrawlerRequestImpl implements RenBaoNewCrawlerRequest {
             Double ciPremium = 0.0;
             Double biPremium = 0.0;
             Double vvTax = 0.0;
+            Double niPremium = 0.0;
             QuoteResultsVo.CostsVo costs = new QuoteResultsVo.CostsVo();
 
             for (RenBaoNewCrawlerSaveResponse.CarQuoteTransProposalRsp rsp :
@@ -897,9 +898,28 @@ public class RenBaoNewCrawlerRequestImpl implements RenBaoNewCrawlerRequest {
             if (biPremium > 0 ) {
                 costs.setBiPremium(biPremium.toString());
             }
+            List<Map<String, Object>> unionRMsgVoList = quoteResponse.getData().getUnionRMsgVoList();
+            if(!unionRMsgVoList.isEmpty()){
+                if (unionRMsgVoList != null) {
+                    for (Map<String, Object> underwriting : unionRMsgVoList) {
+                        Object val = underwriting.get("uPremiums");
+                        if (val != null) {
+                            String strVal = val.toString();
+                            niPremium += Double.parseDouble(strVal);
+                        }
+                    }
+                    totalPremium += niPremium;
+
+                    RiskInfoVo jyRiskInfoVo = new RiskInfoVo();
+                    jyRiskInfoVo.setRiskCode(quoteVo.getAccidentalDrivings().get(0).getProductCode());
+                    resultsVo.setJyRiskInfoVo(jyRiskInfoVo);
+                    resultsVo.setJyPolicyNumber(unionRMsgVoList.get(0).get("uProposalNo").toString());
+                }
+            }
 
             costs.setSumPremium(totalPremium.toString());
             costs.setVvTax(vvTax.toString());
+            costs.setNiPremium(niPremium.toString());
             resultsVo.setCosts(costs);
         }