Ver código fonte

Merge remote-tracking branch 'origin/master'

wangrq 3 meses atrás
pai
commit
dc25807729
13 arquivos alterados com 345 adições e 185 exclusões
  1. 1 1
      commons/src/main/java/com/jzg/commons/entity/vo/PtlAgreementCostRuleVo.java
  2. 2 2
      tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/entity/request/PremiumCalculationRequest.java
  3. 10 9
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/dto/GuoRenBiDTO.java
  4. 21 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/dto/PrptengageListDTO.java
  5. 6 3
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/request/GuoRenCrawlerProposalNoSaveRequest.java
  6. 59 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/service/impl/GuoRenCrawlerRequestImpl.java
  7. 17 1
      tenant/insurance/quotation-huanong/src/main/java/com/jzg/quotation/huanong/crawler/entity/request/HuaNongCrawlerQuotedPriceRequestRequest.java
  8. 3 3
      tenant/insurance/quotation-huanong/src/main/java/com/jzg/quotation/huanong/crawler/service/impl/HuaNongCrawlerRequestImpl.java
  9. 5 4
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/component/HtCrawlerRequestComponent.java
  10. 43 42
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Request/HtCrawlerQuoteRequest.java
  11. 157 111
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java
  12. 4 6
      tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/Impl/ZhongAnCrawlerRequestImpl.java
  13. 17 3
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

+ 1 - 1
commons/src/main/java/com/jzg/commons/entity/vo/PtlAgreementCostRuleVo.java

@@ -11,7 +11,7 @@ import java.util.List;
 
 @Schema(description = "规则条件集合")
 @Data
