|
|
@@ -20,6 +20,7 @@ import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversi
|
|
|
import com.jzg.quotation.zijin.api.constant.enums.MotorVehicleInsuranceEnum;
|
|
|
import com.jzg.quotation.zijin.api.constant.enums.RiskCodeEnum;
|
|
|
import com.jzg.quotation.zijin.crawler.build.ZiJinCrawlerQuoteResultsVoBuild;
|
|
|
+import com.jzg.quotation.zijin.crawler.build.ZiJinCrawlerSaveQuoteInfoRequestBuild;
|
|
|
import com.jzg.quotation.zijin.crawler.component.ZiJinBuildingAttributionInformation;
|
|
|
import com.jzg.quotation.zijin.crawler.component.ZiJinCrawlerCacheComponent;
|
|
|
import com.jzg.quotation.zijin.crawler.component.ZiJinCrawlerRequestComponent;
|
|
|
@@ -32,6 +33,7 @@ import com.jzg.quotation.zijin.crawler.service.ZiJinCrawlerOrderService;
|
|
|
import com.jzg.quotation.zijin.crawler.service.ZiJinCrawlerQuoteProcessService;
|
|
|
import com.jzg.quotation.zijin.crawler.service.ZiJinCrawlerRequest;
|
|
|
import com.jzg.quotation.zijin.crawler.util.Base64ImageExtractor;
|
|
|
+import com.jzg.quotation.zijin.crawler.util.RS6Item;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
@@ -204,10 +206,20 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
// 转保标志
|
|
|
if (ResponseCode.R_0001.getCode().equals(ziJinCrawlerQuotationResponse.getRtnCode())) {
|
|
|
if (ziJinCrawlerQuotationResponse.getBasePart() != null) {
|
|
|
- ZiJinCrawlerRecognizeCodesResponse ziJinCrawlerRecognizeCodesResponse = ziJinCrawlerRequestComponent.recognizeCodes(buildRecognizeCodesRequests(ziJinCrawlerQuotationResponse));
|
|
|
+ ZiJinCrawlerRecognizeCodesResponse ziJinCrawlerRecognizeCodesResponse = ziJinCrawlerRequestComponent.recognizeCodes(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildRecognizeCodesRequests(ziJinCrawlerQuotationResponse), headers);
|
|
|
log.info("ziJinCrawlerRecognizeCodesResponse参数的值:{}", JSON.toJSONString(ziJinCrawlerRecognizeCodesResponse));
|
|
|
// 再次调用报价接口
|
|
|
if (ResponseCode.R_0000.getCode().equals(ziJinCrawlerRecognizeCodesResponse.getRtnCode())) {
|
|
|
+ List<ZiJinCrawlerRecognizeCodesResponse.Results> results = ziJinCrawlerRecognizeCodesResponse.getResults();
|
|
|
+ for (ZiJinCrawlerRecognizeCodesResponse.Results result : results) {
|
|
|
+ if ("question".equals(result.getSerialNo())) {
|
|
|
+ ziJinCrawlerQuotationRequest.getBaseInfo().setAnswer(result.getResult());
|
|
|
+ }
|
|
|
+ if ("questionCI".equals(result.getSerialNo())) {
|
|
|
+ ziJinCrawlerQuotationRequest.getBaseInfo().setAnswerCI(result.getResult());
|
|
|
+ }
|
|
|
+ ziJinCrawlerQuotationRequest.getBaseInfo().setRenewalFlagCI("1");
|
|
|
+ }
|
|
|
ziJinCrawlerQuotationResponse = ziJinCrawlerRequestComponent.quotation(ziJinCrawlerQuotationRequest, headers);
|
|
|
}
|
|
|
}
|
|
|
@@ -241,15 +253,6 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private ArrayList<ZiJinCrawlerRecognizeCodesRequest> buildRecognizeCodesRequests(ZiJinCrawlerQuotationResponse ziJinCrawlerQuotationResponse) {
|
|
|
- ArrayList<ZiJinCrawlerRecognizeCodesRequest> ziJinCrawlerRecognizeCodesRequests = new ArrayList<>();
|
|
|
- ZiJinCrawlerRecognizeCodesRequest ziJinCrawlerRecognizeCodesRequest = new ZiJinCrawlerRecognizeCodesRequest();
|
|
|
- ziJinCrawlerRecognizeCodesRequest.setBase64(ziJinCrawlerQuotationResponse.getBasePart().getQuestion());
|
|
|
- ziJinCrawlerRecognizeCodesRequest.setSerialNo("question");
|
|
|
- ziJinCrawlerRecognizeCodesRequests.add(ziJinCrawlerRecognizeCodesRequest);
|
|
|
- return ziJinCrawlerRecognizeCodesRequests;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 核保
|
|
|
*
|
|
|
@@ -788,8 +791,8 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
baseInfo.setEndMinute("00");
|
|
|
baseInfo.setEndMinuteCI("00");
|
|
|
// 经测试:燃油单强设为0,交三不设置(待确认),会返回转保标志,紫金系统可以忽略进行下一步报价
|
|
|
- // baseInfo.setXbFlag("0");
|
|
|
- // baseInfo.setXbFlagCI("0");
|
|
|
+ baseInfo.setXbFlag(quoteVo.getBiRiskInfoVo() == null ? "0" : null);
|
|
|
+ baseInfo.setXbFlagCI(quoteVo.getBiRiskInfoVo() == null ? "0" : null);
|
|
|
baseInfo.setGoalInsuredFlag("0");
|
|
|
baseInfo.setConfigName("天勤");
|
|
|
baseInfo.setId("1dec8ac2ced74973842a5b098669813a");
|
|
|
@@ -799,11 +802,11 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
baseInfo.setHanderCode("214003263");
|
|
|
baseInfo.setHanderName("程涛");
|
|
|
baseInfo.setDemandNo("01ZKIC140026051910017933666448");
|
|
|
- // baseInfo.setDemandNoCI("01ZKIC140026051910017933666448");
|
|
|
+ baseInfo.setDemandNoCI("01ZKIC140026051910017933666448");// 这个先放开看行不
|
|
|
// 经测试:燃油: 单交设为2,交三设为0
|
|
|
baseInfo.setCalculateFlag(quoteVo.getBiRiskInfoVo() == null ? "2" : "0");
|
|
|
// 经测试:燃油:单交设为"",交三设为1
|
|
|
- baseInfo.setRenewalFlag(quoteVo.getBiRiskInfoVo() == null ? "1" : "");
|
|
|
+ baseInfo.setRenewalFlag(quoteVo.getBiRiskInfoVo() == null ? "" : "1");
|
|
|
return baseInfo;
|
|
|
}
|
|
|
|
|
|
@@ -1746,22 +1749,22 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setOrderNo(ziJinCrawlerQuotationResponse.getOrderNo());
|
|
|
|
|
|
// 设置基础信息
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setBaseInfo(buildSaveBaseInfo(quoteVo, ziJinCrawlerQuotationRequest, ziJinCrawlerQuotationResponse));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setBaseInfo(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveBaseInfo(quoteVo, ziJinCrawlerQuotationRequest, ziJinCrawlerQuotationResponse));
|
|
|
|
|
|
// 设置车主信息
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setCarOwnerInfo(buildSaveCarOwnerInfo(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setCarOwnerInfo(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveCarOwnerInfo(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
|
|
|
// 设置车险附加险信息列表
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setCarPolicySubInfoList(buildSaveCarPolicySubInfo(ziJinCrawlerQuotationRequest));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setCarPolicySubInfoList(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveCarPolicySubInfo(ziJinCrawlerQuotationRequest));
|
|
|
|
|
|
// 设置附加险列表
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setAttachRiskList(new ArrayList<>());
|
|
|
|
|
|
// 设置 投保人/被保人 列表
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setInsuredList(buildSaveInsuredList(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setInsuredList(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveInsuredList(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
|
|
|
// 设置险别明细列表
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setItemKindList(buildSaveItemKindList(ziJinCrawlerQuotationResponse));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setItemKindList(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveItemKindList(ziJinCrawlerQuotationResponse));
|
|
|
|
|
|
// 设置收费信息列表
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setChargingInfoList(new ArrayList<>());
|
|
|
@@ -1779,7 +1782,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setSubmitInfo(new HashMap<>());
|
|
|
|
|
|
// 设置车船税减免信息
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setTaxRelifInfo(buildSaveTaxRelifInfo(ziJinCrawlerQuotationResponse));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setTaxRelifInfo(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveTaxRelifInfo(ziJinCrawlerQuotationResponse));
|
|
|
|
|
|
// 设置终端ID
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setTerminalId("KSCD");
|
|
|
@@ -1791,7 +1794,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setInsuranceSign("0");
|
|
|
|
|
|
// 设置车辆信息
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setVehicleInfo(buildVehicleInfo(ziJinCrawlerQuotationRequest, ziJinCrawlerQuotationResponse));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setVehicleInfo(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildVehicleInfo(ziJinCrawlerQuotationRequest, ziJinCrawlerQuotationResponse));
|
|
|
|
|
|
// 设置车辆设备保费列表
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setCarDevicePremiumDtoList(new ArrayList<>());
|
|
|
@@ -1803,7 +1806,7 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setItemFileDataList(buildSaveFileDataList(ziJinCrawlerQuotationResponse));
|
|
|
|
|
|
// 设置订单附加信息
|
|
|
- ziJinCrawlerSaveQuoteInfoRequest.setOrderAttachInfo(buildSaveOrderAttachInfo(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
+ ziJinCrawlerSaveQuoteInfoRequest.setOrderAttachInfo(ZiJinCrawlerSaveQuoteInfoRequestBuild.buildSaveOrderAttachInfo(quoteVo, ziJinCrawlerQuotationRequest));
|
|
|
|
|
|
// 设置是否包含子机构
|
|
|
ziJinCrawlerSaveQuoteInfoRequest.setIsIncludeSubCom(1);
|
|
|
@@ -1821,394 +1824,4 @@ public class ZiJinCrawlerRequestImpl implements ZiJinCrawlerRequest {
|
|
|
.build()
|
|
|
).toList();
|
|
|
}
|
|
|
-
|
|
|
- private ZiJinCrawlerSaveQuoteInfoRequest.OrderAttachInfo buildSaveOrderAttachInfo(QuoteVo quoteVo, ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest) {
|
|
|
- return ZiJinCrawlerSaveQuoteInfoRequest.OrderAttachInfo.builder()
|
|
|
- .carAppliRelation("1")
|
|
|
- .carInsuredRelation("1")
|
|
|
- .carCheckStatus("2")
|
|
|
- .carCheckReason("2")
|
|
|
- .vehicleId("1")
|
|
|
- .printModelName(ziJinCrawlerQuotationRequest.getVehicleInfo() != null ? ziJinCrawlerQuotationRequest.getVehicleInfo().getPrintModelName() : "")
|
|
|
- .printUseNatureCode("")
|
|
|
- .vehicleOwnerNature(ziJinCrawlerQuotationRequest.getCarOwnerInfo() != null ? ziJinCrawlerQuotationRequest.getCarOwnerInfo().getVehicleOwnerNature() : "1")
|
|
|
- .ownerAddress(quoteVo.getOwnersInfo().getAddr())
|
|
|
- .sale4SFlag("0")
|
|
|
- .policySupplementaryInfoList(new ArrayList<>())
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 构建保存报价信息的车辆信息
|
|
|
- *
|
|
|
- * @param ziJinCrawlerQuotationRequest 报价参数
|
|
|
- * @param ziJinCrawlerQuotationResponse 报价结果
|
|
|
- * @return 保存报价信息的车辆信息
|
|
|
- */
|
|
|
- private ZiJinCrawlerSaveQuoteInfoRequest.VehicleInfo buildVehicleInfo(ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest, ZiJinCrawlerQuotationResponse ziJinCrawlerQuotationResponse) {
|
|
|
- ZiJinCrawlerQuotationRequest.VehicleInfo carInfo = ziJinCrawlerQuotationRequest.getVehicleInfo();
|
|
|
- // 计算使用年限
|
|
|
- int useYears = 0;
|
|
|
- if (carInfo.getEnrollDate() != null) {
|
|
|
- try {
|
|
|
- java.time.LocalDate registerDate = java.time.LocalDate.parse(carInfo.getEnrollDate());
|
|
|
- useYears = java.time.Period.between(registerDate, java.time.LocalDate.now()).getYears();
|
|
|
- } catch (Exception e) {
|
|
|
- log.warn("车辆注册日期格式错误,无法计算使用年限,原始值:{}", carInfo.getEnrollDate());
|
|
|
- }
|
|
|
- }
|
|
|
- // 车辆种类和使用性质
|
|
|
- List<String> vehicleKindAndUseNature = new ArrayList<>();
|
|
|
- vehicleKindAndUseNature.add(carInfo.getCarKindCode());
|
|
|
- vehicleKindAndUseNature.add(carInfo.getUseNatureCode());
|
|
|
-
|
|
|
- return ZiJinCrawlerSaveQuoteInfoRequest.VehicleInfo.builder()
|
|
|
- .useYears(useYears)
|
|
|
- .actualValue(carInfo.getActualValue())
|
|
|
- .agreeActualValue(carInfo.getAgreeActualValue())
|
|
|
- .brandName(carInfo.getBrandName() != null ? carInfo.getBrandName() : "")
|
|
|
- .carKindCode(carInfo.getCarKindCode())
|
|
|
- .carKindDetailId(carInfo.getCarKindDetailId())
|
|
|
- .carLoanFlag(carInfo.getCarLoanFlag())
|
|
|
- .certificateDate(carInfo.getCertificateDate() != null ? carInfo.getCertificateDate() : "")
|
|
|
- .chgOwnerFlag(carInfo.getChgOwnerFlag())
|
|
|
- // .completekerbmass(carInfo.getCompletekerbmass() != null ? Integer.parseInt(carInfo.getCompletekerbmass()) : 0)
|
|
|
- .completekerbmass(carInfo.getCompletekerbmass())
|
|
|
- .ecdemicVehicleFlag(carInfo.getEcdemicVehicleFlag() != null ? carInfo.getEcdemicVehicleFlag() : "0")
|
|
|
- .engineNo(carInfo.getEngineNo() != null ? carInfo.getEngineNo() : "")
|
|
|
- .enrollDate(carInfo.getEnrollDate() != null ? carInfo.getEnrollDate() : "")
|
|
|
- .updateEnrollDate(carInfo.getUpdateEnrollDate() != null ? carInfo.getUpdateEnrollDate() : "")
|
|
|
- .exhaustCapacity(carInfo.getExhaustCapacity() != null ? carInfo.getExhaustCapacity() : 0)
|
|
|
- .fuelType(carInfo.getFuelType())
|
|
|
- .fuelTypeJY(carInfo.getFuelTypeJY())
|
|
|
- .newEnergyFlag(carInfo.getNewEnergyFlag())
|
|
|
- .licenseColorCode(carInfo.getLicenseColorCode())
|
|
|
- .licenseKindCode(carInfo.getLicenseKindCode())
|
|
|
- .licenseNo(carInfo.getLicenseNo() != null ? carInfo.getLicenseNo() : "")
|
|
|
- .loanVehicleFlag(carInfo.getLoanVehicleFlag() != null ? carInfo.getLoanVehicleFlag() : "0")
|
|
|
- .modelCode(carInfo.getModelCode() != null ? carInfo.getModelCode() : "")
|
|
|
- .noLicenseFlag(carInfo.getNoLicenseFlag())
|
|
|
- .issueDate(carInfo.getIssueDate() != null ? carInfo.getIssueDate() : "")
|
|
|
- .oriCarKindName(carInfo.getOriCarKindName())
|
|
|
- .platVehicleCode(carInfo.getPlatVehicleCode() != null ? carInfo.getPlatVehicleCode() : "")
|
|
|
- .power(carInfo.getPower() != null ? carInfo.getPower() : "0")
|
|
|
- .printUseNatureCode("")
|
|
|
- .purchasePrice(carInfo.getPurchasePrice() != null ? carInfo.getPurchasePrice() : "0")
|
|
|
- // .seatCount(carInfo.getSeatCount() != null ? Integer.parseInt(carInfo.getSeatCount()) : 5)
|
|
|
- .seatCount(carInfo.getSeatCount())
|
|
|
- .useNatureCode(carInfo.getUseNatureCode())
|
|
|
- .vehicleId(carInfo.getVehicleId())
|
|
|
- .makeDate(carInfo.getMakeDate() != null ? carInfo.getMakeDate() : "")
|
|
|
- .makeDateJQ(carInfo.getMakeDateJQ() != null ? carInfo.getMakeDateJQ() : "")
|
|
|
- .aliasName(carInfo.getAliasName() != null ? carInfo.getAliasName() : "")
|
|
|
- .carCheckStatus("2")
|
|
|
- .carCheckReason("2")
|
|
|
- .vehicleKindAndUseNature(vehicleKindAndUseNature)
|
|
|
- .oriBrandName(carInfo.getOriBrandName() != null ? carInfo.getOriBrandName() : "")
|
|
|
- .oriPurchasePrice(carInfo.getOriPurchasePrice() != null ? carInfo.getOriPurchasePrice() : "0")
|
|
|
- .isInvokeJingYou(carInfo.getIsInvokeJingYou())
|
|
|
- .vehicleStyleUniqueId(carInfo.getVehicleStyleUniqueId() != null ? carInfo.getVehicleStyleUniqueId() : "")
|
|
|
- .printModelName(carInfo.getPrintModelName() != null ? carInfo.getPrintModelName() : "")
|
|
|
- .oriModelName(carInfo.getOriModelName() != null ? carInfo.getOriModelName() : "")
|
|
|
- .vINNo(carInfo.getVinNo() != null ? carInfo.getVinNo() : "")
|
|
|
- .modelEnergyType(carInfo.getModelEnergyType())
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- private ZiJinCrawlerSaveQuoteInfoRequest.TaxRelifInfo buildSaveTaxRelifInfo(ZiJinCrawlerQuotationResponse ziJinCrawlerQuotationResponse) {
|
|
|
- if (ziJinCrawlerQuotationResponse.getCarShipTax() == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- ZiJinCrawlerQuotationResponse.CarShipTax carShipTax = ziJinCrawlerQuotationResponse.getCarShipTax();
|
|
|
- return ZiJinCrawlerSaveQuoteInfoRequest.TaxRelifInfo.builder()
|
|
|
- .taxRelifFlag(carShipTax.getTaxRelifFlag())
|
|
|
- .sumPayTax(carShipTax.getSumPayTax() == null ? "0.0" : String.valueOf(carShipTax.getSumPayTax()))
|
|
|
- .taxpayerName(carShipTax.getTaxpayerName())
|
|
|
- .taxpayerIdentifier(carShipTax.getTaxpayerIdentifier())
|
|
|
- .identifyNumber(carShipTax.getIdentifyNumber())
|
|
|
- .payLastYear(carShipTax.getPayLastYear())
|
|
|
- .lastCIPaymentTime(carShipTax.getLastCIPaymentTime())
|
|
|
- .taxActual(carShipTax.getTaxActual() == null ? "0.0" : String.valueOf(carShipTax.getTaxActual()))
|
|
|
- .previousPay(carShipTax.getPreviousPay() == null ? "0.0" : String.valueOf(carShipTax.getPreviousPay()))
|
|
|
- .lateFee(carShipTax.getLateFee() == null ? "0.0" : String.valueOf(carShipTax.getLateFee()))
|
|
|
- .taxRegistryNumber(carShipTax.getTaxRegistryNumber())
|
|
|
- .isPlatformTax(true)
|
|
|
- .extendChar1(carShipTax.getExtendChar1())
|
|
|
- .taxUnit(carShipTax.getTaxUnit())
|
|
|
- .completeKerbMass(carShipTax.getCompleteKerbMass())
|
|
|
- .payerCode(carShipTax.getPayerCode())
|
|
|
- .payStartDate(carShipTax.getPayStartDate())
|
|
|
- .payEndDate(carShipTax.getPayEndDate())
|
|
|
- .taxRelifFlagCN(carShipTax.getTaxRelifFlagCN())
|
|
|
- .exceedDaysCount(carShipTax.getExceedDaysCount())
|
|
|
- .currentTaxDue(ZiJinCrawlerSaveQuoteInfoRequest.TaxRelifInfo.CurrentTaxDue.builder()
|
|
|
- .taxLocationCode(carShipTax.getCurrentTaxDue().getTaxLocationCode())
|
|
|
- .taxEndDate(carShipTax.getCurrentTaxDue().getTaxEndDate())
|
|
|
- .taxStartDate(carShipTax.getCurrentTaxDue().getTaxStartDate())
|
|
|
- .taxUnitTypeCode(carShipTax.getCurrentTaxDue().getTaxUnitTypeCode())
|
|
|
- .taxDue(carShipTax.getCurrentTaxDue().getTaxDue() == null ? 0 : convertToInteger(carShipTax.getCurrentTaxDue().getTaxDue()))
|
|
|
- .unitRate(carShipTax.getCurrentTaxDue().getUnitRate() == null ? 0 : convertToInteger(carShipTax.getCurrentTaxDue().getUnitRate()))
|
|
|
- .annualTaxAmount(carShipTax.getCurrentTaxDue().getAnnualTaxAmount() == null ? 0 : convertToInteger(carShipTax.getCurrentTaxDue().getAnnualTaxAmount()))
|
|
|
- .exceedDaysCount(carShipTax.getCurrentTaxDue().getExceedDaysCount())
|
|
|
- .overDue(carShipTax.getCurrentTaxDue().getOverDue() == null ? 0 : convertToInteger(carShipTax.getCurrentTaxDue().getOverDue()))
|
|
|
- .taxConditionCode(carShipTax.getCurrentTaxDue().getTaxConditionCode())
|
|
|
- .totalAmount(carShipTax.getCurrentTaxDue().getTotalAmount() == null ? 0 : convertToInteger(carShipTax.getCurrentTaxDue().getTotalAmount()))
|
|
|
- .build())
|
|
|
- .delinquentTaxDueList(Optional.ofNullable(ziJinCrawlerQuotationResponse.getCarShipTax().getDelinquentTaxDueList())
|
|
|
- .orElseGet(Collections::emptyList).stream().map(currentTaxDue -> ZiJinCrawlerSaveQuoteInfoRequest.TaxRelifInfo.CurrentTaxDue.builder()
|
|
|
- .taxDue(currentTaxDue.getTaxDue() == null ? 0 : convertToInteger(currentTaxDue.getTaxDue()))
|
|
|
- .overDue(currentTaxDue.getOverDue() == null ? 0 : convertToInteger(currentTaxDue.getOverDue()))
|
|
|
- .totalAmount(currentTaxDue.getTotalAmount() == null ? 0 : convertToInteger(currentTaxDue.getTotalAmount()))
|
|
|
- .exceedDaysCount(currentTaxDue.getExceedDaysCount() == null ? 0 : convertToInteger(currentTaxDue.getExceedDaysCount()))
|
|
|
- .unitRate(currentTaxDue.getUnitRate() == null ? 0 : convertToInteger(currentTaxDue.getUnitRate()))
|
|
|
- .annualTaxAmount(currentTaxDue.getAnnualTaxAmount() == null ? 0 : convertToInteger(currentTaxDue.getAnnualTaxAmount()))
|
|
|
- .taxStartDate(currentTaxDue.getTaxStartDate())
|
|
|
- .taxEndDate(currentTaxDue.getTaxEndDate())
|
|
|
- .taxLocationCode(currentTaxDue.getTaxLocationCode())
|
|
|
- .taxUnitTypeCode(currentTaxDue.getTaxUnitTypeCode())
|
|
|
- .taxConditionCode(currentTaxDue.getTaxConditionCode())
|
|
|
- .build()
|
|
|
- ).toList())
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 构建保存的险别明细列表信息
|
|
|
- *
|
|
|
- * @param ziJinCrawlerQuotationResponse
|
|
|
- * @return
|
|
|
- */
|
|
|
- @NotNull
|
|
|
- private List<ZiJinCrawlerSaveQuoteInfoRequest.ItemKindInfo> buildSaveItemKindList(ZiJinCrawlerQuotationResponse ziJinCrawlerQuotationResponse) {
|
|
|
- List<ZiJinCrawlerSaveQuoteInfoRequest.ItemKindInfo> itemKindList = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(ziJinCrawlerQuotationResponse.getItemKindList())) {
|
|
|
- for (ZiJinCrawlerQuotationResponse.ItemKindList kind : ziJinCrawlerQuotationResponse.getItemKindList()) {
|
|
|
- String amount = kind.getAmount() != null ? kind.getAmount().toString() : "0.0";
|
|
|
- String premium = kind.getBenchMarkPremium() != null ? kind.getBenchMarkPremium() : "0.0000";
|
|
|
- ZiJinCrawlerSaveQuoteInfoRequest.ItemKindInfo itemKind = ZiJinCrawlerSaveQuoteInfoRequest.ItemKindInfo.builder()
|
|
|
- .amount(amount)
|
|
|
- .kindCode(kind.getKindCode())
|
|
|
- .kindName(kind.getKindName())
|
|
|
- .riskCode(kind.getRiskCode())
|
|
|
- .premium(premium)
|
|
|
- .benchMarkPremium(premium)
|
|
|
- .basePremium(kind.getBasePremium() != null ? kind.getBasePremium() : premium)
|
|
|
- .serviceTimes(kind.getServiceTimes())
|
|
|
- .build();
|
|
|
- itemKindList.add(itemKind);
|
|
|
- }
|
|
|
- }
|
|
|
- return itemKindList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 构建保存的 投保人/被投保人 信息
|
|
|
- *
|
|
|
- * @param quoteVo
|
|
|
- * @param ziJinCrawlerQuotationRequest
|
|
|
- * @return
|
|
|
- */
|
|
|
- @NotNull
|
|
|
- private List<ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo> buildSaveInsuredList(QuoteVo quoteVo, ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest) {
|
|
|
- // 投保人
|
|
|
- CustomerInfoVo policyHolderInfo = quoteVo.getPolicyHolderInfo();
|
|
|
- String addr = policyHolderInfo.getAddr();
|
|
|
- String identifyValidDate = policyHolderInfo.getIdentifyValidDate();
|
|
|
- String identifyValidEndDate = policyHolderInfo.getIdentifyValidEndDate();
|
|
|
- // 被保人
|
|
|
- CustomerInfoVo insuredPersonInfo = quoteVo.getInsuredPersonInfo();
|
|
|
- String addr1 = insuredPersonInfo.getAddr();
|
|
|
- String identifyValidDate1 = insuredPersonInfo.getIdentifyValidDate();
|
|
|
- String identifyValidEndDate1 = insuredPersonInfo.getIdentifyValidEndDate();
|
|
|
-
|
|
|
- // 投保人信息 (insuredFlag=2), 被保人信息 (insuredFlag=1)
|
|
|
- List<ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo> insuredList = new ArrayList<>();
|
|
|
- // 获取被保人信息
|
|
|
- if (CollectionUtils.isNotEmpty(ziJinCrawlerQuotationRequest.getInsuredList())) {
|
|
|
- for (ZiJinCrawlerQuotationRequest.InsuredList insured : ziJinCrawlerQuotationRequest.getInsuredList()) {
|
|
|
- ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo insuredInfo = ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo.builder()
|
|
|
- .address(insured.getInsuredFlag() == 2 ? addr : addr1)
|
|
|
- .identifyNumber(insured.getIdentifyNumber())
|
|
|
- .identifyType(ObjectUtils.isEmpty(insured.getIdentifyType()) ? "01" : insured.getIdentifyType())
|
|
|
- .insuredFlag(insured.getInsuredFlag())
|
|
|
- .insuredName(insured.getInsuredName())
|
|
|
- .insuredNature("3")
|
|
|
- .insuredType(insured.getInsuredType() != null ? insured.getInsuredType() : "1")
|
|
|
- .longAddress(insured.getInsuredFlag() == 2 ? addr : addr1)
|
|
|
- .mobile(insured.getMobile())
|
|
|
- .sex("2") // 默认值,从request中无法获取性别
|
|
|
- .nationality("中国")
|
|
|
- .occupation("A1301002")
|
|
|
- .addressProvince("")
|
|
|
- .addressPrefecture("")
|
|
|
- .addressCounty("")
|
|
|
- .postCode(insured.getPostCode() != null ? insured.getPostCode() : "030053")
|
|
|
- .insuredRelationship("1")
|
|
|
- .validDate(insured.getInsuredFlag() == 2 ? identifyValidEndDate : identifyValidEndDate1)
|
|
|
- .countryRegions("CHN")
|
|
|
- .vehicleRelationCode("1")
|
|
|
- .certigier(new HashMap<>())
|
|
|
- .chief(new HashMap<>())
|
|
|
- .riskLevelName("一般")
|
|
|
- .riskLevel("4")
|
|
|
- .reserved2("1")
|
|
|
- .reserved(new ArrayList<>())
|
|
|
- .businessManager(ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo.BusinessManager.builder()
|
|
|
- .insuredFlag("1")
|
|
|
- .build())
|
|
|
- .phoneHolder(ZiJinCrawlerSaveQuoteInfoRequest.InsuredInfo.PhoneHolder.builder()
|
|
|
- .insuredFlag("2")
|
|
|
- .build())
|
|
|
- .isPhoneOwner("1")
|
|
|
- .issuer("")
|
|
|
- .iDStartDate(insured.getInsuredFlag() == 2 ? identifyValidDate : identifyValidDate1)
|
|
|
- .build();
|
|
|
- insuredList.add(insuredInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- return insuredList;
|
|
|
- }
|
|
|
-
|
|
|
- @NotNull
|
|
|
- private List<ZiJinCrawlerSaveQuoteInfoRequest.CarPolicySubInfo> buildSaveCarPolicySubInfo(ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest) {
|
|
|
- List<ZiJinCrawlerSaveQuoteInfoRequest.CarPolicySubInfo> carPolicySubInfoList = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(ziJinCrawlerQuotationRequest.getCarPolicySubInfoList())) {
|
|
|
- for (ZiJinCrawlerQuotationRequest.CarPolicySubInfoList subInfo : ziJinCrawlerQuotationRequest.getCarPolicySubInfoList()) {
|
|
|
- ZiJinCrawlerSaveQuoteInfoRequest.CarPolicySubInfo carPolicySubInfo = ZiJinCrawlerSaveQuoteInfoRequest.CarPolicySubInfo.builder()
|
|
|
- .planName(subInfo.getPlanName())
|
|
|
- .insureGradeNo(subInfo.getInsureGradeNo())
|
|
|
- .isUseInsured(subInfo.getIsUseInsured())
|
|
|
- .quantity(subInfo.getQuantity())
|
|
|
- .riskCode(subInfo.getRiskCode())
|
|
|
- .riskName(subInfo.getRiskName())
|
|
|
- .sumAmount(subInfo.getSumAmount() != null ? subInfo.getSumAmount().longValue() : 577000L)
|
|
|
- .sumPremium(subInfo.getSumPremium())
|
|
|
- .actualPremium(subInfo.getActualPremium())
|
|
|
- .productCode(subInfo.getProductCode())
|
|
|
- .build();
|
|
|
- carPolicySubInfoList.add(carPolicySubInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- return carPolicySubInfoList;
|
|
|
- }
|
|
|
-
|
|
|
- private ZiJinCrawlerSaveQuoteInfoRequest.CarOwnerInfo buildSaveCarOwnerInfo(QuoteVo quoteVo, ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest) {
|
|
|
- return ZiJinCrawlerSaveQuoteInfoRequest.CarOwnerInfo.builder()
|
|
|
- .customerAmlPropReqDtoList(new ArrayList<>())
|
|
|
- .carOwner(ziJinCrawlerQuotationRequest.getCarOwnerInfo().getCarOwner())
|
|
|
- .ownerIdentifyNumber(ziJinCrawlerQuotationRequest.getCarOwnerInfo().getOwnerIdentifyNumber())
|
|
|
- .ownerIdentifyType(ziJinCrawlerQuotationRequest.getCarOwnerInfo().getOwnerIdentifyType())
|
|
|
- .vehicleOwnerNature(ziJinCrawlerQuotationRequest.getCarOwnerInfo().getVehicleOwnerNature())
|
|
|
- .ownerAddress(quoteVo.getOwnersInfo().getAddr())
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 构建保存报价 基础信息 请求
|
|
|
- *
|
|
|
- * @param quoteVo 系统前端参数
|
|
|
- * @param ziJinCrawlerQuotationRequest 报价参数
|
|
|
- * @param ziJinCrawlerQuotationResponse 报价返回对象
|
|
|
- */
|
|
|
- private ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo buildSaveBaseInfo(QuoteVo quoteVo, ZiJinCrawlerQuotationRequest ziJinCrawlerQuotationRequest, ZiJinCrawlerQuotationResponse ziJinCrawlerQuotationResponse) {
|
|
|
- Double sumPremium = 0.0;
|
|
|
- Double sumPremiumCI = ziJinCrawlerQuotationResponse.getPlanList().stream().filter(plan -> RiskCodeEnum.TRAFFIC_CODE.equals(plan.getRiskCode())).mapToDouble(ZiJinCrawlerQuotationResponse.PlanList::getPlanFee).findFirst().orElse(0.0);
|
|
|
- return ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo.builder()
|
|
|
- .teamType("10")
|
|
|
- .agentCode(ziJinCrawlerQuotationRequest.getBaseInfo().getAgentCode())
|
|
|
- .agreementNo(ziJinCrawlerQuotationRequest.getBaseInfo().getAgreementNo())
|
|
|
- .businessNature(ziJinCrawlerQuotationRequest.getBaseInfo().getBusinessNature())
|
|
|
- .comCode(ziJinCrawlerQuotationRequest.getBaseInfo().getComCode())
|
|
|
- .comName(ziJinCrawlerQuotationRequest.getBaseInfo().getComName())
|
|
|
- .areaCode("140000")
|
|
|
- .handler1Code(ziJinCrawlerQuotationRequest.getBaseInfo().getHandler1Code())
|
|
|
- .handler1Name(ziJinCrawlerQuotationRequest.getBaseInfo().getHandler1Name())
|
|
|
- .operatorCode(ziJinCrawlerQuotationRequest.getBaseInfo().getOperatorCode())
|
|
|
- .startDate(ziJinCrawlerQuotationRequest.getBaseInfo().getStartDate())
|
|
|
- .startDateCI(ziJinCrawlerQuotationRequest.getBaseInfo().getStartDateCI())
|
|
|
- .startHour(ziJinCrawlerQuotationRequest.getBaseInfo().getStartHour())
|
|
|
- .startHourCI(ziJinCrawlerQuotationRequest.getBaseInfo().getStartHourCI())
|
|
|
- .startMinute(ziJinCrawlerQuotationRequest.getBaseInfo().getStartMinute())
|
|
|
- .startMinuteCI(ziJinCrawlerQuotationRequest.getBaseInfo().getStartMinuteCI())
|
|
|
- .endDate(ziJinCrawlerQuotationRequest.getBaseInfo().getEndDate())
|
|
|
- .endDateCI(ziJinCrawlerQuotationRequest.getBaseInfo().getEndDateCI())
|
|
|
- .endHour(ziJinCrawlerQuotationRequest.getBaseInfo().getEndHour())
|
|
|
- .endHourCI(ziJinCrawlerQuotationRequest.getBaseInfo().getEndHourCI())
|
|
|
- .endMinute(ziJinCrawlerQuotationRequest.getBaseInfo().getEndMinute())
|
|
|
- .endMinuteCI(ziJinCrawlerQuotationRequest.getBaseInfo().getEndMinuteCI())
|
|
|
- .proposalCheckNo(ziJinCrawlerQuotationResponse.getBasePart().getProposalCheckNo())
|
|
|
- .goalInsuredFlag(ziJinCrawlerQuotationRequest.getBaseInfo().getGoalInsuredFlag())
|
|
|
- .configName(ziJinCrawlerQuotationRequest.getBaseInfo().getConfigName())
|
|
|
- .id(ziJinCrawlerQuotationRequest.getBaseInfo().getId())
|
|
|
- .businessName(ziJinCrawlerQuotationRequest.getBaseInfo().getBusinessName())
|
|
|
- .underscoreId(ziJinCrawlerQuotationRequest.getBaseInfo().getId())
|
|
|
- .desc(ziJinCrawlerQuotationRequest.getBaseInfo().getDesc())
|
|
|
- .handerCode(ziJinCrawlerQuotationRequest.getBaseInfo().getHanderCode())
|
|
|
- .handerName(ziJinCrawlerQuotationRequest.getBaseInfo().getHanderName())
|
|
|
- .calculateFlag(ziJinCrawlerQuotationRequest.getBaseInfo().getCalculateFlag())
|
|
|
- .isCI(quoteVo.getCiRiskInfoVo() != null)
|
|
|
- .isBI(quoteVo.getBiRiskInfoVo() != null)
|
|
|
- .riskCodeEnum(ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo.RiskCodeEnum.builder()
|
|
|
- .CSTax(ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo.RiskCodeEnum.CSTaxInfo.builder()
|
|
|
- .riskCode(RiskCodeEnum.ACCIDENT_CODE)
|
|
|
- .riskName("车船税")
|
|
|
- .build())
|
|
|
- .CI(ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo.RiskCodeEnum.CIInfo.builder()
|
|
|
- .riskCode(RiskCodeEnum.TRAFFIC_CODE)
|
|
|
- .riskName("机动车交通事故责任强制保险")
|
|
|
- .amount("200000")
|
|
|
- .build())
|
|
|
- .BI(ZiJinCrawlerSaveQuoteInfoRequest.BaseInfo.RiskCodeEnum.BIInfo.builder()
|
|
|
- .riskCode(RiskCodeEnum.BUSINESS_CODE)
|
|
|
- .oldRiskCode("0501")
|
|
|
- .riskName("机动车商业保险(2020版)")
|
|
|
- .oldRiskName("新机动车商业险")
|
|
|
- .build())
|
|
|
- .productCode("CAR20190517")
|
|
|
- .productName("机动车保险")
|
|
|
- .useNatureList(Arrays.asList("82", "83", "84", "85", "9A", "9B", "9C", "9D"))
|
|
|
- .vehicleKindAndUseNature(Arrays.asList(ziJinCrawlerQuotationRequest.getVehicleInfo().getUseNatureCode(), ziJinCrawlerQuotationRequest.getVehicleInfo().getCarKindCode()))
|
|
|
- .icon("iconfont iconjidongche1")
|
|
|
- .name("car")
|
|
|
- .build())
|
|
|
- .useRateFlag(true)
|
|
|
- .argueSolution("1")
|
|
|
- .autoTransRenewFlag("4")
|
|
|
- .xbFlag("0")
|
|
|
- .xbFlagCI("0")
|
|
|
- .applicationType("T")
|
|
|
- .split("1")
|
|
|
- .sumPremiumCI(sumPremiumCI)
|
|
|
- .sumPremium(sumPremium)
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 将数字对象安全转换为整数
|
|
|
- * 支持 Integer、Long、Float、Double、BigDecimal 等类型
|
|
|
- *
|
|
|
- * @param value 待转换的数字对象
|
|
|
- * @return 转换后的整数值
|
|
|
- */
|
|
|
- private int convertToInteger(Object value) {
|
|
|
- if (value == null) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- if (value instanceof Number) {
|
|
|
- return ((Number) value).intValue();
|
|
|
- }
|
|
|
- try {
|
|
|
- // 处理字符串类型的数字(可能包含小数点)
|
|
|
- String strValue = String.valueOf(value);
|
|
|
- if (strValue.contains(".")) {
|
|
|
- return (int) Double.parseDouble(strValue);
|
|
|
- } else {
|
|
|
- return Integer.parseInt(strValue);
|
|
|
- }
|
|
|
- } catch (NumberFormatException e) {
|
|
|
- // 如果转换失败,返回默认值 0
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|