|
|
@@ -1,10 +1,9 @@
|
|
|
package com.jzg.quotation.taikang.crawler.service;
|
|
|
|
|
|
-import com.jzg.commons.entity.orders.po.InsOrdersCarUserInfo;
|
|
|
-import com.jzg.commons.entity.quote.vo.*;
|
|
|
import com.jzg.commons.constants.quote.enums.quote.CarKindCode;
|
|
|
import com.jzg.commons.constants.quote.enums.quote.VehicleUseCode;
|
|
|
-import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
+import com.jzg.commons.entity.orders.po.InsOrdersCarUserInfo;
|
|
|
+import com.jzg.commons.entity.quote.vo.*;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
|
|
|
import com.jzg.quotation.taikang.crawler.CodeUtil;
|
|
|
@@ -12,11 +11,14 @@ import com.jzg.quotation.taikang.crawler.model.TKLoginSession;
|
|
|
import com.jzg.quotation.taikang.crawler.model.api.*;
|
|
|
import com.jzg.quotation.taikang.crawler.model.entity.*;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class TKSimpleService {
|
|
|
@@ -334,14 +336,14 @@ public class TKSimpleService {
|
|
|
carModelinfoQueryParam.setTplatformId(session.getTplatformId());
|
|
|
carModelinfoQueryParam.setTplatLoginKey(session.getTplatLoginKey());
|
|
|
carModelinfoQueryParam.setFromId(session.getFromid());
|
|
|
- //抓包观察到每次查车型前,都要获取一个新的订单id, 不知道为什么
|
|
|
+ // 抓包观察到每次查车型前,都要获取一个新的订单id, 不知道为什么
|
|
|
carModelinfoQueryParam.setOrderID(mainOrderId);
|
|
|
carModelinfoQueryParam.setOrderOldID(mainOrderId);
|
|
|
carModelinfoQueryParam.setChannelCode("OffWeb");
|
|
|
carModelinfoQueryParam.setAreaInfoVo(area);
|
|
|
carModelinfoQueryParam.setCarInfoVo(carInfoVo);
|
|
|
|
|
|
- CarModelinfoQueryResult carModelinfoQueryResult = httpService.carModelinfoQuery(session,mainOrderId, carModelinfoQueryParam);
|
|
|
+ CarModelinfoQueryResult carModelinfoQueryResult = httpService.carModelinfoQuery(session, mainOrderId, carModelinfoQueryParam);
|
|
|
|
|
|
return carModelinfoQueryResult;
|
|
|
}
|
|
|
@@ -392,10 +394,7 @@ public class TKSimpleService {
|
|
|
carModelinfoQueryParam.setAreaInfoVo(area);
|
|
|
carModelinfoQueryParam.setCarInfoVo(carInfoVo);
|
|
|
carModelinfoQueryParam.setPremiumTrialFlag(null); // todo
|
|
|
-
|
|
|
- CarModelinfoQueryResult carModelinfoQueryResult = httpService.carModelinfoQuery(session, mainOrderId,carModelinfoQueryParam);
|
|
|
-
|
|
|
- return carModelinfoQueryResult;
|
|
|
+ return httpService.carModelinfoQuery(session, mainOrderId, carModelinfoQueryParam);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -416,7 +415,7 @@ public class TKSimpleService {
|
|
|
|
|
|
if (tkCarModels != null) {
|
|
|
carModelinfoQueryResult = queryCarModels(session, mainOrderId, commonCarInfoVo, area, tkCarModels, ownersInfo);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new RuntimeException("车辆信息未查询到!");
|
|
|
}
|
|
|
|
|
|
@@ -449,7 +448,7 @@ public class TKSimpleService {
|
|
|
carInfoVo.setLicenseTypeChinese("小型汽车号牌");
|
|
|
carInfoVo.setLicenseType("02");
|
|
|
carInfoVo.setEngineNo(commonCarInfoVo.getEngineNo());
|
|
|
- carInfoVo.setFuelType("0");
|
|
|
+ carInfoVo.setFuelType(tkCarModel.getFuelType());
|
|
|
carInfoVo.setEnrollDate(commonCarInfoVo.getRegisterDate());
|
|
|
carInfoVo.setBillDate("");
|
|
|
carInfoVo.setCarBookingTime("");
|
|
|
@@ -481,7 +480,7 @@ public class TKSimpleService {
|
|
|
carModelinfoQueryParam.setAreaInfoVo(area);
|
|
|
carModelinfoQueryParam.setCarInfoVo(carInfoVo);
|
|
|
carModelinfoQueryParam.setCarOwnerVo(carOwnerVo);
|
|
|
- return httpService.carModelinfoQuery(session, mainOrderId,carModelinfoQueryParam);
|
|
|
+ return httpService.carModelinfoQuery(session, mainOrderId, carModelinfoQueryParam);
|
|
|
}
|
|
|
|
|
|
public TKAreaInfoVo dataCreateArea(TKLoginSession session,
|
|
|
@@ -528,7 +527,6 @@ public class TKSimpleService {
|
|
|
tkAreaInfoVo.setComCode(city.getComCode());
|
|
|
tkAreaInfoVo.setBjFlag(0); // todo 需要校验车牌是否京开头
|
|
|
tkAreaInfoVo.setIsNewCarWithoutLicense(0); // todo 可以考虑是否有车牌号来判断是否为没有车牌号的新车,但不严谨,旧车可能也没有车牌号。
|
|
|
-
|
|
|
return tkAreaInfoVo;
|
|
|
}
|
|
|
|
|
|
@@ -550,7 +548,6 @@ public class TKSimpleService {
|
|
|
carOwnerVo.setCertificateType("01");
|
|
|
|
|
|
|
|
|
-
|
|
|
// 投保人信息
|
|
|
TKAppliInfo appliInfo = new TKAppliInfo();
|
|
|
appliInfo.setAppliName(carOwnerVo.getName());
|
|
|
@@ -685,8 +682,6 @@ public class TKSimpleService {
|
|
|
carOwnerVo.setInsuredAddress("");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 投保人信息
|
|
|
SaveBasicInfoParam.InsureInfo insureInfo = new SaveBasicInfoParam.InsureInfo();
|
|
|
insureInfo.setAppliInfo(new SaveBasicInfoParam.AppliInfo());
|
|
|
@@ -695,86 +690,86 @@ public class TKSimpleService {
|
|
|
|
|
|
// 车辆信息
|
|
|
TKCar car = new TKCar();
|
|
|
- car.setFuelType(tkCarModel.getFuelType()); // todo 燃油类型
|
|
|
- car.setModelName(tkCarModel.getModelName()); // todo
|
|
|
+ car.setFuelType(tkCarModel.getFuelType());
|
|
|
+ car.setModelName(tkCarModel.getModelName());
|
|
|
car.setBillDate(""); // 页面上没有输入框,可能是北京地区才用到
|
|
|
car.setCarBookingTime(""); // 页面上没有输入框,原注释为“上海地区开具发票日期”,但感觉是车辆时间。
|
|
|
car.setBillNo(""); // 页面上没有输入框,发票号
|
|
|
+ car.setColorCode("010"); // 默认黑色
|
|
|
+ car.setCuringQuality(tkCarModel.getVehicleWeight());
|
|
|
+ car.setVehicleType(tkCarModel.getVehicleType());
|
|
|
+ car.setVehicleTypeCname(tkCarModel.getVehicleTypeCname());
|
|
|
|
|
|
+ // 车辆大类
|
|
|
+ String carKindCode = commonCarInfoVo.getCarKindCode();
|
|
|
+ if (carKindCode.equals(CarKindCode.CAR_KIND_CODE_A0.getCode())) {
|
|
|
+ car.setCarType("A");
|
|
|
+ } else if (carKindCode.equals(CarKindCode.CAR_KIND_CODE_A1.getCode())) {
|
|
|
+ car.setCarType("D");
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未知车辆大类:" + carKindCode);
|
|
|
+ }
|
|
|
|
|
|
- if (commonCarInfoVo != null) {
|
|
|
- // 车辆大类
|
|
|
- String carKindCode = commonCarInfoVo.getCarKindCode();
|
|
|
-
|
|
|
- if (carKindCode.equals(CarKindCode.CAR_KIND_CODE_A0.getCode())) {
|
|
|
- car.setCarType("A");
|
|
|
- } else if (carKindCode.equals(CarKindCode.CAR_KIND_CODE_A1.getCode())) {
|
|
|
- car.setCarType("D");
|
|
|
- } else {
|
|
|
- throw new RuntimeException("未知车辆大类:" + carKindCode);
|
|
|
- }
|
|
|
-
|
|
|
- CodeUtil.autoSetter(car::setLicenseNo, commonCarInfoVo::getLicenseNo, tkCarModel::getLicenseNo);
|
|
|
- CodeUtil.autoSetter(car::setTransferDate, commonCarInfoVo::getTransferDate, null);
|
|
|
- CodeUtil.autoSetter(car::setPurchasePrice, commonCarInfoVo::getPurchasePrice, tkCarModel::getReplacementValue);
|
|
|
- CodeUtil.autoSetter(car::setSelectedSeat, commonCarInfoVo::getSeatCount, () -> tkCarModel.getVehicleJingyou().getSeat());
|
|
|
- CodeUtil.autoSetter(car::setExhaustScale, commonCarInfoVo::getDisplacement, tkCarModel::getDisplacement); // 排量
|
|
|
- CodeUtil.autoSetter(car::setBrandName, commonCarInfoVo::getBrandName, tkCarModel::getModelName); // todo 与 tkCarModel.getModelName() 重复
|
|
|
-
|
|
|
- car.setSeatFlag("1"); // todo
|
|
|
- car.setExhaustScale(tkCarModel.getDisplacement().substring(0,tkCarModel.getDisplacement().indexOf(".")));
|
|
|
- car.setPurchasePrice(tkCarModel.getPurchasePrice().substring(0,tkCarModel.getPurchasePrice().indexOf(".")));
|
|
|
- car.setVinNo(commonCarInfoVo.getVinNo());
|
|
|
- car.setEngineNo(commonCarInfoVo.getEngineNo());
|
|
|
- car.setEnrollDate(commonCarInfoVo.getRegisterDate());
|
|
|
-
|
|
|
- Double tonCount = commonCarInfoVo.getTonCountDouble();
|
|
|
- if (tonCount != null && tonCount > 2) {
|
|
|
- // 好像主要是货车使用此字段
|
|
|
- car.setTonnageFlag("1");
|
|
|
- } else {
|
|
|
- car.setTonnageFlag("0");
|
|
|
- }
|
|
|
-
|
|
|
- if (commonCarInfoVo.isTransfer()) {
|
|
|
- car.setChgOwnerFlag("1"); // 是过户
|
|
|
- car.setTransferDate(commonCarInfoVo.getTransferDate()); // 过户时间
|
|
|
- } else {
|
|
|
- car.setChgOwnerFlag("0"); // 不是过户
|
|
|
- car.setTransferDate("");
|
|
|
- }
|
|
|
+ CodeUtil.autoSetter(car::setLicenseNo, commonCarInfoVo::getLicenseNo, tkCarModel::getLicenseNo);
|
|
|
+ CodeUtil.autoSetter(car::setTransferDate, commonCarInfoVo::getTransferDate, null);
|
|
|
+ CodeUtil.autoSetter(car::setPurchasePrice, commonCarInfoVo::getPurchasePrice, tkCarModel::getReplacementValue);
|
|
|
+ CodeUtil.autoSetter(car::setSelectedSeat, commonCarInfoVo::getSeatCount, () -> tkCarModel.getVehicleJingyou().getSeat());
|
|
|
+ CodeUtil.autoSetter(car::setExhaustScale, commonCarInfoVo::getDisplacement, tkCarModel::getDisplacement); // 排量
|
|
|
+ CodeUtil.autoSetter(car::setBrandName, commonCarInfoVo::getBrandName, tkCarModel::getModelName); // todo 与 tkCarModel.getModelName() 重复
|
|
|
+
|
|
|
+ car.setSeatFlag("1"); // todo
|
|
|
+ car.setExhaustScale(tkCarModel.getDisplacement().substring(0, tkCarModel.getDisplacement().indexOf(".")));
|
|
|
+ car.setPurchasePrice(tkCarModel.getPurchasePrice().substring(0, tkCarModel.getPurchasePrice().indexOf(".")));
|
|
|
+ car.setVinNo(commonCarInfoVo.getVinNo());
|
|
|
+ car.setEngineNo(commonCarInfoVo.getEngineNo());
|
|
|
+ car.setEnrollDate(commonCarInfoVo.getRegisterDate());
|
|
|
+
|
|
|
+ Double tonCount = commonCarInfoVo.getTonCountDouble();
|
|
|
+ if (tonCount != null && tonCount > 2) {
|
|
|
+ // 好像主要是货车使用此字段
|
|
|
+ car.setTonnageFlag("1");
|
|
|
+ } else {
|
|
|
+ car.setTonnageFlag("0");
|
|
|
+ }
|
|
|
|
|
|
- String vehicleUseCode = commonCarInfoVo.getVehicleUseCode();
|
|
|
-
|
|
|
- if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_05.getCode())) {
|
|
|
- // 05 家庭自用 = 8A 家庭自用
|
|
|
- car.setUseNatureCodeCode("8A"); // 页面上选择的家庭自用、非营业企业、、、、
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_06.getCode())) {
|
|
|
- // 06 非营业企业 = 8C 非营业党政机关事业团体
|
|
|
- car.setUseNatureCodeCode("8C");
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_07.getCode())) {
|
|
|
- // 07 非营业企业 = 8B 非营业企业
|
|
|
- car.setUseNatureCodeCode("8B");
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_01.getCode())) {
|
|
|
- // 01 营业出租租赁 = 9 营业
|
|
|
- car.setUseNatureCodeCode("9");
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_02.getCode())) {
|
|
|
- // 02 营业城市公交 = 9 营业
|
|
|
- car.setUseNatureCodeCode("9");
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_03.getCode())) {
|
|
|
- // 03 营业公路客运 = 9 营业
|
|
|
- car.setUseNatureCodeCode("9");
|
|
|
- } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_04.getCode())) {
|
|
|
- // 04 营业货运 = 9 营业
|
|
|
- car.setUseNatureCodeCode("9");
|
|
|
- } else {
|
|
|
- // 默认 8B 非营业企业
|
|
|
- car.setUseNatureCodeCode("8B");
|
|
|
- }
|
|
|
+ if (commonCarInfoVo.isTransfer()) {
|
|
|
+ car.setChgOwnerFlag("1"); // 是过户
|
|
|
+ car.setTransferDate(commonCarInfoVo.getTransferDate()); // 过户时间
|
|
|
+ } else {
|
|
|
+ car.setChgOwnerFlag("0"); // 不是过户
|
|
|
+ car.setTransferDate("");
|
|
|
+ }
|
|
|
|
|
|
- TKSimpleService.setLicenseTypeByLicenseNo(car, car.getLicenseNo());
|
|
|
+ String vehicleUseCode = commonCarInfoVo.getVehicleUseCode();
|
|
|
+
|
|
|
+ if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_05.getCode())) {
|
|
|
+ // 05 家庭自用 = 8A 家庭自用
|
|
|
+ car.setUseNatureCodeCode("8A"); // 页面上选择的家庭自用、非营业企业、、、、
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_06.getCode())) {
|
|
|
+ // 06 非营业企业 = 8C 非营业党政机关事业团体
|
|
|
+ car.setUseNatureCodeCode("8C");
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_07.getCode())) {
|
|
|
+ // 07 非营业企业 = 8B 非营业企业
|
|
|
+ car.setUseNatureCodeCode("8B");
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_01.getCode())) {
|
|
|
+ // 01 营业出租租赁 = 9 营业
|
|
|
+ car.setUseNatureCodeCode("9");
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_02.getCode())) {
|
|
|
+ // 02 营业城市公交 = 9 营业
|
|
|
+ car.setUseNatureCodeCode("9");
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_03.getCode())) {
|
|
|
+ // 03 营业公路客运 = 9 营业
|
|
|
+ car.setUseNatureCodeCode("9");
|
|
|
+ } else if (vehicleUseCode.equals(VehicleUseCode.VEHICLE_USE_CODE_04.getCode())) {
|
|
|
+ // 04 营业货运 = 9 营业
|
|
|
+ car.setUseNatureCodeCode("9");
|
|
|
+ } else {
|
|
|
+ // 默认 8B 非营业企业
|
|
|
+ car.setUseNatureCodeCode("8B");
|
|
|
}
|
|
|
|
|
|
+ TKSimpleService.setLicenseTypeByLicenseNo(car, car.getLicenseNo());
|
|
|
+
|
|
|
String passengerSeat = httpService.carTypePassengerSeat(session.getToken(), session.getTplatformId(), session.getFromid(), session.getComCode());
|
|
|
|
|
|
String carType = carType(passengerSeat, car.getCarType(), carOwnerVo.getCarOwnerNature());
|
|
|
@@ -795,11 +790,11 @@ public class TKSimpleService {
|
|
|
// 其他信息
|
|
|
SaveBasicInfoParam.OtherInfo otherInfo = new SaveBasicInfoParam.OtherInfo();
|
|
|
otherInfo.setIsQueryVehicleFlag(false);
|
|
|
- otherInfo.setShowEngineNoFlag("0"); // todo 抓到几个包,都是 0。看代码时发现是 1。
|
|
|
+ otherInfo.setShowEngineNoFlag("1"); // todo 抓到几个包,都是 0。看代码时发现是 1。
|
|
|
otherInfo.setJyQueryFlag(false);
|
|
|
otherInfo.setOcrFlag(1);
|
|
|
otherInfo.setNewCarFlag("0"); // todo
|
|
|
- otherInfo.setKindLimitCode("1"); // 交强或商业,抓包查到没有值
|
|
|
+ otherInfo.setKindLimitCode(""); // 交强或商业,抓包查到没有值
|
|
|
otherInfo.setRetrospectId(UUID.randomUUID().toString()); // 可回溯ID ,好像不是很需要
|
|
|
|
|
|
|
|
|
@@ -818,7 +813,7 @@ public class TKSimpleService {
|
|
|
param.setCarOwnerVo(carOwnerVo);
|
|
|
param.setCarTaxVo(carTax);
|
|
|
param.setOtherInfo(otherInfo);
|
|
|
-
|
|
|
+ param.setOrderVersion("1");
|
|
|
|
|
|
SaveBasicInfoResult saveBasicInfoResult = httpService.saveBasicInfo(session.getToken(), param);
|
|
|
|
|
|
@@ -829,6 +824,7 @@ public class TKSimpleService {
|
|
|
|
|
|
/**
|
|
|
* 初次创建投保单时的逻辑,暂时没有内容,里面一些注释是页面 js 逻辑。
|
|
|
+ *
|
|
|
* @param carType
|
|
|
*/
|
|
|
private void orderCreateOther(String carType) {
|
|
|
@@ -917,7 +913,7 @@ public class TKSimpleService {
|
|
|
}
|
|
|
|
|
|
if (carType.equals("G")) {
|
|
|
- //若勾选挂车,车辆种类,交管车辆种类,号牌种类为必传
|
|
|
+ // 若勾选挂车,车辆种类,交管车辆种类,号牌种类为必传
|
|
|
/*
|
|
|
if (_carType == 'G') {//若勾选挂车,车辆种类,交管车辆种类,号牌种类为必传
|
|
|
if (comCode === '0131' && marketQuery !== '1') {
|
|
|
@@ -948,27 +944,21 @@ public class TKSimpleService {
|
|
|
*/
|
|
|
public PreciseInitResult orderInit(TKLoginSession session,
|
|
|
String mainOrderId) {
|
|
|
- String tplatformId = session.getTplatformId();
|
|
|
- String tplatLoginKey = session.getTplatLoginKey();
|
|
|
- String token = session.getToken();
|
|
|
-
|
|
|
- PreciseInitResult preciseInitResult = httpService.preciseInitToInit(token, tplatformId, tplatLoginKey, mainOrderId);
|
|
|
-
|
|
|
+ PreciseInitResult preciseInitResult = httpService.preciseInitToInit(session.getToken(), session.getTplatformId(), session.getTplatLoginKey(), mainOrderId);
|
|
|
if (preciseInitResult == null) {
|
|
|
throw new RuntimeException("HttpService#preciseInitToInit 失败!");
|
|
|
}
|
|
|
TKOther other = preciseInitResult.getOther();
|
|
|
List<String> messageBZ = other.getMessageBZ();
|
|
|
if (messageBZ != null) {
|
|
|
- throw new SystemException(messageBZ.get(0)+"\n"+ messageBZ.get(1));
|
|
|
+ throw new SystemException(messageBZ.get(0) + "\n" + messageBZ.get(1));
|
|
|
}
|
|
|
if (other.getVehicleOwnerMessage() != null) {
|
|
|
throw new SystemException(other.getVehicleOwnerMessage());
|
|
|
}
|
|
|
-// if (preciseInitResult.getPremium() == null) {
|
|
|
-// throw new SystemException(other.getNotice());
|
|
|
-// }
|
|
|
-
|
|
|
+ if (preciseInitResult.getPremium() == null) {
|
|
|
+ throw new SystemException(other.getNotice());
|
|
|
+ }
|
|
|
return preciseInitResult;
|
|
|
}
|
|
|
|
|
|
@@ -991,6 +981,7 @@ public class TKSimpleService {
|
|
|
String tplatLoginKey = session.getTplatLoginKey();
|
|
|
String fromId = session.getFromid();
|
|
|
|
|
|
+ // 险种选中标志
|
|
|
{
|
|
|
TKFlag flag = preciseInitParam.getFlag();
|
|
|
if (flag == null) {
|
|
|
@@ -1000,6 +991,7 @@ public class TKSimpleService {
|
|
|
flag.setVipWeekFlag("0");
|
|
|
}
|
|
|
|
|
|
+ // 其他参数
|
|
|
{
|
|
|
TKOther other = preciseInitParam.getOther();
|
|
|
if (other != null) {
|
|
|
@@ -1010,8 +1002,8 @@ public class TKSimpleService {
|
|
|
other.setChannelCode("OffWeb");
|
|
|
}
|
|
|
|
|
|
+ // 时间参数
|
|
|
TKDateInfo date = preciseInitParam.getDate();
|
|
|
-
|
|
|
{
|
|
|
// 同步交强险
|
|
|
TKBzKindVo bzKindVo = preciseInitParam.getBzKindVo();
|
|
|
@@ -1021,26 +1013,27 @@ public class TKSimpleService {
|
|
|
}
|
|
|
bzKindVo.setIsSelect("1"); // 选择交纳交强险
|
|
|
|
|
|
+ // 同步交强险时间信息,从前端参数获取
|
|
|
RiskInfoVo commonCiRiskInfoVo = commonQuoteVo.getCiRiskInfoVo();
|
|
|
-
|
|
|
if (commonCiRiskInfoVo != null) {
|
|
|
// 交强险的时间
|
|
|
date.setStartDateBZ(commonCiRiskInfoVo.getStartDate());
|
|
|
date.setEndDateBZ(commonCiRiskInfoVo.getEndDate());
|
|
|
}
|
|
|
|
|
|
+ // 同步车船税
|
|
|
TKCarTaxInfo carTaxInfo = preciseInitParam.getCarTaxInfo();
|
|
|
if (carTaxInfo == null) {
|
|
|
carTaxInfo = new TKCarTaxInfo();
|
|
|
preciseInitParam.setCarTaxInfo(carTaxInfo);
|
|
|
}
|
|
|
|
|
|
- // 同步车船税信息
|
|
|
+ // 同步车船税信息,从前端参数获取
|
|
|
VehicleAndVesselTaxVo vehicleAndVesselTax = commonQuoteVo.getVehicleAndVesselTaxVo();
|
|
|
-
|
|
|
if (vehicleAndVesselTax != null) {
|
|
|
+ // 车船税标志
|
|
|
String taxRelifFlag = vehicleAndVesselTax.getTaxRelifFlag();
|
|
|
-
|
|
|
+ // 转换为保司的参数
|
|
|
if (taxRelifFlag.equals("1")) {
|
|
|
carTaxInfo.setTaxFlag("T");
|
|
|
} else if (taxRelifFlag.equals("2")) {
|
|
|
@@ -1055,22 +1048,20 @@ public class TKSimpleService {
|
|
|
|
|
|
|
|
|
{
|
|
|
- // 同步商业险
|
|
|
+ // 同步商业险时间信息,从前端参数获取
|
|
|
RiskInfoVo commonBiRiskInfoVo = commonQuoteVo.getBiRiskInfoVo();
|
|
|
if (commonBiRiskInfoVo != null) {
|
|
|
date.setStartDateCI(commonBiRiskInfoVo.getStartDate());
|
|
|
date.setEndDateCI(commonBiRiskInfoVo.getEndDate());
|
|
|
}
|
|
|
|
|
|
- // 同步险种
|
|
|
+ // 获取保司默认选中的商险信息
|
|
|
Map<String, TKCiKindsVo> tkCiKindsVoMap = new HashMap<>();
|
|
|
-
|
|
|
for (TKCiKindsVo tkCiKindVo : preciseInitParam.getCiKindsVo()) {
|
|
|
String isSelect = tkCiKindVo.getIsSelect();
|
|
|
BigDecimal premium = tkCiKindVo.getPremium();
|
|
|
|
|
|
- if (isSelect != null && isSelect.equals("1") &&
|
|
|
- premium != null && premium.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ if (isSelect != null && isSelect.equals("1") && premium != null && premium.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -1082,23 +1073,21 @@ public class TKSimpleService {
|
|
|
tkCiKindsVoMap.put(tkCiKindVo.getKindCode(), tkCiKindVo);
|
|
|
}
|
|
|
|
|
|
+ // 根据公司系统选择的险种进行覆盖
|
|
|
List<KindInfoVo> commonBiKindInfoVos = commonQuoteVo.getKindInfoVo();
|
|
|
- if (commonBiKindInfoVos != null && commonBiKindInfoVos.size() > 0) {
|
|
|
+ if (CollectionUtils.isNotEmpty(commonBiKindInfoVos)) {
|
|
|
for (KindInfoVo commonBiKindInfoVo : commonBiKindInfoVos) {
|
|
|
if (tkCiKindsVoMap.isEmpty() || tkCiKindsVoMap.get(commonBiKindInfoVo.getKindCode()) == null) {
|
|
|
continue;
|
|
|
}
|
|
|
TKCiKindsVo tkCiKindVo = tkCiKindsVoMap.get(commonBiKindInfoVo.getKindCode());
|
|
|
-
|
|
|
tkCiKindVo.setIsSelect("1");
|
|
|
tkCiKindVo.setQuoteAmount(new BigDecimal(commonBiKindInfoVo.getAmount()));
|
|
|
tkCiKindVo.setQuoteAmountCN(commonBiKindInfoVo.getAmount());
|
|
|
tkCiKindVo.setUnitAmount(new BigDecimal(commonBiKindInfoVo.getUnitAmount()));
|
|
|
tkCiKindVo.setUnitAmountCN(commonBiKindInfoVo.getUnitAmount());
|
|
|
-
|
|
|
String quantity = commonBiKindInfoVo.getQuantity();
|
|
|
String serviceTimes = commonBiKindInfoVo.getServiceTimes();
|
|
|
-
|
|
|
if (StringUtils.isNotBlank(quantity)) {
|
|
|
tkCiKindVo.setQuantity(quantity);
|
|
|
} else if (StringUtils.isNotBlank(serviceTimes)) {
|
|
|
@@ -1111,6 +1100,25 @@ public class TKSimpleService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ {
|
|
|
+ // 同步驾意险, 系统有选择驾意险进行匹配覆盖(泰康要求必须有驾意险)
|
|
|
+ Map<String, TKCarPlanInfo> carPlanInfoMap = Optional.ofNullable(preciseInitParam.getDriverAccidentVo().getCarPlanInfoList()).orElseGet(Collections::emptyList).stream().collect(Collectors.toMap(TKCarPlanInfo::getPlanCode, Function.identity()));
|
|
|
+ TKDriverAccidentVo driverAccidentVo = preciseInitParam.getDriverAccidentVo();
|
|
|
+ List<AccidentalDrivingVo> accidentalDrivings = commonQuoteVo.getAccidentalDrivings();
|
|
|
+ if (CollectionUtils.isNotEmpty(accidentalDrivings)) {
|
|
|
+ for (AccidentalDrivingVo accidentalDriving : accidentalDrivings) {
|
|
|
+ if (carPlanInfoMap.isEmpty() || accidentalDriving.getRiskCode() == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ TKCarPlanInfo tkCarPlanInfo = carPlanInfoMap.get(accidentalDriving.getProductCode());
|
|
|
+ driverAccidentVo.setIsSelect("1");
|
|
|
+ driverAccidentVo.setSelectPlanCode(tkCarPlanInfo.getPlanCode());
|
|
|
+ driverAccidentVo.setQuoteAmountCN(tkCarPlanInfo.getPlanName());
|
|
|
+ driverAccidentVo.setPremium(new BigDecimal(tkCarPlanInfo.getSumPremium()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 请求接口
|
|
|
preciseInitParam.setChannelCode("OffWeb");
|
|
|
preciseInitParam.setInitFlag("quote");
|
|
|
@@ -1119,7 +1127,7 @@ public class TKSimpleService {
|
|
|
preciseInitParam.setOrderID(mainOrderId);
|
|
|
preciseInitParam.setRiskType("0808");
|
|
|
// orderVersion = 1
|
|
|
-
|
|
|
+ preciseInitParam.setOrderVersion("1");
|
|
|
PreciseInitResult preciseQuoteResult = httpService.preciseInitToQuote(session.getToken(), preciseInitParam);
|
|
|
|
|
|
if (preciseQuoteResult == null) {
|
|
|
@@ -1158,7 +1166,7 @@ public class TKSimpleService {
|
|
|
throw new RuntimeException("HttpService#preciseInitToQuote (核保)失败!");
|
|
|
}
|
|
|
TKEntranceFor000038Result tkEntranceFor000038Result = httpService.entranceFor000038(token, tplatformId, fromId, mainOrderId);
|
|
|
- //为获取支付链接预处理 TODO
|
|
|
+ // 为获取支付链接预处理 TODO
|
|
|
TKEntranceFor000021Result tkEntranceFor000021Result = httpService.entranceFor000021(token, fromId, mainOrderId);
|
|
|
|
|
|
TKEntranceFor000052Result tkEntranceFor000052Result = httpService.entranceFor000052(token, tkEntranceFor000038Result);
|