|
|
@@ -15,6 +15,7 @@ import lombok.NoArgsConstructor;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
@@ -107,6 +108,10 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
|
|
|
@JSONField(name = "policyRatios")
|
|
|
private List<PolicyRatiosDTO> policyRatios;
|
|
|
|
|
|
+ @JsonProperty("quotationList")
|
|
|
+ @JSONField(name = "quotationList")
|
|
|
+ private List<QuotationListDTO> quotationList;
|
|
|
+
|
|
|
public void addCompulsoryInsurance() {
|
|
|
PolicyCoveragesDTO policyCoveragesDTO = new PolicyCoveragesDTO();
|
|
|
policyCoveragesDTO.setDutyCode("TPF");
|
|
|
@@ -176,6 +181,7 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
|
|
|
this.policyCoverages = new ArrayList<>();
|
|
|
this.policyPersons = buildPolicyPersons(quoteVo.getOwnersInfo(), quoteVo.getPolicyHolderInfo(), quoteVo.getInsuredPersonInfo(), userDetailResponse.getDepartmentCode());
|
|
|
this.policyRatios = new ArrayList<>();
|
|
|
+ this.quotationList = buildQuotationList(quoteVo);
|
|
|
}
|
|
|
|
|
|
private List<PolicyPersonsDTO> buildPolicyPersons(CustomerInfoVo ownersInfo, CustomerInfoVo policyHolderInfo, CustomerInfoVo insuredPersonInfo, String department) {
|
|
|
@@ -185,6 +191,16 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
|
|
|
return List.of(owners, policyHolder, insuredPerson);
|
|
|
}
|
|
|
|
|
|
+ private List<QuotationListDTO> buildQuotationList(QuoteVo quoteVo) {
|
|
|
+ List<QuotationListDTO> quotationListDTOS = new ArrayList<>();
|
|
|
+ if (quoteVo.getAccidentalDrivings() != null && quoteVo.getAccidentalDrivings().size() > 0) {
|
|
|
+ for (AccidentalDrivingVo accidentalDriving : quoteVo.getAccidentalDrivings()) {
|
|
|
+ quotationListDTOS.add(new QuotationListDTO(accidentalDriving, quoteVo));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return quotationListDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
public void addCiPolicyRatios() {
|
|
|
PolicyRatiosDTO policyRatiosDTOF44 = new PolicyRatiosDTO("", "", "", "", "F44", "V6", 1, 1, 1, 1, 1);
|
|
|
this.policyRatios.add(policyRatiosDTOF44);
|
|
|
@@ -1204,8 +1220,8 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
|
|
|
this.advicediscount = "";
|
|
|
this.dbVehicleBrand = brandAutoModel.getBrandChnName();
|
|
|
Optional.ofNullable(brandAutoModel.getVtrList())
|
|
|
- .filter(x->!x.isEmpty())
|
|
|
- .ifPresent(x->{
|
|
|
+ .filter(x -> !x.isEmpty())
|
|
|
+ .ifPresent(x -> {
|
|
|
this.dbVehicleTypeName = x.get(0).getJyVehicleTypeName();
|
|
|
this.vehicleTypeChiName = x.get(0).getVehicleTypeName();
|
|
|
});
|
|
|
@@ -1900,5 +1916,54 @@ public class AnShengCrawlerCalculatePremiumApplyMessage {
|
|
|
@JSONField(name = "ratiototal")
|
|
|
private Integer ratiototal;
|
|
|
}
|
|
|
+
|
|
|
+ @AllArgsConstructor
|
|
|
+ @NoArgsConstructor
|
|
|
+ @Data
|
|
|
+ public static class QuotationListDTO {
|
|
|
+ @JsonProperty("totalStandardPremium")
|
|
|
+ @JSONField(name = "totalStandardPremium")
|
|
|
+ private Integer totalStandardPremium;
|
|
|
+
|
|
|
+ @JsonProperty("totalAgreePremium")
|
|
|
+ @JSONField(name = "totalAgreePremium")
|
|
|
+ private Integer totalAgreePremium;
|
|
|
+
|
|
|
+ @JsonProperty("totalActualPremium")
|
|
|
+ @JSONField(name = "totalActualPremium")
|
|
|
+ private Integer totalActualPremium;
|
|
|
+
|
|
|
+ @JsonProperty("insuranceBeginTime")
|
|
|
+ @JSONField(name = "insuranceBeginTime")
|
|
|
+ private String insuranceBeginTime;
|
|
|
+
|
|
|
+ @JsonProperty("insuranceEndTime")
|
|
|
+ @JSONField(name = "insuranceEndTime")
|
|
|
+ private String insuranceEndTime;
|
|
|
+
|
|
|
+ @JsonProperty("productCode")
|
|
|
+ @JSONField(name = "productCode")
|
|
|
+ private String productCode;
|
|
|
+
|
|
|
+ @JsonProperty("totalInsuredAmount")
|
|
|
+ @JSONField(name = "totalInsuredAmount")
|
|
|
+ private Integer totalInsuredAmount;
|
|
|
+
|
|
|
+ public QuotationListDTO(AccidentalDrivingVo accidentalDrivingVo, QuoteVo quoteVo) {
|
|
|
+ BigDecimal premiumBigDecimal = new BigDecimal(accidentalDrivingVo.getPremium());
|
|
|
+ int premiumInt = premiumBigDecimal.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
|
|
|
+ this.totalStandardPremium = premiumInt;
|
|
|
+ this.totalAgreePremium = premiumInt;
|
|
|
+ this.totalActualPremium = premiumInt;
|
|
|
+ if (quoteVo.getCiRiskInfoVo() != null) {
|
|
|
+ this.insuranceBeginTime = quoteVo.getCiRiskInfoVo().getStartDate();
|
|
|
+ this.insuranceEndTime = quoteVo.getCiRiskInfoVo().getEndDate();
|
|
|
+ } else {
|
|
|
+ this.insuranceBeginTime = quoteVo.getBiRiskInfoVo().getStartDate();
|
|
|
+ this.insuranceEndTime = quoteVo.getBiRiskInfoVo().getEndDate();
|
|
|
+ }
|
|
|
+ this.productCode = accidentalDrivingVo.getProductCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|