-public class PtlAgreementCostRuleVo{
+public class  PtlAgreementCostRuleVo{
 
     @Schema(description = "ID")
     private String id;

+ 2 - 2
tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/entity/request/PremiumCalculationRequest.java

@@ -503,7 +503,7 @@ public class PremiumCalculationRequest {
          * 功率 摩托车拖拉机传
          */
         @JacksonXmlProperty(localName = "power")
-        private Integer power;
+        private String power;
 
         /**
          * 设计最高时速 摩托车传
@@ -608,7 +608,7 @@ public class PremiumCalculationRequest {
             } else {
                 this.displacement = vehicle.getVehicleDisplacement();
             }
-            this.power = Integer.valueOf(carInfoVo.getPowerScale());
+            this.power = carInfoVo.getPowerScale();
             if (carInfoVo.getEnergyTypeCode().equals("0")) {
                 this.energyFlag = "0";
             } else {

+ 10 - 9
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/dto/GuoRenBiDTO.java

@@ -124,9 +124,17 @@ public class GuoRenBiDTO {
             this.inputRisk = 1;
             this.prpTmain = new GuoRenPrpTmainDTO(biRiskInfoVo, today);
             this.prpTmainRate = new GuoRenPrpTmainRateDTO();
+            prpTmain.setStartDate(TimeUtils.extractDate(biRiskInfoVo.getStartDate()));
+            prpTmain.setStartHour(Integer.valueOf(TimeUtils.extractHour(biRiskInfoVo.getStartDate())));
+            prpTmain.setStartMinute(Integer.valueOf(TimeUtils.extractMinute(biRiskInfoVo.getStartDate())));
+            prpTmain.setEndDate(TimeUtils.extractDate(biRiskInfoVo.getEndDate()));
+            prpTmain.setEndHour(24);
+            prpTmain.setEndMinute(0);
+            this.prptitemkindList = GuoRenCrawlerCalculationPremiumRequest.PrptitemkindListDTO.getBiPrptitemkindList(kindInfoVo, prpTmain);
+
         }
         this.prpTitemCar = prpTitemCar;
-        this.ciInsureDemand = new CiInsureDemandDTO("", "",quoteVo);
+        this.ciInsureDemand = new CiInsureDemandDTO("", "", quoteVo);
         this.ciInsureDemandPay = new ArrayList<>();
         this.ciInsureDemandWarningClaim = new ArrayList<>();
         this.prpTenGearAllocationFeeList = new ArrayList<>();
@@ -137,13 +145,6 @@ public class GuoRenBiDTO {
                 infoVo.setAmount(prpTitemCar.getCompromisePrice());
             }
         }
-        prpTmain.setStartDate(TimeUtils.extractDate(biRiskInfoVo.getStartDate()));
-        prpTmain.setStartHour(Integer.valueOf(TimeUtils.extractHour(biRiskInfoVo.getStartDate())));
-        prpTmain.setStartMinute(Integer.valueOf(TimeUtils.extractMinute(biRiskInfoVo.getStartDate())));
-        prpTmain.setEndDate(TimeUtils.extractDate(biRiskInfoVo.getEndDate()));
-        prpTmain.setEndHour(24);
-        prpTmain.setEndMinute(0);
-        this.prptitemkindList = GuoRenCrawlerCalculationPremiumRequest.PrptitemkindListDTO.getBiPrptitemkindList(kindInfoVo, prpTmain);
         this.prptengageList = new ArrayList<>();
         this.prpDclause = new ArrayList<>();
         this.prpTcarDeviceCount = new PrpTcarDeviceCountDTO();
@@ -155,7 +156,7 @@ public class GuoRenBiDTO {
         this.blPrpTRealNameVerification = new ArrayList<>();
         this.prpTLastCarShipTax = new PrpTLastCarShipTaxDTO();
         this.duplicateInsuranceItemsSchema = new DuplicateInsuranceItemsSchemaDTO();
-        this.prpTChannel = new PrpTChannelDTO("","","");
+        this.prpTChannel = new PrpTChannelDTO("", "", "");
 
         this.inputRisk0518 = 1;
         this.inputRisk0521 = 0;

+ 21 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/dto/PrptengageListDTO.java

@@ -1,11 +1,14 @@
 package com.jzg.quotation.guoren.crawler.entity.dto;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.quotation.guoren.api.entity.vo.GuoRenSpecialAgreementVo;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serial;
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 @Data
 @NoArgsConstructor
@@ -32,4 +35,22 @@ public class PrptengageListDTO implements Serializable {
     @JsonProperty("flag")
     private String flag;
 
+    public PrptengageListDTO(GuoRenSpecialAgreementVo specialAgreementVo, int serialNo) {
+        this.serialNo = serialNo;
+        this.clauseCode = specialAgreementVo.getClauseCode();
+        this.clauses = specialAgreementVo.getClauses();
+        this.clausesContext = specialAgreementVo.getClausesContext();
+    }
+
+    /**
+     * 将特约VO列表转换为PrptengageListDTO列表
+     */
+    public static List<PrptengageListDTO> fromSpecialAgreementVo(List<GuoRenSpecialAgreementVo> specialAgreementVos) {
+        List<PrptengageListDTO> result = new ArrayList<>();
+        for (int i = 0; i < specialAgreementVos.size(); i++) {
+            result.add(new PrptengageListDTO(specialAgreementVos.get(i), i + 1));
+        }
+        return result;
+    }
+
 }

+ 6 - 3
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/request/GuoRenCrawlerProposalNoSaveRequest.java

@@ -30,15 +30,18 @@ public class GuoRenCrawlerProposalNoSaveRequest implements Serializable {
     private GuoRenCrawlerCalculationPremiumData.CiDTO ci;
 
     public GuoRenCrawlerProposalNoSaveRequest(QuoteVo quoteVo, GuoRenCrawlerCalculationPremiumData guoRenCrawlerCalculationPremiumData, GuoRenCrawlerCalculationPremiumRequest calculationPremiumRequest) {
+        GuoRenCrawlerCalculationPremiumData.BiDTO biDto = guoRenCrawlerCalculationPremiumData.getBi();
         this.bc = calculationPremiumRequest.getBc();
         this.bc.getPrpTmain().setCaptcha("");
         this.bc.getPrpTmain().setEProposalFlag("1");
         this.basePartVo = calculationPremiumRequest.getBasePartVo();
         guoRenCrawlerCalculationPremiumData.getCi().getCiInsureDemand().setTonCount(quoteVo.getCarInfoVo().getTonCount());
         guoRenCrawlerCalculationPremiumData.getCi().getCiInsureDemand().setSeatCount(quoteVo.getCarInfoVo().getSeatCount());
-        guoRenCrawlerCalculationPremiumData.getBi().getCiInsureDemand().setTonCount(quoteVo.getCarInfoVo().getTonCount());
-        guoRenCrawlerCalculationPremiumData.getBi().getCiInsureDemand().setSeatCount(quoteVo.getCarInfoVo().getSeatCount());
-        this.bi = guoRenCrawlerCalculationPremiumData.getBi();
+        if (biDto.getCiInsureDemand() != null) {
+            guoRenCrawlerCalculationPremiumData.getBi().getCiInsureDemand().setTonCount(quoteVo.getCarInfoVo().getTonCount());
+            guoRenCrawlerCalculationPremiumData.getBi().getCiInsureDemand().setSeatCount(quoteVo.getCarInfoVo().getSeatCount());
+        }
+        this.bi = biDto;
         this.ci = guoRenCrawlerCalculationPremiumData.getCi();
     }
 

+ 59 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/service/impl/GuoRenCrawlerRequestImpl.java

@@ -1,7 +1,9 @@
 package com.jzg.quotation.guoren.crawler.service.impl;
 
+import com.jzg.commons.constants.InsuranceRisk;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.commons.entity.orders.po.InsOrders;
+import com.jzg.commons.entity.po.InsCompanyClause;
 import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.aggregated.*;
@@ -14,12 +16,14 @@ import com.jzg.quotation.commons.entity.GetCaptchaRequest;
 import com.jzg.quotation.commons.entity.GetCaptchaResponse;
 import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
 import com.jzg.quotation.commons.utils.TimeProcessing;
+import com.jzg.quotation.guoren.api.entity.vo.GuoRenSpecialAgreementVo;
 import com.jzg.quotation.guoren.crawler.build.GuoRenCrawlerQuoteResultsVoBuild;
 import com.jzg.quotation.guoren.crawler.component.GuoRenCrawlerRequestComponent;
 import com.jzg.quotation.guoren.crawler.constant.enums.RequestUrl;
 import com.jzg.quotation.guoren.crawler.entity.GuoRenCrawlerConfigureParameters;
 import com.jzg.quotation.guoren.crawler.entity.dto.GuoRenPrpTitemCarDTO;
 import com.jzg.quotation.guoren.crawler.entity.dto.PrpTMainDTO;
+import com.jzg.quotation.guoren.crawler.entity.dto.PrptengageListDTO;
 import com.jzg.quotation.guoren.crawler.entity.po.GuoRenCrawlerOrder;
 import com.jzg.quotation.guoren.crawler.entity.po.OrderCommon;
 import com.jzg.quotation.guoren.crawler.entity.request.GuoRenCrawlerCalculationPremiumRequest;
@@ -32,9 +36,11 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 @QuoteCrawlerService(value = InsuranceCode.INSURANCE_XDCX)
 @Service
@@ -90,8 +96,25 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
         GuoRenCrawlerWriteBackAddressData policyHolderAddr = writeBackAddress(quoteVo.getPolicyHolderInfo().getAddr(), quoteVo.getOwnersInfo().getAddr(), ownersAddr, headers);
         // 被保人 回填地址信息
         GuoRenCrawlerWriteBackAddressData insuredPersonAddr = writeBackAddress(quoteVo.getInsuredPersonInfo().getAddr(), quoteVo.getPolicyHolderInfo().getAddr(), ownersAddr, headers);
+        // 获取并处理特约数据
+        List<GuoRenSpecialAgreementVo> specialAgreements = getSpecialAgreements(quoteVo);
+        // 处理车主约定特约T0028占位符替换
+        processSpecialAgreementT0028(specialAgreements, quoteVo);
         // 保费计算
         GuoRenCrawlerCalculationPremiumRequest crawlerCalculationPremiumRequest = new GuoRenCrawlerCalculationPremiumRequest(quoteVo, prpTmainDTO, prpTitemCar, policyHolderAddr, insuredPersonAddr, insuredTypeTmp);
+        // 按险种设置特约数据
+        if (crawlerCalculationPremiumRequest.getCi() != null) {
+            List<GuoRenSpecialAgreementVo> trafficSpecialAgreements = specialAgreements.stream()
+                    .filter(x -> InsuranceRisk.TRAFFIC.getCode().equals(x.getRiskCode()))
+                    .collect(Collectors.toList());
+            crawlerCalculationPremiumRequest.getCi().setPrptengageList(PrptengageListDTO.fromSpecialAgreementVo(trafficSpecialAgreements));
+        }
+        if (crawlerCalculationPremiumRequest.getBi() != null) {
+            List<GuoRenSpecialAgreementVo> businessSpecialAgreements = specialAgreements.stream()
+                    .filter(x -> InsuranceRisk.BUSINESS.getCode().equals(x.getRiskCode()))
+                    .collect(Collectors.toList());
+            crawlerCalculationPremiumRequest.getBi().setPrptengageList(PrptengageListDTO.fromSpecialAgreementVo(businessSpecialAgreements));
+        }
         GuoRenCrawlerBaseResponse<GuoRenCrawlerCalculationPremiumData> calculationPremium = guoRenCrawlerRequestComponent.calculationPremium(crawlerCalculationPremiumRequest, headers);
         // 处理重复投保
         String message = calculationPremium.getResultMsg();
@@ -163,6 +186,42 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
         return null;
     }
 
+    /**
+     * 获取特约数据
+     * 从报价单中的特约条款列表转换为国任特约VO列表
+     *
+     * @param quoteVo 报价单
+     * @return 特约VO列表(按交强/商业险拆分)
+     */
+    private List<GuoRenSpecialAgreementVo> getSpecialAgreements(QuoteVo quoteVo) {
+        List<InsCompanyClause> companyClauseVos = quoteVo.getSpecialInfoVo();
+        List<GuoRenSpecialAgreementVo> list = new ArrayList<>();
+        for (InsuranceRisk insuranceRisk : InsuranceRisk.getInsuranceRisk()) {
+            List<GuoRenSpecialAgreementVo> collect = companyClauseVos.stream()
+                    .map(x -> new GuoRenSpecialAgreementVo(x, insuranceRisk))
+                    .collect(Collectors.toList());
+            list.addAll(collect);
+        }
+        return list;
+    }
+
+    /**
+     * 处理T0028车主约定特约,替换占位符
+     * 将特约内容中的下划线占位符替换为被保人姓名和车主姓名
+     *
+     * @param specialAgreements 特约列表
+     * @param quoteVo           报价单
+     */
+    private void processSpecialAgreementT0028(List<GuoRenSpecialAgreementVo> specialAgreements, QuoteVo quoteVo) {
+        specialAgreements.forEach(item -> {
+            if ("T0028".equals(item.getClauseCode())) {
+                String replace = item.getClausesContext().replaceFirst("_", quoteVo.getInsuredPersonInfo().getName());
+                replace = replace.replaceFirst("_", quoteVo.getOwnersInfo().getName());
+                item.setClausesContext(replace);
+            }
+        });
+    }
+
     @Override
     public UnderwritingResultsVo underwriting(UnderwritingVo underwritingVo) throws Exception {
         String username = underwritingVo.getOrder().getAttributionInformationVo().getUsername();

+ 17 - 1
tenant/insurance/quotation-huanong/src/main/java/com/jzg/quotation/huanong/crawler/entity/request/HuaNongCrawlerQuotedPriceRequestRequest.java

@@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64;
 import com.alibaba.fastjson2.annotation.JSONField;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.jzg.commons.entity.quote.vo.*;
+import com.jzg.commons.exception.SystemException;
 import com.jzg.quotation.commons.utils.TimeProcessing;
 import com.jzg.quotation.huanong.crawler.constant.enums.JiaYiXianProduct;
 import com.jzg.quotation.huanong.crawler.entity.HuaNongCrawlerConfigureParameters;
@@ -228,6 +229,21 @@ public class HuaNongCrawlerQuotedPriceRequestRequest implements HuaNongHeadReque
             // 险种:根据车型查询返回的 energyTypes 判断是否新能源车(0=燃油,4=其他混动,其他=新能源)
             String energyTypes = carModelDTO != null && carModelDTO.getFullCarData() != null ? carModelDTO.getFullCarData().getEnergyTypes() : null;
             boolean isNewEnergy = energyTypes != null && !"0".equals(energyTypes) && !"4".equals(energyTypes);
+            List<KindInfoVo> kindInfoVos = quoteVo.getKindInfoVo();
+            if(kindInfoVos != null && kindInfoVos.size() >0){
+                kindInfoVos.forEach(kind->{
+                    kind.setUnitAmount(kind.getAmount());
+                    if(kind.getKindCode().equals("D4")){
+                        String seatCount = quoteVo.getCarInfoVo().getSeatCount();
+                        if(seatCount.isEmpty()){
+                            throw new SystemException("未填写座位数信息");
+                        }
+                        kind.setAmount((Integer.parseInt(seatCount)-1) * Integer.parseInt(kind.getAmount())+"");
+                        kind.setQuantity(Integer.parseInt(seatCount)-1+"");
+                    }
+                });
+            }
+
             this.contract = ContractDTO.build(quoteVo.getCiRiskInfoVo(), quoteVo.getBiRiskInfoVo(), quoteVo.getKindInfoVo(), quoteVo.getInsuredPersonInfo(), isNewEnergy);
             // 人员
             this.customer = CustomerDTO.build(quoteVo.getPolicyHolderInfo(), quoteVo.getInsuredPersonInfo(), quoteVo.getOwnersInfo(), this.saleInfo.agentCode, this.saleInfo.comCode);
@@ -2896,7 +2912,7 @@ public class HuaNongCrawlerQuotedPriceRequestRequest implements HuaNongHeadReque
                     this.vat = 0;
                     this.vatChg = 0;
                     this.calculateFlag1 = "";
-                    this.choosed = false;
+                    this.choosed = true;
                     this.notDeductibleFlag = false;
                     this.optNotDeductibleFlag = 0;
                     this.ductibleRate = "";

+ 3 - 3
tenant/insurance/quotation-huanong/src/main/java/com/jzg/quotation/huanong/crawler/service/impl/HuaNongCrawlerRequestImpl.java

@@ -338,13 +338,13 @@ public class HuaNongCrawlerRequestImpl implements HuaNongCrawlerRequest {
 
         response = processDuplicateInsurance(request, response, httpHeaders);
 
-        boolean stillDuplicate = hasDuplicateInsurance(response);
+        /*boolean stillDuplicate = hasDuplicateInsurance(response);
         if (stillDuplicate) {
             log.info("第一次重试后仍存在重复投保,日期向后推迟一天进行第二次重试");
             response = processDuplicateInsuranceWithOneMoreDay(request, response, httpHeaders);
-        }
+        }*/
 
-        return checkAndHandleRemainingDuplicate(response, false);
+        return checkAndHandleRemainingDuplicate(response, true);
     }
 
     private HuaNongCrawlerQuotedPriceResponse processDuplicateInsurance(

+ 5 - 4
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/component/HtCrawlerRequestComponent.java

@@ -15,6 +15,7 @@ import com.jzg.quotation.huatai.crawler.entity.dto.LoginDTO;
 import com.jzg.quotation.huatai.crawler.properties.HuaTaiCrawlerProperties;
 import com.jzg.quotation.commons.utils.HtEncryptDecryptUtils;
 import com.jzg.quotation.huatai.crawler.util.CookieUtils;
+import com.jzg.quotation.huatai.crawler.util.CryptoUtil;
 import com.jzg.quotation.huatai.crawler.util.HuaTaiCryptUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -156,8 +157,8 @@ public class HtCrawlerRequestComponent {
         log.info("huatai_cookie:{}", cookie);
         ResponseEntity<HtCrawlerCarQueryResponse> carQueryResponseEntity = requestComponent.objectPostWithProxy(RequestUrl.CAR_QUERY.getRequestUrl(huaTaiCrawlerProperties.getBaseUrl()), htCrawlerCarQueryRequest, HtCrawlerCarQueryResponse.class, headers, proxyHostName, proxyPort);
         HtCrawlerCarQueryResponse carQueryResponse = carQueryResponseEntity.getBody();
-        String decryptKey = HuaTaiCryptUtil.RSADecrypt(carQueryResponse.getAccessToken());
-        String decryptData = HuaTaiCryptUtil.AESDecrypt(carQueryResponse.getData(), decryptKey);
+        String decryptKey = CryptoUtil.rsaDecrypt(carQueryResponse.getAccessToken());
+        String decryptData = CryptoUtil.aesDecrypt(carQueryResponse.getData(), decryptKey);
         System.out.println("carQueryResponse::"+JSONObject.parseObject(decryptData, HtCrawlerCarQueryResponse.DataDTO.class).toString());
         return JSONObject.parseObject(decryptData, HtCrawlerCarQueryResponse.DataDTO.class);
     }
@@ -186,8 +187,8 @@ public class HtCrawlerRequestComponent {
         headers.add("Referer", "https://cspxp.pc.ehuatai.com/htcsp/VehicleInfoEntryAction.do?cmd=saveOneStept");
         ResponseEntity<HtCrawlerQuoteResponse> responseEntity = requestComponent.objectPostWithProxy(RequestUrl.QUOTE_PRICE.getRequestUrl(huaTaiCrawlerProperties.getBaseUrl()), htCrawlerQuoteRequest, HtCrawlerQuoteResponse.class, headers, proxyHostName, proxyPort);
         HtCrawlerQuoteResponse quoteResponse = responseEntity.getBody();
-        String decryptKey = HuaTaiCryptUtil.RSADecrypt(quoteResponse.getAccessToken());
-        String decryptData = HuaTaiCryptUtil.AESDecrypt(quoteResponse.getData(), decryptKey);
+        String decryptKey = CryptoUtil.rsaDecrypt(quoteResponse.getAccessToken());
+        String decryptData = CryptoUtil.aesDecrypt(quoteResponse.getData(), decryptKey);
         log.info("HtCrawlerQuoteResponse:{}",JSONObject.toJSONString(quoteResponse));
         return decryptData;
     }

+ 43 - 42
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Request/HtCrawlerQuoteRequest.java

@@ -35,8 +35,8 @@ public class HtCrawlerQuoteRequest implements Serializable {
     @Serial
     private static final long serialVersionUID = -3648463870224027622L;
 
-    public HtCrawlerQuoteRequest(QuoteVo quoteVo, String mealid, String basePartJSON) {
-        DataDTO dataDTO = new DataDTO(quoteVo, mealid, basePartJSON);
+    public HtCrawlerQuoteRequest(QuoteVo quoteVo, String mealid, String basePartJSON, String personalInsuredJSON) {
+        DataDTO dataDTO = new DataDTO(quoteVo, mealid, basePartJSON, personalInsuredJSON);
         ObjectMapper objectMapper = new ObjectMapper();
         Map<String, Object> dataMap = objectMapper.convertValue(dataDTO, new TypeReference<Map<String, Object>>() {});
 
@@ -68,7 +68,7 @@ public class HtCrawlerQuoteRequest implements Serializable {
         @Serial
         private static final long serialVersionUID = 3131283514749202563L;
 
-        public DataDTO(QuoteVo quoteVo, String mealid, String basePartJSON) {
+        public DataDTO(QuoteVo quoteVo, String mealid, String basePartJSON, String personalInsuredJSON) {
             RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
             RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
             VehicleAndVesselTaxVo taxVo = quoteVo.getVehicleAndVesselTaxVo();
@@ -164,7 +164,7 @@ public class HtCrawlerQuoteRequest implements Serializable {
             this.SYxinxi = "0";
             this.PiLing = "0";
             this.pilingFlag = "2";
-            this.personalInsuredJSON = "";
+            this.personalInsuredJSON = personalInsuredJSON;
             this.relationno_bi = "";
             this.promotesaleplanid = "";
             this.disfeeregmaxbi = "";
@@ -511,32 +511,32 @@ public class HtCrawlerQuoteRequest implements Serializable {
         public static class PersonalInsuredDTO implements Serializable {
             @Serial
             private static final long serialVersionUID = 1729064286503004418L;
-            private String butouflag;
+            private String butouflag = "";
             private String amount;
             private String car_limitloadperson;
-            private String isInsuredPassenger;
+            private String isInsuredPassenger = "0";
             private String productcode;
             private String productname;
             private String mealcode;
             private String mealname;
             private String startdate;
             private String enddate;
-            private String num;
+            private String num = "1";
             private String premium;
             private String formationJudiciary;
-            private String argueJudiciary;
-            private String newCarSalesProvince;
-            private String newCarSalesCity;
-            private String newCarSalesDistrict;
-            private String buildYear;
-            private String xiangxiAddress;
-            private String postalCode;
-            private String bulidTypeCode;
-            private String bulidTypeQiTaMes;
-            private String provinceName;
-            private String cityName;
-            private String regionName;
-            private String isInsuredSizesFlag;
+            private String argueJudiciary = "";
+            private String newCarSalesProvince = "";
+            private String newCarSalesCity = "";
+            private String newCarSalesDistrict = "";
+            private String buildYear = "";
+            private String xiangxiAddress = "";
+            private String postalCode = "";
+            private String bulidTypeCode = "";
+            private String bulidTypeQiTaMes = "";
+            private String provinceName = "";
+            private String cityName = "";
+            private String regionName = "";
+            private String isInsuredSizesFlag = "0";
             private List<PerinsuredDTO> perinsuredList;
 
             @Data
@@ -544,34 +544,35 @@ public class HtCrawlerQuoteRequest implements Serializable {
                 @Serial
                 private static final long serialVersionUID = 4914844581040597499L;
                 private String productcode;
-                private String mark;
+                private String mark = "1";
                 private String insuredname;
                 private String certitype;
                 private String certicode;
                 private String age;
                 private String gender;
-                private String perProWithCarStartDate;
+                private String perProWithCarStartDate = "";
+                private String perProWithCarEndDate = "";
                 private String relation;
-                private String job;
-                private String parentcode;
-                private String parentname;
-                private String parametercode;
-                private String parametername;
-                private String codecode;
-                private String codecname;
-                private String risktype;
-                private String jobtype;
-                private String customerno;
-                private String workname;
-                private String workphone;
-                private String yearmoney;
-                private String workaddress;
-                private String otherphone;
-                private String otheraddress;
-                private String mobile;
-                private String urgentname;
-                private String urgentmobile;
-                private String nationality;
+                private String job = "";
+                private String parentcode = "";
+                private String parentname = "";
+                private String parametercode = "";
+                private String parametername = "";
+                private String codecode = "";
+                private String codecname = "";
+                private String risktype = "";
+                private String jobtype = "";
+                private String customerno = "";
+                private String workname = "";
+                private String workphone = "";
+                private String yearmoney = "";
+                private String workaddress = "";
+                private String otherphone = "";
+                private String otheraddress = "";
+                private String mobile = "";
+                private String urgentname = "";
+                private String urgentmobile = "";
+                private String nationality = "CHN";
             }
         }
 

+ 157 - 111
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java

@@ -5,13 +5,17 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.jzg.commons.constants.ProductsType;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.po.jyxSetting;
 import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
 import com.jzg.commons.entity.quote.vo.CarInfoVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.aggregated.*;
+import com.jzg.commons.entity.vo.JyxConfigVo;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.quotation.commons.annotation.QuoteCrawlerService;
+import com.jzg.quotation.commons.client.PlatformClient;
 import com.jzg.quotation.commons.constant.InsuranceCode;
 import com.jzg.commons.entity.quote.vo.base.LoginBase;
 import com.jzg.commons.entity.quote.vo.base.OrderBase;
@@ -70,6 +74,7 @@ import java.security.cert.X509Certificate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -91,6 +96,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
     private final HtCrawlerOrderService htCrawlerOrderService;
 
+    private final PlatformClient platformClient;
+
     @Value("${huatai.api.username}")
     private String username;
 
@@ -100,8 +107,6 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     @Value("${huatai.api.comcode}")
     private String comcode;
 
-    private String basePartJSON = "";
-
     // 特殊账号列表
     private final List<String> specialUsers = Arrays.asList(
             "EA27000180", "EA27000401", "EA27000098", "EA27000076",
@@ -109,7 +114,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             "EA27000381", "EA27000394", "XN9279003"
     );
 
-    private final ObjectMapper objectMapper = new ObjectMapper();
+    private static final ObjectMapper objectMapper = new ObjectMapper();
 
     private Map<String, Object> gsInfo = new HashMap<>();
 
@@ -433,6 +438,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     @NotNull
     private Result2 getResult2(QuoteVo quoteVo, int retryCount, int maxRetries, boolean success, Result result, String quotationNo, LoginDTO loginDTO, Map<String, Object> gsInfo, String cookie, HtCrawlerQuoteResponse.DataDTO quoteResponseData, AttributionInformationVo attributionInformationVo) {
         HttpHeaders headers2;
+        String basePartJSON = "";
+        String personalInsuredJSONString = "";
         String fcPrice = "";
         while (retryCount < maxRetries && !success) {
             try {
@@ -464,11 +471,97 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
                 String mealid = "";
                 if (mealidMatcher.find()) {
                     mealid = mealidMatcher.group(1);
-                    System.out.println("mealid::"+mealid);
+                    System.out.println("mealid::" + mealid);
                 }
 
                 //报价第二步
-                HtCrawlerQuoteRequest htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON);
+                //如果有驾意险
+                List<Map<String, Object>> personalInsuredJSON = new ArrayList<>();
+                List<Map<String, Object>> perinsuredList = new ArrayList<>();
+                if (quoteVo.getAccidentalDrivings() != null && !quoteVo.getAccidentalDrivings().isEmpty()) {
+                    AtomicReference<jyxSetting> setting = new AtomicReference<>(new jyxSetting());
+                    AtomicReference<JyxConfigVo> jyxConfigVo = new AtomicReference<>(new JyxConfigVo());
+                    quoteVo.getAccidentalDrivings().forEach(drivingDTO -> {
+                        // 查询jyx_config表,拿到总保额和总保费
+                        HttpResult<JyxConfigVo> jyxConfigVoHttpResult = platformClient.jyxConfigGetById(drivingDTO.getId());
+                        jyxConfigVo.set(jyxConfigVoHttpResult.getData());
+                        setting.set(jyxConfigVo.get().getSettingList().stream()
+                                .filter(s -> s.getSeats() == Integer.parseInt(quoteVo.getCarInfoVo().getSeatCount()))
+                                .findFirst()
+                                .orElse(null));
+                        String productCode = jyxConfigVo.get().getParentProductCode();
+                        Map<String, Object> insuredInfo = new HashMap<>();
+                        //insuredInfo.put("allQuantity", "");
+                        //insuredInfo.put("planName", "");
+                        insuredInfo.put("productcode", StringUtils.isEmpty(productCode) ? "E007" : productCode);
+                        insuredInfo.put("mark", "1");
+                        insuredInfo.put("insuredname", quoteVo.getInsuredPersonInfo().getName());
+                        insuredInfo.put("certitype", "01");
+                        insuredInfo.put("certicode", quoteVo.getInsuredPersonInfo().getIdentifyNumber());
+                        insuredInfo.put("age", quoteVo.getInsuredPersonInfo().getBirthday().substring(0, 10));//quoteVo.getInsuredPersonInfo().getAge()
+                        insuredInfo.put("gender", quoteVo.getInsuredPersonInfo().getGender());
+                        insuredInfo.put("perProWithCarStartDate", "");
+                        insuredInfo.put("perProWithCarEndDate", "");
+                        insuredInfo.put("relation", quoteVo.getOwnersInfo().getName().equals(quoteVo.getInsuredPersonInfo().getName()) ? "00" : "99");
+                        insuredInfo.put("job", "");
+                        insuredInfo.put("parentcode", "");
+                        insuredInfo.put("parentname", "");
+                        insuredInfo.put("parametercode", "");
+                        insuredInfo.put("parametername", "");
+                        insuredInfo.put("codecode", "");
+                        insuredInfo.put("codecname", "");
+                        insuredInfo.put("risktype", "");
+                        insuredInfo.put("jobtype", "");
+                        insuredInfo.put("customerno", "");
+                        insuredInfo.put("workname", "");
+                        insuredInfo.put("workphone", "");
+                        insuredInfo.put("yearmoney", "");
+                        insuredInfo.put("workaddress", "");
+                        insuredInfo.put("otherphone", "");
+                        insuredInfo.put("otheraddress", "");
+                        insuredInfo.put("mobile", "");
+                        insuredInfo.put("urgentname", "");
+                        insuredInfo.put("urgentmobile", "");
+                        insuredInfo.put("nationality", "CHN");
+
+                        perinsuredList.add(insuredInfo);
+                    });
+                    Map<String, Object> accidentalDriving = new HashMap<>();
+                    accidentalDriving.put("butouflag", "");
+                    accidentalDriving.put("amount", setting.get().getCoverage() == null ? "" : setting.get().getCoverage().toString().replace(".00", ""));
+                    accidentalDriving.put("car_limitloadperson", StringUtils.isBlank(String.valueOf(setting.get().getSeats())) ? "" : setting.get().getSeats());
+                    accidentalDriving.put("isInsuredPassenger", "");
+                    accidentalDriving.put("productcode", jyxConfigVo.get().getParentProductCode());
+                    accidentalDriving.put("productname", "");//"“百万驾乘”意外伤害保险"
+                    accidentalDriving.put("mealcode", jyxConfigVo.get().getProductCode());//jyxConfigVo.get().getProductCode()
+                    accidentalDriving.put("mealname", "");//jyxConfigVo.get().getProductName()  //"经济款"
+                    accidentalDriving.put("startdate", quoteVo.getCiRiskInfoVo().getStartDate());
+                    accidentalDriving.put("enddate", quoteVo.getCiRiskInfoVo().getStartDate().replace("2026", "2027"));//quoteVo.getCiRiskInfoVo().getEndDate()
+                    accidentalDriving.put("num", "1");
+                    accidentalDriving.put("premium", setting.get().getPremium() == null ? "" : setting.get().getPremium().toString().replace(".00", ".0"));
+                    accidentalDriving.put("formationJudiciary", "");
+                    accidentalDriving.put("argueJudiciary", "");
+                    accidentalDriving.put("newCarSalesProvince", "");
+                    accidentalDriving.put("newCarSalesCity", "");
+                    accidentalDriving.put("newCarSalesDistrict", "");
+                    accidentalDriving.put("buildYear", "");
+                    accidentalDriving.put("xiangxiAddress", "");
+                    accidentalDriving.put("postalCode", "");
+                    accidentalDriving.put("bulidTypeCode", "");
+                    accidentalDriving.put("bulidTypeQiTaMes", "");
+                    accidentalDriving.put("provinceName", "");
+                    accidentalDriving.put("cityName", "");
+                    accidentalDriving.put("regionName", "");
+                    accidentalDriving.put("isInsuredSizesFlag", "0");
+                    accidentalDriving.put("perinsuredList", perinsuredList);
+                    accidentalDriving.put("car_limitloadperson", quoteVo.getCarInfoVo().getSeatCount());
+                    accidentalDriving.put("startdate", quoteVo.getCiRiskInfoVo().getStartDate());
+                    accidentalDriving.put("enddate", quoteVo.getCiRiskInfoVo().getEndDate());
+                    personalInsuredJSON.add(accidentalDriving);
+
+                    personalInsuredJSONString = JSONObject.toJSONString(personalInsuredJSON);
+                }
+                HtCrawlerQuoteRequest htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON, personalInsuredJSONString);
                 headers2 = new HttpHeaders();
                 headers2.add(HtRequestConstant.COOKIE, cookie);
                 headers2.add("Accept", "*/*");
@@ -483,39 +576,38 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
                 headers2.add("X-Requested-With", "XMLHttpRequest");
 
                 String decryptData = htCrawlerRequestComponent.quote(htCrawlerQuoteRequest, headers2);
-                //System.out.println("decryptData::HtCrawlerQuoteResponse::"+decryptData);
-                if(decryptData.contains("errrorFlag") && decryptData.contains("carChange")) {//请修改新车购置价
+                if (decryptData.contains("errrorFlag") && decryptData.contains("carChange")) {//请修改新车购置价
                     //重新获取车型
                     //throw new RuntimeException("请修改新车购置价/重新获取车型");
                     retryCount = maxRetries + 1;
                     HtCrawlerQuoteResponse.DataErrDTO dataErr = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
-                    throw new RuntimeException("报价失败:"+dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
+                    throw new RuntimeException("报价失败:" + dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
                 }
 
-                if(decryptData.contains("erroeInfo") && decryptData.contains("投保查询校验信息不存在或已经校验成功")) {
+                if (decryptData.contains("erroeInfo") && decryptData.contains("投保查询校验信息不存在或已经校验成功")) {
                     //投保查询校验信息不存在或已经校验成功
                     //throw new RuntimeException("投保查询校验信息不存在或已经校验成功");
                     retryCount = maxRetries + 1;
                     HtCrawlerQuoteResponse.DataErrDTO dataErr = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
-                    throw new RuntimeException("报价失败:"+dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
+                    throw new RuntimeException("报价失败:" + dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
                 }
 
-                if(decryptData.contains("erroeInfo") && decryptData.contains("起保日期必须在当前日期的30天范围内")) {
+                if (decryptData.contains("erroeInfo") && decryptData.contains("起保日期必须在当前日期的30天范围内")) {
                     //投保查询校验信息不存在或已经校验成功
                     //throw new RuntimeException("起保日期必须在当前日期的30天范围内");
                     retryCount = maxRetries + 1;
                     HtCrawlerQuoteResponse.DataErrDTO dataErr = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
-                    throw new RuntimeException("报价失败:"+dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
+                    throw new RuntimeException("报价失败:" + dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
                 }
                 //晋AB8H22存在有效交强险保单,请核实保期进入续保期后再进行投保。
                 //{"erroeInfo":"投保业务:投保业务:中国银保信交强险平台友情提示:号牌号码“晋AB8H22”的保单发生重复投保,与其重复投保的本公司的保单信息如下:车架号 LGWEF4A54HF017616;发动机号 1725032719;地区 山西。","erroeType":"01","errrorFlag":"true"}
-                if(decryptData.contains("erroeInfo") && decryptData.contains("发生重复投保") && !decryptData.contains("终保日期")) {
+                if (decryptData.contains("erroeInfo") && decryptData.contains("发生重复投保") && !decryptData.contains("终保日期")) {
                     retryCount = maxRetries + 1;
                     HtCrawlerQuoteResponse.DataErrDTO dataErr = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
-                    throw new RuntimeException("报价失败:"+dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
+                    throw new RuntimeException("报价失败:" + dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
                 }
 
-                if((decryptData.contains("erroeInfo") && decryptData.contains("发生重复投保") && decryptData.contains("终保日期")) || decryptData.contains("录入的校验码有误")) {
+                if ((decryptData.contains("erroeInfo") && decryptData.contains("发生重复投保") && decryptData.contains("终保日期")) || decryptData.contains("录入的校验码有误")) {
                     HtCrawlerQuoteResponse.DataErrDTO dataErrDTO = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
                     //{
                     //    "erroeInfo" : "投保业务:投保业务:中国银保信交强险平台友情提示:号牌号码“晋AQ93G8”的保单发生重复投保,与其重复投保的其它公司的保单信息如下:投保确认码 02HBIC140025061888945034991892;保单号 H070503080120250028429;起保日期 2025-06-03 18:49;终保日期 2026-06-03 18:49;号牌号码 晋AQ93G8;号牌种类 02;车架号 LSVCH6A43DN070172;发动机号 U01490;地区 山西。",
@@ -528,7 +620,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
 
                     if (matcher.find()) {
                         String endDate = matcher.group(1).trim();
-                        String startDate = endDate+":00";
+                        String startDate = endDate + ":00";
                         quoteVo.getCiRiskInfoVo().setStartDate(startDate);
                         try {
                             LocalDateTime dateTime = LocalDateTime.parse(
@@ -549,102 +641,51 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
                     }
                 }
 
-                if(decryptData.contains("erroeInfo")) {
+                if (decryptData.contains("erroeInfo")) {
                     //投保查询校验信息不存在或已经校验成功
                     //throw new RuntimeException("投保查询校验信息不存在或已经校验成功");
-                    HtCrawlerQuoteResponse.DataErrDTO dataErr = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataErrDTO.class);
-                    throw new RuntimeException("报价失败:"+dataErr.getErroeInfo().substring(dataErr.getErroeInfo().indexOf("中国")));
+                    Map<String, Object> dataErr = JSONObject.parseObject(decryptData, Map.class);
+                    throw new RuntimeException("报价失败:" + dataErr.get("erroeInfo").toString());
                 }
 
-                quoteResponseData = getDataDTO(quoteVo, decryptData, mealid, headers2);
+                quoteResponseData = getDataDTO(quoteVo, decryptData, mealid, headers2, basePartJSON, personalInsuredJSONString);
 
-                if(quoteResponseData.getApplicationdto() != null) {
+                if (quoteResponseData.getApplicationdto() != null) {
                     success = true;
 
                     // 调用非车险保费接口
-                    //HttpHeaders fcHeaders = new HttpHeaders();
-                    //fcHeaders.add(HtRequestConstant.COOKIE, cookie);
-                    //fcHeaders.add("Accept", "*/*");
-                    //fcHeaders.add("Accept-Language", "zh-CN,zh;q=0.9");
-                    //fcHeaders.add("Connection", "keep-alive");
-                    //fcHeaders.add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
-                    //fcHeaders.add("Origin", "https://cspxp.pc.ehuatai.com");
-                    //fcHeaders.add("Referer", "https://cspxp.pc.ehuatai.com/htcsp/VehicleInfoEntryAction.do?cmd=saveOneStept");
-                    //fcHeaders.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36");
-                    //fcHeaders.add("X-Requested-With", "XMLHttpRequest");
-//
-                    //MultiValueMap<String, String> fcData = new LinkedMultiValueMap<>();
-//
-                    //List<Map<String, Object>> personalInsuredJSON = new ArrayList<>();
-                    //List<Map<String, Object>> perinsuredList = new ArrayList<>();
-                    ////String productcode = accidentalDriving.get("productcode") != null ? accidentalDriving.get("productcode").toString() : "";
-//
-                    //Map<String, Object> insuredInfo = new HashMap<>();
-                    //insuredInfo.put("allQuantity", "");
-                    //insuredInfo.put("planName", "");
-                    //insuredInfo.put("productcode", "E007");//StringUtils.isEmpty(productcode) ? "E007" : productcode
-                    //insuredInfo.put("mark", "1");
-                    //insuredInfo.put("insuredname", quoteVo.getInsuredPersonInfo().getName());
-                    //insuredInfo.put("certitype", "01");
-                    //insuredInfo.put("certicode", quoteVo.getInsuredPersonInfo().getIdentifyNumber());
-                    //insuredInfo.put("age", quoteVo.getInsuredPersonInfo().getAge());
-                    //insuredInfo.put("gender", quoteVo.getInsuredPersonInfo().getGender());
-                    //insuredInfo.put("perProWithCarStartDate", "");
-                    //insuredInfo.put("perProWithCarEndDate", "");
-                    //insuredInfo.put("relation", quoteVo.getOwnersInfo().getName().equals(quoteVo.getInsuredPersonInfo().getIdentifyNumber()) ? "00" : "99");
-                    //insuredInfo.put("job", "");
-                    //insuredInfo.put("parentcode", "");
-                    //insuredInfo.put("parentname", "");
-                    //insuredInfo.put("parametercode", "");
-                    //insuredInfo.put("parametername", "");
-                    //insuredInfo.put("codecode", "");
-                    //insuredInfo.put("codecname", "");
-                    //insuredInfo.put("risktype", "");
-                    //insuredInfo.put("jobtype", "");
-                    //insuredInfo.put("customerno", "");
-                    //insuredInfo.put("workname", "");
-                    //insuredInfo.put("workphone", "");
-                    //insuredInfo.put("yearmoney", "");
-                    //insuredInfo.put("workaddress", "");
-                    //insuredInfo.put("otherphone", "");
-                    //insuredInfo.put("otheraddress", "");
-                    //insuredInfo.put("mobile", "");
-                    //insuredInfo.put("urgentname", "");
-                    //insuredInfo.put("urgentmobile", "");
-                    //insuredInfo.put("nationality", "CHN");
-//
-                    //perinsuredList.add(insuredInfo);
-                    //Map<String, Object> accidentalDriving = new HashMap<>();
-                    //accidentalDriving.put("perinsuredList", perinsuredList);
-                    //accidentalDriving.put("car_limitloadperson", quoteVo.getCarInfoVo().getSeatCount());
-                    //accidentalDriving.put("startdate", quoteVo.getCiRiskInfoVo().getStartDate());
-                    //accidentalDriving.put("enddate", quoteVo.getCiRiskInfoVo().getEndDate());
-                    //personalInsuredJSON.add(accidentalDriving);
-//
-                    //String personalInsuredJSONStr = JSONObject.toJSONString(personalInsuredJSON);
-                    //fcData.add("personalInsuredJSON", personalInsuredJSONStr);
-                    //fcData.add("noCarProductMes", "");
-                    //fcData.add("quotationNo", quotationNo);
-                    //fcData.add("comCode", attributionInformationVo.getConfigInfo().get("comCode").toString());
-                    //fcData.add("handToCount43T3_903", "");
-                    //fcData.add("isCheckFlag", "1");
-//
-                    //HttpEntity<MultiValueMap<String, String>> fcRequestEntity = new HttpEntity<>(fcData, fcHeaders);
-//
-                    //ResponseEntity<String> fcResponse = getRestTemplate().postForEntity(
-                    //        "https://cspxp.pc.ehuatai.com/htcsp/QuotedPriceAction.do?cmd=getNoCarPreimum",
-                    //        fcRequestEntity,
-                    //        String.class
-                    //);
-//
-                    //JSONObject fcResponseJson = JSONObject.parseObject(fcResponse.getBody());
-                    //System.out.println("fcResponseJson"+JSONObject.toJSONString(fcResponseJson));
-                    //fcPrice = fcResponseJson.getString("premium");
-//
-                    //if (fcPrice == null || fcPrice.isEmpty()) {
-                    //    String fcMessage = fcResponseJson.getString("errormes");
-                    //    System.out.println("非车险保费获取失败: " + fcMessage);
-                    //}
+                    if (quoteVo.getAccidentalDrivings() != null && quoteVo.getAccidentalDrivings().size() > 0) {
+
+                        HttpHeaders fcHeaders = new HttpHeaders();
+                        fcHeaders.add(HtRequestConstant.COOKIE, cookie);
+                        fcHeaders.add("Accept", "*/*");
+                        fcHeaders.add("Accept-Language", "zh-CN,zh;q=0.9");
+                        fcHeaders.add("Connection", "keep-alive");
+                        fcHeaders.add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
+                        fcHeaders.add("Origin", "https://cspxp.pc.ehuatai.com");
+                        fcHeaders.add("Referer", "https://cspxp.pc.ehuatai.com/htcsp/VehicleInfoEntryAction.do?cmd=saveOneStept");
+                        fcHeaders.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36");
+                        fcHeaders.add("X-Requested-With", "XMLHttpRequest");
+
+                        MultiValueMap<String, String> fcData = new LinkedMultiValueMap<>();
+                        fcData.add("noCarProductMes", personalInsuredJSONString);
+                        fcData.add("quotationNo", quotationNo);
+                        fcData.add("comCode", attributionInformationVo.getConfigInfo().get("comCode").toString());
+                        fcData.add("handToCount43T3_903", "");
+                        fcData.add("isCheckFlag", "1");
+
+                        HttpEntity<MultiValueMap<String, String>> fcRequestEntity = new HttpEntity<>(fcData, fcHeaders);
+
+                        ResponseEntity<String> fcResponse = getRestTemplate().postForEntity(
+                                "https://cspxp.pc.ehuatai.com/htcsp/QuotedPriceAction.do?cmd=getNoCarPreimum",
+                                fcRequestEntity,
+                                String.class
+                        );
+                        System.out.println("fcResponse.getBody()::" + fcResponse.getBody());
+                        Map<String, Object> res = objectMapper.readValue(fcResponse.getBody(), HashMap.class);
+
+                        fcPrice = res.get("premium") == null ? "" : res.get("premium").toString();
+                    }
                 } else {
                     retryCount++;
                     System.out.println("quoteResponseData.getApplicationdto() 为 null,第 " + retryCount + " 次重试...");
@@ -694,7 +735,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     }
 
     @NotNull
-    private HtCrawlerQuoteResponse.DataDTO getDataDTO(QuoteVo quoteVo, String decryptData, String mealid, HttpHeaders headers2) throws Exception {
+    private HtCrawlerQuoteResponse.DataDTO getDataDTO(QuoteVo quoteVo, String decryptData, String mealid, HttpHeaders headers2, String basePartJSON, String personalInsuredJSONString) throws Exception {
         HtCrawlerQuoteResponse.DataDTO quoteResponseData;
         HtCrawlerQuoteRequest htCrawlerQuoteRequest;
         quoteResponseData = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataDTO.class);
@@ -706,7 +747,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             String riskfalg = "0".equals(querrysequenceno.substring(0, 1)) ? "0" : "1";//.equals(querrysequenceno) ? "0" : "1"
 
             basePartJSON = "[{'riskfalg':'"+riskfalg+"','checktype':2,'querysequenceno':'"+querrysequenceno+"','checkcode':'"+autocheckcode+"','answer':''}]";
-            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON);
+            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON, personalInsuredJSONString);
             decryptData = htCrawlerRequestComponent.quote(htCrawlerQuoteRequest, headers2);
             System.out.println("quoteResponseData:1:"+JSONObject.toJSONString(decryptData));
             quoteResponseData = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataDTO.class);
@@ -722,9 +763,9 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             HtCrawlerQuoteResponse.DataDTO.BasePartDTOListDTO.BasePartDTO basePartDTO1 = quoteResponseData.getBasepartdtolist().getBasepartdto().get(1);
             String querrysequenceno1 = basePartDTO1.getQuerrysequenceno();
             String autocheckcode1 = basePartDTO1.getAutocheckcode();
-            String basePartJSON = "[{'riskfalg':'0','checktype':2,'querysequenceno':'"+querrysequenceno1+"','checkcode':'"+autocheckcode1+"','answer':''}," +
+            basePartJSON = "[{'riskfalg':'0','checktype':2,'querysequenceno':'"+querrysequenceno1+"','checkcode':'"+autocheckcode1+"','answer':''}," +
                                    "{'riskfalg':'1','checktype':2,'querysequenceno':'"+querrysequenceno+"','checkcode':'"+autocheckcode+"','answer':''}]";
-            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON);
+            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON, personalInsuredJSONString);
             decryptData = htCrawlerRequestComponent.quote(htCrawlerQuoteRequest, headers2);
             System.out.println("quoteResponseData:2:"+JSONObject.toJSONString(decryptData));
             quoteResponseData = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataDTO.class);
@@ -739,10 +780,10 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
             HtCrawlerQuoteResponse.DataDTO.BasePartDTOListDTO.BasePartDTO basePartDTO2 = quoteResponseData.getBasepartdtolist().getBasepartdto().get(1);
             String querrysequenceno2 = basePartDTO2.getQuerrysequenceno();
             String autocheckcode2 = basePartDTO2.getAutocheckcode();
-            String basePartJSON = "[{'riskfalg':'0','checktype':2,'querysequenceno':'"+querrysequenceno1+"','checkcode':'"+autocheckcode1+"','answer':''}," +
+            basePartJSON = "[{'riskfalg':'0','checktype':2,'querysequenceno':'"+querrysequenceno1+"','checkcode':'"+autocheckcode1+"','answer':''}," +
                                    "{'riskfalg':'1','checktype':2,'querysequenceno':'"+querrysequenceno+"','checkcode':'"+autocheckcode+"','answer':''}," +
                                    "{'riskfalg':'2','checktype':2,'querysequenceno':'"+querrysequenceno2+"','checkcode':'"+autocheckcode2+"','answer':''}]";
-            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON);
+            htCrawlerQuoteRequest = new HtCrawlerQuoteRequest(quoteVo, mealid, basePartJSON, personalInsuredJSONString);
             decryptData = htCrawlerRequestComponent.quote(htCrawlerQuoteRequest, headers2);
             System.out.println("quoteResponseData:3:"+JSONObject.toJSONString(decryptData));
             quoteResponseData = JSONObject.parseObject(decryptData, HtCrawlerQuoteResponse.DataDTO.class);
@@ -1353,6 +1394,11 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
     }
 
     public static void main(String[] args) throws Exception {
+
+        Map<String, Object> map = new HashMap<>();
+        map.put("accessToken", "fhEhAev4XHQyX7jQddYAURPArSOq5RSaE/nNtCu7mXC+APlSBeIzPHX3TJJULnROwnHkUhYy/M1PsXldVq0ZhMPs9pCB3Um1V3xcjVacYMer6k59s3I/np35FCAg7p/f6V0GPTX2kA0ZW0qZGE0xbiJtlxSwJ4ORNC0E/o0K6dY=");
+        map.put("data", "OqQ0kxg3UWV18BXBVcNrAsdB2CCMMO39VgAq7YQGnLpb9A9Gppj9GxjG4c9VNdX5M9zRYYWWscj5KYWEIWWkeAkzkt8oWkmI/VYuMikExadzN1IpMrdIKIkhJRd4R7UD");
+        decrypt(map);
 //        String token="Wr6ZGWsDqfdccgGXUBkCzMgySSw/ORJj6ZJfBqhEmmz6ku//ZQaYpUDN6/95kOYFolfIGogncftA/k4PeRKtMe5RvifZgesN6HZFm4tZNssod/XQR4lESSSeJN67i3kTda2BYkMJDVCbNMp3nUkuYoxtqthkWKoBaA1wk5fYkdk=";
 //        String data="vdWlTgo4OLFgkDJoTjBy3nMWXugJwXB/QA777snMrLMy9ruEqWXYCwDq0HBizp/dbnrU8A2whRpJLXhDrkcS1omgdDUPnhu7EoI06wV267Dtw9bJc1JUky6O5DdRRGioq5isZeXjQbFr2YhbIaxa33G30JdgH365wL963lSSr97WMFRij7elYm9HxGrnqjJ3LBcQxlsOj9Xdi+wHSEZuH/C7xO8qOVWWLaAS78uPjbyfmsfl3dXsAGTldxQ1dl8q6BKTr38qfRQdAcoKFNsEid8Gt01nzG3NmwvfAL0xQu7mzbqpdywla6JFGmtxrdmF2ImfNBvRp7cAf4g7A1UhJDOYNZO2dNC6Irhn2sDM5vRYEfvcG03O1+Zaq6AxSazAI/whs772/IUsKiYlsAt/DE02afl6K7pZBXloAEmIoj9/CWAyOfFNBSnyEPFd3Qf9O9eFFiy+B2snJ7e4izaBDadMsB9ByglraMvyzhcPL3fmmFdfv8wM66gv6Ch8nARXU7GlKNiM35aP+627QPc5UMy7HkIB89/TTqamMMJgqgU=";
 
@@ -1437,7 +1483,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         return makeInputData;
     }
 
-    public Map<String, Object> decrypt(Map<String, Object> x) throws Exception {
+    public static Map<String, Object> decrypt(Map<String, Object> x) throws Exception {
         String accessToken = (String) x.get("accessToken");
         String data = (String) x.get("data");
         String aesKey = CryptoUtil.rsaDecrypt(accessToken);

+ 4 - 6
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/Impl/ZhongAnCrawlerRequestImpl.java

@@ -623,12 +623,10 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
                         for (ZhongAnCrawlerPolicyListResponse.ValueDTO.DatasDTO.policyListsDto policy : policyPayLists) {
                             if (orderNo.equals(policy.getOrderNo())) {
                                 // 保单号
-                                if (policy.getInsureTypeCode().equals("2")) {
-                                    orderStatusResultVo.setJqPolicyno(policy.getTpPolicyNo());
-                                } else if (policy.getInsureTypeCode().equals("1")) {
-                                    orderStatusResultVo.setSyPolicyno(policy.getTpPolicyNo());
-                                } else if (policy.getInsureTypeCode().equals("3")) {
-                                    orderStatusResultVo.setJyPolicyno(policy.getTpPolicyNo());
+                                switch (policy.getInsureTypeCode()) {
+                                    case "2" -> orderStatusResultVo.setJqPolicyno(policy.getTpPolicyNo());
+                                    case "1" -> orderStatusResultVo.setSyPolicyno(policy.getTpPolicyNo());
+                                    case "3" -> orderStatusResultVo.setJyPolicyno(policy.getTpPolicyNo());
                                 }
                                 orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.UNDERWRITED);
                             } else {

+ 17 - 3
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -347,7 +347,13 @@
             pa.agreement_title,
             pa.agreement_abbreviation,
             pa.id as ptlAgreementId,
-            pr.rule_description,
+            CASE 
+                WHEN pr_raw.parent_id IS NOT NULL AND pr_raw.parent_id != '' 
+                THEN (SELECT GROUP_CONCAT(child.rule_description ORDER BY child.order_num ASC SEPARATOR ',') 
+                      FROM ptl_agreement_undwrt_rules child 
+                      WHERE child.parent_id = pr_raw.parent_id AND child.is_delete = 0)
+                ELSE pr_raw.rule_description
+            END AS rule_description,
             eic.name as company_name,
             pa.docking_person,
             pc.update_time,
@@ -360,7 +366,7 @@
         FROM
             ptl_agreement_cost pc
                 LEFT JOIN ptl_agreement pa ON pa.id = pc.ptl_agreement_id and pa.is_delete = 0
-                LEFT JOIN ptl_agreement_undwrt_rules pr ON pr.id = pc.cover_rule_id AND pr.agreement_id = pc.ptl_agreement_id and pr.is_delete = 0
+                LEFT JOIN ptl_agreement_undwrt_rules pr_raw ON pr_raw.id = pc.cover_rule_id AND pr_raw.is_delete = 0
         LEFT JOIN esm_ins_company eic on eic.id = pa.company_id
         <where>
             pc.is_delete = 0
@@ -374,7 +380,15 @@
                 AND pc.product_id = #{costParam.productId}
             </if>
             <if test="costParam.rulesName != null and costParam.rulesName != ''">
-                AND pr.rule_description  like concat('%',#{costParam.rulesName},'%')
+                AND (
+                    (pr_raw.parent_id IS NOT NULL AND pr_raw.parent_id != '' 
+                     AND EXISTS (SELECT 1 FROM ptl_agreement_undwrt_rules child 
+                                 WHERE child.parent_id = pr_raw.parent_id 
+                                   AND child.is_delete = 0 
+                                   AND child.rule_description LIKE concat('%',#{costParam.rulesName},'%')))
+                    OR (pr_raw.parent_id IS NULL OR pr_raw.parent_id = '')
+                    AND pr_raw.rule_description LIKE concat('%',#{costParam.rulesName},'%')
+                )
             </if>
             <if test="costParam.costRules != null and costParam.costRules != ''">
                 AND pc.cost_describe like concat('%',#{costParam.costRules},'%')