|
|
@@ -1,11 +1,18 @@
|
|
|
package com.jzg.quotation.taikang.crawler.service;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+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.CarInfoVo;
|
|
|
+import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
|
|
|
+import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
+import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
|
|
|
+import com.jzg.quotation.taikang.crawler.CodeUtil;
|
|
|
import com.jzg.quotation.taikang.crawler.JsonUtil;
|
|
|
import com.jzg.quotation.taikang.crawler.client.*;
|
|
|
+import com.jzg.quotation.taikang.crawler.model.TKLoginSession;
|
|
|
import com.jzg.quotation.taikang.crawler.model.api.*;
|
|
|
-import com.jzg.quotation.taikang.crawler.model.entity.TKAgentFuzzy;
|
|
|
-import com.jzg.quotation.taikang.crawler.model.entity.TKChgOwnerInfo;
|
|
|
-import com.jzg.quotation.taikang.crawler.model.entity.TKInsureInfo;
|
|
|
+import com.jzg.quotation.taikang.crawler.model.entity.*;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.Setter;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -16,6 +23,8 @@ import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.util.MultiValueMap;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -422,17 +431,169 @@ public class TKHttpAPIService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public String carModelinfoCheckVehicleType(String token, CarModelinfoCheckVehicleTypeParam param) {
|
|
|
+ public String carModelinfoCheckVehicleType(TKLoginSession session, QuoteVo commonQuoteVo, String mainOrderId, CarModelinfoQueryResult carModelinfoQueryResult) {
|
|
|
+ CarModelinfoCheckVehicleTypeParam carModelinfoCheckVehicleTypeParam = new CarModelinfoCheckVehicleTypeParam();
|
|
|
+ carModelinfoCheckVehicleTypeParam.setChannelCode("OffWeb");
|
|
|
+ carModelinfoCheckVehicleTypeParam.setOrderId(mainOrderId);
|
|
|
+ TKCarModel tkCarModel = CarModelsFilterUtils.to(carModelinfoQueryResult.getCarModel(), commonQuoteVo.getCarInfoVo());
|
|
|
+ tkCarModel.setVehicleStyleUniqueId("");
|
|
|
+ CarModelinfoQueryResult.CarInfoDto carInfoDto = carModelinfoQueryResult.getCarInfoDto();
|
|
|
+
|
|
|
+ // 车辆所有人信息
|
|
|
+ TKCarOwnerVo carOwnerVo = new TKCarOwnerVo();
|
|
|
+
|
|
|
+ CustomerInfoVo commonCustomersInfo = commonQuoteVo.getOwnersInfo();
|
|
|
+
|
|
|
+ if (commonCustomersInfo != null) {
|
|
|
+ carOwnerVo.setCarOwnerNature("1"); // todo
|
|
|
+ carOwnerVo.setCertificateType("01"); // 身份证
|
|
|
+ carOwnerVo.setId(commonCustomersInfo.getIdentifyNumber());
|
|
|
+ carOwnerVo.setName(commonCustomersInfo.getName());
|
|
|
+ carOwnerVo.setBirthDate(commonCustomersInfo.getBirthday());
|
|
|
+ carOwnerVo.setSerialno(BigDecimal.ZERO);
|
|
|
+ carOwnerVo.setSex(commonCustomersInfo.getGender()); // todo
|
|
|
+ carOwnerVo.setInsuredAddress("");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 投保人信息
|
|
|
+ SaveBasicInfoParam.InsureInfo insureInfo = new SaveBasicInfoParam.InsureInfo();
|
|
|
+ insureInfo.setAppliInfo(new SaveBasicInfoParam.AppliInfo());
|
|
|
+ insureInfo.setInsuredInfo(new SaveBasicInfoParam.InsuredInfo());
|
|
|
+ insureInfo.setContacts(new SaveBasicInfoParam.Contacts());
|
|
|
+
|
|
|
+ // 车辆信息
|
|
|
+ TKCar car = new TKCar();
|
|
|
+ car.setFuelType(tkCarModel.getFuelType()); // todo 燃油类型
|
|
|
+ car.setModelName(tkCarModel.getModelName()); // todo
|
|
|
+ car.setBillDate(""); // 页面上没有输入框,可能是北京地区才用到
|
|
|
+ car.setCarBookingTime(""); // 页面上没有输入框,原注释为“上海地区开具发票日期”,但感觉是车辆时间。
|
|
|
+ car.setBillNo(""); // 页面上没有输入框,发票号
|
|
|
+
|
|
|
+ CarInfoVo commonCarInfoVo = commonQuoteVo.getCarInfoVo();
|
|
|
+
|
|
|
+ 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::setVinNo, commonCarInfoVo::getVinNo, carInfoDto::getVinCode);
|
|
|
+ CodeUtil.autoSetter(car::setEngineNo, commonCarInfoVo::getEngineNo, carInfoDto::getEngineNo); // 发动机号
|
|
|
+ CodeUtil.autoSetter(car::setEnrollDate, commonCarInfoVo::getRegisterDate, carInfoDto::getRegisterDate); // 初登日期
|
|
|
+ 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(".")));
|
|
|
+
|
|
|
+
|
|
|
+ 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("");
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 = this.carTypePassengerSeat(session.getToken(), session.getTplatformId(), session.getFromid(), session.getComCode());
|
|
|
+
|
|
|
+ String carType = carType(passengerSeat, car.getCarType(), carOwnerVo.getCarOwnerNature());
|
|
|
+
|
|
|
+ if (carType != null) {
|
|
|
+ car.setCarType(carType);
|
|
|
+ }
|
|
|
+ car.setCarModel(Arrays.asList(tkCarModel));
|
|
|
+ car.setBrandName(tkCarModel.getModelName());
|
|
|
+ CarModelinfoCheckVehicleTypeParam.CarInfoVo carInfoVo = BeanUtil.copyProperties(car, CarModelinfoCheckVehicleTypeParam.CarInfoVo.class);
|
|
|
+ carModelinfoCheckVehicleTypeParam.setCarInfoVo(carInfoVo);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
|
- httpHeaders.add("tkCarRequestToken", token);
|
|
|
+ httpHeaders.add("tkCarRequestToken", session.getToken());
|
|
|
|
|
|
- StringResponse response = client.request(HttpURL.carModelinfoCheckVehicleType, param, httpHeaders, StringResponse.class);
|
|
|
+ StringResponse response = client.request(HttpURL.carModelinfoCheckVehicleType, carModelinfoCheckVehicleTypeParam, httpHeaders, StringResponse.class);
|
|
|
|
|
|
checkResponseUnknownField(response);
|
|
|
|
|
|
return response.getData();
|
|
|
}
|
|
|
|
|
|
+ public String carType(String passengerSeat, String carType, String carOwnerNature) {
|
|
|
+ if (passengerSeat == null || carType == null || carOwnerNature == null) {
|
|
|
+ return carType;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!passengerSeat.equals("1")) {
|
|
|
+ if (carType.equals("A")) {
|
|
|
+ if (carOwnerNature.equals("1")) {
|
|
|
+ // 个人客车
|
|
|
+ carType = "A";
|
|
|
+ } else if (carOwnerNature.equals("2")) {
|
|
|
+ // 机关团体客车
|
|
|
+ carType = "C";
|
|
|
+ } else if (carOwnerNature.equals("3")) {
|
|
|
+ // 企业客车
|
|
|
+ carType = "B";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return carType;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 10
|
|
|
*
|
|
|
@@ -821,6 +982,8 @@ public class TKHttpAPIService {
|
|
|
}
|
|
|
|
|
|
String data = response.getData();
|
|
|
+// String data = "501d2faf0e619845ab4f7199aa72a07a2b41e9b50808a138082179f3b5b72bb81cb95f3a4a2c5a6e9db1d8f9ce6c0ba66a569ff9fe8332825173adefba99b30cb1e5d060200cf374a24b5e0e7014daa1d5187ce8314bc8cdb7d35dc9232f507dda98753109a579e1b9681d88b6d2e98ce59493807ac18c77f0085efd47fb8d0ba3640d2962679596311861bf477aa746f59033098be8eb65c7f739ada72cb4ed6e22dd7b050dbd0b9e32851525fd197ad4d9c00cd641f5a2de90926829520bc54e0ccb905141e2ca7565a1e07135ec236bd74f1e442b39180b7f03962f71ca5e325f27e518cf40cf849f59ace456f310004d55fe1452384859e1e7bd70e680dc038e71041262e1afcb4d5128079833dea89ea5cabf740a89c8aac9f32a58e0235900b3e6f2c912e3a9e23c9aefc2627848648e7beb481a49efd234291d06771add181e49c09de7d23d6600467c12f1a8eb779091ab4e71c66120eb1c362cce4532b30a08db125e4dacf20d3e02fc3267982741cfae98af3179fbb8d0ce74b0bf17ee08441f2222db0779c683d3ff4670";
|
|
|
+// String data = "501d2faf0e619845ab4f7199aa72a07a2b41e9b50808a138082179f3b5b72bb844fa7180f1936a19ae21994798f72f70ac7356eacf72aa5a7425a26e586a40ab3dd841865d5fab7cf9a1ac268907d1a8ead449d3bc95998f1ca0a7afa241ec8125e37cd104ceb7a05efe800b0f7e15b812b24ebf1b79e360dfeaf103d73ea2f9eb464d379f91f9d8d02b92b1c85facad7ff8aa5f092cfa4694988e3a84e2efa4699e7e61f9a070127e0594f72de3e4f9631c361afb91b3b6d9ca49f7383c508086527f891d4eeab32f8fa80dc937c5874103e9e979fb7333657fa9acd16b05b87a7e471bf1e20a9c29b122db24c5c94884227b3f4d4e9d2a7b6e53783519a78205185518523d08622e9a089a872626cb64ce6d74551dcaa2d9ab0407b7767cfea9a5ca032401a38100b1094ad2798fb1530ed11f4b352e44c20165d9fe84f70835910f6aa4f39d288cf1fc8995387d808f5a063f106f73647f9fe7ca595eefca4c64f65ed19aacfd39627125123b66c79f6b3c4d9ca6d701f73e1401ab352ccfb5e5d25317b2fed5505d429441fdfe9f";
|
|
|
|
|
|
if (data == null || data.isBlank()) {
|
|
|
return null;
|