|
@@ -13,6 +13,7 @@ import lombok.Data;
|
|
|
import java.io.Serial;
|
|
import java.io.Serial;
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
|
@@ -81,20 +82,21 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
this.clauseType = "2";
|
|
this.clauseType = "2";
|
|
|
List<KindInfoVo> kindInfoVoList = quoteVo.getKindInfoVo();
|
|
List<KindInfoVo> kindInfoVoList = quoteVo.getKindInfoVo();
|
|
|
this.risktype = "0";
|
|
this.risktype = "0";
|
|
|
- this.begintimeBi = DateUtil.toUtcDateTime(quoteVo.getCiRiskInfoVo().getStartDate());
|
|
|
|
|
if (Objects.nonNull(quoteVo.getCiRiskInfoVo())) {
|
|
if (Objects.nonNull(quoteVo.getCiRiskInfoVo())) {
|
|
|
this.begintimeCi = DateUtil.toUtcDateTime(quoteVo.getCiRiskInfoVo().getStartDate());
|
|
this.begintimeCi = DateUtil.toUtcDateTime(quoteVo.getCiRiskInfoVo().getStartDate());
|
|
|
- this.begintimeAccident = DateUtil.toUtcDateTime(quoteVo.getCiRiskInfoVo().getStartDate());
|
|
|
|
|
|
|
+ this.begintimeAccident = DateUtil.getNextDayMidnightUtc();
|
|
|
this.risktype = "1";
|
|
this.risktype = "1";
|
|
|
}
|
|
}
|
|
|
if (CollUtil.isNotEmpty(kindInfoVoList)) {
|
|
if (CollUtil.isNotEmpty(kindInfoVoList)) {
|
|
|
this.epersonliabilityList = getEpersonliabilityList(kindInfoVoList, depreciationPrice);
|
|
this.epersonliabilityList = getEpersonliabilityList(kindInfoVoList, depreciationPrice);
|
|
|
this.begintimeBi = DateUtil.toUtcDateTime(quoteVo.getBiRiskInfoVo().getStartDate());
|
|
this.begintimeBi = DateUtil.toUtcDateTime(quoteVo.getBiRiskInfoVo().getStartDate());
|
|
|
- this.begintimeAccident = DateUtil.toUtcDateTime(quoteVo.getBiRiskInfoVo().getStartDate());
|
|
|
|
|
|
|
+ this.begintimeAccident = DateUtil.getNextDayMidnightUtc();
|
|
|
this.risktype = "2";
|
|
this.risktype = "2";
|
|
|
} else {
|
|
} else {
|
|
|
this.epersonliabilityList = new ArrayList<>();
|
|
this.epersonliabilityList = new ArrayList<>();
|
|
|
}
|
|
}
|
|
|
|
|
+ // 驾意险列表需在 accidentEpolicyFlag 之前赋值
|
|
|
|
|
+ this.accidentInsuranceList = getAccidentInsuranceList(quoteVo.getBiRiskInfoVo(), quoteVo.getAccidentalDrivings());
|
|
|
this.plyappno = plyappno;
|
|
this.plyappno = plyappno;
|
|
|
this.ecarshiptaxPart = "投保人";
|
|
this.ecarshiptaxPart = "投保人";
|
|
|
this.taxonomyCode = "02";
|
|
this.taxonomyCode = "02";
|
|
@@ -102,14 +104,14 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
this.endtimeBi = "";
|
|
this.endtimeBi = "";
|
|
|
this.endtimeCi = "";
|
|
this.endtimeCi = "";
|
|
|
this.expdisc = "";
|
|
this.expdisc = "";
|
|
|
- this.accidentEpolicyFlag = "Y";
|
|
|
|
|
|
|
+ // 有驾意险时传"Y",无驾意险时传""(与javadoc示例对齐)
|
|
|
|
|
+ this.accidentEpolicyFlag = this.accidentInsuranceList.isEmpty() ? "" : "Y";
|
|
|
this.effectfLag = null;
|
|
this.effectfLag = null;
|
|
|
this.ecarChargingPosts = new ArrayList<>();
|
|
this.ecarChargingPosts = new ArrayList<>();
|
|
|
this.carInsureDevices = new ArrayList<>();
|
|
this.carInsureDevices = new ArrayList<>();
|
|
|
this.outofwarrantytype = "N";
|
|
this.outofwarrantytype = "N";
|
|
|
this.drivingtype = "";
|
|
this.drivingtype = "";
|
|
|
- this.endtimeAccident = "";
|
|
|
|
|
- this.accidentInsuranceList = getAccidentInsuranceList(quoteVo.getBiRiskInfoVo(), quoteVo.getAccidentalDrivings());
|
|
|
|
|
|
|
+ this.endtimeAccident = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<EpersonliabilityDTO> getEpersonliabilityList(List<KindInfoVo> kindInfoVoList, String depreciationPrice) {
|
|
public List<EpersonliabilityDTO> getEpersonliabilityList(List<KindInfoVo> kindInfoVoList, String depreciationPrice) {
|
|
@@ -120,25 +122,58 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
epersonliabilityDTO.setLiabname(kindInfoVo.getKindName());
|
|
epersonliabilityDTO.setLiabname(kindInfoVo.getKindName());
|
|
|
// kindcode "101"(机动车损失保险)的保额必须使用车辆折旧价(实际价值),
|
|
// kindcode "101"(机动车损失保险)的保额必须使用车辆折旧价(实际价值),
|
|
|
// 否则保司会校验"协商价格范围建议在实际价值上下30%浮动"并拒绝
|
|
// 否则保司会校验"协商价格范围建议在实际价值上下30%浮动"并拒绝
|
|
|
|
|
+ // 注意:正确请求中kindcode "101"/"102"/"115"不包含unitAmount/quantity字段
|
|
|
if ("101".equals(kindInfoVo.getKindCode()) && depreciationPrice != null) {
|
|
if ("101".equals(kindInfoVo.getKindCode()) && depreciationPrice != null) {
|
|
|
- epersonliabilityDTO.setLiabamt(depreciationPrice);
|
|
|
|
|
- epersonliabilityDTO.setUnitAmount(depreciationPrice);
|
|
|
|
|
|
|
+ epersonliabilityDTO.setLiabamt(parseNumeric(depreciationPrice));
|
|
|
|
|
+ } else if (Arrays.asList("102", "115").contains(kindInfoVo.getKindCode())) {
|
|
|
|
|
+ epersonliabilityDTO.setLiabamt(parseNumeric(kindInfoVo.getAmount()));
|
|
|
} else if (!"116".equals(kindInfoVo.getKindCode())) {
|
|
} else if (!"116".equals(kindInfoVo.getKindCode())) {
|
|
|
// kindcode "116"不需要liabamt和unitAmount
|
|
// kindcode "116"不需要liabamt和unitAmount
|
|
|
- epersonliabilityDTO.setLiabamt(kindInfoVo.getAmount());
|
|
|
|
|
- epersonliabilityDTO.setUnitAmount(kindInfoVo.getUnitAmount());
|
|
|
|
|
|
|
+ Object liabamt = parseNumeric(kindInfoVo.getAmount());
|
|
|
|
|
+ epersonliabilityDTO.setLiabamt(liabamt);
|
|
|
|
|
+ Object unitAmount = parseNumeric(kindInfoVo.getUnitAmount());
|
|
|
|
|
+ // "103"(司机)/"104"(乘客)在正确请求中必须有unitAmount,数据缺失时兜底为liabamt
|
|
|
|
|
+ if (unitAmount == null && Arrays.asList("103", "104").contains(kindInfoVo.getKindCode())) {
|
|
|
|
|
+ unitAmount = liabamt;
|
|
|
|
|
+ }
|
|
|
|
|
+ epersonliabilityDTO.setUnitAmount(unitAmount);
|
|
|
}
|
|
}
|
|
|
if ("116".equals(kindInfoVo.getKindCode())) {
|
|
if ("116".equals(kindInfoVo.getKindCode())) {
|
|
|
// 道路救援服务特约条款:只需要serviceTimes字段
|
|
// 道路救援服务特约条款:只需要serviceTimes字段
|
|
|
epersonliabilityDTO.setServiceTimes(kindInfoVo.getServiceTimes() != null ? kindInfoVo.getServiceTimes() : "2");
|
|
epersonliabilityDTO.setServiceTimes(kindInfoVo.getServiceTimes() != null ? kindInfoVo.getServiceTimes() : "2");
|
|
|
} else {
|
|
} else {
|
|
|
- epersonliabilityDTO.setQuantity(kindInfoVo.getQuantity() != null ? kindInfoVo.getQuantity() : "4");
|
|
|
|
|
|
|
+ // kindInfoVo有quantity才设置,否则不传(避免默认值"4"篡改司机险等正确值)
|
|
|
|
|
+ // "103"(司机)正确请求中quantity=1,数据缺失时兜底
|
|
|
|
|
+ String qty = kindInfoVo.getQuantity();
|
|
|
|
|
+ if (qty != null) {
|
|
|
|
|
+ epersonliabilityDTO.setQuantity(parseNumeric(qty));
|
|
|
|
|
+ } else if ("103".equals(kindInfoVo.getKindCode())) {
|
|
|
|
|
+ epersonliabilityDTO.setQuantity(1);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
epersonliabilityDTOList.add(epersonliabilityDTO);
|
|
epersonliabilityDTOList.add(epersonliabilityDTO);
|
|
|
}
|
|
}
|
|
|
return epersonliabilityDTOList;
|
|
return epersonliabilityDTOList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将字符串解析为数值类型,确保Jackson序列化为数字而非字符串
|
|
|
|
|
+ */
|
|
|
|
|
+ private static Object parseNumeric(String value) {
|
|
|
|
|
+ if (value == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (value.contains(".")) {
|
|
|
|
|
+ return new java.math.BigDecimal(value);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Long.valueOf(value);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ return value;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public List<AccidentInsuranceDTO> getAccidentInsuranceList(RiskInfoVo biRiskInfoVo, List<AccidentalDrivingVo> accidentalDrivings) {
|
|
public List<AccidentInsuranceDTO> getAccidentInsuranceList(RiskInfoVo biRiskInfoVo, List<AccidentalDrivingVo> accidentalDrivings) {
|
|
|
if (accidentalDrivings == null || accidentalDrivings.isEmpty()) {
|
|
if (accidentalDrivings == null || accidentalDrivings.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
@@ -154,15 +189,9 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
AccidentInsuranceDTO dto = new AccidentInsuranceDTO();
|
|
AccidentInsuranceDTO dto = new AccidentInsuranceDTO();
|
|
|
dto.setNonriskcode(vo.getProductCode().split("_")[1]);
|
|
dto.setNonriskcode(vo.getProductCode().split("_")[1]);
|
|
|
dto.setProgramcode(vo.getProductCode());
|
|
dto.setProgramcode(vo.getProductCode());
|
|
|
- dto.setProgramname(vo.getProductName());
|
|
|
|
|
- if (biRiskInfoVo != null && StringUtils.isNotBlank(biRiskInfoVo.getStartDate()) && StringUtils.isNotBlank(biRiskInfoVo.getEndDate())) {
|
|
|
|
|
- dto.setBegintime(DateUtil.toUtcDateTime(DateUtil.getCurrentDate(1) + " 00:00:00"));
|
|
|
|
|
- dto.setEndtime(DateUtil.toUtcDateTime(DateUtil.getNextYearDateStrTranfer(DateUtil.getCurrentDate(1) + " 00:00:00")));
|
|
|
|
|
- }
|
|
|
|
|
- dto.setCompanycode("0107");
|
|
|
|
|
- dto.setRelationcarowner("a");
|
|
|
|
|
- dto.setSuminsured("525000");
|
|
|
|
|
- dto.setSumgrosspremium(vo.getPremium());
|
|
|
|
|
|
|
+ // programname/companycode/begintime/endtime/relationcarowner 正确请求中均不包含,移除以避免保司API 500
|
|
|
|
|
+ dto.setSuminsured(parseNumeric("525000"));
|
|
|
|
|
+ dto.setSumgrosspremium(parseNumeric(vo.getPremium()));
|
|
|
dto.setIfdefault(true);
|
|
dto.setIfdefault(true);
|
|
|
dto.setBuynum(vo.getQuantity());
|
|
dto.setBuynum(vo.getQuantity());
|
|
|
dto.setGgriskprogramclauselist(getGgriskprogramclauseList(vo.getProductCode().split("_")[1], vo.getProductCode()));
|
|
dto.setGgriskprogramclauselist(getGgriskprogramclauseList(vo.getProductCode().split("_")[1], vo.getProductCode()));
|
|
@@ -243,11 +272,11 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
detail1.setSerialno(1);
|
|
detail1.setSerialno(1);
|
|
|
detail1.setKindcode("1119066");
|
|
detail1.setKindcode("1119066");
|
|
|
detail1.setKindname("机动车辆驾乘意外伤害保险意外身故保险责任(2024款)");
|
|
detail1.setKindname("机动车辆驾乘意外伤害保险意外身故保险责任(2024款)");
|
|
|
- detail1.setKindrate("0.098");
|
|
|
|
|
- detail1.setKindunitinsured("50000");
|
|
|
|
|
- detail1.setKindsuminsured("250000");
|
|
|
|
|
- detail1.setKindunitpremium("4.9");
|
|
|
|
|
- detail1.setKindgrosspremium("54");
|
|
|
|
|
|
|
+ detail1.setKindrate(parseNumeric("0.098"));
|
|
|
|
|
+ detail1.setKindunitinsured(parseNumeric("50000"));
|
|
|
|
|
+ detail1.setKindsuminsured(parseNumeric("250000"));
|
|
|
|
|
+ detail1.setKindunitpremium(parseNumeric("4.9"));
|
|
|
|
|
+ detail1.setKindgrosspremium(parseNumeric("54"));
|
|
|
list.add(detail1);
|
|
list.add(detail1);
|
|
|
|
|
|
|
|
// 机动车辆驾乘意外伤害保险意外残疾保险责任(2024款)
|
|
// 机动车辆驾乘意外伤害保险意外残疾保险责任(2024款)
|
|
@@ -257,11 +286,11 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
detail2.setSerialno(2);
|
|
detail2.setSerialno(2);
|
|
|
detail2.setKindcode("1119067");
|
|
detail2.setKindcode("1119067");
|
|
|
detail2.setKindname("机动车辆驾乘意外伤害保险意外残疾保险责任(2024款)");
|
|
detail2.setKindname("机动车辆驾乘意外伤害保险意外残疾保险责任(2024款)");
|
|
|
- detail2.setKindrate("0.09166");
|
|
|
|
|
- detail2.setKindunitinsured("30000");
|
|
|
|
|
- detail2.setKindsuminsured("240000");
|
|
|
|
|
- detail2.setKindunitpremium("2.75");
|
|
|
|
|
- detail2.setKindgrosspremium("22");
|
|
|
|
|
|
|
+ detail2.setKindrate(parseNumeric("0.09166"));
|
|
|
|
|
+ detail2.setKindunitinsured(parseNumeric("30000"));
|
|
|
|
|
+ detail2.setKindsuminsured(parseNumeric("240000"));
|
|
|
|
|
+ detail2.setKindunitpremium(parseNumeric("2.75"));
|
|
|
|
|
+ detail2.setKindgrosspremium(parseNumeric("22"));
|
|
|
list.add(detail2);
|
|
list.add(detail2);
|
|
|
|
|
|
|
|
// 附加机动车辆驾乘意外伤害医疗保险(2024款)
|
|
// 附加机动车辆驾乘意外伤害医疗保险(2024款)
|
|
@@ -271,11 +300,11 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
detail3.setSerialno(3);
|
|
detail3.setSerialno(3);
|
|
|
detail3.setKindcode("1119065");
|
|
detail3.setKindcode("1119065");
|
|
|
detail3.setKindname("附加机动车辆驾乘意外伤害医疗保险(2024款)");
|
|
detail3.setKindname("附加机动车辆驾乘意外伤害医疗保险(2024款)");
|
|
|
- detail3.setKindrate("1.0001");
|
|
|
|
|
- detail3.setKindunitinsured("3000");
|
|
|
|
|
- detail3.setKindsuminsured("24000");
|
|
|
|
|
- detail3.setKindunitpremium("3");
|
|
|
|
|
- detail3.setKindgrosspremium("24");
|
|
|
|
|
|
|
+ detail3.setKindrate(parseNumeric("1.0001"));
|
|
|
|
|
+ detail3.setKindunitinsured(parseNumeric("3000"));
|
|
|
|
|
+ detail3.setKindsuminsured(parseNumeric("24000"));
|
|
|
|
|
+ detail3.setKindunitpremium(parseNumeric("3"));
|
|
|
|
|
+ detail3.setKindgrosspremium(parseNumeric("24"));
|
|
|
list.add(detail3);
|
|
list.add(detail3);
|
|
|
|
|
|
|
|
return list;
|
|
return list;
|
|
@@ -311,12 +340,13 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
private static final long serialVersionUID = 4972640996367640469L;
|
|
private static final long serialVersionUID = 4972640996367640469L;
|
|
|
|
|
|
|
|
private String kindcode;
|
|
private String kindcode;
|
|
|
- private String liabamt;
|
|
|
|
|
|
|
+ // 使用Object类型确保liabamt序列化为数字而非字符串,匹配保司API期望的数字类型
|
|
|
|
|
+ private Object liabamt;
|
|
|
private String liabname;
|
|
private String liabname;
|
|
|
private String model = "0";
|
|
private String model = "0";
|
|
|
- private String quantity;
|
|
|
|
|
|
|
+ private Object quantity;
|
|
|
private String serviceTimes;
|
|
private String serviceTimes;
|
|
|
- private String unitAmount;
|
|
|
|
|
|
|
+ private Object unitAmount;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Data
|
|
@Data
|
|
@@ -333,8 +363,9 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
private String programname;
|
|
private String programname;
|
|
|
private String companycode;
|
|
private String companycode;
|
|
|
private String resourcetype;
|
|
private String resourcetype;
|
|
|
- private String suminsured;
|
|
|
|
|
- private String sumgrosspremium;
|
|
|
|
|
|
|
+ // 使用Object类型确保序列化为数字而非字符串,匹配保司API期望的数字类型
|
|
|
|
|
+ private Object suminsured;
|
|
|
|
|
+ private Object sumgrosspremium;
|
|
|
private String sumuwpricetaxtotal;
|
|
private String sumuwpricetaxtotal;
|
|
|
private Boolean ifdefault;
|
|
private Boolean ifdefault;
|
|
|
private String seatcount;
|
|
private String seatcount;
|
|
@@ -353,7 +384,7 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
private String risk1205field;
|
|
private String risk1205field;
|
|
|
private String risk1283items;
|
|
private String risk1283items;
|
|
|
private String drivingtype;
|
|
private String drivingtype;
|
|
|
- private String relationcarowner = "a";
|
|
|
|
|
|
|
+ private String relationcarowner;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Data
|
|
@Data
|
|
@@ -407,11 +438,12 @@ public class HbCrawlerCalculationRequest extends HbBaseRequest {
|
|
|
private Integer serialno;
|
|
private Integer serialno;
|
|
|
private String kindcode;
|
|
private String kindcode;
|
|
|
private String kindname;
|
|
private String kindname;
|
|
|
- private String kindrate;
|
|
|
|
|
- private String kindunitinsured;
|
|
|
|
|
- private String kindsuminsured;
|
|
|
|
|
- private String kindunitpremium;
|
|
|
|
|
- private String kindgrosspremium;
|
|
|
|
|
|
|
+ // 使用Object类型确保序列化为数字,匹配保司API期望的数字类型
|
|
|
|
|
+ private Object kindrate;
|
|
|
|
|
+ private Object kindunitinsured;
|
|
|
|
|
+ private Object kindsuminsured;
|
|
|
|
|
+ private Object kindunitpremium;
|
|
|
|
|
+ private Object kindgrosspremium;
|
|
|
private String itemDetailCode;
|
|
private String itemDetailCode;
|
|
|
private String itemDetailName;
|
|
private String itemDetailName;
|
|
|
private String kindInd;
|
|
private String kindInd;
|