Browse Source

Merge remote-tracking branch 'origin/master'

dongxin 1 year ago
parent
commit
ce649f4616
20 changed files with 866 additions and 91 deletions
  1. 1 0
      gateway/src/main/java/com/jzg/config/CorsConfig.java
  2. 16 2
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/component/AnShengCrawlerRequestComponent.java
  3. 4 3
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/constant/enums/RequestUrl.java
  4. 219 8
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/request/AnShengCrawlerCalculatePremiumApplyMessage.java
  5. 42 0
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/request/AnShengCrawlerPaymentRequest.java
  6. 74 0
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/response/AnShengCrawlerPaymentResponse.java
  7. 12 1
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/response/AnShengCrawlerSearchVehicleByVinResponse.java
  8. 23 8
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/service/impl/AnShengCrawlerRequestImpl.java
  9. 5 0
      tenant/insurance/quotation-commons/pom.xml
  10. 17 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/build/GuoRenApiQuoteResultsVoBuild.java
  11. 8 6
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/component/GuoRenRequestApiComponent.java
  12. 289 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/component/GuorenDuplicateInsuranceComponent.java
  13. 5 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/GuoRenApiOrder.java
  14. 1 3
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/Request/CarPriceRequest.java
  15. 17 31
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/Request/PremiumRequest.java
  16. 3 0
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/GuoRenApiOrderService.java
  17. 3 1
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/Impl/GuoRenApiOrderServiceImpl.java
  18. 66 16
      tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/Impl/GuoRenApiRequestImpl.java
  19. 1 3
      tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/entity/request/YangGuangAccuracyCalculateRequest.java
  20. 60 9
      tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/service/impl/YangGuangApiRequestImpl.java

+ 1 - 0
gateway/src/main/java/com/jzg/config/CorsConfig.java

