|
@@ -1,23 +1,21 @@
|
|
|
package com.jzg.quotation.taikang.crawler.service.impl;
|
|
package com.jzg.quotation.taikang.crawler.service.impl;
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
-import com.jzg.commons.core.page.HttpResult;
|
|
|
|
|
import com.jzg.commons.entity.orders.po.InsOrdersCarUserInfo;
|
|
import com.jzg.commons.entity.orders.po.InsOrdersCarUserInfo;
|
|
|
-import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
|
|
-import com.jzg.commons.entity.quote.vo.*;
|
|
|
|
|
|
|
+import com.jzg.commons.entity.quote.vo.CarInfoVo;
|
|
|
|
|
+import com.jzg.commons.entity.quote.vo.KindInfoVo;
|
|
|
|
|
+import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
|
|
+import com.jzg.commons.entity.quote.vo.RiskInfoVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
import com.jzg.commons.entity.quote.vo.base.LoginBase;
|
|
import com.jzg.commons.entity.quote.vo.base.LoginBase;
|
|
|
import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
|
|
import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
|
|
|
-import com.jzg.commons.entity.vo.InsTaskImagesVo;
|
|
|
|
|
-import com.jzg.commons.util.MinioUtils;
|
|
|
|
|
|
|
+import com.jzg.commons.util.DateTimeUtils;
|
|
|
|
|
+import com.jzg.commons.util.ImageUtil;
|
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
import com.jzg.commons.util.idgen.IdGenerate;
|
|
|
import com.jzg.quotation.commons.annotation.QuoteCrawlerService;
|
|
import com.jzg.quotation.commons.annotation.QuoteCrawlerService;
|
|
|
import com.jzg.quotation.commons.client.PlatformClient;
|
|
import com.jzg.quotation.commons.client.PlatformClient;
|
|
|
import com.jzg.quotation.commons.constant.InsuranceCode;
|
|
import com.jzg.quotation.commons.constant.InsuranceCode;
|
|
|
-import com.jzg.quotation.taikang.crawler.JsonUtil;
|
|
|
|
|
import com.jzg.quotation.taikang.crawler.cache.RedisCacheUtil;
|
|
import com.jzg.quotation.taikang.crawler.cache.RedisCacheUtil;
|
|
|
import com.jzg.quotation.taikang.crawler.client.AESDecryptor;
|
|
import com.jzg.quotation.taikang.crawler.client.AESDecryptor;
|
|
|
import com.jzg.quotation.taikang.crawler.model.TKLoginSession;
|
|
import com.jzg.quotation.taikang.crawler.model.TKLoginSession;
|
|
@@ -31,20 +29,18 @@ import com.jzg.quotation.taikang.crawler.service.TKSimpleService;
|
|
|
import io.micrometer.core.instrument.simple.SimpleConfig;
|
|
import io.micrometer.core.instrument.simple.SimpleConfig;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.redisson.api.RBucket;
|
|
|
|
|
-import org.redisson.api.RedissonClient;
|
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.Duration;
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@QuoteCrawlerService(value = InsuranceCode.INSURANCE_TKIC)
|
|
@QuoteCrawlerService(value = InsuranceCode.INSURANCE_TKIC)
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
|
|
+@Slf4j
|
|
|
public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -118,7 +114,7 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
@Override
|
|
@Override
|
|
|
public QuoteResultsVo quote(QuoteVo commonQuoteVo) {
|
|
public QuoteResultsVo quote(QuoteVo commonQuoteVo) {
|
|
|
CarInfoVo commonCarInfoVo = commonQuoteVo.getCarInfoVo();
|
|
CarInfoVo commonCarInfoVo = commonQuoteVo.getCarInfoVo();
|
|
|
-
|
|
|
|
|
|
|
+ commonCarInfoVo.setColorCode("010"); // 默认设置为黑色
|
|
|
String username = "Tgengchenjie";
|
|
String username = "Tgengchenjie";
|
|
|
String password = "Gcj123456#";
|
|
String password = "Gcj123456#";
|
|
|
|
|
|
|
@@ -164,7 +160,9 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
// # 初始化车险投保单
|
|
// # 初始化车险投保单
|
|
|
PreciseInitResult preciseInitResult = tkSimpleService.orderInit(session, mainOrderId);
|
|
PreciseInitResult preciseInitResult = tkSimpleService.orderInit(session, mainOrderId);
|
|
|
TKDriverAccidentVo driverAccidentVo = preciseInitResult.getDriverAccidentVo();
|
|
TKDriverAccidentVo driverAccidentVo = preciseInitResult.getDriverAccidentVo();
|
|
|
- driverAccidentVo.setIsSelect("0");
|
|
|
|
|
|
|
+ if (driverAccidentVo != null) {
|
|
|
|
|
+ driverAccidentVo.setIsSelect("0");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// # 车险投保单报价
|
|
// # 车险投保单报价
|
|
|
|
|
|
|
@@ -183,8 +181,8 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
// 交强险
|
|
// 交强险
|
|
|
TKBzKindVo bzKindVo = preciseInitResult.getBzKindVo();
|
|
TKBzKindVo bzKindVo = preciseInitResult.getBzKindVo();
|
|
|
RiskInfoVo riskInfoVo1 = new RiskInfoVo();
|
|
RiskInfoVo riskInfoVo1 = new RiskInfoVo();
|
|
|
- riskInfoVo1.setStartDate(date.getStartDateBZ());
|
|
|
|
|
- riskInfoVo1.setEndDate(date.getEndDateBZ());
|
|
|
|
|
|
|
+ riskInfoVo1.setStartDate(date.getStartDateBZ() == null ? DateTimeUtils.convertToDateTime(date.getJqStartDate(), date.getJqStartHour(), date.getJqStartMinute()) : date.getStartDateBZ());
|
|
|
|
|
+ riskInfoVo1.setEndDate(date.getEndDateBZ() == null ? DateTimeUtils.convertToDateTime(date.getJqEndDate(), date.getJqEndHour(), date.getJqEndMinute()) : date.getEndDateBZ());
|
|
|
quoteResultsVo.setCiRiskInfoVo(riskInfoVo1);
|
|
quoteResultsVo.setCiRiskInfoVo(riskInfoVo1);
|
|
|
|
|
|
|
|
// 商业险
|
|
// 商业险
|
|
@@ -361,7 +359,8 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
param.setChannelCode("OffWeb");
|
|
param.setChannelCode("OffWeb");
|
|
|
param.setTplatformId(session.getTplatformId());
|
|
param.setTplatformId(session.getTplatformId());
|
|
|
param.setOnlyId(orderID);
|
|
param.setOnlyId(orderID);
|
|
|
- param.setFullProposalNo(proposalNo);
|
|
|
|
|
|
|
+ param.setOrderID(orderID);
|
|
|
|
|
+ param.setFullProposalNo(insuranceUploadImageVo.getOrder().getQuoteNo());
|
|
|
param.setLastFullProposalNo("");
|
|
param.setLastFullProposalNo("");
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
@@ -377,32 +376,50 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
List<InsuranceImageVo.ImageDTO> imageBase64List = s.getImageBase64List();
|
|
List<InsuranceImageVo.ImageDTO> imageBase64List = s.getImageBase64List();
|
|
|
imageBase64List.forEach(c -> {
|
|
imageBase64List.forEach(c -> {
|
|
|
String imageId = c.getImageId();
|
|
String imageId = c.getImageId();
|
|
|
- SysUploadFiles sysUploadFiles = platformClient.getUploadFile(imageId);
|
|
|
|
|
- String url = MinioUtils.getPresignedObjectUrl("jzg", sysUploadFiles.getFileName());
|
|
|
|
|
- File file = new File(url);
|
|
|
|
|
- param.setTypePath("01-15-01");
|
|
|
|
|
- String info = "1fileOrgName" + param.getTypePath() + date.getTime() + "0";
|
|
|
|
|
- param.setFileOrgName(info);
|
|
|
|
|
- param.setTypeName("投保业务-车辆证件-行驶证");
|
|
|
|
|
- param.setOnlyId("投保业务-车辆证件-行驶证-0");
|
|
|
|
|
- param.setFileType(info);
|
|
|
|
|
- httpService.carCheckUploadFile(file, param);
|
|
|
|
|
|
|
+ String imageBase64Str = c.getImageBase64Str();
|
|
|
|
|
+ File file = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 将 Base64 字符串转换为 File 对象
|
|
|
|
|
+ file = ImageUtil.convertBase64ToFile(imageBase64Str, imageId);
|
|
|
|
|
+ param.setTypePath("01-15-01");
|
|
|
|
|
+ String info = "1fileOrgName" + param.getTypePath() + date.getTime() + "0";
|
|
|
|
|
+ param.setFileOrgName(info);
|
|
|
|
|
+ param.setTypeName("投保业务-车辆证件-行驶证");
|
|
|
|
|
+ param.setOnlyId("投保业务-车辆证件-行驶证-0");
|
|
|
|
|
+ param.setFileType(info);
|
|
|
|
|
+ httpService.carCheckUploadFile(file, param);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("处理行驶证图片失败: imageId={}, orderID={}", imageId, orderID, e);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ if (file != null) {
|
|
|
|
|
+ file.delete();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
} else if ("C02".equals(imageCode)) {
|
|
} else if ("C02".equals(imageCode)) {
|
|
|
List<InsuranceImageVo.ImageDTO> imageBase64List = s.getImageBase64List();
|
|
List<InsuranceImageVo.ImageDTO> imageBase64List = s.getImageBase64List();
|
|
|
imageBase64List.forEach(c -> {
|
|
imageBase64List.forEach(c -> {
|
|
|
String imageId = c.getImageId();
|
|
String imageId = c.getImageId();
|
|
|
- SysUploadFiles sysUploadFiles = platformClient.getUploadFile(imageId);
|
|
|
|
|
- String jzgTouXiang = MinioUtils.getPresignedObjectUrl("jzg", sysUploadFiles.getFileName());
|
|
|
|
|
- File file = new File(jzgTouXiang);
|
|
|
|
|
- param.setTypePath("01-14-01");
|
|
|
|
|
- String info = "1fileOrgName" + param.getTypePath() + date.getTime() + "0";
|
|
|
|
|
- param.setFileOrgName(info);
|
|
|
|
|
- param.setTypeName("投保业务-证件照-证件照");
|
|
|
|
|
- param.setOnlyId("投保业务-证件照-证件照-0");
|
|
|
|
|
- param.setFileType(info);
|
|
|
|
|
- httpService.carCheckUploadFile(file, param);
|
|
|
|
|
|
|
+ String imageBase64Str = c.getImageBase64Str();
|
|
|
|
|
+ File file = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 将 Base64 字符串转换为 File 对象
|
|
|
|
|
+ file = ImageUtil.convertBase64ToFile(imageBase64Str, imageId);
|
|
|
|
|
+ param.setTypePath("01-14-01");
|
|
|
|
|
+ String info = "1fileOrgName" + param.getTypePath() + date.getTime() + "0";
|
|
|
|
|
+ param.setFileOrgName(info);
|
|
|
|
|
+ param.setTypeName("投保业务-证件照-证件照");
|
|
|
|
|
+ param.setOnlyId("投保业务-证件照-证件照-0");
|
|
|
|
|
+ param.setFileType(info);
|
|
|
|
|
+ httpService.carCheckUploadFile(file, param);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("处理身份证图片失败: imageId={}, orderID={}", imageId, orderID, e);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ if (file != null) {
|
|
|
|
|
+ file.delete();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -581,10 +598,10 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
|
|
|
public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) {
|
|
public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) {
|
|
|
TKLoginSession session = login("Tgengchenjie", "Gcj123456#");
|
|
TKLoginSession session = login("Tgengchenjie", "Gcj123456#");
|
|
|
String orderId = redisCacheUtil.getCache(orderStatusVo.getOrder().getOrdersNo(), "DD");
|
|
String orderId = redisCacheUtil.getCache(orderStatusVo.getOrder().getOrdersNo(), "DD");
|
|
|
- String proposalNo = "";
|
|
|
|
|
- String fullProposalNo = "";
|
|
|
|
|
|
|
+ String proposalNo = orderStatusVo.getOrder().getCompanyOrderNo();
|
|
|
|
|
+ String fullProposalNo = orderStatusVo.getOrder().getCompanyOrderNo();
|
|
|
|
|
|
|
|
- TKEntranceFor000086Result tkEntranceFor000086Result = httpService.entranceFor000086(session.getToken(), session.getTplatformId(), session.getFromid(), orderId, proposalNo, fullProposalNo);
|
|
|
|
|
|
|
+ TKEntranceFor000086Result tkEntranceFor000086Result = httpService.entranceFor000086(session.getToken(), session.getLoginInfo().getCarssToken(),session.getTplatformId(), session.getFromid(), orderId, proposalNo, fullProposalNo, session.getLoginInfo().getTplatLoginKey());
|
|
|
/**
|
|
/**
|
|
|
* 订单状态
|
|
* 订单状态
|
|
|
* 大概如下:
|
|
* 大概如下:
|