RuleAttrMappingVo.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. package com.ydtech.modules.fee.dto.vo;
  2. import com.ydtech.constants.enums.InsurKind;
  3. import com.ydtech.constants.enums.dict.insurance.VehicleType;
  4. import com.ydtech.modules.ins.model.vo.CarInfoVo;
  5. import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
  6. import com.ydtech.modules.ins.model.vo.KindInfoVo;
  7. import com.ydtech.modules.order.entity.InsAreaCompany;
  8. import com.ydtech.modules.order.entity.InsOrders;
  9. import com.ydtech.modules.order.entity.api.bohai.constants.VehicleUsage;
  10. import com.ydtech.modules.order.entity.api.dajia.constants.TypeVehicleMapping;
  11. import com.ydtech.modules.protocol.entity.po.PtlNewCarJudgeRules;
  12. import com.ydtech.modules.protocols.entity.po.PtlAgreementUndwrtRulesAttr;
  13. import com.ydtech.utils.StringUtils;
  14. import io.swagger.annotations.ApiModelProperty;
  15. import lombok.Data;
  16. import java.time.LocalDate;
  17. import java.time.LocalDateTime;
  18. import java.time.format.DateTimeFormatter;
  19. import java.time.temporal.ChronoUnit;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import java.util.regex.Pattern;
  23. /**
  24. * @author: tz
  25. * @description: 规则属性映射费用因子Vo
  26. * @create: 2024-2-28 08:35:57
  27. */
  28. @Data
  29. public class RuleAttrMappingVo {
  30. @ApiModelProperty(value = "因子属性Code")
  31. private String attrCode;
  32. @ApiModelProperty(value = "值")
  33. private String value;
  34. public RuleAttrMappingVo(String attrCode, String value) {
  35. this.attrCode = attrCode;
  36. this.value = value;
  37. }
  38. public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(InsAreaCompany insAreaCompany, InsOrders insOrders,
  39. List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList,
  40. PtlNewCarJudgeRules carJudgeRule) {
  41. List<RuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
  42. CarInfoVo carInfo = insOrders.getCarinfo().toJavaObject(CarInfoVo.class);
  43. //车牌号
  44. ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseNo", carInfo.getLicenseNo()));
  45. //品牌型号
  46. ruleAttrMappingVoList.add(new RuleAttrMappingVo("BrandandModel", carInfo.getModelcname()));
  47. //座位数
  48. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerCarSeatingCapacity", carInfo.getSeatCount()));
  49. //新车购置价
  50. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PurchasePriceofNewVehicle", carInfo.getPurchasePrice()));
  51. //车辆用途
  52. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NatureOfUse", TypeVehicleMapping.getByCode(carInfo.getVehicleUse())));
  53. //车辆种类
  54. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarType", VehicleType.getByCode(carInfo.getCimodelclass())));
  55. //车辆类型
  56. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarClass", carInfo.getCartype()));
  57. //核定载质量
  58. ruleAttrMappingVoList.add(new RuleAttrMappingVo("AuthorizedLoadWeight", carInfo.getLimitLoad()));
  59. //整备质量
  60. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CurbWeight", carInfo.getVehicleweight()));
  61. //能源类型
  62. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewEnergy", carInfo.getEnergyType()));
  63. //注册日期
  64. ruleAttrMappingVoList.add(new RuleAttrMappingVo("RegistrationDate", carInfo.getRegisterDate()));
  65. //是否过户
  66. ruleAttrMappingVoList.add(new RuleAttrMappingVo("TransferVehicle", carInfo.isTransferFlag() ? "1" : "0"));
  67. //是否新车
  68. //使用注册日期算出自然月 然后判断是否是新旧车
  69. LocalDate registrationDate = LocalDate.parse(carInfo.getRegisterDate());
  70. LocalDate currentDate = LocalDate.now();
  71. //交强起保日期
  72. ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime",insOrders.getJqstartdate()));
  73. //商业起保日期
  74. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartTime",insOrders.getSystartdate()));
  75. boolean isNoLicenseFlag = false;
  76. if (carJudgeRule != null) {
  77. if (carJudgeRule.getUnitTypeCode().equals("天")) {
  78. long days = ChronoUnit.DAYS.between(registrationDate, currentDate);
  79. if (days < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
  80. isNoLicenseFlag = true;
  81. }
  82. }
  83. if (carJudgeRule.getUnitTypeCode().equals("月")) {
  84. long months = ChronoUnit.MONTHS.between(registrationDate, currentDate);
  85. if (months < Integer.parseInt(carJudgeRule.getUnitTypeValue())) {
  86. isNoLicenseFlag = true;
  87. }
  88. }
  89. }
  90. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NewAndOldCars", isNoLicenseFlag ? "1" : "0"));
  91. //车龄
  92. long between = ChronoUnit.YEARS.between(registrationDate, currentDate) + 1;
  93. ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleAge",String.valueOf(between)));
  94. //发证日期
  95. ruleAttrMappingVoList.add(new RuleAttrMappingVo("DateofIssuance", carInfo.getIssueDate()));
  96. //车长
  97. // ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleLength", carInfo.getCarLength()));
  98. //转续保 交强
  99. ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqRenewalOfInsurance", insAreaCompany.getJqRenewal()));
  100. //转续保 商业
  101. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyRenewalOfInsurance", insAreaCompany.getSyRenewal()));
  102. CustomerInfoVo ownerInfo = insOrders.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
  103. if(StringUtils.isBlank(ownerInfo.getProperty()) || !"0".equals(ownerInfo.getProperty())) {
  104. //车主 证件号码(前6位)
  105. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersIDNumber", ownerInfo.getIdentifyNumber()));
  106. //车主 年龄
  107. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersAge", ownerInfo.getAge()));
  108. //车主 性别
  109. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnersSex", ownerInfo.getGender().equals("男") ? "1" : "2"));
  110. }
  111. //车主 姓名
  112. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarOwnerName", ownerInfo.getName()));
  113. CustomerInfoVo policyHolderInfo = insOrders.getApplyinfo().toJavaObject(CustomerInfoVo.class);
  114. if(StringUtils.isBlank(policyHolderInfo.getProperty()) || !"0".equals(policyHolderInfo.getProperty())) {
  115. //投保人 证件号码(前6位)
  116. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantIDNumber", policyHolderInfo.getIdentifyNumber()));
  117. //投保人 年龄
  118. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantAge", policyHolderInfo.getAge()));
  119. //投保人 性别
  120. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ApplicantSex", policyHolderInfo.getGender().equals("男") ? "1" : "2"));
  121. }
  122. CustomerInfoVo insuredPersonInfo = insOrders.getInsureinfo().toJavaObject(CustomerInfoVo.class);
  123. if(StringUtils.isBlank(insuredPersonInfo.getProperty()) || !"0".equals(insuredPersonInfo.getProperty())) {
  124. //被保人 证件号码(前6位)
  125. ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredIDNumber", insuredPersonInfo.getIdentifyNumber()));
  126. //被保人 年龄
  127. ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredAge", insuredPersonInfo.getAge()));
  128. //被保人 性别
  129. ruleAttrMappingVoList.add(new RuleAttrMappingVo("InsuredSex", insuredPersonInfo.getGender().equals("男") ? "1" : "2"));
  130. }
  131. String OPIConsistent = "0";
  132. if(StringUtils.isNotBlank(ownerInfo.getProperty())){
  133. boolean boo = ownerInfo.getProperty().equals(insuredPersonInfo.getProperty()) && insuredPersonInfo.getProperty().equals(policyHolderInfo.getProperty());
  134. if(boo){
  135. if("0".equals(ownerInfo.getProperty())){
  136. if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
  137. (ownerInfo.getOrganizationCode().equals(insuredPersonInfo.getOrganizationCode()) && insuredPersonInfo.getOrganizationCode().equals(policyHolderInfo.getOrganizationCode()))){
  138. OPIConsistent = "1";
  139. }
  140. }else{
  141. if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
  142. (ownerInfo.getIdentifyNumber().equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber()))){
  143. OPIConsistent = "1";
  144. }
  145. }
  146. }
  147. }else{
  148. if((ownerInfo.getName().equals(insuredPersonInfo.getName()) && insuredPersonInfo.getName().equals(policyHolderInfo.getName())) &&
  149. (ownerInfo.getIdentifyNumber().equals(insuredPersonInfo.getIdentifyNumber()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber()))){
  150. OPIConsistent = "1";
  151. }
  152. }
  153. ruleAttrMappingVoList.add(new RuleAttrMappingVo("OPIConsistent",OPIConsistent));
  154. String PIConsistent = "0";
  155. if(StringUtils.isNotBlank(insuredPersonInfo.getProperty())){
  156. boolean boo = insuredPersonInfo.getProperty().equals(policyHolderInfo.getProperty());
  157. if(boo){
  158. if("0".equals(insuredPersonInfo.getProperty())){
  159. //投被保人是否一致
  160. if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getOrganizationCode().equals(policyHolderInfo.getOrganizationCode())){
  161. PIConsistent = "1";
  162. }
  163. }else{
  164. //投被保人是否一致
  165. if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber())){
  166. PIConsistent = "1";
  167. }
  168. }
  169. }
  170. }else{
  171. //投被保人是否一致
  172. if(insuredPersonInfo.getName().equals(policyHolderInfo.getName()) && insuredPersonInfo.getIdentifyNumber().equals(policyHolderInfo.getIdentifyNumber())){
  173. PIConsistent = "1";
  174. }
  175. }
  176. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PIConsistent",PIConsistent));
  177. //2024-06-20 起保日期 月份判断
  178. if(insAreaCompany.getJqStartDate() != null && !insAreaCompany.getJqStartDate().equals("")){
  179. LocalDateTime jqStartDate = LocalDateTime.parse(insAreaCompany.getJqStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
  180. ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartMonth", String.valueOf(jqStartDate.getMonthValue())));
  181. }
  182. if(insAreaCompany.getSyStartDate() != null && !insAreaCompany.getSyStartDate().equals("")) {
  183. LocalDateTime syStartDate = LocalDateTime.parse(insAreaCompany.getSyStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
  184. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyStartMonth", String.valueOf(syStartDate.getMonthValue())));
  185. }
  186. List<KindInfoVo> kindInfoVos = insAreaCompany.getKindinfo().toJavaList(KindInfoVo.class);
  187. //险别信息
  188. kindInfoVos.forEach(kindInfoVo -> {
  189. //机动车损失险
  190. if (InsurKind.A.getCode().equals(kindInfoVo.getKindCode()))
  191. ruleAttrMappingVoList.add(new RuleAttrMappingVo("MotorVehicleDamageInsurance", String.valueOf(kindInfoVo.getAmount())));
  192. //第三者责任险
  193. if (InsurKind.B.getCode().equals(kindInfoVo.getKindCode()))
  194. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdPartyLiabilityInsurance",
  195. String.valueOf(Double.valueOf(kindInfoVo.getAmount()).intValue())));
  196. //司机责任险
  197. if (InsurKind.D3.getCode().equals(kindInfoVo.getKindCode()))
  198. ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverLiabilityInsurance", String.valueOf(kindInfoVo.getAmount())));
  199. //乘客责任险
  200. if (InsurKind.D4.getCode().equals(kindInfoVo.getKindCode()))
  201. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerLiabilityInsurance", String.valueOf(kindInfoVo.getUnitAmount())));
  202. //车身划痕险
  203. if (InsurKind.L.getCode().equals(kindInfoVo.getKindCode()))
  204. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarScratchInsurance", String.valueOf(kindInfoVo.getAmount())));
  205. //绝对免赔率特约险(车损)
  206. if (InsurKind.MJ1.getCode().equals(kindInfoVo.getKindCode()))
  207. ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleDamageAbsoluteDeductibleSpecialInsurance",
  208. String.valueOf(kindInfoVo.getAmount())));
  209. //绝对免赔率特约险(三者)
  210. if (InsurKind.MJ2.getCode().equals(kindInfoVo.getKindCode()))
  211. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdAbsoluteDeductibleSpecialInsurance",
  212. String.valueOf(kindInfoVo.getAmount())));
  213. //绝对免赔率特约险(司机)
  214. if (InsurKind.MJ3.getCode().equals(kindInfoVo.getKindCode()))
  215. ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverAbsoluteDeductibleSpecialInsurance",
  216. String.valueOf(kindInfoVo.getAmount())));
  217. //绝对免赔率特约险(乘客)
  218. if (InsurKind.MJ4.getCode().equals(kindInfoVo.getKindCode()))
  219. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerAbsoluteDeductibleSpecialInsurance",
  220. String.valueOf(kindInfoVo.getAmount())));
  221. //附加医保-三者
  222. if (InsurKind.SY_FJ_YBW1.getCode().equals(kindInfoVo.getKindCode()))
  223. ruleAttrMappingVoList.add(new RuleAttrMappingVo("ThirdPartyAdditionalMedicalInsurance",
  224. String.valueOf(kindInfoVo.getAmount())));
  225. //附加医保-座位险(乘客)
  226. if (InsurKind.SY_FJ_YBW2.getCode().equals(kindInfoVo.getKindCode()))
  227. ruleAttrMappingVoList.add(new RuleAttrMappingVo("PassengerAdditionalMedicalInsurance",
  228. String.valueOf(kindInfoVo.getAmount())));
  229. //附加医保-座位险(司机)
  230. if (InsurKind.SY_FJ_YBW3.getCode().equals(kindInfoVo.getKindCode()))
  231. ruleAttrMappingVoList.add(new RuleAttrMappingVo("DriverAdditionalMedicalInsurance",
  232. String.valueOf(kindInfoVo.getAmount())));
  233. //法定节假日限额翻倍险
  234. if (InsurKind.BD.getCode().equals(kindInfoVo.getKindCode()))
  235. ruleAttrMappingVoList.add(new RuleAttrMappingVo("LegalHolidayLimitDoublingInsurance",
  236. String.valueOf(kindInfoVo.getAmount())));
  237. //道路救援服务特约条款
  238. if (InsurKind.TY1.getCode().equals(kindInfoVo.getKindCode()))
  239. ruleAttrMappingVoList.add(new RuleAttrMappingVo("RoadsideAssistanceServiceSpecialClause",
  240. String.valueOf(kindInfoVo.getServiceTimes())));
  241. //车辆安全检测特约条款
  242. if (InsurKind.TY2.getCode().equals(kindInfoVo.getKindCode()))
  243. ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleSafetyInspectionSpecialClause",
  244. String.valueOf(kindInfoVo.getServiceTimes())));
  245. //代为驾驶服务特约条款
  246. if (InsurKind.TY3.getCode().equals(kindInfoVo.getKindCode()))
  247. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SubstituteDrivingServiceSpecialClause",
  248. String.valueOf(kindInfoVo.getServiceTimes())));
  249. //代为送检服务特约条款
  250. if (InsurKind.TY4.getCode().equals(kindInfoVo.getKindCode()))
  251. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SubstituteInspectionServiceSpecialClause",
  252. String.valueOf(kindInfoVo.getServiceTimes())));
  253. });
  254. //交强保费
  255. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryTrafficAccidentLiabilityInsurancePremium",
  256. String.valueOf(insAreaCompany.getJqpremium())));
  257. //车船税
  258. ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleandVesselTax", String.valueOf(insAreaCompany.getTaxamount())));
  259. //非车险
  260. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonMotorInsurance", String.valueOf(insAreaCompany.getJypremium())));
  261. //总折扣率
  262. ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalDiscountRate", String.valueOf(insAreaCompany.getTotalAdjustRate())));
  263. //交强折扣
  264. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceDiscount", String.valueOf(insAreaCompany.getJqAdjustRate())));
  265. //商业折扣
  266. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialDiscount", String.valueOf(insAreaCompany.getSyAdjustRate())));
  267. //数值型总评分
  268. Pattern pattern = Pattern.compile("[0-9]*");
  269. if (insAreaCompany.getScore() != null) {
  270. if (pattern.matcher(insAreaCompany.getScore()).matches()) {
  271. //数值型评分
  272. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NumericalOverallRating", String.valueOf(insAreaCompany.getScore())));
  273. } else {
  274. //字母型评分
  275. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CharacterBasedRating", String.valueOf(insAreaCompany.getScore())));
  276. }
  277. }
  278. //交强评分
  279. if (insAreaCompany.getJqScore() != null) {
  280. if (pattern.matcher(insAreaCompany.getJqScore()).matches()) {
  281. //数值型评分
  282. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceRating", String.valueOf(insAreaCompany.getJqScore())));
  283. } else {
  284. //字母型评分
  285. ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqCharacterBasedRating",
  286. String.valueOf(insAreaCompany.getJqScore())));
  287. }
  288. }
  289. // ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsuranceRating", String.valueOf(insAreaCompany.getJqScore())));
  290. //商业评分
  291. if (insAreaCompany.getSyScore() != null) {
  292. if (pattern.matcher(insAreaCompany.getSyScore()).matches()) {
  293. //数值型评分
  294. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialRating", String.valueOf(insAreaCompany.getSyScore())));
  295. } else {
  296. //字母型评分
  297. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyCharacterBasedRating",
  298. String.valueOf(insAreaCompany.getSyScore())));
  299. }
  300. }
  301. //交强赔付率
  302. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CompulsoryInsurancePayoutRate", String.valueOf(insAreaCompany.getJqLossRation())));
  303. //商业赔付率
  304. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CommercialPayoutRate", String.valueOf(insAreaCompany.getSyLossRation())));
  305. //总赔付率
  306. ruleAttrMappingVoList.add(new RuleAttrMappingVo("TotalPayoutRate", String.valueOf(insAreaCompany.getLossRation())));
  307. //太平绿黄红区
  308. ruleAttrMappingVoList.add(new RuleAttrMappingVo("GreenYellowAndRedAreas", insAreaCompany.getTpColorScore()));
  309. if (insAreaCompany.getAccidentalDriving() != null) {
  310. //非车名称
  311. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarName", insAreaCompany.getAccidentalDriving().getRideRiskName()));
  312. //非车份数
  313. ruleAttrMappingVoList.add(new RuleAttrMappingVo("NonCarQuantity",
  314. String.valueOf(insAreaCompany.getAccidentalDriving().getQuantity())));
  315. }
  316. //真假单交
  317. ruleAttrMappingVoList.add(new RuleAttrMappingVo("IsDJQ", insAreaCompany.getIsDjq()));
  318. //紫金鼎然评分
  319. ruleAttrMappingVoList.add(new RuleAttrMappingVo("UbiPredictedInfoScore", insAreaCompany.getUbiPredictedInfoScore()));
  320. // 交强出险次数
  321. ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqNumberOfClaims", insAreaCompany.getJqClaims() == null ? "0" : insAreaCompany.getJqClaims()));
  322. // 商业出险次数
  323. ruleAttrMappingVoList.add(new RuleAttrMappingVo("SyNumberOfClaims", insAreaCompany.getSyClaims() == null ? "0" : insAreaCompany.getSyClaims()));
  324. // 车牌地区
  325. ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseArea", insOrders.getLicenseno().substring(0,1)));
  326. // 系数
  327. ruleAttrMappingVoList.add(new RuleAttrMappingVo("Coefficient", getCoefficient(carInfo,insAreaCompany).toString()));
  328. // 商业是否有费用
  329. ruleAttrMappingVoList.add(new RuleAttrMappingVo("CiMessage", (insAreaCompany.getCiMessage() == null || "".equals(insAreaCompany.getCiMessage())) ? "0" : "1"));
  330. return ruleAttrMappingVoList;
  331. }
  332. private static Float getCoefficient(CarInfoVo carInfo,InsAreaCompany insAreaCompany){
  333. Integer seatCount = Integer.parseInt(carInfo.getSeatCount());
  334. Float coefficient = 1.00f;
  335. // ruleAttrMappingVoList.add(new RuleAttrMappingVo())
  336. //家庭自用车
  337. if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
  338. carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_05.getCode())){
  339. //2-5座
  340. if(seatCount >= 2 && seatCount <=5) {
  341. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 950;
  342. }
  343. //6-9座
  344. if(seatCount >= 6 && seatCount <=9){
  345. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1100;
  346. }
  347. }else
  348. //非营业机关、企业
  349. if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
  350. (carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_06.getCode()) ||
  351. carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_07.getCode()))){
  352. //2-5座
  353. if(seatCount >= 2 && seatCount <=5) {
  354. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1000;
  355. }
  356. //6-9座
  357. if(seatCount >= 6 && seatCount <=9){
  358. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1130;
  359. }
  360. }
  361. else
  362. //货车
  363. if(carInfo.getCimodelclass().equals(VehicleType.VT_A1.getCode()))
  364. {
  365. //营业货运 2吨
  366. if(carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_04.getCode()) &&
  367. Integer.parseInt(carInfo.getLimitLoad()) < 2000){
  368. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1850;
  369. }
  370. //非营业货运 2吨
  371. if(carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_08.getCode()) &&
  372. Integer.parseInt(carInfo.getLimitLoad()) < 2000){
  373. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1200;
  374. }
  375. //大吨位
  376. if(Integer.parseInt(carInfo.getLimitLoad()) > 2000){
  377. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 4480;
  378. }
  379. }
  380. else
  381. //出租车 网约车
  382. if(carInfo.getCimodelclass().equals(VehicleType.VT_A0.getCode()) &&
  383. carInfo.getVehicleUse().equals(TypeVehicleMapping.TM_01.getCode())){
  384. coefficient = Float.parseFloat(insAreaCompany.getJqpremium().toString()) / 1800;
  385. }
  386. return coefficient;
  387. }
  388. }