| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584 |
- package com.ydtech.modules.fee.dto.vo;
- import com.alibaba.fastjson.JSONObject;
- import com.ydtech.constants.enums.InsurKind;
- import com.ydtech.constants.enums.dict.ZmTransferType;
- import com.ydtech.constants.enums.dict.insurance.VehicleType;
- import com.ydtech.modules.ins.model.vo.CarInfoVo;
- import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
- import com.ydtech.modules.ins.model.vo.KindInfoVo;
- import com.ydtech.modules.ins.model.vo.QuoteRespVo;
- import com.ydtech.modules.order.entity.InsAreaCompany;
- import com.ydtech.modules.order.entity.InsOrders;
- import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
- import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
- import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
- import com.ydtech.utils.StringUtils;
- import io.swagger.annotations.ApiModelProperty;
- import lombok.Data;
- import java.time.LocalDate;
- import java.time.LocalDateTime;
- import java.time.format.DateTimeFormatter;
- import java.time.temporal.ChronoUnit;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- import java.util.Optional;
- import java.util.regex.Pattern;
- /**
- * @author: tz
- * @description: 规则属性映射费用因子Vo
- * @create: 2024-2-28 08:35:57
- */
- @Data
- public class RuleAttrMappingVo {
- @ApiModelProperty(value = "因子属性Code")
- private String attrCode;
- @ApiModelProperty(value = "值")
- private String value;
- public RuleAttrMappingVo(String attrCode, String value) {
- this.attrCode = attrCode;
- this.value = value;
- }
- public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(QuoteRespVo quoteRespVo, InsAreaCompany insAreaCompany, InsOrders insOrders,
- List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList,
- PtlNewCarJudgeRules carJudgeRule) {
- List<RuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
- CarInfoVo carInfo = insOrders.getCarinfo().toJavaObject(CarInfoVo.class);
- //车牌号
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseNo", carInfo.getLicenseNo()));
- //品牌型号
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("BrandandModel", carInfo.getModelcname()));
- //座位数
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerCarSeatingCapacity", carInfo.getSeatCount()));
- //新车购置价
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PurchasePriceofNewVehicle", carInfo.getPurchasePrice()));
- //车辆用途
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NatureOfUse", TypeVehicleMapping.getByCode(carInfo.getVehicleUse())));
- //车辆种类
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarType", VehicleType.getByCode(carInfo.getCimodelclass())));
- //车辆类型
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarClass", carInfo.getCartype()));
- //核定载质量
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("AuthorizedLoadWeight", carInfo.getLimitLoad()));
- //汽车排量
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("EngineCapacity", carInfo.getEnginedesc()));
- //整备质量
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CurbWeight", carInfo.getVehicleweight()));
- //能源类型
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewEnergy", carInfo.getEnergyType()));
- //注册日期
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("RegistrationDate", carInfo.getRegisterDate()));
- //是否过户
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("TransferVehicle", carInfo.isTransferFlag() ? "1" : "0"));
- //是否新车
- //使用注册日期算出自然月 然后判断是否是新旧车
- LocalDate registrationDate = LocalDate.parse(carInfo.getRegisterDate());
- LocalDate currentDate = LocalDate.now();
- //特种车判断
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SpecialVehicle", Objects.nonNull(carInfo.getImportFlag()) && carInfo.getImportFlag()
- .equals("特种车类") ? "1" : "0"));
- //交强起保日期
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime", insAreaCompany.getJqStartDate()));
- //商业起保日期
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartTime", insAreaCompany.getSyStartDate()));
- String isImportedCar = "1";
- if (carInfo.getFrameNo() != null && !carInfo.getFrameNo().isEmpty() && carInfo.getFrameNo().charAt(0) == 'L') {
- isImportedCar = "0";
- }
- //自主定价系数
- if (Objects.nonNull(quoteRespVo)) {
- if (quoteRespVo.getPricingCoefficient() != null) {
- if("".equals(quoteRespVo.getPricingCoefficient())){
- quoteRespVo.setPricingCoefficient("0");
- }
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PricingCoefficient", quoteRespVo.getPricingCoefficient()));
- }
- }
- // 判断是否是进口车
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("IsImportedCar", isImportedCar));
- // 中煤不浮动原因
- if (Objects.nonNull(quoteRespVo)) {
- String rateFloatFlag = ZmTransferType.getByCode(quoteRespVo.getRateFloatFlag());
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("RateFloatFlag", rateFloatFlag == null ? "null" : rateFloatFlag));
- }
- boolean isNoLicenseFlag = false;
- if (carJudgeRule != null) {
- if (carJudgeRule.getUnitTypeCode().equals("天")) {
- long days = ChronoUnit.DAYS.between(registrationDate, currentDate);
- if (days < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
- isNoLicenseFlag = true;
- }
- }
- if (carJudgeRule.getUnitTypeCode().equals("月")) {
- long months = ChronoUnit.MONTHS.between(registrationDate, currentDate);
- if (months < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
- isNoLicenseFlag = true;
- }
- }
- }
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewAndOldCars", isNoLicenseFlag ? "1" : "0"));
- //车龄
- long between = ChronoUnit.YEARS.between(registrationDate, currentDate) + 1;
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleAge", String.valueOf(between)));
- //发证日期
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("DateofIssuance", carInfo.getIssueDate()));
- // 初登日期是否与发证日期一致
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SameDate", carInfo.getRegisterDate().equals(carInfo.getIssueDate()) ? "1" : "0"));
- //车长
- // ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleLength", carInfo.getCarLength()));
- //转续保 交强
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqRenewalOfInsurance", insAreaCompany.getJqRenewal()));
- //转续保 商业
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyRenewalOfInsurance", insAreaCompany.getSyRenewal()));
- CustomerInfoVo ownerInfo = insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
- if (StringUtils.isBlank(ownerInfo.getProperty()) || !"0".equals(ownerInfo.getProperty())) {
- //车主 证件号码(前6位)
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
- //车主 年龄
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
- //车主 性别
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender()
- .equals("男") ? "1" : "2"));
- //车主地址
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAddress", ownerInfo.getAddr()));
- // 车主生日
- String carOwnersBirthday = ownerInfo.getIdentifyNumber()
- .substring(6, 10) + "-" + ownerInfo.getIdentifyNumber()
- .substring(10, 12) + "-" + ownerInfo.getIdentifyNumber().substring(12, 14);
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersBirthday", carOwnersBirthday));
- }
- //车主 姓名
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
- CustomerInfoVo policyHolderInfo = insOrders.getApplyinfo().toJavaObject(CustomerInfoVo.class);
- if (StringUtils.isBlank(policyHolderInfo.getProperty()) || !"0".equals(policyHolderInfo.getProperty())) {
- //投保人 证件号码(前6位)
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
- //投保人 年龄
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
- //投保人 性别
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender()
- .equals("男") ? "1" : "2"));
- //投保人地址
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAddress", policyHolderInfo.getAddr()));
- // 投保人生日
- String applicantBirthday = policyHolderInfo.getIdentifyNumber()
- .substring(6, 10) + "-" + policyHolderInfo.getIdentifyNumber()
- .substring(10, 12) + "-" + policyHolderInfo.getIdentifyNumber().substring(12, 14);
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantBirthday", applicantBirthday));
- }
- CustomerInfoVo insuredPersonInfo = insOrders.getInsureinfo().toJavaObject(CustomerInfoVo.class);
- if (StringUtils.isBlank(insuredPersonInfo.getProperty()) || !"0".equals(insuredPersonInfo.getProperty())) {
- //被保人 证件号码(前6位)
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
- //被保人 年龄
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
- //被保人 性别
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender()
- .equals("男") ? "1" : "2"));
- //被保人地址
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAddress", insuredPersonInfo.getAddr()));
- //被保人生日
- String insuredBirthday = insuredPersonInfo.getIdentifyNumber()
- .substring(6, 10) + "-" + insuredPersonInfo.getIdentifyNumber()
- .substring(10, 12) + "-" + insuredPersonInfo.getIdentifyNumber().substring(12, 14);
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredBirthday", insuredBirthday));
- }
- String OPIConsistent = "0";
- if (StringUtils.isNotBlank(ownerInfo.getProperty())) {
- boolean boo = ownerInfo.getProperty()
- .equals(insuredPersonInfo.getProperty()) && insuredPersonInfo.getProperty()
- .equals(policyHolderInfo.getProperty());
- if (boo) {
- if ("0".equals(ownerInfo.getProperty())) {
- if ((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName()
- .equals(policyHolderInfo.getName())) &&
- (ownerInfo.getOrganizationCode()
- .equals(insuredPersonInfo.getOrganizationCode()) && insuredPersonInfo.getOrganizationCode()
- .equals(policyHolderInfo.getOrganizationCode()))) {
- OPIConsistent = "1";
- }
- } else {
- if ((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName()
- .equals(policyHolderInfo.getName())) &&
- (ownerInfo.getIdentifyNumber()
- .equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber()
- .equals(policyHolderInfo.getIdentifyNumber()))) {
- OPIConsistent = "1";
- }
- }
- }
- } else {
- if ((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName()
- .equals(policyHolderInfo.getName())) &&
- (ownerInfo.getIdentifyNumber()
- .equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber()
- .equals(policyHolderInfo.getIdentifyNumber()))) {
- OPIConsistent = "1";
- }
- }
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("OPIConsistent", OPIConsistent));
- String PIConsistent = "0";
- if (StringUtils.isNotBlank(insuredPersonInfo.getProperty())) {
- boolean boo = insuredPersonInfo.getProperty().equals(policyHolderInfo.getProperty());
- if (boo) {
- if ("0".equals(insuredPersonInfo.getProperty())) {
- //投被保人是否一致
- if (insuredPersonInfo.getName()
- .equals(policyHolderInfo.getName()) && insuredPersonInfo.getOrganizationCode()
- .equals(policyHolderInfo.getOrganizationCode())) {
- PIConsistent = "1";
- }
- } else {
- //投被保人是否一致
- if (insuredPersonInfo.getName()
- .equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber()
- .equals(policyHolderInfo.getIdentifyNumber())) {
- PIConsistent = "1";
- }
- }
- }
- } else {
- //投被保人是否一致
- if (insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber()
- .equals(policyHolderInfo.getIdentifyNumber())) {
- PIConsistent = "1";
- }
- }
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PIConsistent", PIConsistent));
- // 车被保人是否一致
- String CIConsistent = "0";
- if (StringUtils.isNotBlank(ownerInfo.getProperty())) {
- boolean boo = ownerInfo.getProperty().equals(insuredPersonInfo.getProperty());
- if (boo) {
- if ("0".equals(insuredPersonInfo.getProperty())) {
- //车被保人是否一致
- if (insuredPersonInfo.getName()
- .equals(ownerInfo.getName()) && insuredPersonInfo.getOrganizationCode()
- .equals(ownerInfo.getOrganizationCode())) {
- CIConsistent = "1";
- }
- } else {
- //车被保人是否一致
- if (insuredPersonInfo.getName()
- .equals(ownerInfo.getName()) && insuredPersonInfo.getIdentifyNumber()
- .equals(ownerInfo.getIdentifyNumber())) {
- CIConsistent = "1";
- }
- }
- }
- } else {
- //投被保人是否一致
- if (insuredPersonInfo.getName().equals(ownerInfo.getName()) && insuredPersonInfo.getIdentifyNumber()
- .equals(ownerInfo.getIdentifyNumber())) {
- CIConsistent = "1";
- }
- }
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CIConsistent", CIConsistent));
- //2024-06-20 起保日期 月份判断
- if (insAreaCompany.getJqStartDate() != null && !insAreaCompany.getJqStartDate().equals("")) {
- LocalDateTime jqStartDate = LocalDateTime.parse(insAreaCompany.getJqStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartMonth", String.valueOf(jqStartDate.getMonthValue())));
- }
- if (insAreaCompany.getSyStartDate() != null && !insAreaCompany.getSyStartDate().equals("")) {
- LocalDateTime syStartDate = LocalDateTime.parse(insAreaCompany.getSyStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartMonth", String.valueOf(syStartDate.getMonthValue())));
- }
- List<KindInfoVo> kindInfoVos = insAreaCompany.getKindinfo().toJavaList(KindInfoVo.class);
- //险别信息
- kindInfoVos.forEach(kindInfoVo -> {
- //机动车损失险
- if (InsurKind.A.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("MotorVehicleDamageInsurance", String.valueOf(kindInfoVo.getAmount())));
- }
- //第三者责任险
- if (InsurKind.B.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdPartyLiabilityInsurance",
- String.valueOf(Double.valueOf(kindInfoVo.getAmount()).intValue())));
- }
- //司机责任险
- if (InsurKind.D3.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverLiabilityInsurance", String.valueOf(kindInfoVo.getAmount())));
- }
- //乘客责任险
- if (InsurKind.D4.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerLiabilityInsurance", String.valueOf(kindInfoVo.getUnitAmount())));
- }
- //车身划痕险
- if (InsurKind.L.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarScratchInsurance", String.valueOf(kindInfoVo.getAmount())));
- }
- //绝对免赔率特约险(车损)
- if (InsurKind.MJ1.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleDamageAbsoluteDeductibleSpecialInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //绝对免赔率特约险(三者)
- if (InsurKind.MJ2.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdAbsoluteDeductibleSpecialInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //绝对免赔率特约险(司机)
- if (InsurKind.MJ3.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverAbsoluteDeductibleSpecialInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //绝对免赔率特约险(乘客)
- if (InsurKind.MJ4.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerAbsoluteDeductibleSpecialInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //附加医保-三者
- if (InsurKind.SY_FJ_YBW1.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdPartyAdditionalMedicalInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //附加医保-座位险(乘客)
- if (InsurKind.SY_FJ_YBW2.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerAdditionalMedicalInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //附加医保-座位险(司机)
- if (InsurKind.SY_FJ_YBW3.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverAdditionalMedicalInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //法定节假日限额翻倍险
- if (InsurKind.BD.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("LegalHolidayLimitDoublingInsurance",
- String.valueOf(kindInfoVo.getAmount())));
- }
- //道路救援服务特约条款
- if (InsurKind.TY1.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("RoadsideAssistanceServiceSpecialClause",
- String.valueOf(kindInfoVo.getServiceTimes())));
- }
- //车辆安全检测特约条款
- if (InsurKind.TY2.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleSafetyInspectionSpecialClause",
- String.valueOf(kindInfoVo.getServiceTimes())));
- }
- //代为驾驶服务特约条款
- if (InsurKind.TY3.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SubstituteDrivingServiceSpecialClause",
- String.valueOf(kindInfoVo.getServiceTimes())));
- }
- //代为送检服务特约条款
- if (InsurKind.TY4.getCode().equals(kindInfoVo.getKindCode())) {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SubstituteInspectionServiceSpecialClause",
- String.valueOf(kindInfoVo.getServiceTimes())));
- }
- });
- //交强保费
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryTrafficAccidentLiabilityInsurancePremium",
- String.valueOf(insAreaCompany.getJqpremium())));
- //车船税
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleandVesselTax", String.valueOf(insAreaCompany.getTaxamount())));
- //非车险
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonMotorInsurance", String.valueOf(insAreaCompany.getJypremium())));
- //总折扣率
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalDiscountRate", String.valueOf(insAreaCompany.getTotalAdjustRate())));
- //交强折扣
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceDiscount", String.valueOf(insAreaCompany.getJqAdjustRate())));
- //商业折扣
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialDiscount", String.valueOf(insAreaCompany.getSyAdjustRate())));
- //永安评分
- Optional.ofNullable(quoteRespVo)
- .map(quoteRespVo1 -> quoteRespVo.getYaScore())
- .ifPresent(x -> {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("YaScore", x));
- });
- //永安交强费用浮动
- Optional.ofNullable(quoteRespVo)
- .map(quoteRespVo1 -> quoteRespVo.getCifeeFloat())
- .ifPresent(x -> {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CifeeFloat", x));
- });
- // 华农评分分组
- Optional.ofNullable(quoteRespVo)
- .map(quoteRespVo1 -> quoteRespVo.getMarkGroup())
- .ifPresent(x -> {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("MarkGroup", x));
- });
- //永安商业费用浮动
- Optional.ofNullable(insAreaCompany)
- .map(InsAreaCompany::getBifeeFloat)
- .ifPresent(x -> {
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("BifeeFloat", x));
- });
- // 向阳花评分 阳光
- Optional.ofNullable(insAreaCompany)
- .map(InsAreaCompany::getXyhGrade)
- .map(String::valueOf)
- .ifPresent(x -> ruleAttrMappingVoList.add(new RuleAttrMappingVo("XyhGrade", x)));
- // 红黄蓝车系 阳光
- Optional.ofNullable(insAreaCompany)
- .map(InsAreaCompany::getSeriesTypeActualName)
- .map(String::valueOf)
- .ifPresent(x -> ruleAttrMappingVoList.add(new RuleAttrMappingVo("SeriesTypeActualName", x)));
- //数值型总评分
- Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?");
- if (insAreaCompany.getScore() != null) {
- if (pattern.matcher(insAreaCompany.getScore()).matches()) {
- //数值型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NumericalOverallRating", String.valueOf(insAreaCompany.getScore())));
- } else {
- //字母型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CharacterBasedRating", String.valueOf(insAreaCompany.getScore())));
- }
- }
- //交强评分
- if (insAreaCompany.getJqScore() != null) {
- if (pattern.matcher(insAreaCompany.getJqScore()).matches()) {
- //数值型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceRating", String.valueOf(insAreaCompany.getJqScore())));
- } else {
- //字母型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqCharacterBasedRating",
- String.valueOf(insAreaCompany.getJqScore())));
- }
- }
- // ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceRating", String.valueOf(insAreaCompany.getJqScore())));
- //商业评分
- if (insAreaCompany.getSyScore() != null) {
- if (pattern.matcher(insAreaCompany.getSyScore()).matches()) {
- //数值型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialRating", String.valueOf(insAreaCompany.getSyScore())));
- } else {
- //字母型评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyCharacterBasedRating",
- String.valueOf(insAreaCompany.getSyScore())));
- }
- }
- //交强赔付率
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsurancePayoutRate", String.valueOf(insAreaCompany.getJqLossRation())));
- //商业赔付率
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialPayoutRate", String.valueOf(insAreaCompany.getSyLossRation())));
- //总赔付率
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalPayoutRate", String.valueOf(insAreaCompany.getLossRation())));
- //太平绿黄红区
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("GreenYellowAndRedAreas", insAreaCompany.getTpColorScore()));
- if (insAreaCompany.getApiType() == 2) {
- if (insAreaCompany.getAccidentInfo() != null && !insAreaCompany.getAccidentInfo().isEmpty()) {
- //非车名称
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarName", ((JSONObject) insAreaCompany.getAccidentInfo().get(0)).getString("projectName")));
- //非车份数
- Integer quantity = ((JSONObject) insAreaCompany.getAccidentInfo().get(0)).getInteger("quantity");
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarQuantity",
- String.valueOf(quantity)));
- }
- }else if(insAreaCompany.getApiType() == 1){
- if (Objects.nonNull(insAreaCompany.getAccidentalDriving())){
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarName", insAreaCompany.getAccidentalDriving().getRideRiskName()));
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarQuantity", String.valueOf(insAreaCompany.getAccidentalDriving().getQuantity())));
- }
- }
- //真假单交
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("IsDJQ", insAreaCompany.getIsDjq()));
- //紫金鼎然评分
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("UbiPredictedInfoScore", insAreaCompany.getUbiPredictedInfoScore()));
- // 交强出险次数
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqNumberOfClaims", insAreaCompany.getJqClaims() == null ? "0" : insAreaCompany.getJqClaims()));
- // 商业出险次数
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyNumberOfClaims", insAreaCompany.getSyClaims() == null ? "0" : insAreaCompany.getSyClaims()));
- // 车牌地区
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseArea", insOrders.getLicenseno().substring(0, 1)));
- // 系数
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("Coefficient", getCoefficient(carInfo, insAreaCompany).toString()));
- // 商业是否有费用
- ruleAttrMappingVoList.add(new RuleAttrMappingVo("CiMessage", (insAreaCompany.getCiMessage() == null || "".equals(insAreaCompany.getCiMessage())) ? "0" : "1"));
- return ruleAttrMappingVoList;
- }
- private static Float getCoefficient(CarInfoVo carInfo, InsAreaCompany insAreaCompany) {
- Integer seatCount = Integer.parseInt(carInfo.getSeatCount());
- Float coefficient = 1.00f;
- // ruleAttrMappingVoList.add(new RuleAttrMappingVo())
- //家庭自用车
- if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
- carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_05.getCode())) {
- //2-5座
- if (seatCount >= 2 && seatCount <= 5) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 950;
- }
- //6-9座
- if (seatCount >= 6 && seatCount <= 9) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1100;
- }
- } else
- //非营业机关、企业
- if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
- (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_06.getCode()) ||
- carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_07.getCode()))) {
- //2-5座
- if (seatCount >= 2 && seatCount <= 5) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1000;
- }
- //6-9座
- if (seatCount >= 6 && seatCount <= 9) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1130;
- }
- } else
- //货车
- if (carInfo.getCimodelclass().equals(VehicleType.VT_A1.getCode())) {
- //营业货运 2吨
- if (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_04.getCode()) &&
- Integer.parseInt(carInfo.getLimitLoad()) < 2000) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1850;
- }
- //非营业货运 2吨
- if (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_08.getCode()) &&
- Integer.parseInt(carInfo.getLimitLoad()) < 2000) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1200;
- }
- //大吨位
- if (Integer.parseInt(carInfo.getLimitLoad()) > 2000) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 4480;
- }
- } else
- //出租车 网约车
- if (carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
- carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_01.getCode())) {
- coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1800;
- }
- return coefficient;
- }
- }
|