dongxin 1 жил өмнө
parent
commit
5b50e6298d

+ 119 - 133
src/main/java/com/ydtech/modules/order/entity/api/chengtai/response/InsurePremiumResponse.java

@@ -8,134 +8,24 @@ import com.ydtech.utils.StringUtils;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 
 @NoArgsConstructor
 @Data
-public class InsurePremiumResponse extends ChengTaiBaseResponse{
-
+public class InsurePremiumResponse extends ChengTaiBaseResponse {
     @JsonProperty("orderId")
     private String orderId;
+    @JsonProperty("carRegistFlag")
+    private String carRegistFlag;
     @JsonProperty("biContract")
     private BiContractDTO biContract;
-//    @JsonProperty("insuredObject")
-//    private InsuredObjectDTO insuredObject;
-    @JsonProperty("ciContract")
-    private CiContractDTO ciContract;
     @JsonProperty("accContract")
     private AccContractDTO accContract;
-    @JsonProperty("carRegistFlag")
-    private String carRegistFlag;
-
-
-    @NoArgsConstructor
-    @Data
-    public static class AccContractDTO {
-        @JsonProperty("coverage")
-        private List<InsurePremiumResponse.AccContractDTO.CoverageDTO> coverage;
-        @JsonProperty("engage")
-        private List<InsurePremiumResponse.AccContractDTO.EngageDTO> engage;
-        @JsonProperty("contractMain")
-        private InsurePremiumResponse.AccContractDTO.ContractMainDTO contractMain;
-
-        public static List<AccidentResponseVo> toAccidentResponseVoList(AccContractDTO accContract, BaseQuoteVo<InsDrivingIntentionInsurance> quoteInfoVo) {
-            InsurePremiumResponse.AccContractDTO.ContractMainDTO contractMainDTO = accContract.getContractMain();
-            InsDrivingIntentionInsurance insDrivingIntentionInsurance = quoteInfoVo.getAccidentalDrivingVo();
-            List<AccidentResponseVo> accidentResponseVoList = new ArrayList<>();
-            AccidentResponseVo accidentResponseVo = new AccidentResponseVo();
-
-            accidentResponseVo.setProjectCode(quoteInfoVo.getAccidentalDrivingVo().getProjectCode());
-            if (StringUtils.isNotBlank(quoteInfoVo.getAccidentalDrivingVo().getProjectName())) {
-                accidentResponseVo.setProjectName(quoteInfoVo.getAccidentalDrivingVo().getProjectName());
-            }
-            accidentResponseVo.setPremium(contractMainDTO.getTotalPremium().toString());
-            accidentResponseVo.setQuantity("1");
-            accidentResponseVo.setActualPremium(contractMainDTO.getSumAmount().toString());
-            accidentResponseVoList.add(accidentResponseVo);
-            return accidentResponseVoList;
-        }
-
-        @NoArgsConstructor
-        @Data
-        public static class ContractMainDTO {
-            @JsonProperty("riskName")
-            private String riskName;
-            @JsonProperty("hopeDiscount")
-            private String hopeDiscount;
-            @JsonProperty("validDate")
-            private String validDate;
-            @JsonProperty("riskCode")
-            private String riskCode;
-            @JsonProperty("totalPremium")
-            private String totalPremium;
-            @JsonProperty("policyNo")
-            private String policyNo;
-            @JsonProperty("validAtOnce")
-            private String validAtOnce;
-            @JsonProperty("renewalFlag")
-            private String renewalFlag;
-            @JsonProperty("lastYearPolicyNo")
-            private String lastYearPolicyNo;
-            @JsonProperty("sumAmount")
-            private String sumAmount;
-            @JsonProperty("proposalNo")
-            private String proposalNo;
-            @JsonProperty("expiryDate")
-            private String expiryDate;
-            @JsonProperty("currency")
-            private String currency;
-        }
-
-        @NoArgsConstructor
-        @Data
-        public static class CoverageDTO {
-            @JsonProperty("glassClassName")
-            private String glassClassName;
-            @JsonProperty("amount")
-            private Integer amount;
-            @JsonProperty("kindCode")
-            private String kindCode;
-            @JsonProperty("quantity")
-            private String quantity;
-            @JsonProperty("validDate")
-            private String validDate;
-            @JsonProperty("coveragePremium")
-            private String coveragePremium;
-            @JsonProperty("glassClassCode")
-            private String glassClassCode;
-            @JsonProperty("calculateFlag")
-            private String calculateFlag;
-            @JsonProperty("expiryDate")
-            private String expiryDate;
-            @JsonProperty("ifMainKind")
-            private String ifMainKind;
-            @JsonProperty("deductible")
-            private String deductible;
-            @JsonProperty("kindName")
-            private String kindName;
-            @JsonProperty("unitAmount")
-            private String unitAmount;
-            @JsonProperty("currency")
-            private String currency;
-        }
-
-        @NoArgsConstructor
-        @Data
-        public static class EngageDTO {
-            @JsonProperty("engageDetail")
-            private String engageDetail;
-            @JsonProperty("modifyind")
-            private String modifyind;
-            @JsonProperty("engageCode")
-            private String engageCode;
-            @JsonProperty("engageTitle")
-            private String engageTitle;
-            @JsonProperty("chooseType")
-            private String chooseType;
-        }
-    }
+    @JsonProperty("insuredObject")
+    private InsuredObjectDTO insuredObject;
+    @JsonProperty("ciContract")
+    private CiContractDTO ciContract;
 
     @NoArgsConstructor
     @Data
@@ -153,7 +43,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
         @JsonProperty("chargingPileList")
         private List<?> chargingPileList;
         @JsonProperty("coveragePremium")
-        private List<CoveragePremiumDTO> coveragePremium;
+        private List<?> coveragePremium;
         @JsonProperty("reInsureItem")
         private ReInsureItemDTO reInsureItem;
         @JsonProperty("contractMain")
@@ -276,7 +166,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("riskCode")
             private String riskCode;
             @JsonProperty("totalPremium")
-            private BigDecimal totalPremium;
+            private Double totalPremium;
             @JsonProperty("policyNo")
             private String policyNo;
             @JsonProperty("validAtOnce")
@@ -303,7 +193,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("glassClassName")
             private String glassClassName;
             @JsonProperty("amount")
-            private Double amount;
+            private Integer amount;
             @JsonProperty("kindCode")
             private String kindCode;
             @JsonProperty("quantity")
@@ -311,7 +201,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("validDate")
             private String validDate;
             @JsonProperty("coveragePremium")
-            private BigDecimal coveragePremium;
+            private String coveragePremium;
             @JsonProperty("glassClassCode")
             private String glassClassCode;
             @JsonProperty("calculateFlag")
@@ -325,7 +215,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("kindName")
             private String kindName;
             @JsonProperty("unitAmount")
-            private BigDecimal unitAmount;
+            private Double unitAmount;
             @JsonProperty("currency")
             private String currency;
         }
@@ -359,16 +249,112 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("chooseType")
             private String chooseType;
         }
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class AccContractDTO {
+        @JsonProperty("coverage")
+        private List<CoverageDTO> coverage;
+        @JsonProperty("engage")
+        private List<EngageDTO> engage;
+        @JsonProperty("contractMain")
+        private ContractMainDTO contractMain;
+
+        public static List<AccidentResponseVo> toAccidentResponseVoList(AccContractDTO accContract, BaseQuoteVo<InsDrivingIntentionInsurance> quoteInfoVo) {
+            InsurePremiumResponse.AccContractDTO.ContractMainDTO contractMainDTO = accContract.getContractMain();
+            InsDrivingIntentionInsurance insDrivingIntentionInsurance = quoteInfoVo.getAccidentalDrivingVo();
+            List<AccidentResponseVo> accidentResponseVoList = new ArrayList<>();
+            AccidentResponseVo accidentResponseVo = new AccidentResponseVo();
+
+            accidentResponseVo.setProjectCode(quoteInfoVo.getAccidentalDrivingVo().getProjectCode());
+            if (StringUtils.isNotBlank(quoteInfoVo.getAccidentalDrivingVo().getProjectName())) {
+                accidentResponseVo.setProjectName(quoteInfoVo.getAccidentalDrivingVo().getProjectName());
+            }
+            accidentResponseVo.setPremium(contractMainDTO.getTotalPremium().toString());
+            accidentResponseVo.setQuantity("1");
+            accidentResponseVo.setActualPremium(contractMainDTO.getSumAmount().toString());
+            accidentResponseVoList.add(accidentResponseVo);
+            return accidentResponseVoList;
+        }
 
         @NoArgsConstructor
         @Data
-        public static class CoveragePremiumDTO {
-            @JsonProperty("vehiclaCode")
-            private String vehiclaCode;
-            @JsonProperty("pureriskPremium")
-            private String pureriskPremium;
-            @JsonProperty("used")
-            private String used;
+        public static class ContractMainDTO {
+            @JsonProperty("riskName")
+            private String riskName;
+            @JsonProperty("hopeDiscount")
+            private String hopeDiscount;
+            @JsonProperty("validDate")
+            private String validDate;
+            @JsonProperty("riskCode")
+            private String riskCode;
+            @JsonProperty("totalPremium")
+            private Double totalPremium;
+            @JsonProperty("policyNo")
+            private String policyNo;
+            @JsonProperty("validAtOnce")
+            private String validAtOnce;
+            @JsonProperty("renewalFlag")
+            private String renewalFlag;
+            @JsonProperty("lastYearPolicyNo")
+            private String lastYearPolicyNo;
+            @JsonProperty("sumAmount")
+            private String sumAmount;
+            @JsonProperty("proposalNo")
+            private String proposalNo;
+            @JsonProperty("expiryDate")
+            private String expiryDate;
+            @JsonProperty("currency")
+            private String currency;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class CoverageDTO {
+            @JsonProperty("glassClassName")
+            private String glassClassName;
+            @JsonProperty("amount")
+            private Integer amount;
+            @JsonProperty("kindCode")
+            private String kindCode;
+            @JsonProperty("quantity")
+            private String quantity;
+            @JsonProperty("validDate")
+            private String validDate;
+            @JsonProperty("coveragePremium")
+            private String coveragePremium;
+            @JsonProperty("glassClassCode")
+            private String glassClassCode;
+            @JsonProperty("calculateFlag")
+            private String calculateFlag;
+            @JsonProperty("expiryDate")
+            private String expiryDate;
+            @JsonProperty("ifMainKind")
+            private String ifMainKind;
+            @JsonProperty("deductible")
+            private String deductible;
+            @JsonProperty("kindName")
+            private String kindName;
+            @JsonProperty("unitAmount")
+            private String unitAmount;
+            @JsonProperty("currency")
+            private String currency;
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class EngageDTO {
+            @JsonProperty("engageDetail")
+            private String engageDetail;
+            @JsonProperty("modifyind")
+            private String modifyind;
+            @JsonProperty("engageCode")
+            private String engageCode;
+            @JsonProperty("engageTitle")
+            private String engageTitle;
+            @JsonProperty("chooseType")
+            private String chooseType;
         }
     }
 
@@ -475,9 +461,9 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
         @Data
         public static class TaxDTO {
             @JsonProperty("sumTax")
-            private BigDecimal sumTax;
+            private Double sumTax;
             @JsonProperty("sumOverdue")
-            private BigDecimal sumOverdue;
+            private Double sumOverdue;
             @JsonProperty("taxPayerIdentityNo")
             private String taxPayerIdentityNo;
             @JsonProperty("documentNumber")
@@ -485,7 +471,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("taxPayerName")
             private String taxPayerName;
             @JsonProperty("annualTaxDue")
-            private BigDecimal annualTaxDue;
+            private Double annualTaxDue;
             @JsonProperty("noTaxReasonCode")
             private String noTaxReasonCode;
             @JsonProperty("sumTaxDefault")
@@ -542,7 +528,7 @@ public class InsurePremiumResponse extends ChengTaiBaseResponse{
             @JsonProperty("riskCode")
             private String riskCode;
             @JsonProperty("totalPremium")
-            private BigDecimal totalPremium;
+            private String totalPremium;
             @JsonProperty("policyNo")
             private String policyNo;
             @JsonProperty("validAtOnce")

+ 8 - 8
src/main/java/com/ydtech/modules/order/service/impl/ChengTaiOrderApiServiceImpl.java

@@ -161,8 +161,8 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
         if(Objects.nonNull(insurePremiumResponse.getCiContract())){
             if(Objects.nonNull(insurePremiumResponse.getCiContract().getTax())){
                 InsurePremiumResponse.CiContractDTO.TaxDTO taxDTO = insurePremiumResponse.getCiContract().getTax();
-                TaxArrears taxArrears = new TaxArrears("往年欠税", taxDTO.getAnnualTaxDue().doubleValue(),
-                        taxDTO.getSumOverdue().doubleValue());
+                TaxArrears taxArrears = new TaxArrears("往年欠税", taxDTO.getAnnualTaxDue(),
+                        taxDTO.getSumOverdue());
                 List<TaxArrears> taxArrearsList = Collections.singletonList(taxArrears);
                 insAreaCompany.setTaxArrears(JSON.parseArray(JSON.toJSONString(taxArrearsList)));
 
@@ -199,17 +199,17 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
         // 交强
         if(Objects.nonNull(insurePremiumResponse.getCiContract())){
             InsurePremiumResponse.CiContractDTO.ContractMainDTO ciContractMain = insurePremiumResponse.getCiContract().getContractMain();
-            jqPremium = ciContractMain.getTotalPremium().doubleValue();
+            jqPremium = Double.parseDouble(ciContractMain.getTotalPremium());
             quoteRespVo.setStartDateJq(ciContractMain.getValidDate());
             quoteRespVo.setEndDateJq(ciContractMain.getExpiryDate());
             //车船税
             InsurePremiumResponse.CiContractDTO.TaxDTO taxDTO = insurePremiumResponse.getCiContract().getTax();
-            sumPayTax = taxDTO.getSumTax().doubleValue();
+            sumPayTax = taxDTO.getSumTax();
         }
         //商业
         if(Objects.nonNull(insurePremiumResponse.getBiContract())){
             InsurePremiumResponse.BiContractDTO.ContractMainDTO biContractMain = insurePremiumResponse.getBiContract().getContractMain();
-            syPremium = biContractMain.getTotalPremium().doubleValue();
+            syPremium = biContractMain.getTotalPremium();
             quoteRespVo.setStartDateSy(biContractMain.getValidDate());
             quoteRespVo.setEndDateSy(biContractMain.getExpiryDate());
         }
@@ -220,7 +220,7 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
                     InsurePremiumResponse.AccContractDTO.toAccidentResponseVoList(accContract,quoteVo);
             quoteRespVo.setAccident(accidentResponseVos);
             // 驾意险价格
-            jyPremium = Double.parseDouble(accContract.getContractMain().getTotalPremium());
+            jyPremium = accContract.getContractMain().getTotalPremium();
         }
 
         List<QuoteKindRespVo> kindList1 = new ArrayList<>();
@@ -245,8 +245,8 @@ public class ChengTaiOrderApiServiceImpl implements ChengTaiOrderApiService {
                 CtKindCodeEnum ctKindCodeEnum = Enum.valueOf(CtKindCodeEnum.class, kindInfoVo.getKindCode());
                 InsurePremiumResponse.BiContractDTO.CoverageDTO coverageDTO = coverage.stream().filter(a -> a.getKindCode().equals(ctKindCodeEnum.getCode())).collect(Collectors.toList()).get(0);
                 kind.setAmount(coverageDTO.getAmount().doubleValue());
-                kind.setCoveragePremium(coverageDTO.getCoveragePremium().doubleValue());
-                kind.setUnitAmount(coverageDTO.getUnitAmount() != null ? coverageDTO.getUnitAmount().doubleValue() : 0);
+                kind.setCoveragePremium(Double.parseDouble(coverageDTO.getCoveragePremium()));
+                kind.setUnitAmount(Objects.isNull(coverageDTO.getUnitAmount()) ? 0 : coverageDTO.getUnitAmount() );
                 kind.setServiceTimes(coverageDTO.getQuantity());
                 if (!ObjectUtils.isEmpty(kindInfoVo.getDeductibleRate())) {
                     kind.setDeductibleRate(Double.parseDouble(kindInfoVo.getDeductibleRate()));