@@ -14,6 +14,7 @@ public class CorsConfig {
         CorsConfiguration corsConfiguration = new CorsConfiguration();
         // 允许所有来源,你可以根据需要修改为具体的来源
         corsConfiguration.addAllowedOrigin("http://localhost:8080");
+        corsConfiguration.addAllowedOrigin("http://localhost:8082");
         corsConfiguration.addAllowedOrigin("http://localhost:9000");
         corsConfiguration.addAllowedOrigin("http://localhost:9001");
         corsConfiguration.addAllowedOrigin("http://127.0.0.1:9000");

+ 16 - 2
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/component/AnShengCrawlerRequestComponent.java

@@ -19,6 +19,7 @@ import org.springframework.util.ObjectUtils;
 
 import java.io.File;
 import java.util.Base64;
+import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
@@ -124,9 +125,9 @@ public class AnShengCrawlerRequestComponent {
      * @param headers 请求头
      * @return 车辆信息
      */
-    public AnShengCrawlerSearchVehicleByVinResponse searchVehicleByVin(AnShengCrawlerSearchVehicleByVinRequest request, HttpHeaders headers) {
+    public List<AnShengCrawlerSearchVehicleByVinResponse.DataDTO> searchVehicleByVin(AnShengCrawlerSearchVehicleByVinRequest request, HttpHeaders headers) {
         ResponseEntity<AnShengCrawlerSearchVehicleByVinResponse> responseEntity = requestComponent.formData(RequestUrl.SEARCH_VEHICLE_BY_VIN.getRequestUrl(anShengCrawlerProperties.getUrl()), request, AnShengCrawlerSearchVehicleByVinResponse.class, headers);
-        return responseEntity.getBody();
+        return responseEntity.getBody().getData();
     }
 
     /**
@@ -165,6 +166,19 @@ public class AnShengCrawlerRequestComponent {
         ResponseEntity<AnShengCrawlerQueryDocumentsInformationResponse> responseEntity = requestComponent.formData(RequestUrl.QUERY_DOCUMENTS_INFORMATION.getRequestUrl(anShengCrawlerProperties.getUrl()), request, AnShengCrawlerQueryDocumentsInformationResponse.class, headers);
     }
 
+    /**
+     * 支付链接
+     *
+     * @param request 支付链接请求
+     * @param headers 请求头
+     * @return 支付链接
+     */
+    public AnShengCrawlerPaymentResponse payment(AnShengCrawlerPaymentRequest request, HttpHeaders headers) {
+        MultiValueMap<String, Object> multiValueMap = RequestObjectConversion.convertMultiValueMap(request);
+        ResponseEntity<AnShengCrawlerPaymentResponse> responseEntity = requestComponent.formData(RequestUrl.PAYMENT.getRequestUrl(anShengCrawlerProperties.getUrl()), request, AnShengCrawlerPaymentResponse.class, headers);
+        return responseEntity.getBody();
+    }
+
     /**
      * 保单下载
      *

+ 4 - 3
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/constant/enums/RequestUrl.java

@@ -17,11 +17,10 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
     LOGIN("/ssooauth2/login", "登录"),
     OAUTH_AUTHORIZE("/ssooauth2/oauth/authorize?client_id=ast-prod&response_type=code", "oauth验证"),
 
-    // 归属信息
+    // 保费计算
     GET_USER_DETAIL("/portalapi/getUserDetail", "获取归属"),
-    // 登录
+    QUERY_AUTO_MATCH_PRICE_RATIO("portalapi/queryAutoMatchPriceRatio", ""),
     SEARCH_VEHICLE_BY_VIN("/portalapi/searchVehicleByVIN", "车架号查询"),
-    // 保费计算
     CALCULATE_PREMIUM_APPLY("/portalapi/calculatePremiumApply", "保费计算"),
     // 上传影像
     FILE_UPLOAD("/portalapi/fileUpload", "影像上传"),
@@ -38,6 +37,8 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
     DOWNLOAD_PDF("/printportalapi/printportal/downloadPdf.do?policyNo=%s&policyType=6&channel=print&systemName=tpaic-ec&userName=tpaic-ec", "非车保单下载"),
     ;
 
+
+
     private final String uri;
 
     private final String description;

+ 219 - 8
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/request/AnShengCrawlerCalculatePremiumApplyMessage.java

@@ -3,6 +3,8 @@ import com.google.common.collect.Lists;
 
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.ansheng.crawler.entity.response.AnShengCrawlerSearchVehicleByVinResponse;
+import com.jzg.commons.entity.quote.vo.CarInfoVo;
 import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
 import com.jzg.commons.entity.quote.vo.KindInfoVo;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
@@ -24,23 +26,23 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
     @JsonProperty("contracts")
     private List<ContractsDTO> contracts;
 
-    public AnShengCrawlerCalculatePremiumApplyMessage(QuoteVo quoteVo) {
+    public AnShengCrawlerCalculatePremiumApplyMessage(QuoteVo quoteVo, AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO) {
         this.isTryCal = false;
         this.contracts = new ArrayList<>();
         if (!ObjectUtils.isEmpty(quoteVo.getBiRiskInfoVo())) {
-            ContractsDTO baseContracts = getBaseContracts(quoteVo);
+            ContractsDTO baseContracts = getBaseContracts(quoteVo, dataDTO, "");
             baseContracts.addCompulsoryInsurance(baseContracts);
             this.contracts.add(baseContracts);
         }
         if (!ObjectUtils.isEmpty(quoteVo.getCiRiskInfoVo())) {
-            ContractsDTO baseContracts = getBaseContracts(quoteVo);
+            ContractsDTO baseContracts = getBaseContracts(quoteVo, dataDTO, "");
             baseContracts.addBusinessInsurance(baseContracts, quoteVo.getKindInfoVo());
             this.contracts.add(baseContracts);
         }
     }
 
-    public ContractsDTO getBaseContracts(QuoteVo quoteVo) {
-        return new ContractsDTO(quoteVo);
+    public ContractsDTO getBaseContracts(QuoteVo quoteVo, AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO, String departmentCode) {
+        return new ContractsDTO(quoteVo, dataDTO, departmentCode);
     }
 
     @NoArgsConstructor
@@ -117,7 +119,7 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
             }
         }
 
-        public ContractsDTO(QuoteVo quoteVo) {
+        public ContractsDTO(QuoteVo quoteVo, AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO, String departmentCode) {
             this.policyExtend = new PolicyExtendDTO("", "", "", "", "", "");
             this.noVehicleNo = false;
             this.noCarowner = false;
@@ -127,7 +129,9 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
             this.departmentDefine = new DepartmentDefineDTO();
             this.saleBusinessSource = new SaleBusinessSourceDTO();
             this.policyAttachments = new ArrayList<>();
-            this.targetList = new ArrayList<>();
+            TargetListDTO targetListDTO = new TargetListDTO(dataDTO, quoteVo.getCarInfoVo(), departmentCode);
+            this.targetList = List.of(targetListDTO);
+
             this.policyCoverages = new ArrayList<>();
             this.policyPersons = buildPolicyPersons(quoteVo.getOwnersInfo(), quoteVo.getPolicyHolderInfo(), quoteVo.getInsuredPersonInfo());
             this.policyRatios = new ArrayList<>();
@@ -482,7 +486,124 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
             @JsonProperty("vehicleTax")
             private VehicleTaxDTO vehicleTax;
 
-            @NoArgsConstructor
+            public TargetListDTO(AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO, CarInfoVo carInfoVo, String departmentCode) {
+                AnShengCrawlerSearchVehicleByVinResponse.DataDTO.BrandAutoModelDTO brandAutoModel = dataDTO.getBrandAutoModel();
+                this.linkId = "";
+                this.targetId = "";
+                this.ymIsbuyOrnot = "";
+                this.ymBirthDate = "";
+                this.ymElecBatteryType = "";
+                this.marketDate = "";
+                this.vehicleCertificateNo = "";
+                this.vehicleCertificateType = "";
+                this.vehiclePurchasePrice = "";
+                this.modelsListedYear = dataDTO.getMadeDate();
+                this.platformId = "";
+                this.vehicleColor = "";
+                this.theftproofEquipmentCode = "5";
+                this.isMortgage = "";
+                this.isSpecialInsuranceVehicle = "0";
+                this.vehicleVer = "";
+                this.groupCode = "";
+                this.standardName = brandAutoModel.getStandardName();
+                this.tradeName = brandAutoModel.getTradeName();
+                this.tradeCode = brandAutoModel.getTradeCode();
+                this.totalVehicleWeight = "0";
+                this.seriesCode = brandAutoModel.getSeriesCode();
+                this.modelIdCode = brandAutoModel.getModelIdCode();
+                this.seats = carInfoVo.getSeatCount();
+                this.rbCode = brandAutoModel.getRbCode();
+                this.otherEnergyTypeDesc = "";
+                this.madeDate = brandAutoModel.getMakeDate();
+                this.exhaustCapability = brandAutoModel.getExhaustCapabilityString();
+                this.noDamageYears = "";
+                this.specialVehicleFlag = "";
+                this.overseasVehicleFlag = "";
+                this.brand = brandAutoModel.getBrand();
+                this.modelCodeAlien = "";
+                this.carNameAlien = "";
+                this.tradeNameAlien = "";
+                this.brandAlien = "";
+                this.deptNameAlien = "";
+                this.checkVehicleInfo = new CheckVehicleInfoDTO();
+                this.departmentCode = departmentCode;
+                this.dbVehicleType = brandAutoModel.getInsuranceCode();
+                this.vehicleLicenceCode = carInfoVo.getLicenseNo();
+                this.vehicleFrameNo = carInfoVo.getVinNo();
+                this.engineNo = carInfoVo.getEngineNo();
+                this.firstRegisterDate = carInfoVo.getRegisterDate();
+                this.firstRegisterDateStr = carInfoVo.getRegisterDate();
+                this.vehicleCertificateDate = "";
+                this.weigth = brandAutoModel.getCurbWeightMin();
+                this.totalMass = "";
+                this.priceType = "04";
+                this.purchasePrice = brandAutoModel.getPurchasePrice();
+                this.vehicleLossInsuredValue = dataDTO.getVehicleLossInsuredValue();
+                this.importFlag = brandAutoModel.getImportFlag();
+                this.modelCode = brandAutoModel.getModelCode();
+                this.carName = brandAutoModel.getCarName();
+                this.theftProof = brandAutoModel.getTheftProof();
+                this.vehicleType = brandAutoModel.getVehicleType();
+                this.pureRange = "";
+                this.vehicleClass = brandAutoModel.getVehicleClass();
+                this.vehicleStyle = carInfoVo.getCarTypeCode();
+                this.autoModelCode = brandAutoModel.getAutoModelCode();
+                this.vehicleBrand = brandAutoModel.getBrandChnName();
+                this.brandChnName = brandAutoModel.getAutoModelChnName();
+                this.averageMile = "";
+                this.csTradeName = brandAutoModel.getTradeName();
+                this.csTradeCode = brandAutoModel.getTradeCode();
+                this.brandCode = brandAutoModel.getBrandCode();
+                this.series = brandAutoModel.getSeries();
+                this.noticeType = brandAutoModel.getNoticeType();
+                this.categoryName = brandAutoModel.getCategoryName();
+                this.categoryCode = brandAutoModel.getCategoryCode();
+                this.configType = brandAutoModel.getConfigType();
+                this.partInfo = brandAutoModel.getAirbagCountString();
+                this.powerType = brandAutoModel.getPowerType();
+                this.vehicleFgwCode = brandAutoModel.getAutoModelChnName();
+                this.vehicleFgwName = brandAutoModel.getBrandChnName();
+                this.vehicleModelType = brandAutoModel.getVehicleModelType();
+                this.vehicleStyleDesc = "";
+                this.vehicleTypeName = brandAutoModel.getVehicleTypeName();
+                this.makeDate = Integer.valueOf(brandAutoModel.getMakeDate());
+                this.stopFlag = stopFlag;
+                this.detailDesc = detailDesc;
+                this.vehicleCategory = vehicleCategory;
+                this.personnelName = personnelName;
+                this.refitDesc = refitDesc;
+                this.basicRateCode = basicRateCode;
+                this.deptName = deptName;
+                this.deptCode = deptCode;
+                this.vehicleSeats = vehicleSeats;
+                this.fuelType = fuelType;
+                this.autoModelChnName = autoModelChnName;
+                this.licenceTypeCode = licenceTypeCode;
+                this.ecdemicVehicleFlag = ecdemicVehicleFlag;
+                this.vehicleTonnages = vehicleTonnages;
+                this.power = power;
+                this.maxDesignSpeed = 0;
+                this.runCardCertificateDate = runCardCertificateDate;
+                this.customerNegotiatePrice = customerNegotiatePrice;
+                this.originalCustomerNegotiatePrice = originalCustomerNegotiatePrice;
+                this.fleetNo = fleetNo;
+                this.maker = maker;
+                this.approvedCapacity = approvedCapacity;
+                this.ineffectualDate = ineffectualDate;
+                this.lastCheckDate = lastCheckDate;
+                this.rejectDate = rejectDate;
+                this.riskFlag = riskFlag;
+                this.targetType = targetType;
+                this.fleetRate = fleetRate;
+                this.usageAttributeCode = usageAttributeCode;
+                this.usageAttributeCodePM = usageAttributeCodePM;
+                this.ownershipAttributeCode = ownershipAttributeCode;
+                this.beneficiaryList = beneficiaryList;
+                this.checkVehicleCodeSecret = checkVehicleCodeSecret;
+                this.policyPricing = new PolicyPricingDTO(dataDTO);
+                this.vehicleTax = new VehicleTaxDTO();
+            }
+
             @Data
             public static class CheckVehicleInfoDTO {
                 @JsonProperty("usageAttributeCode")
@@ -503,6 +624,18 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
                 private String checkRecord;
                 @JsonProperty("checkTime")
                 private String checkTime;
+
+                public CheckVehicleInfoDTO() {
+                    this.usageAttributeCode = "1";
+                    this.usageAttributeCodePM = "";
+                    this.runRegionCode = "";
+                    this.checkVehicleFlag = "";
+                    this.uploadCheckVehicleInfo = "1";
+                    this.checkVehicleSituation = "";
+                    this.vehicleChecker = "";
+                    this.checkRecord = "";
+                    this.checkTime = "";
+                }
             }
 
             @NoArgsConstructor
@@ -658,6 +791,84 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
                 private String vehicleAlias;
                 @JsonProperty("customerSource")
                 private String customerSource;
+
+                public PolicyPricingDTO(AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO) {
+                    this.usageAttributeCode = "";
+                    this.usageAttributeCodePM = "";
+                    this.ownershipAttributeCode = "";
+                    this.nonclaimAdjust = "";
+                    this.claimAdjustLevel = "";
+                    this.lastyearStartDate = "";
+                    this.lastyearEndDate = "";
+                    this.partInfo = "";
+                    this.isMortgage = "";
+                    this.isSpecialInsuranceVehicle = "";
+                    this.claimRecordBizScoreSize = "";
+                    this.loanVehicleFlag = "";
+                    this.injurySite = "";
+                    this.transferFlag = "";
+                    this.searchSequenceNo = "";
+                    this.dbVehicleAutoModelChnName = "";
+                    this.refitDesc = "";
+                    this.lastYearIsTel = "";
+                    this.reinsureFlag = "";
+                    this.rateFloatFlag = "";
+                    this.ratioFluctuateType = "";
+                    this.repairFactory = "";
+                    this.dbVehicleWeigth = "";
+                    this.riskScore = "";
+                    this.riskScoreTwenty = "";
+                    this.algrId = "";
+                    this.riskScoreColor = "";
+                    this.scoreReason = "";
+                    this.scoreReasonLevel = "";
+                    this.scoreReasonLevel2 = "";
+                    this.scoreReasonLevel3 = "";
+                    this.highRiskFlag = "";
+                    this.effectReason = "";
+                    this.dbVehicleVeiw = "";
+                    this.lastYearCompanyId = "";
+                    this.chargeRateFinal = "";
+                    this.rateType = "";
+                    this.priceRises = "";
+                    this.underWriteRate = "";
+                    this.autoRuleRatioOD = "";
+                    this.autoRuleRatioTP = autoRuleRatioTP;
+                    this.autoRuleRatioTHEFT = autoRuleRatioTHEFT;
+                    this.autoRuleRatioOTHER = autoRuleRatioOTHER;
+                    this.underwriteRuleRatioOD = underwriteRuleRatioOD;
+                    this.underwriteRuleRatioTP = underwriteRuleRatioTP;
+                    this.underwriteRuleRatioTHEFT = underwriteRuleRatioTHEFT;
+                    this.underwriteRuleRatioOTHER = underwriteRuleRatioOTHER;
+                    this.tlType = tlType;
+                    this.autoFloatRatioOD = autoFloatRatioOD;
+                    this.autoFloatRatioTp = autoFloatRatioTp;
+                    this.autoFloatRatioTheft = autoFloatRatioTheft;
+                    this.autoFloatRatioOther = autoFloatRatioOther;
+                    this.appointAreaCode = appointAreaCode;
+                    this.fdConfigId = fdConfigId;
+                    this.modelDiscount = modelDiscount;
+                    this.autoFloatHandingCost = autoFloatHandingCost;
+                    this.modelrate = modelrate;
+                    this.advicediscount = advicediscount;
+                    this.dbVehicleBrand = dbVehicleBrand;
+                    this.dbVehicleTypeName = dbVehicleTypeName;
+                    this.usageLicenceName = usageLicenceName;
+                    this.vehicleTypeChiName = vehicleTypeChiName;
+                    this.autoFloatTargetRebate = autoFloatTargetRebate;
+                    this.riskFlag = "";
+                    this.dbExhaustCapability = "";
+                    this.dbVehicleSeats = "";
+                    this.dbVehicleTonnages = "";
+                    this.dbVehicleValue = "";
+                    this.ifModelRate = "";
+                    this.isMotorcade = "";
+                    this.scoreRunId = "";
+                    this.specialCarFlag = "";
+                    this.transferDate = "";
+                    this.vehicleAlias = "";
+                    this.customerSource = "";
+                }
             }
 
             @NoArgsConstructor

+ 42 - 0
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/request/AnShengCrawlerPaymentRequest.java

@@ -0,0 +1,42 @@
+package com.jzg.ansheng.crawler.entity.request;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AnShengCrawlerPaymentRequest {
+
+    @JsonProperty("paymentFlag")
+    private String paymentFlag;
+
+    @JsonProperty("documentType")
+    private String documentType;
+
+    @JsonProperty("documentList")
+    private List<String> documentList;
+
+    @JsonProperty("departmentCode")
+    private String departmentCode;
+
+    @JsonProperty("totalPremium")
+    private String totalPremium;
+
+    @JsonProperty("addH24Planhandle")
+    private String addH24PlanHandle;
+
+    public AnShengCrawlerPaymentRequest(List<String> documentList, String departmentCode, String totalPremium) {
+        this.paymentFlag = "2";
+        this.documentType = "5";
+        this.documentList = documentList;
+        this.departmentCode = departmentCode;
+        this.totalPremium = totalPremium;
+        this.addH24PlanHandle = "0";
+    }
+}

+ 74 - 0
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/response/AnShengCrawlerPaymentResponse.java

@@ -0,0 +1,74 @@
+package com.jzg.ansheng.crawler.entity.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class AnShengCrawlerPaymentResponse {
+
+    @JsonProperty("code")
+    private Integer code;
+
+    @JsonProperty("simpleMessage")
+    private String simpleMessage;
+
+    @JsonProperty("message")
+    private String message;
+
+    @JsonProperty("data")
+    private DataDTO data;
+
+    @NoArgsConstructor
+    @Data
+    public static class DataDTO {
+
+        @JsonProperty("page")
+        private Integer page;
+
+        @JsonProperty("pageSize")
+        private Integer pageSize;
+
+        @JsonProperty("circPaymentNo")
+        private String circPaymentNo;
+
+        @JsonProperty("isShangHai")
+        private Boolean isShangHai;
+
+        @JsonProperty("fxQRCode")
+        private String fxQRCode;
+
+        @JsonProperty("totalPremium")
+        private Double totalPremium;
+
+        @JsonProperty("personnelNameList")
+        private List<String> personnelNameList;
+
+        @JsonProperty("vehicleLicenceCodeList")
+        private List<String> vehicleLicenceCodeList;
+
+        @JsonProperty("realBusinessType")
+        private String realBusinessType;
+
+        @JsonProperty("planCodeNames")
+        private List<String> planCodeNames;
+
+        @JsonProperty("productCodes")
+        private List<String> productCodes;
+
+        @JsonProperty("personnelNames")
+        private List<String> personnelNames;
+
+        @JsonProperty("insuranerNames")
+        private List<String> insuranerNames;
+
+        @JsonProperty("tmk")
+        private Boolean tmk;
+
+        @JsonProperty("autoPlan")
+        private Boolean autoPlan;
+    }
+}

+ 12 - 1
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/entity/response/AnShengCrawlerSearchVehicleByVinResponse.java

@@ -1,6 +1,7 @@
 package com.jzg.ansheng.crawler.entity.response;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.quotation.commons.filter.CarModelsFilter;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -24,7 +25,7 @@ public class AnShengCrawlerSearchVehicleByVinResponse {
 
     @NoArgsConstructor
     @Data
-    public static class DataDTO {
+    public static class DataDTO implements CarModelsFilter {
         @JsonProperty("customerNegotiatePrice")
         private String customerNegotiatePrice;
         @JsonProperty("BrandAutoModel")
@@ -44,6 +45,16 @@ public class AnShengCrawlerSearchVehicleByVinResponse {
         @JsonProperty("originalCustomerNegotiatePrice")
         private String originalCustomerNegotiatePrice;
 
+        @Override
+        public String getCarYear() {
+            return this.brandAutoModel.firstSaleDate;
+        }
+
+        @Override
+        public String getPurchasePrice() {
+            return this.brandAutoModel.purchasePrice;
+        }
+
         @NoArgsConstructor
         @Data
         public static class BrandAutoModelDTO {

+ 23 - 8
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/ansheng/crawler/service/impl/AnShengCrawlerRequestImpl.java

@@ -2,22 +2,21 @@ package com.jzg.ansheng.crawler.service.impl;
 
 import com.jzg.ansheng.crawler.component.AnShengCrawlerRequestComponent;
 import com.jzg.ansheng.crawler.entity.po.AnShengCrawlerOrder;
-import com.jzg.ansheng.crawler.entity.request.AnShengCrawlerCalculatePremiumApplyMessage;
-import com.jzg.ansheng.crawler.entity.request.AnShengCrawlerFileUploadRequest;
-import com.jzg.ansheng.crawler.entity.request.AnShengCrawlerQueryDocumentsInformationRequest;
-import com.jzg.ansheng.crawler.entity.request.AnShengCrawlerQueryPrintPdfRequest;
+import com.jzg.ansheng.crawler.entity.request.*;
 import com.jzg.ansheng.crawler.entity.response.AnShengCrawlerCalculatePremiumApplyResponse;
 import com.jzg.ansheng.crawler.entity.response.AnShengCrawlerQueryDocumentsInformationResponse;
+import com.jzg.ansheng.crawler.entity.response.AnShengCrawlerSearchVehicleByVinResponse;
 import com.jzg.ansheng.crawler.service.AnShengCrawlerOrderService;
 import com.jzg.ansheng.crawler.service.AnShengCrawlerRequest;
 import com.jzg.quotation.commons.entity.vo.aggregated.*;
 import com.jzg.quotation.commons.entity.vo.base.LoginBase;
-import com.jzg.quotation.commons.entity.vo.base.OrderBase;
+import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.util.List;
 import java.util.Optional;
 
 @Service
@@ -35,8 +34,18 @@ public class AnShengCrawlerRequestImpl implements AnShengCrawlerRequest {
 
     @Override
     public QuoteResultsVo quote(QuoteVo quoteVo) {
-        AnShengCrawlerCalculatePremiumApplyMessage crawlerCalculatePremiumApply = new AnShengCrawlerCalculatePremiumApplyMessage(quoteVo);
-        AnShengCrawlerCalculatePremiumApplyResponse anShengCrawlerCalculatePremiumApplyResponse = anShengCrawlerRequestComponent.calculatePremiumApply(crawlerCalculatePremiumApply, new HttpHeaders());
+        HttpHeaders httpHeaders = new HttpHeaders();
+        AnShengCrawlerSearchVehicleByVinRequest anShengCrawlerSearchVehicleByVinRequest = new AnShengCrawlerSearchVehicleByVinRequest();
+        List<AnShengCrawlerSearchVehicleByVinResponse.DataDTO> dataDTOS = anShengCrawlerRequestComponent.searchVehicleByVin(anShengCrawlerSearchVehicleByVinRequest, httpHeaders);
+        AnShengCrawlerSearchVehicleByVinResponse.DataDTO dataDTO = CarModelsFilterUtils.to(dataDTOS, quoteVo.getCarInfoVo());
+
+
+
+
+        AnShengCrawlerCalculatePremiumApplyMessage crawlerCalculatePremiumApply = new AnShengCrawlerCalculatePremiumApplyMessage(quoteVo, dataDTO);
+        AnShengCrawlerCalculatePremiumApplyResponse anShengCrawlerCalculatePremiumApplyResponse = anShengCrawlerRequestComponent.calculatePremiumApply(crawlerCalculatePremiumApply, httpHeaders);
+
+
 
 
         return null;
@@ -45,11 +54,16 @@ public class AnShengCrawlerRequestImpl implements AnShengCrawlerRequest {
     @Override
     public UnderwritingResultsVo underwriting(UnderwritingVo underwritingVo) {
 
+
+
         return null;
     }
 
     @Override
     public PaymentLinkResultsVo getPaymentLink(PaymentLinkVo paymentLinkVo) {
+        HttpHeaders httpHeaders = new HttpHeaders();
+        AnShengCrawlerPaymentRequest anShengCrawlerPaymentRequest = new AnShengCrawlerPaymentRequest();
+        anShengCrawlerRequestComponent.payment(anShengCrawlerPaymentRequest, httpHeaders);
         return null;
     }
 
@@ -93,7 +107,7 @@ public class AnShengCrawlerRequestImpl implements AnShengCrawlerRequest {
     }
 
     @Override
-    public void queryOrderState(OrderStatusVo orderStatusVo) {
+    public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) {
 
         AnShengCrawlerOrder anShengCrawlerOrder = anShengCrawlerOrderService.getById(orderStatusVo.getOrder()
                 .getOrdersNo());
@@ -102,6 +116,7 @@ public class AnShengCrawlerRequestImpl implements AnShengCrawlerRequest {
         AnShengCrawlerQueryDocumentsInformationRequest anShengCrawlerQueryDocumentsInformationRequest = new AnShengCrawlerQueryDocumentsInformationRequest("", "", anShengCrawlerOrder.getOrderNo(), anShengCrawlerOrder.getRecordingTime());
         AnShengCrawlerQueryDocumentsInformationResponse anShengCrawlerQueryDocumentsInformationResponse = anShengCrawlerRequestComponent.queryDocumentsInformation(anShengCrawlerQueryDocumentsInformationRequest, httpHeaders);
 
+        return null;
     }
 
 }

+ 5 - 0
tenant/insurance/quotation-commons/pom.xml

@@ -25,6 +25,11 @@
             <artifactId>weixin-java-mp</artifactId>
             <version>4.3.8.B</version>
         </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.7.21</version>
+        </dependency>
         <!--thumbnailator图片处理-->
         <dependency>
             <groupId>net.coobird</groupId>

+ 17 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/build/GuoRenApiQuoteResultsVoBuild.java

@@ -1,5 +1,6 @@
 package com.jzg.quotation.guoren.api.build;
 
+import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
 import com.jzg.commons.entity.quote.vo.KindInfoVo;
@@ -98,4 +99,20 @@ public class GuoRenApiQuoteResultsVoBuild {
 
     }
 
+    public static QuoteResultsVo buildQuoteFailResultsVo(PremiumResponse response) {
+        QuoteResultsVo quoteResultsVo = new QuoteResultsVo();
+        // 报价失败提示
+        quoteResultsVo.setErrorMessage(response.getResultMsg());
+        quoteResultsVo.setQuoteStatus(InsOrderStatusEnum.QUOTE_FAIL);
+        return quoteResultsVo;
+    }
+
+    public static QuoteResultsVo buildQuoteSuccessResultsVo(PremiumResponse response) {
+        QuoteResultsVo quoteResultsVo = new QuoteResultsVo();
+        // 报价失败提示
+        quoteResultsVo.setErrorMessage(response.getResultMsg());
+        quoteResultsVo.setQuoteStatus(InsOrderStatusEnum.QUOTE_FAIL);
+        return quoteResultsVo;
+    }
+
 }

+ 8 - 6
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/component/GuoRenRequestApiComponent.java

@@ -9,6 +9,7 @@ import com.jzg.commons.util.StringUtils;
 import com.jzg.quotation.commons.component.RequestComponent;
 import com.jzg.quotation.commons.constant.enums.base.InsuranceEnum;
 import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
+import com.jzg.quotation.commons.utils.InsuranceLog;
 import com.jzg.quotation.guoren.api.entity.Request.*;
 import com.jzg.quotation.guoren.api.entity.Response.*;
 import com.jzg.quotation.guoren.api.entity.dto.ResponseDTO;
@@ -28,6 +29,7 @@ import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.lang.Nullable;
 import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -49,6 +51,8 @@ public class GuoRenRequestApiComponent {
 
     private final RequestComponent requestComponent;
 
+    private final RestTemplate restTemplate;
+
     private ResponseDTO<JSONObject> post(String logId, String message, @Nullable RequestDTO requestBody) {
         HttpHeaders httpHeaders = new HttpHeaders();
         httpHeaders.setContentType(MediaType.APPLICATION_JSON);
@@ -56,13 +60,11 @@ public class GuoRenRequestApiComponent {
         String request = JSON.toJSONString(requestBody);
         String baseUrl = properties.getBaseUrl();
         HttpEntity<String> httpEntity = new HttpEntity<>(request, httpHeaders);
-
-//        InsuranceLog.infoLog(logId, "\n\t---------> {} \n\t---------> URL: {} \n\t---------> 请求参数: {}", message, baseUrl, request);
-
-        ResponseEntity<String> exchange = requestComponent.objectPost(baseUrl, httpEntity, String.class);
+        InsuranceLog.infoLog(InsuranceEnum.YGBX.getPinyin(), "\n\t---------> {} \n\t---------> URl: {} \n\t---------> 请求参数:{}",
+                message,baseUrl,request);
+        ResponseEntity<String> exchange = restTemplate.postForEntity(baseUrl, httpEntity, String.class);
         String body1 = exchange.getBody();
-//        InsuranceLog.infoLog(logId, "\n\t---------> {} \n\t---------> 响应参数:{}", message, body1);
-
+        InsuranceLog.infoLog(InsuranceEnum.BPIC.getPinyin(), "\n\t---------> {} \n\t---------> 响应参数:{}", message, body1);
         if (body1 == null) {
             throw new SystemException(message + "接口请求失败");
         }

+ 289 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/component/GuorenDuplicateInsuranceComponent.java

@@ -0,0 +1,289 @@
+package com.jzg.quotation.guoren.api.component;
+
+import cn.hutool.core.lang.Assert;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.json.JSONUtil;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jzg.commons.exception.SystemException;
+import com.jzg.quotation.guoren.api.entity.Request.PremiumRequest;
+import com.jzg.quotation.guoren.api.entity.Response.PremiumResponse;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.ObjectUtils;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @description: 国任财险重复投保
+ * @author: wenks
+ * @date: 2023/11/8 10:40
+ **/
+public class GuorenDuplicateInsuranceComponent {
+
+    public static final String THE_FIRST_REGEX = "终保日期(.+?);";
+
+    public static final String THE_SECOND_REGEX = ".+终保日期(.+?);";
+
+    public static final String JQ = "交强险";
+
+    public static final String SY = "商业险";
+
+    protected static final Map<Integer, String> dateFormatMap;
+
+    private GuorenDuplicateInsuranceComponent() {
+        throw new IllegalStateException("工具方法");
+    }
+
+
+    static {
+        dateFormatMap = new HashMap<>();
+        dateFormatMap.put(8, "yyyyMMdd");
+        dateFormatMap.put(10, "yyyyMMddHH");
+        dateFormatMap.put(12, "yyyyMMddHHmm");
+        dateFormatMap.put(14, "yyyyMMddHHmmss");
+    }
+
+    /**
+     * 获取终保日期
+     *
+     * @param rtnMsg 返回信息
+     * @param regex  正则
+     * @return 终保日期
+     */
+    public static String getEndDate(String rtnMsg, String regex) {
+        String endDate = getTheExpiryDate(rtnMsg, regex);
+        if (!endDate.isEmpty()) {
+            return endDate;
+        }
+        return "";
+    }
+
+    public static String getTimelyEndDate(String rtnMsg, String regex) {
+        String endDate = getTimelyTheExpiryDate(rtnMsg, regex);
+        if (!endDate.isEmpty()) {
+            return endDate;
+        }
+        return "";
+    }
+
+    /**
+     * 获取终保日期
+     *
+     * @param message 重复投保返回信息
+     * @param regex   正则内容
+     * @return
+     */
+    public static String getTheExpiryDate(String message, String regex) {
+        Pattern pattern = Pattern.compile(regex);
+        String replace = message.replace("\r", ";").replace("\n", ";").replace(" ", "");
+        Matcher m = pattern.matcher(replace);
+
+        boolean b = m.find();
+        if (b) {
+            try {
+                String group = m.group(1);
+                String startDate = group.replace(":", "").replace(":", "").replace("-", "").replace(" ", "");
+                String string = dateFormatMap.get(startDate.length());
+                SimpleDateFormat dateFormat = new SimpleDateFormat(string);
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date parse = dateFormat.parse(startDate);
+
+                return simpleDateFormat.format(parse);
+
+            } catch (Exception e) {
+                throw new SystemException(message);
+            }
+        }
+        return "";
+    }
+
+
+    public static String getTimelyTheExpiryDate(String message, String regex) {
+        Pattern pattern = Pattern.compile(regex);
+        String replace = message.replace("\r", ";").replace("\n", ";").replace(" ", "");
+        Matcher m = pattern.matcher(replace);
+
+        boolean b = m.find();
+        if (b) {
+            try {
+                String startDate = "";
+                String group = m.group(2);
+                String groupRegex = "终保日期(\\d{4}-\\d{2}-\\d{2})";
+                Pattern groupPattern = Pattern.compile(groupRegex);
+                Matcher groupMatcher = groupPattern.matcher(group);
+                if(groupMatcher.find()) {
+                    startDate = groupMatcher.group(1);
+                }else{
+                    return "";
+                }
+                String string = "yyyy-MM-dd";
+                SimpleDateFormat dateFormat = new SimpleDateFormat(string);
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                Date parse = dateFormat.parse(startDate);
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(parse);
+                calendar.add(Calendar.DAY_OF_MONTH, 1); // 加一天
+                // 获取增加一天后的日期
+                Date newDate = calendar.getTime();
+                return simpleDateFormat.format(newDate);
+
+            } catch (Exception e) {
+                throw new SystemException(message);
+            }
+        }
+        return "";
+    }
+
+    /**
+     * 重复投保
+     *
+     * @param resp            响应
+     * @param requestInfoList 返回重复信息
+     * @param req             重新构造请求
+     * @return 正确与否
+     */
+    public static boolean processor(PremiumResponse resp, List<String> requestInfoList, PremiumRequest req) {
+        String syEndDate = "";
+        PremiumResponse.DataDTO data = resp.getData();
+        if (ObjectUtils.isEmpty(data)) {
+            throw new SystemException("程序异常请联系管理员");
+        }
+
+        if (StringUtils.isNotEmpty(data.getBireCoverMsg()) && data.getBireCoverMsg().contains("重复投保")) {
+            requestInfoList.add(data.getBireCoverMsg());
+            syEndDate = getTheExpiryDate(data.getBireCoverMsg(), THE_FIRST_REGEX);
+            // 商业险
+            PremiumRequest.BiDTO bi = req.getBi();
+            bi.setBusinessTime(syEndDate);
+            return true;
+        }
+
+        String resultMsg = resp.getResultMsg();
+        //1. 交强重复投保 替换日期重新报价
+        if (StringUtils.isNotEmpty(resultMsg) && resultMsg.contains("重复投保")) {
+            requestInfoList.add(resultMsg);
+            String jqEndDate = getEndDate(resultMsg, THE_FIRST_REGEX);
+            if (resp.getResultMsg().contains(SY)) {
+                syEndDate = getEndDate(resultMsg, THE_SECOND_REGEX);
+            }
+
+            if (StringUtils.isNotEmpty(syEndDate)) {
+                // 商业险
+                PremiumRequest.BiDTO bi = req.getBi();
+                bi.setBusinessTime(syEndDate);
+            }
+
+            if (StringUtils.isNotEmpty(jqEndDate)) {
+                // 交强
+                PremiumRequest.CiDTO ci = req.getCi();
+                ci.setTrafficTime(jqEndDate);
+            }
+            if (StringUtils.isNotEmpty(jqEndDate) || StringUtils.isNotEmpty(syEndDate)) {
+                return true;
+            }
+            return false;
+        }
+
+        return false;
+
+    }
+
+    /**
+     * 校验码有误
+     *
+     * @param response 响应
+     * @return 正确与否
+     */
+    public static boolean theCheckCodeIsWrong(PremiumResponse response) {
+        if (response.getResultMsg().contains("校验码有误")) {
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 转保单
+     *
+     * @param resp            响应
+     * @param requestInfoList 返回重复信息
+     * @param req             重新构造请求
+     * @return 正确与否
+     */
+    public static boolean buildCheckCodeParam(PremiumResponse resp, List<String> requestInfoList, PremiumRequest req) {
+        String ciCheckCode = resp.getData().getCicheckCode();
+        String biCheckCode = resp.getData().getBicheckCode();
+        if (StringUtils.isNotEmpty(ciCheckCode) || StringUtils.isNotEmpty(biCheckCode)) {
+            CheckCodeResp ccResp = gainCheckCode(ciCheckCode, biCheckCode);
+            req.getCi().getPrpTmain().setAnswer(ccResp.getJqImageCode());
+            req.getBi().getPrpTmain().setAnswer(ccResp.getSyImageCode());
+            requestInfoList.add("转保单");
+            return true;
+        }
+        return false;
+    }
+
+    public static String toString(Object object, String defaultValue) {
+        if (object == null) return defaultValue;
+        return String.valueOf(object);
+    }
+
+    public static String toJson(Object value) {
+        Assert.notNull(value);
+
+        try {
+            return new ObjectMapper().writeValueAsString(value);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public static String sendPost(String url,String bodyStr){
+        System.err.println("请求[post、json、body]参数:"+bodyStr);
+        HttpRequest request = HttpRequest.post(url)
+                .header("Content-Type", "application/json")//以json的方式传递
+//     .header("authorization","Bearer abcdefghijklmnopqrstuvwxyz")
+                .body(bodyStr);
+
+        HttpResponse response = request.execute();
+        String respStr = response.body();
+        System.err.println("返回[post、json、body]参数:"+ respStr);
+
+        return respStr;
+    }
+
+    /**
+     * 获取图片验证码 校验的code
+     *
+     * @author: lig
+     * @date: 2023年10月13日 0013
+     */
+    private static CheckCodeResp gainCheckCode(String jqImageStr, String syImageStr) {
+        Map<String, String> bodyMap = new HashMap<>();
+        bodyMap.put("jqImage", toString(jqImageStr, ""));
+        bodyMap.put("syImage", toString(syImageStr, ""));
+        String sendBody = toJson(bodyMap);
+        String ocrStr = sendPost("http://39.98.41.104:8088/getres", sendBody);
+        return JSONUtil.toBean(ocrStr, CheckCodeResp.class);
+
+    }
+
+
+    @Data
+    static class CheckCodeResp {
+
+        @JsonProperty(value = "jqImageCode")
+        String jqImageCode;
+
+        @JsonProperty(value = "syImageCode")
+        String syImageCode;
+
+    }
+
+}

+ 5 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/GuoRenApiOrder.java

@@ -61,4 +61,9 @@ public class GuoRenApiOrder {
      * 国任财险 商业险保单号
      */
     private String syPolicyNo;
+
+    /**
+     * 产品代码
+     */
+    private String productsCode;
 }

+ 1 - 3
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/Request/CarPriceRequest.java

@@ -139,9 +139,7 @@ public class CarPriceRequest {
         prpTitemCar.setCertifiCateDate(carInfo.getIssueDate());
 
         //使用性质  8A	家庭自用
-        String vehicleUse = carInfo.getVehicleUseCode();
-        UseNatureCodeMapping useNatureCodeMapping = UseNatureCodeMapping.valueOf(UseNatureCodeMapping.TITLE + vehicleUse);
-        prpTitemCar.setUseNatureCode(useNatureCodeMapping.getUseNatureCode());
+        prpTitemCar.setUseNatureCode(carInfo.getVehicleUseCode());
         // 初登日期
         prpTitemCar.setEnrollDate(carInfo.getRegisterDate());
         //核定载客数

+ 17 - 31
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/entity/Request/PremiumRequest.java

@@ -94,42 +94,28 @@ public class PremiumRequest {
             }
         });
 
-        List<GuoRenSpecialAgreementVo> trafficSpecialAgreement =
-                specialAgreementVo.stream().filter(x -> InsuranceRisk.TRAFFIC.getCode().equals(x.getRiskCode())).collect(Collectors.toList());
-        CiDTO ciDto = buildCiDto(vehicleAndVesselTax, ownersInfo, ciRiskInfoVo, isNoCar, trafficSpecialAgreement, noCarPremium, goodsCode);
-        ciDto.setTrafficTime(ciRiskInfoVo.getStartDate());
-        quoteReq.setCi(ciDto);
-
-        List<GuoRenSpecialAgreementVo> businessSpecialAgreement =
-                specialAgreementVo.stream().filter(x -> InsuranceRisk.BUSINESS.getCode().equals(x.getRiskCode())).collect(Collectors.toList());
-        BiDTO biDto = buildBiDto(ownersInfo, biRiskInfoVo, kindInfoVList, carPriceResult, vinQ, isNoCar, businessSpecialAgreement, noCarPremium, goodsCode);
-        biDto.setBusinessTime(biRiskInfoVo.getStartDate());
-        quoteReq.setBi(biDto);
-
-        /*riskList.forEach(a -> {
-            if (a.getRiskCode().equals(InsuranceRisk.TRAFFIC.getCode())) {
-                List<GuoRenSpecialAgreementVo> trafficSpecialAgreement =
-                        specialAgreementVo.stream().filter(x -> InsuranceRisk.TRAFFIC.getCode().equals(x.getRiskCode())).collect(Collectors.toList());
-                CiDTO ciDto = buildCiDto(vehicleAndVesselTax, ownersInfo, a, isNoCar, trafficSpecialAgreement, noCarPremium, goodsCode);
-                ciDto.setTrafficTime(a.getStartDate());
-                quoteReq.setCi(ciDto);
-            } else if (a.getRiskCode().equals(InsuranceRisk.BUSINESS_CODE)) {
-                List<GuoRenSpecialAgreementVo> businessSpecialAgreement =
-                        specialAgreementVo.stream().filter(x -> InsuranceRisk.BUSINESS_CODE.equals(x.getRiskCode())).collect(Collectors.toList());
-                BiDTO biDto = buildBiDto(ownerInfo, a, kindInfoVList, carPriceResult, vinQ, isNoCar, businessSpecialAgreement, noCarPremium, goodsCode);
-                biDto.setBusinessTime(a.getStartDate());
-                quoteReq.setBi(biDto);
-            }
-        });*/
-
+        if (ciRiskInfoVo != null && ciRiskInfoVo.getRiskCode().equals(InsuranceRisk.TRAFFIC.getCode())) {
+            List<GuoRenSpecialAgreementVo> trafficSpecialAgreement =
+                    specialAgreementVo.stream().filter(x -> InsuranceRisk.TRAFFIC.getCode().equals(x.getRiskCode())).collect(Collectors.toList());
+            CiDTO ciDto = buildCiDto(vehicleAndVesselTax, ownersInfo, ciRiskInfoVo, isNoCar, trafficSpecialAgreement, noCarPremium, goodsCode);
+            ciDto.setTrafficTime(ciRiskInfoVo.getStartDate());
+            quoteReq.setCi(ciDto);
+        }
+        if (biRiskInfoVo != null && biRiskInfoVo.getRiskCode().equals(InsuranceRisk.BUSINESS.getCode())) {
+            List<GuoRenSpecialAgreementVo> businessSpecialAgreement =
+                    specialAgreementVo.stream().filter(x -> InsuranceRisk.BUSINESS.getCode().equals(x.getRiskCode())).collect(Collectors.toList());
+            BiDTO biDto = buildBiDto(ownersInfo, biRiskInfoVo, kindInfoVList, carPriceResult, vinQ, isNoCar, businessSpecialAgreement, noCarPremium, goodsCode);
+            biDto.setBusinessTime(biRiskInfoVo.getStartDate());
+            quoteReq.setBi(biDto);
+        }
         //未投保交强
         if (null == quoteReq.getCi()) {
-            ciDto = buildCiDto(null, ownersInfo, null, false, new ArrayList<>(), "", "");
+            CiDTO ciDto = buildCiDto(null, ownersInfo, null, false, new ArrayList<>(), "", "");
             quoteReq.setCi(ciDto);
         }
         //未投保商业
         if (null == quoteReq.getBi()) {
-            biDto = buildBiDto(ownersInfo, null, null, null, vinQ, false, new ArrayList<>(), "", "");
+            BiDTO biDto = buildBiDto(ownersInfo, null, null, null, vinQ, false, new ArrayList<>(), "", "");
             quoteReq.setBi(biDto);
         }
 
@@ -630,7 +616,7 @@ public class PremiumRequest {
         prptitemkind.setDeductible("");
         prptitemkind.setIsDeductible("true");
         prptitemkind.setRate("");
-        //prptitemkind.setAmount(ciRiskInfo.getAmount());暂时不设置交强险保额
+        prptitemkind.setAmount("200000");
         prptitemkind.setNoTaxPremium("");
         prptitemkind.setTaxFee("");
         prptitemkind.setFlag("2 03");

+ 3 - 0
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/GuoRenApiOrderService.java

@@ -1,6 +1,9 @@
 package com.jzg.quotation.guoren.api.service;
 
+import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
 import com.jzg.quotation.guoren.api.entity.GuoRenApiOrder;
+import com.jzg.quotation.guoren.api.entity.Response.InsuranceSlipResponse;
+import com.jzg.quotation.guoren.api.entity.Response.PremiumResponse;
 
 /**
  * @description: todo

+ 3 - 1
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/Impl/GuoRenApiOrderServiceImpl.java

@@ -1,6 +1,9 @@
 package com.jzg.quotation.guoren.api.service.Impl;
 
+import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
 import com.jzg.quotation.guoren.api.entity.GuoRenApiOrder;
+import com.jzg.quotation.guoren.api.entity.Response.InsuranceSlipResponse;
+import com.jzg.quotation.guoren.api.entity.Response.PremiumResponse;
 import com.jzg.quotation.guoren.api.repository.GuoRenApiOrderRepository;
 import com.jzg.quotation.guoren.api.service.GuoRenApiOrderService;
 import lombok.RequiredArgsConstructor;
@@ -26,7 +29,6 @@ public class GuoRenApiOrderServiceImpl implements GuoRenApiOrderService {
     }
 
     /**
-     * @param guoRenApiOrder
      * @return
      */
     @Override

+ 66 - 16
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/api/service/Impl/GuoRenApiRequestImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.jzg.commons.constants.InsuranceRisk;
+import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.StringUtils;
@@ -20,6 +21,7 @@ import com.jzg.quotation.commons.utils.DateTimeUtil;
 import com.jzg.quotation.commons.utils.HttpUtil;
 import com.jzg.quotation.guoren.api.build.GuoRenApiQuoteResultsVoBuild;
 import com.jzg.quotation.guoren.api.component.GuoRenRequestApiComponent;
+import com.jzg.quotation.guoren.api.component.GuorenDuplicateInsuranceComponent;
 import com.jzg.quotation.guoren.api.entity.GuoRenApiOrder;
 import com.jzg.quotation.guoren.api.entity.GuoRenConfigureParameters;
 import com.jzg.quotation.guoren.api.entity.Request.*;
@@ -102,7 +104,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
         String noCarPremium = "";
         String goodsCode = "";
         GuoRenAccidentalDrivingVo accidentalDrivingVo = getGuoRenAccidentalDrivingVo(quoteVo.getAccidentalDrivings());
-        if (accidentalDrivingVo != null) {
+        if (accidentalDrivingVo.getProdCode() != null) {
             NonAutoInsOrderResponse nonAutoInsOrderResponse = nonAutoInsOrder(quoteVo, accidentalDrivingVo,
                     carPriceQuery.getInputvo(), parameters, vinQuery);
             AssertionUtils.isEmpty(nonAutoInsOrderResponse.getData(), nonAutoInsOrderResponse.getMessage());
@@ -119,24 +121,42 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
         // 4、保费计算
         PremiumResponse premiumResponse = premiumQuery(quoteVo, carPriceQuery, vinQuery, isNoCar,
                 specialAgreements, noCarPremium, goodsCode);
-        PremiumResponse.DataDTO premiumResult = premiumResponse.getData();
-        AssertionUtils.isEmpty(premiumResult, "保费计算失败");
-
-        //保存投保单 该接口返回投保单号
-        InsuranceSlipResponse insuranceSlipResponse = guoRenRequestApiComponent.insuranceSlip(quoteVo,
-                carPriceQuery.getInputvo(), orderCode, specialAgreements);
-
-        GuoRenApiOrder guoRenApiOrder = new GuoRenApiOrder();
-        guoRenApiOrder.setOrdersNo(orderBase.getOrdersNo());
-        guoRenApiOrder.setJqPremium(new BigDecimal(premiumResult.getSumPremiumCI()));
-        guoRenApiOrder.setSyPremium(new BigDecimal(premiumResult.getSumPremiumBI()));
-        guoRenApiOrder.setJqApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoCI());
-        guoRenApiOrder.setSyApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoBI());
+
+        if (premiumResponse.getResultCode() == 1) {
+            // 保费计算失败返回
+            GuoRenApiOrder guoRenApiOrder = new GuoRenApiOrder();
+            guoRenApiOrder.setOrdersNo(orderBase.getOrdersNo());
+            guoRenApiOrder.setProductsCode(orderBase.getProductsCode());
+            return handleFailedQuote(guoRenApiOrder,quoteVo,premiumResponse);
+        } else {
+            //保存投保单 该接口返回投保单号
+            InsuranceSlipResponse insuranceSlipResponse = guoRenRequestApiComponent.insuranceSlip(quoteVo,
+                    carPriceQuery.getInputvo(), orderCode, specialAgreements);
+            if (insuranceSlipResponse.getResultCode() == 1) {
+                throw new SystemException(insuranceSlipResponse.getResultMsg());
+            }
+            // 保费计算成功返回
+            GuoRenApiOrder guoRenApiOrder = new GuoRenApiOrder();
+            guoRenApiOrder.setOrdersNo(orderBase.getOrdersNo());
+            guoRenApiOrder.setProductsCode(orderBase.getProductsCode());
+            guoRenApiOrder.setJqApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoCI());
+            guoRenApiOrder.setSyApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoBI());
+            return handleSuccessQuote(guoRenApiOrder,quoteVo, premiumResponse);
+        }
+    }
+
+    private QuoteResultsVo handleFailedQuote(GuoRenApiOrder guoRenApiOrder,QuoteVo quoteVo,PremiumResponse response) {
         guoRenApiOrderService.save(guoRenApiOrder);
+        return GuoRenApiQuoteResultsVoBuild.buildQuoteFailResultsVo(response);
+    }
 
-        return GuoRenApiQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo, premiumResponse);
+    private QuoteResultsVo handleSuccessQuote(GuoRenApiOrder guoRenApiOrder,QuoteVo quoteVo,PremiumResponse response) {
+        guoRenApiOrderService.save(guoRenApiOrder);
+        return GuoRenApiQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo,response);
     }
 
+
+
     /**
      * 提交核保 子订单
      *
@@ -413,10 +433,40 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
 
     public PremiumResponse premiumQuery(QuoteVo quoteVo, CarPriceResponse.DataDTO carPriceQuery, VinQueryResponse.DataDTO vinQuery, Boolean isNoCar,
                                         List<GuoRenSpecialAgreementVo> specialAgreements, String noCarPremium, String goodsCode) {
+        boolean boo;
+        //请求信息列表
+        List<String> requestInfoList = new ArrayList<>();
         //构造请求参数
         PremiumRequest premiumRequest = PremiumRequest.buildQuoteParam(quoteVo, carPriceQuery, vinQuery, isNoCar, specialAgreements, noCarPremium, goodsCode);
-        PremiumResponse premiumResponse = guoRenRequestApiComponent.request(premiumRequest, PlatformInterfaceCode.API_IIRBT00004, PremiumResponse.class);
+        PremiumResponse premiumResponse;
+        int a = 0;
+        for (; ; ) {
+            premiumResponse = guoRenRequestApiComponent.request(premiumRequest, PlatformInterfaceCode.API_IIRBT00004, PremiumResponse.class);
+
+            premiumRequest.getCi().getPrpTmain().setAnswer(null);
+            premiumRequest.getBi().getPrpTmain().setAnswer(null);
+            //1、 交强险重复投保 替换时间
+            boo = GuorenDuplicateInsuranceComponent.processor(premiumResponse, requestInfoList, premiumRequest);
+            if (boo) {
+                a++;
+                continue;
+            }
 
+            boo = GuorenDuplicateInsuranceComponent.theCheckCodeIsWrong(premiumResponse);
+            if (boo) {
+                a++;
+                continue;
+            }
+            //2、 转保
+            boo = GuorenDuplicateInsuranceComponent.buildCheckCodeParam(premiumResponse, requestInfoList, premiumRequest);
+            if (boo) {
+                continue;
+            }
+            if (a > 3) {
+                break;
+            }
+            break;
+        }
         premiumResponse.getData().setCiStartDate(premiumRequest.getCi().getPrpTmain().getStartDate());
         premiumResponse.getData().setCiEndDate(premiumRequest.getCi().getPrpTmain().getEndDate());
         premiumResponse.getData().setBiStartDate(premiumRequest.getBi().getPrpTmain().getStartDate());

+ 1 - 3
tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/entity/request/YangGuangAccuracyCalculateRequest.java

@@ -266,7 +266,6 @@ public class YangGuangAccuracyCalculateRequest extends YangGuangBaseRequest{
             this.NonVehicleProductInformationList = quoteVo.getAccidentalDrivings().stream().map(NonVehicleProductInformationListDTO::new).collect(Collectors.toList());
             this.CasualtyFlag = "1";
         }
-        System.out.println(quoteVo.getVehicleAndVesselTaxVo());
         this.carshipyTaxInfo = new CarshipyTaxInfoDTO(quoteVo.getVehicleAndVesselTaxVo(),quoteVo.getCiRiskInfoVo(),quoteVo.getBiRiskInfoVo(),quoteVo.getOwnersInfo());
     }
 
@@ -703,8 +702,7 @@ public class YangGuangAccuracyCalculateRequest extends YangGuangBaseRequest{
             YangGuangCarType yangGuangCarType = Enum.valueOf(YangGuangCarType.class,carInfoVo.getCarTypeCode());
             this.VehicleType = yangGuangCarType.getCode();
             // 车辆使用性质代码
-            YgUseNatureCode ygUseNatureCode1 = Enum.valueOf(YgUseNatureCode.class, YgUseNatureCode.TITLE + carInfoVo.getVehicleUseCode());
-            this.UseNatureCode = ygUseNatureCode1.getCode();
+            this.UseNatureCode = carInfoVo.getVehicleUseCode();
             this.EnrollDate = carInfoVo.getRegisterDate();
             this.LicenseNo = carInfoVo.getLicenseNo();
             this.EngineNo = carInfoVo.getEngineNo();

+ 60 - 9
tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/service/impl/YangGuangApiRequestImpl.java

@@ -1,7 +1,5 @@
 package com.jzg.quotation.yangguang.api.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
@@ -25,14 +23,15 @@ import com.jzg.quotation.yangguang.api.properties.YangGuangApiProperties;
 import com.jzg.quotation.yangguang.api.service.YangGuangApiRequest;
 import com.jzg.quotation.yangguang.api.service.YangGuangCrawlerOrderService;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 /**
  * @author quchen
@@ -89,10 +88,10 @@ public class YangGuangApiRequestImpl implements YangGuangApiRequest {
                 newRequest.setInfotransNo(yangGuangQueryVehicleModelResponse.getInfotransNo());
                 return recursiveQuote(newRequest, carModel, yangGuangQueryVehicleModelResponse,quoteVo, parameters);
             }
-            handleFailedQuote(response, quoteVo);
+            return handleFailedQuote(response, quoteVo);
+        } else {
+            return handleSuccessfulQuote(response, quoteVo);
         }
-
-        return handleSuccessfulQuote(response, quoteVo);
     }
 
     private QuoteResultsVo handleFailedQuote(YangGuangAccuracyCalculateResponse response,QuoteVo quoteVo) {
@@ -218,12 +217,64 @@ public class YangGuangApiRequestImpl implements YangGuangApiRequest {
             throw new RuntimeException(e);
         }
     }
-
     @Override
     public DownloadPolicyResultVo downloadPolicy(DownloadPolicyVo downloadPolicyVo) {
+        OrderBase orderBase = downloadPolicyVo.getOrder();
+        // 配置信息
+        YangGuangConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(YangGuangConfigureParameters.class, orderBase
+                .getAttributionInformationVo()
+                .getConfigInfo());
+        DownloadPolicyResultVo downloadPolicyResultVo = new DownloadPolicyResultVo();
+        String jqPolicyNo = downloadPolicyVo.getPolicie().getJqPolicyNo();
+        if(Objects.nonNull(jqPolicyNo)) {
+            queryPolicy(jqPolicyNo, parameters, downloadPolicyResultVo,PolicyType.JQ);
+        }
+        String syPolicyNo = downloadPolicyVo.getPolicie().getSyPolicyNo();
+        if(Objects.nonNull(syPolicyNo)) {
+            queryPolicy(syPolicyNo, parameters, downloadPolicyResultVo,PolicyType.SY);
+        }
+        String jyPolicyNo = downloadPolicyVo.getPolicie().getJyPolicyNo();
+        if(Objects.nonNull(jyPolicyNo)) {
+            queryPolicy(jyPolicyNo, parameters, downloadPolicyResultVo,PolicyType.JY);
+        }
+        return downloadPolicyResultVo;
+    }
 
-        return null;
+    /**
+     * 查询保单
+     * @param policyNo
+     * @param parameters
+     * @param downloadPolicyResultVo
+     */
+    private void queryPolicy(String policyNo,YangGuangConfigureParameters parameters,DownloadPolicyResultVo downloadPolicyResultVo,PolicyType policyType){
+        YangGuangGetEpolicyPdfUrlRequest downloadPolicyRequest = new YangGuangGetEpolicyPdfUrlRequest(parameters, policyNo);
+        try {
+            YangGuangGetEpolicyPdfUrlResponse response = yangGuangApiRequestComponent.getEpolicyPDFURL(downloadPolicyRequest);
+            if (response.getErrorCode().equals("0")) {
+                if (StringUtils.isNotEmpty(response.getEPolicyPDFURL())) {
+                    String url = response.getEPolicyPDFURL();
+                    switch (policyType) {
+                        case JQ: // 交强保单
+                            downloadPolicyResultVo.setJqUrl(url);
+                            break;
+                        case SY: // 商业保单
+                            downloadPolicyResultVo.setSyUrl(url);
+                            break;
+                        case JY: // 非车保单
+                            downloadPolicyResultVo.setJyUrl(url);
+                            break;
+                    }
+                }
+            } else {
+                throw new SystemException(response.getErrorMessage());
+            }
+        } catch (JsonProcessingException jsonProcessingException) {
+            throw new SystemException("获取电子保单失败");
+        }
+    }
 
+    private enum PolicyType {
+        JQ, SY, JY
     }
 
 
@@ -260,7 +311,7 @@ public class YangGuangApiRequestImpl implements YangGuangApiRequest {
                 // underwritingResultsVo.setUnderwritingResult(sb.toString());
             } else if ("1".equals(statusJq) || "1".equals(statusSy)) {
                 // 自动核保成功
-                // underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
+                insOrders.setOrderStatus(InsOrderStatusEnum.PAY_PENDING.getCode());
                 String jq = yangGuangProposalStatusQueryResponse.getCiProposalNo(); // 交强险投保单号
                 String sy = yangGuangProposalStatusQueryResponse.getBiProposalNo(); // 商业险投保单号
                 insOrdersPolicy.setJqApplyNo(jq);