|
@@ -1,14 +1,29 @@
|
|
|
package com.jzg.quotation.zijin.api.entity.request;
|
|
package com.jzg.quotation.zijin.api.entity.request;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.IdcardUtil;
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.quote.CarInfoVo;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.quote.CustomerInfoVo;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.quote.KindInfoVo;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.quote.RiskInfoVo;
|
|
|
|
|
+import com.jzg.quotation.zijin.api.constant.enums.CalculateFlagEnum;
|
|
|
|
|
+import com.jzg.quotation.zijin.api.constant.enums.RiskCodeEnum;
|
|
|
|
|
+import com.jzg.quotation.zijin.api.entity.ZiJinApiConfigureParameters;
|
|
|
|
|
+import com.jzg.quotation.zijin.api.entity.response.ModelQueryResponse;
|
|
|
|
|
+import com.jzg.quotation.zijin.api.utils.InsuranceTimeProcessing;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
|
import lombok.Getter;
|
|
import lombok.Getter;
|
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
import java.io.Serial;
|
|
import java.io.Serial;
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @description: 紫金财险 保费计算 入参实体
|
|
* @description: 紫金财险 保费计算 入参实体
|
|
@@ -96,6 +111,35 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("demandNoCheckFlag")
|
|
@JsonProperty("demandNoCheckFlag")
|
|
|
private String demandNoCheckFlag = "1";
|
|
private String demandNoCheckFlag = "1";
|
|
|
|
|
|
|
|
|
|
+ public CalculatePremiumRequest(QuoteVo quoteVo, ModelQueryResponse.VehicleModelInfosDTO vehicleModelInfosDTO, String actualValue, ZiJinApiConfigureParameters parameters, ModelQueryResponse modelQueryResponse) {
|
|
|
|
|
+// List<ZjQuoteAccidentVo> accidentalDrivingVo = quoteVo.getAccidentalDrivingVo();
|
|
|
|
|
+ // 基本信息
|
|
|
|
|
+ this.baseInfo = new BaseInfoDTO(quoteVo.getCiRiskInfoVo(), quoteVo.getBiRiskInfoVo());
|
|
|
|
|
+ // 车主信息
|
|
|
|
|
+ this.carOwnerInfo = new CarOwnerInfoDTO(quoteVo.getOwnersInfo());
|
|
|
|
|
+ // 投被保人信息
|
|
|
|
|
+ this.insuredList = InsuredListDTO.toInsuredListDTOList(quoteVo.getPolicyHolderInfo(), quoteVo.getInsuredPersonInfo());
|
|
|
|
|
+ // 险别信息
|
|
|
|
|
+ this.itemKindList = ItemKindListDTO.toItemKindListDTOList(actualValue, quoteVo.getKindInfoVo());
|
|
|
|
|
+ // 浮动因子信息
|
|
|
|
|
+// this.profitDataList = ProfitDataListDTO.toCoefficient(quoteVo.getCoefficient());
|
|
|
|
|
+ // 驾意险
|
|
|
|
|
+// this.carPolicySubInfoList = CarPolicySubInfoListDTO.toCarPolicySubInfoListDTO(accidentalDrivingVo);
|
|
|
|
|
+ // 交强险
|
|
|
|
|
+ if (!"1".equals(this.baseInfo.calculateFlag)) {
|
|
|
|
|
+ itemKindList.add(ItemKindListDTO.getCompulsoryInsurance());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 车辆信息
|
|
|
|
|
+ this.vehicleInfo = new VehicleInfoDTO(quoteVo.getCarInfoVo(), vehicleModelInfosDTO, actualValue);
|
|
|
|
|
+ this.orderId = modelQueryResponse.getOrderId();
|
|
|
|
|
+ this.orderNo = modelQueryResponse.getOrderNo();
|
|
|
|
|
+ this.orderOrigin = parameters.getAppKey();
|
|
|
|
|
+ this.proposalAreaCode = parameters.getProposalAreaCode();
|
|
|
|
|
+ this.proposalCityCode = parameters.getProposalCityCode();
|
|
|
|
|
+ //
|
|
|
|
|
+// this.taxRelifInfo = new TaxRelifInfoDTO(quoteInfoVo.getVehicleAndVesselTax());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 基本信息
|
|
* 基本信息
|
|
|
*/
|
|
*/
|
|
@@ -200,6 +244,109 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("startMinuteCI")
|
|
@JsonProperty("startMinuteCI")
|
|
|
private String startMinuteCI;
|
|
private String startMinuteCI;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 商业险
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param startDate 起保时间
|
|
|
|
|
+ */
|
|
|
|
|
+ public void setBusinessTime(String startDate) {
|
|
|
|
|
+ if (!startDate.isEmpty()) {
|
|
|
|
|
+ setStrengthTime(startDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 交强险
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param startDate 起保时间
|
|
|
|
|
+ */
|
|
|
|
|
+ public void setTrafficTime(String startDate) {
|
|
|
|
|
+ if (!startDate.isEmpty()) {
|
|
|
|
|
+ setCommerceTime(startDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 商业险
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param startDate 起保时间
|
|
|
|
|
+ */
|
|
|
|
|
+ private void setStrengthTime(String startDate) {
|
|
|
|
|
+ if (!StringUtils.hasLength(startDate)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (startDate.contains(InsuranceTimeProcessing.START_TIME)) {
|
|
|
|
|
+ InsuranceTimeProcessing.UntimelyInsurancePeriod untimely = InsuranceTimeProcessing.untimely(startDate);
|
|
|
|
|
+ this.endDate = untimely.getEndDate();
|
|
|
|
|
+ this.endHour = InsuranceTimeProcessing.END_HOUR;
|
|
|
|
|
+ this.endMinute = InsuranceTimeProcessing.MINUTE;
|
|
|
|
|
+ this.startDate = untimely.getStartDate();
|
|
|
|
|
+ this.startHour = InsuranceTimeProcessing.START_HOUR;
|
|
|
|
|
+ this.startMinute = InsuranceTimeProcessing.MINUTE;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 及时
|
|
|
|
|
+ InsuranceTimeProcessing.TimelyInsurancePeriod timely = InsuranceTimeProcessing.timely(startDate);
|
|
|
|
|
+ this.endDate = timely.getEndDate();
|
|
|
|
|
+ this.endHour = timely.getEndHour();
|
|
|
|
|
+ this.endMinute = timely.getEndMinute();
|
|
|
|
|
+ this.startDate = timely.getStartDate();
|
|
|
|
|
+ this.startHour = timely.getStartHour();
|
|
|
|
|
+ this.startMinute = timely.getStartMinute();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 交强险
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param startDate 起保时间
|
|
|
|
|
+ */
|
|
|
|
|
+ private void setCommerceTime(String startDate) {
|
|
|
|
|
+ if (!StringUtils.hasLength(startDate)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (startDate.contains(InsuranceTimeProcessing.START_TIME)) {
|
|
|
|
|
+ InsuranceTimeProcessing.UntimelyInsurancePeriod untimely = InsuranceTimeProcessing.untimely(startDate);
|
|
|
|
|
+ this.endDateCI = untimely.getEndDate();
|
|
|
|
|
+ this.endHourCI = InsuranceTimeProcessing.END_HOUR;
|
|
|
|
|
+ this.endMinuteCI = InsuranceTimeProcessing.MINUTE;
|
|
|
|
|
+ this.startDateCI = untimely.getStartDate();
|
|
|
|
|
+ this.startHourCI = InsuranceTimeProcessing.START_HOUR;
|
|
|
|
|
+ this.startMinuteCI = InsuranceTimeProcessing.MINUTE;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 及时
|
|
|
|
|
+ InsuranceTimeProcessing.TimelyInsurancePeriod timely = InsuranceTimeProcessing.timely(startDate);
|
|
|
|
|
+ this.endDateCI = timely.getEndDate();
|
|
|
|
|
+ this.endHourCI = timely.getEndHour();
|
|
|
|
|
+ this.endMinuteCI = timely.getEndMinute();
|
|
|
|
|
+ this.startDateCI = timely.getStartDate();
|
|
|
|
|
+ this.startHourCI = timely.getStartHour();
|
|
|
|
|
+ this.startMinuteCI = timely.getStartMinute();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public BaseInfoDTO(RiskInfoVo ciRiskInfoVo, RiskInfoVo biRiskInfoVo) {
|
|
|
|
|
+ // 交强险
|
|
|
|
|
+ String ciStartDate = Optional.ofNullable(ciRiskInfoVo)
|
|
|
|
|
+ .map(RiskInfoVo::getStartDate)
|
|
|
|
|
+ .orElse("");
|
|
|
|
|
+ setCommerceTime(ciStartDate);
|
|
|
|
|
+ // 商业险
|
|
|
|
|
+ String biStartDate = Optional.ofNullable(biRiskInfoVo)
|
|
|
|
|
+ .map(RiskInfoVo::getStartDate)
|
|
|
|
|
+ .orElse("");
|
|
|
|
|
+ setStrengthTime(biStartDate);
|
|
|
|
|
+
|
|
|
|
|
+ if (!StringUtils.hasLength(ciStartDate)) {
|
|
|
|
|
+ this.calculateFlag = CalculateFlagEnum.CF_1.getCode();
|
|
|
|
|
+ } else if (!StringUtils.hasLength(biStartDate)) {
|
|
|
|
|
+ this.calculateFlag = CalculateFlagEnum.CF_2.getCode();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.calculateFlag = CalculateFlagEnum.CF_0.getCode();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -248,6 +395,32 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("vehicleOwnerNature")
|
|
@JsonProperty("vehicleOwnerNature")
|
|
|
private String vehicleOwnerNature;
|
|
private String vehicleOwnerNature;
|
|
|
|
|
|
|
|
|
|
+ @AllArgsConstructor
|
|
|
|
|
+ @Getter
|
|
|
|
|
+ public enum VehicleOwnerNature {
|
|
|
|
|
+
|
|
|
|
|
+ VEHICLE_OWNER_NATURE_1("1"),
|
|
|
|
|
+ VEHICLE_OWNER_NATURE_2("2"),
|
|
|
|
|
+ VEHICLE_OWNER_NATURE_3("3");
|
|
|
|
|
+ // 编号
|
|
|
|
|
+ private final String code;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public CarOwnerInfoDTO(CustomerInfoVo customerInfoVo) {
|
|
|
|
|
+ if (VehicleOwnerNature.VEHICLE_OWNER_NATURE_1.getCode().equals(customerInfoVo.getProperty())) {
|
|
|
|
|
+ this.ownerIdentifyNumber = customerInfoVo.getIdentifyNumber();
|
|
|
|
|
+ this.ownerIdentifyType = "01";
|
|
|
|
|
+ this.vehicleOwnerNature = "1";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.ownerIdentifyNumber = customerInfoVo.getOrganizationCode();
|
|
|
|
|
+ this.ownerIdentifyType = "73";
|
|
|
|
|
+ this.vehicleOwnerNature = "3";
|
|
|
|
|
+ }
|
|
|
|
|
+ this.carOwner = customerInfoVo.getName();
|
|
|
|
|
+ this.mobile = customerInfoVo.getMobile();
|
|
|
|
|
+ this.ownerAddress = customerInfoVo.getAddr();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -670,6 +843,10 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("makeDateJQ")
|
|
@JsonProperty("makeDateJQ")
|
|
|
private String makeDateJQ;
|
|
private String makeDateJQ;
|
|
|
|
|
|
|
|
|
|
+ public VehicleInfoDTO(CarInfoVo carInfoVo, ModelQueryResponse.VehicleModelInfosDTO vehicleModelInfosDTO, String actualValue) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -802,6 +979,48 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("businessSort")
|
|
@JsonProperty("businessSort")
|
|
|
private String businessSort;
|
|
private String businessSort;
|
|
|
|
|
|
|
|
|
|
+ public InsuredListDTO(CustomerInfoVo customerInfoVo, String insuredFlag) {
|
|
|
|
|
+ this.occupation = "030199";
|
|
|
|
|
+ this.address = customerInfoVo.getAddr();
|
|
|
|
|
+
|
|
|
|
|
+ if ("".equals(insuredFlag)) {
|
|
|
|
|
+ this.identifyNumber = customerInfoVo.getIdentifyNumber();
|
|
|
|
|
+ this.identifyType = "01";
|
|
|
|
|
+ this.insuredNature = "3";
|
|
|
|
|
+ this.insuredType = "1";
|
|
|
|
|
+ int gender = IdcardUtil.getGenderByIdCard(customerInfoVo.getIdentifyNumber());
|
|
|
|
|
+ this.sex = gender == 1 ? "1" : "2";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.businessSort = "900";
|
|
|
|
|
+ this.identifyNumber = customerInfoVo.getOrganizationCode();
|
|
|
|
|
+ this.identifyType = "73";
|
|
|
|
|
+ this.insuredNature = "4";
|
|
|
|
|
+ this.insuredType = "2";
|
|
|
|
|
+ this.sex = "9";
|
|
|
|
|
+ this.certigierName = customerInfoVo.getLegalPerson();
|
|
|
|
|
+ this.certigierType = "01";
|
|
|
|
|
+ this.certigierNumber = customerInfoVo.getLeaderIdentifyNumber();
|
|
|
|
|
+ this.certigierNumValidDate = customerInfoVo.getLeaderOtherEffectiveDate();
|
|
|
|
|
+ this.chiefName = customerInfoVo.getLegalPerson();
|
|
|
|
|
+ this.chiefType = "01";
|
|
|
|
|
+ this.chiefNumber = customerInfoVo.getLeaderIdentifyNumber();
|
|
|
|
|
+ this.chiefNumValidDate = customerInfoVo.getLeaderOtherEffectiveDate();
|
|
|
|
|
+ }
|
|
|
|
|
+ this.insuredFlag = insuredFlag;
|
|
|
|
|
+ this.insuredName = customerInfoVo.getName();
|
|
|
|
|
+ this.longAddress = customerInfoVo.getAddr();
|
|
|
|
|
+ this.mobile = customerInfoVo.getMobile();
|
|
|
|
|
+ this.validDate = customerInfoVo.getIdentifyValidEndDate();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static List<InsuredListDTO> toInsuredListDTOList(CustomerInfoVo policyHolderInfo, CustomerInfoVo insuredPersonInfo) {
|
|
|
|
|
+ List<InsuredListDTO> insuredListDTOS = new ArrayList<>();
|
|
|
|
|
+ InsuredListDTO policyHolder = new InsuredListDTO(policyHolderInfo, "2");
|
|
|
|
|
+ InsuredListDTO insuredPerson = new InsuredListDTO(insuredPersonInfo, "1");
|
|
|
|
|
+ insuredListDTOS.add(policyHolder);
|
|
|
|
|
+ insuredListDTOS.add(insuredPerson);
|
|
|
|
|
+ return insuredListDTOS;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -858,6 +1077,35 @@ public class CalculatePremiumRequest implements Serializable {
|
|
|
@JsonProperty("serviceTimes")
|
|
@JsonProperty("serviceTimes")
|
|
|
private String serviceTimes;
|
|
private String serviceTimes;
|
|
|
|
|
|
|
|
|
|
+ public static ItemKindListDTO getCompulsoryInsurance() {
|
|
|
|
|
+ ItemKindListDTO insuredListDTO = new ItemKindListDTO();
|
|
|
|
|
+ insuredListDTO.setKindCode("BZ");
|
|
|
|
|
+ insuredListDTO.setKindName("机动车交通事故责任强制保险");
|
|
|
|
|
+ insuredListDTO.setRiskCode(RiskCodeEnum.RC_0590.getCode());
|
|
|
|
|
+ insuredListDTO.setAmount("200000");
|
|
|
|
|
+ return insuredListDTO;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static List<ItemKindListDTO> toItemKindListDTOList(String actualValue, List<KindInfoVo> kindList) {
|
|
|
|
|
+ List<ItemKindListDTO> list = new ArrayList<>();
|
|
|
|
|
+ for (KindInfoVo kindInfoVo : kindList) {
|
|
|
|
|
+ ItemKindListDTO itemKindListDTO = new ItemKindListDTO();
|
|
|
|
|
+ itemKindListDTO.kindCode = kindInfoVo.getKindCode();
|
|
|
|
|
+ itemKindListDTO.kindName = kindInfoVo.getKindName();
|
|
|
|
|
+ itemKindListDTO.riskCode = RiskCodeEnum.RC_050A.getCode();
|
|
|
|
|
+ itemKindListDTO.quantity = kindInfoVo.getQuantity();
|
|
|
|
|
+ itemKindListDTO.unitAmount = kindInfoVo.getAmount();
|
|
|
|
|
+ itemKindListDTO.amount = kindInfoVo.getAmount();
|
|
|
|
|
+ // 车损险
|
|
|
|
|
+ if ("A".equals(itemKindListDTO.kindCode)) {
|
|
|
|
|
+ itemKindListDTO.amount = actualValue;
|
|
|
|
|
+ }
|
|
|
|
|
+ itemKindListDTO.deductibleRate = kindInfoVo.getDeductibleRate();
|
|
|
|
|
+ itemKindListDTO.serviceTimes = kindInfoVo.getServiceTimes();
|
|
|
|
|
+ list.add(itemKindListDTO);
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|