|
|
@@ -11,12 +11,14 @@ import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
|
|
|
import com.jzg.commons.entity.po.InsCompanyClause;
|
|
|
+import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
import com.jzg.commons.entity.quote.vo.AccidentalDrivingVo;
|
|
|
import com.jzg.commons.entity.quote.vo.CarInfoVo;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
+import com.jzg.commons.util.MinioUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.quotation.commons.annotation.QuoteApiService;
|
|
|
import com.jzg.quotation.commons.client.PlatformClient;
|
|
|
@@ -27,6 +29,7 @@ import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
|
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
|
import com.jzg.quotation.commons.utils.DateTimeUtil;
|
|
|
import com.jzg.quotation.commons.utils.HttpUtil;
|
|
|
+import com.jzg.quotation.commons.utils.TimeProcessing;
|
|
|
import com.jzg.quotation.guoren.api.build.GuoRenApiQuoteResultsVoBuild;
|
|
|
import com.jzg.quotation.guoren.api.component.GuoRenRequestApiComponent;
|
|
|
import com.jzg.quotation.guoren.api.component.GuorenDuplicateInsuranceComponent;
|
|
|
@@ -42,6 +45,7 @@ import com.jzg.quotation.guoren.api.properties.GuoRenApiConfigurationProperties;
|
|
|
import com.jzg.quotation.guoren.api.service.GuoRenApiOrderService;
|
|
|
import com.jzg.quotation.guoren.api.service.GuoRenApiRequest;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.commons.compress.utils.IOUtils;
|
|
|
import org.apache.commons.httpclient.methods.multipart.FilePart;
|
|
|
import org.apache.commons.httpclient.methods.multipart.Part;
|
|
|
import org.apache.commons.httpclient.methods.multipart.StringPart;
|
|
|
@@ -52,6 +56,7 @@ import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
+import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -59,6 +64,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* description:
|
|
|
+ *
|
|
|
* @author: shenwd
|
|
|
* @date: 2025/3/14 09:58
|
|
|
**/
|
|
|
@@ -79,6 +85,8 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
private final PlatformClient platformClient;
|
|
|
|
|
|
+ private final MinioUtils minioUtils;
|
|
|
+
|
|
|
public String getApiUrl(String companyId) {
|
|
|
// 获取保司配置url地址
|
|
|
HttpResult<PtlAgreementUrl> ptlAgreementUrl = platformClient.getAgreementUrlByCompanyId(companyId);
|
|
|
@@ -87,6 +95,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 报价
|
|
|
+ *
|
|
|
* @param quoteVo 报价实体
|
|
|
* @return 报价信息
|
|
|
*/
|
|
|
@@ -103,11 +112,11 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
vinQueryRequest.setFrameNo(carInfoVo.getVinNo());
|
|
|
vinQueryRequest.setLicenseNo(carInfoVo.getLicenseNo());
|
|
|
|
|
|
- VinQueryResponse.DataDTO vinQuery = vinQuery(vinQueryRequest, parameters,url);
|
|
|
+ VinQueryResponse.DataDTO vinQuery = vinQuery(vinQueryRequest, parameters, url);
|
|
|
AssertionUtils.isEmpty(vinQuery, "未找到匹配的车辆信息");
|
|
|
|
|
|
//车价查询
|
|
|
- CarPriceResponse.DataDTO carPriceQuery = carPriceQuery(quoteVo, vinQuery, parameters,url);
|
|
|
+ CarPriceResponse.DataDTO carPriceQuery = carPriceQuery(quoteVo, vinQuery, parameters, url);
|
|
|
AssertionUtils.isEmpty(carPriceQuery, "车价获取失败");
|
|
|
|
|
|
//创建非车订单
|
|
|
@@ -142,11 +151,11 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
guoRenApiOrder.setId(orderBase.getOrdersNo());
|
|
|
guoRenApiOrder.setOrdersNo(orderBase.getOrdersNo());
|
|
|
guoRenApiOrder.setProductsCode(orderBase.getProductId());
|
|
|
- return handleFailedQuote(guoRenApiOrder,quoteVo,premiumResponse);
|
|
|
+ return handleFailedQuote(guoRenApiOrder, quoteVo, premiumResponse);
|
|
|
} else {
|
|
|
//保存投保单 该接口返回投保单号
|
|
|
InsuranceSlipResponse insuranceSlipResponse = guoRenRequestApiComponent.insuranceSlip(quoteVo,
|
|
|
- carPriceQuery.getInputvo(), orderCode, specialAgreements,url);
|
|
|
+ carPriceQuery.getInputvo(), orderCode, specialAgreements, url);
|
|
|
if (insuranceSlipResponse.getResultCode() == 1) {
|
|
|
throw new SystemException(insuranceSlipResponse.getResultMsg());
|
|
|
}
|
|
|
@@ -163,22 +172,21 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
guoRenApiOrder.setCarTax(BigDecimal.valueOf(premiumResponse.getData().getSumPayTax()));
|
|
|
guoRenApiOrder.setOthBusinessNo(carPriceQuery.getInputvo());
|
|
|
guoRenApiOrder.setNoCarOrderNo(nonAutoInsOrderResponse != null ? nonAutoInsOrderResponse.getData().getOrderCode() : "");
|
|
|
- return handleSuccessQuote(guoRenApiOrder,quoteVo, premiumResponse,nonAutoInsOrderResponse);
|
|
|
+ return handleSuccessQuote(guoRenApiOrder, quoteVo, premiumResponse, nonAutoInsOrderResponse);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private QuoteResultsVo handleFailedQuote(GuoRenApiOrder guoRenApiOrder,QuoteVo quoteVo,PremiumResponse response) {
|
|
|
+ private QuoteResultsVo handleFailedQuote(GuoRenApiOrder guoRenApiOrder, QuoteVo quoteVo, PremiumResponse response) {
|
|
|
guoRenApiOrderService.save(guoRenApiOrder);
|
|
|
return GuoRenApiQuoteResultsVoBuild.buildQuoteFailResultsVo(response);
|
|
|
}
|
|
|
|
|
|
- private QuoteResultsVo handleSuccessQuote(GuoRenApiOrder guoRenApiOrder,QuoteVo quoteVo,PremiumResponse response,NonAutoInsOrderResponse nonAutoInsOrderResponse) {
|
|
|
+ private QuoteResultsVo handleSuccessQuote(GuoRenApiOrder guoRenApiOrder, QuoteVo quoteVo, PremiumResponse response, NonAutoInsOrderResponse nonAutoInsOrderResponse) {
|
|
|
guoRenApiOrderService.save(guoRenApiOrder);
|
|
|
- return GuoRenApiQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo,response,nonAutoInsOrderResponse);
|
|
|
+ return GuoRenApiQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo, response, nonAutoInsOrderResponse);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 提交核保 子订单
|
|
|
*
|
|
|
@@ -192,7 +200,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
|
- SubmitAuditResponse auditResponse = guoRenRequestApiComponent.submitAudit(guoRenApiOrder, parameters,url);
|
|
|
+ SubmitAuditResponse auditResponse = guoRenRequestApiComponent.submitAudit(guoRenApiOrder, parameters, url);
|
|
|
UnderwritingResultsVo underwritingResultsVo = new UnderwritingResultsVo();
|
|
|
String jqStatus = auditResponse.getData().get(0).getUnderWriteFlagCI();
|
|
|
String syStatus = auditResponse.getData().get(0).getUnderWriteFlagBI();
|
|
|
@@ -200,14 +208,14 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
// 0初始值/1通过/2不通过/3无需核保/9人工核保
|
|
|
if (StringUtils.isEmpty(jqStatus) && StringUtils.isEmpty(syStatus)) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
|
|
|
- underwritingResultsVo.setUnderwritingResult("核保失败:"+ message);
|
|
|
+ underwritingResultsVo.setUnderwritingResult("核保失败:" + message);
|
|
|
return underwritingResultsVo;
|
|
|
}
|
|
|
// 单交核保状态
|
|
|
if (StringUtils.isNotEmpty(jqStatus) && StringUtils.isEmpty(syStatus)) {
|
|
|
if (jqStatus.equals("1") || jqStatus.equals("3")) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
- SignatureResponse signature = getSignature(guoRenApiOrder,url);
|
|
|
+ SignatureResponse signature = getSignature(guoRenApiOrder, url);
|
|
|
underwritingResultsVo.setPaymentLink(signature.getQrCode());
|
|
|
} else if (jqStatus.equals("2") || jqStatus.equals("0")) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
|
|
|
@@ -218,7 +226,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
if (StringUtils.isEmpty(syStatus) && StringUtils.isNotEmpty(syStatus)) {
|
|
|
if (syStatus.equals("1") || syStatus.equals("3")) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
- SignatureResponse signature = getSignature(guoRenApiOrder,url);
|
|
|
+ SignatureResponse signature = getSignature(guoRenApiOrder, url);
|
|
|
underwritingResultsVo.setPaymentLink(signature.getQrCode());
|
|
|
|
|
|
} else if (syStatus.equals("2") || syStatus.equals("0")) {
|
|
|
@@ -234,11 +242,11 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
underwritingResultsVo.setUnderwritingResult(message);
|
|
|
} else if (jqStatus.equals("1") && syStatus.equals("1")) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
- SignatureResponse signature = getSignature(guoRenApiOrder,url);
|
|
|
+ SignatureResponse signature = getSignature(guoRenApiOrder, url);
|
|
|
underwritingResultsVo.setPaymentLink(signature.getQrCode());
|
|
|
} else if (jqStatus.equals("3") && syStatus.equals("3")) {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
- SignatureResponse signature = getSignature(guoRenApiOrder,url);
|
|
|
+ SignatureResponse signature = getSignature(guoRenApiOrder, url);
|
|
|
underwritingResultsVo.setPaymentLink(signature.getQrCode());
|
|
|
}
|
|
|
}
|
|
|
@@ -248,13 +256,14 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
/**
|
|
|
* 通过二维码扫描获取电子投保单签名
|
|
|
*/
|
|
|
- public SignatureResponse getSignature(GuoRenApiOrder guoRenApiOrder,String url) {
|
|
|
- return guoRenRequestApiComponent.signature(guoRenApiOrder,url);
|
|
|
+ public SignatureResponse getSignature(GuoRenApiOrder guoRenApiOrder, String url) {
|
|
|
+ return guoRenRequestApiComponent.signature(guoRenApiOrder, url);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取支付链接
|
|
|
+ *
|
|
|
* @param paymentLinkVo
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -264,7 +273,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, paymentLinkVo.getOrder().getAttributionInformationVo().getConfigInfo());
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(paymentLinkVo.getOrder().getOrdersNo());
|
|
|
|
|
|
- PayResponse.DataDTO dataDTO = guoRenRequestApiComponent.getPaid(guoRenApiOrder, parameters,url);
|
|
|
+ PayResponse.DataDTO dataDTO = guoRenRequestApiComponent.getPaid(guoRenApiOrder, parameters, url);
|
|
|
PaymentLinkResultsVo resultsVo = new PaymentLinkResultsVo();
|
|
|
resultsVo.setPaymentLink(dataDTO.getPayUrl());
|
|
|
return resultsVo;
|
|
|
@@ -272,6 +281,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 上传影像
|
|
|
+ *
|
|
|
* @param insuranceUploadImageVo
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -291,6 +301,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 下载保单
|
|
|
+ *
|
|
|
* @param downloadPolicyVo
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -304,16 +315,16 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
String syPolicyNo = policie.getSyPolicyNo();
|
|
|
String jyPolicyNo = policie.getJyPolicyNo();
|
|
|
if (jqPolicyNo != null) {
|
|
|
- PolicyResponse jqResponse = guoRenRequestApiComponent.policyPrint(jqPolicyNo,url);
|
|
|
+ PolicyResponse jqResponse = guoRenRequestApiComponent.policyPrint(jqPolicyNo, url);
|
|
|
downloadPolicyResultVo.setJqFlagUrl(properties.getPolicyFlagUrl() + jqResponse.getData());
|
|
|
downloadPolicyResultVo.setJqUrl(properties.getPolicyUrl() + jqResponse.getData());
|
|
|
}
|
|
|
if (syPolicyNo != null) {
|
|
|
- PolicyResponse syResponse = guoRenRequestApiComponent.policyPrint(syPolicyNo,url);
|
|
|
+ PolicyResponse syResponse = guoRenRequestApiComponent.policyPrint(syPolicyNo, url);
|
|
|
downloadPolicyResultVo.setSyUrl(properties.getPolicyUrl() + syResponse.getData());
|
|
|
}
|
|
|
if (jyPolicyNo != null) {
|
|
|
- String jyResponse = guoRenRequestApiComponent.noCarElectronicPolicy(properties.getChannelCode(),guoRenApiOrder.getOthBusinessNo(),jyPolicyNo,url);
|
|
|
+ String jyResponse = guoRenRequestApiComponent.noCarElectronicPolicy(properties.getChannelCode(), guoRenApiOrder.getOthBusinessNo(), jyPolicyNo, url);
|
|
|
downloadPolicyResultVo.setJyUrl(jyResponse);
|
|
|
}
|
|
|
return downloadPolicyResultVo;
|
|
|
@@ -326,13 +337,17 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
*/
|
|
|
@Override
|
|
|
public OrderStatusResultVo queryOrderState(OrderStatusVo orderBase) {
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrder().getOrdersNo());
|
|
|
+
|
|
|
//查询投保单信息
|
|
|
InsOrdersPolicy insOrdersPolicy = orderBase.getInsOrdersPolicy();
|
|
|
+ insOrdersPolicy.setJqApplyNo(guoRenApiOrder.getJqApplyNo());
|
|
|
+ insOrdersPolicy.setSyApplyNo(guoRenApiOrder.getSyApplyNo());
|
|
|
+
|
|
|
InsOrders insOrders = orderBase.getInsOrders();
|
|
|
String url = getApiUrl(orderBase.getOrder().getInsuranceCompanyId());
|
|
|
// 获取保司订单状态
|
|
|
- OrderStateResponse orderStateResponse = insOrderStatus(insOrdersPolicy,url);
|
|
|
- GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrder().getOrdersNo());
|
|
|
+ OrderStateResponse orderStateResponse = insOrderStatus(insOrdersPolicy, url);
|
|
|
OrderStatusResultVo orderStatusResultVo = new OrderStatusResultVo();
|
|
|
if (null != orderStateResponse && CollUtil.isNotEmpty(orderStateResponse.getData())) {
|
|
|
OrderStateResponse.DataDTO jqDataDTO =
|
|
|
@@ -370,7 +385,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
// 支付
|
|
|
if (updateFlag) {
|
|
|
orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.UNDERWRITED);
|
|
|
- List<DrivingInsuranceDTO> drivingInsuranceDTOList = guoRenRequestApiComponent.queryNoCarPolicyNo(guoRenApiOrder,url);
|
|
|
+ List<DrivingInsuranceDTO> drivingInsuranceDTOList = guoRenRequestApiComponent.queryNoCarPolicyNo(guoRenApiOrder, url);
|
|
|
drivingInsuranceDTOList.forEach(drivingInsuranceDTO -> {
|
|
|
orderStatusResultVo.setJyPolicyno(drivingInsuranceDTO.getPolicyNumber());
|
|
|
orderStatusResultVo.setJyApplyNo(drivingInsuranceDTO.getApplicationNumber());
|
|
|
@@ -381,7 +396,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public OrderStateResponse insOrderStatus(InsOrdersPolicy insOrdersPolicy,String url) {
|
|
|
+ public OrderStateResponse insOrderStatus(InsOrdersPolicy insOrdersPolicy, String url) {
|
|
|
OrderStateRequest orderStateRequest = new OrderStateRequest();
|
|
|
// 交强投保单号
|
|
|
orderStateRequest.addProposalNos(insOrdersPolicy.getJqApplyNo());
|
|
|
@@ -389,19 +404,20 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
orderStateRequest.addProposalNos(insOrdersPolicy.getSyApplyNo());
|
|
|
//投保单状态查询
|
|
|
return guoRenRequestApiComponent.request(orderStateRequest, PlatformInterfaceCode.API_IIRBT00010,
|
|
|
- OrderStateResponse.class,url);
|
|
|
+ OrderStateResponse.class, url);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* vin码查询车辆信息
|
|
|
+ *
|
|
|
* @return VinQueryResp.DataDTO
|
|
|
* @author: lig
|
|
|
* @date: 2023年08月18日 0018
|
|
|
*/
|
|
|
- public VinQueryResponse.DataDTO vinQuery(VinQueryRequest vinQueryReq, GuoRenConfigureParameters parameters,String url) {
|
|
|
+ public VinQueryResponse.DataDTO vinQuery(VinQueryRequest vinQueryReq, GuoRenConfigureParameters parameters, String url) {
|
|
|
VinQueryRequest req = new VinQueryRequest(vinQueryReq, parameters);
|
|
|
VinQueryResponse resp = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00009,
|
|
|
- VinQueryResponse.class,url);
|
|
|
+ VinQueryResponse.class, url);
|
|
|
if (resp.getResultCode() == 1) {
|
|
|
throw new SystemException(resp.getResultMsg() == null ? "未找到车辆信息" : resp.getResultMsg());
|
|
|
}
|
|
|
@@ -412,10 +428,10 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
* 车价查询
|
|
|
*/
|
|
|
public CarPriceResponse.DataDTO carPriceQuery(QuoteVo quoteVo, VinQueryResponse.DataDTO vinQ,
|
|
|
- GuoRenConfigureParameters parameters,String url) {
|
|
|
+ GuoRenConfigureParameters parameters, String url) {
|
|
|
|
|
|
CarPriceRequest req = CarPriceRequest.buildCarPriceParam(quoteVo, vinQ, parameters);
|
|
|
- JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00003,url);
|
|
|
+ JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00003, url);
|
|
|
Object cars = request.get("cars");
|
|
|
|
|
|
if (ObjectUtils.isEmpty(cars)) {
|
|
|
@@ -438,7 +454,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
//车辆年款不能超过注册日期
|
|
|
List<CarPriceMuchResponse.DataDTO.CarsDTO> vehicleInfoList =
|
|
|
respMuch.getData().getCars().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(),
|
|
|
- a.getCarYear())).collect(Collectors.toList());
|
|
|
+ a.getCarYear())).collect(Collectors.toList());
|
|
|
|
|
|
//匹配的车辆信息数据 为空
|
|
|
if (CollUtil.isEmpty(vehicleInfoList)) {
|
|
|
@@ -458,7 +474,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
confirmCarMuch = vehicleInfoList.get(0);
|
|
|
}
|
|
|
}
|
|
|
- return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch,url
|
|
|
+ return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch, url
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -468,12 +484,12 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
/**
|
|
|
* (多条)车价查询
|
|
|
*/
|
|
|
- public CarPriceResponse.DataDTO carPriceQueryMuch(String uuid, CarPriceMuchResponse.DataDTO.CarsDTO carsDTO,String url) {
|
|
|
+ public CarPriceResponse.DataDTO carPriceQueryMuch(String uuid, CarPriceMuchResponse.DataDTO.CarsDTO carsDTO, String url) {
|
|
|
//构造请求参数
|
|
|
CarPriceMuchRequest req = new CarPriceMuchRequest();
|
|
|
req.setUuid(uuid);
|
|
|
req.setCarPriceMuchResp(carsDTO);
|
|
|
- JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00017,url);
|
|
|
+ JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00017, url);
|
|
|
CarPriceResponse resp = request.toJavaObject(CarPriceResponse.class);
|
|
|
if (resp.getResultCode() == 1) {
|
|
|
throw new SystemException(resp.getResultMsg() == null ? "未获取到车价信息,请联系管理员" : resp.getResultMsg());
|
|
|
@@ -484,6 +500,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 意外险转换
|
|
|
+ *
|
|
|
* @param accidentalDrivingVoList
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -504,23 +521,25 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 创建非车订单
|
|
|
+ *
|
|
|
* @author: lig
|
|
|
* @date: 2023-09-28
|
|
|
*/
|
|
|
public NonAutoInsOrderResponse nonAutoInsOrder(QuoteVo quoteVo,
|
|
|
GuoRenAccidentalDrivingVo accidentalDrivingVo,
|
|
|
String carPriceUuid, GuoRenConfigureParameters channelInfo,
|
|
|
- VinQueryResponse.DataDTO vinQ,String url) {
|
|
|
+ VinQueryResponse.DataDTO vinQ, String url) {
|
|
|
//构造请求参数
|
|
|
NonAutoInsOrderRequest nonAutoInsOrderReq = new NonAutoInsOrderRequest(quoteVo, vinQ, accidentalDrivingVo,
|
|
|
channelInfo,
|
|
|
carPriceUuid, properties.getChannelCode());
|
|
|
return guoRenRequestApiComponent.request(nonAutoInsOrderReq, PlatformInterfaceCode.API_IIIRBT00054,
|
|
|
- NonAutoInsOrderResponse.class,url);
|
|
|
+ NonAutoInsOrderResponse.class, url);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询国任特约数据
|
|
|
+ *
|
|
|
* @param quoteVo 原参数为agreementId,以后看orderbase中的配置信息map中是否可以获取
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -551,7 +570,6 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
// }
|
|
|
// return list;
|
|
|
// }
|
|
|
-
|
|
|
public List<GuoRenSpecialAgreementVo> getSpecialAgreements(QuoteVo quoteVo) {
|
|
|
List<InsCompanyClause> companyClauseVos = quoteVo.getSpecialInfoVo();
|
|
|
List<GuoRenSpecialAgreementVo> list = new ArrayList<>();
|
|
|
@@ -563,7 +581,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
}
|
|
|
|
|
|
public PremiumResponse premiumQuery(QuoteVo quoteVo, CarPriceResponse.DataDTO carPriceQuery, VinQueryResponse.DataDTO vinQuery, Boolean isNoCar,
|
|
|
- List<GuoRenSpecialAgreementVo> specialAgreements, String noCarPremium, String goodsCode,String url) {
|
|
|
+ List<GuoRenSpecialAgreementVo> specialAgreements, String noCarPremium, String goodsCode, String url) {
|
|
|
boolean boo;
|
|
|
//请求信息列表
|
|
|
List<String> requestInfoList = new ArrayList<>();
|
|
|
@@ -572,7 +590,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
PremiumResponse premiumResponse;
|
|
|
int a = 0;
|
|
|
for (; ; ) {
|
|
|
- premiumResponse = guoRenRequestApiComponent.request(premiumRequest, PlatformInterfaceCode.API_IIRBT00004, PremiumResponse.class,url);
|
|
|
+ premiumResponse = guoRenRequestApiComponent.request(premiumRequest, PlatformInterfaceCode.API_IIRBT00004, PremiumResponse.class, url);
|
|
|
|
|
|
premiumRequest.getCi().getPrpTmain().setAnswer(null);
|
|
|
premiumRequest.getBi().getPrpTmain().setAnswer(null);
|
|
|
@@ -608,72 +626,174 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 影像上传 调用三方
|
|
|
+ * 请求参数:
|
|
|
+ * - businessNo: 投保单号(交商同保传交强)
|
|
|
+ * - operatorCode: 操作人代码
|
|
|
+ * - comCode: 机构代码
|
|
|
+ * - fileGroup: 影像类型(DZ—单证影像,YC-验车影像)
|
|
|
+ * - file: 图片对象
|
|
|
*/
|
|
|
public void imageUpdate(GuoRenApiOrder guoRenApiOrder, GuoRenConfigureParameters parameters, InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
+ // 获取交强险投保单号(交商同保传交强)
|
|
|
+ String businessNo = guoRenApiOrder.getJqApplyNo();
|
|
|
+ if (StringUtils.isEmpty(businessNo)) {
|
|
|
+ logger.error("国任上传影像失败,交强险投保单号为空");
|
|
|
+ throw new SystemException("国任,影像上传失败,投保单号为空");
|
|
|
+ }
|
|
|
|
|
|
- //构造请求参数
|
|
|
- Map<String, Object> formMap = new HashMap<>();
|
|
|
- formMap.put("businessNo", StringUtils.isEmpty(guoRenApiOrder.getJqApplyNo()) ? guoRenApiOrder.getSyApplyNo() : guoRenApiOrder.getJqApplyNo());
|
|
|
- formMap.put("operatorCode", parameters.getHandlerCode());
|
|
|
- formMap.put("comCode", parameters.getComCode());
|
|
|
- formMap.put("fileGroup", "DZ");
|
|
|
+ // 操作人代码
|
|
|
+ String operatorCode = parameters.getHandlerCode();
|
|
|
+ // 机构代码
|
|
|
+ String comCode = parameters.getComCode();
|
|
|
|
|
|
List<InsuranceImageVo> imageVoList = insuranceUploadImageVo.getImageVoList();
|
|
|
- Map<String, List<String>> map = new HashMap<>();
|
|
|
+ Map<String, List<String>> resultMap = new HashMap<>();
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(imageVoList)) {
|
|
|
+ logger.warn("国任上传影像失败,影像列表为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (InsuranceImageVo imageVo : imageVoList) {
|
|
|
+ if (imageVo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- imageVoList.forEach(insuranceImageVo -> {
|
|
|
List<String> imageIds = new ArrayList<>();
|
|
|
- for (InsuranceImageVo.ImageDTO imageDTO : insuranceImageVo.getImageBase64List()) {
|
|
|
- try {
|
|
|
- //需要设置一个临时图片路径
|
|
|
- File tempFile = File.createTempFile("upload_temp_", getFileSuffix(imageDTO.getImageName()));
|
|
|
- FilePart file1 = new FilePart("file", tempFile);
|
|
|
+ List<InsuranceImageVo.ImageDTO> imageList = imageVo.getImageBase64List();
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(imageList)) {
|
|
|
+ logger.warn("国任上传影像失败,影像Base64列表为空,类型:{}", imageVo.getImageType());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据影像类型确定fileGroup
|
|
|
+ String fileGroup = getFileGroup(imageVo);
|
|
|
+
|
|
|
+ byte[] imageBytes;
|
|
|
+ String fileName;
|
|
|
+
|
|
|
+ for (InsuranceImageVo.ImageDTO imageDTO : imageList) {
|
|
|
+ if (imageDTO == null) {
|
|
|
+ logger.warn("国任上传影像失败,图片DTO为空");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ try { // 根据imageId查询文件信息
|
|
|
+ SysUploadFiles uploadFile = platformClient.getUploadFile(imageDTO.getImageId());
|
|
|
+ if (uploadFile == null) {
|
|
|
+ logger.error("国任上传影像失败,未找到文件信息,imageId:{}", imageDTO.getImageId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取文件名
|
|
|
+ fileName = uploadFile.getFileName();
|
|
|
+
|
|
|
+ // 获取文件流
|
|
|
+ String imgUrl = minioUtils.getPresignedObjectUrl(uploadFile.getBucketName(), fileName);
|
|
|
+ logger.info("国任影像上传,获取文件预签名URL,imgUrl:{}", imgUrl);
|
|
|
+ InputStream inputStream = minioUtils.getObject(uploadFile.getBucketName(), fileName);
|
|
|
+ if (inputStream == null) {
|
|
|
+ logger.error("国任上传影像失败,获取文件预签名URL失败,imageId:{}", imageDTO.getImageId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下载文件内容为byte[]
|
|
|
+ imageBytes = IOUtils.toByteArray(inputStream);
|
|
|
+ if (imageBytes == null || imageBytes.length == 0) {
|
|
|
+ logger.error("国任上传影像失败,文件内容为空,imageId:{}", imageDTO.getImageId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ logger.info("国任下载影像成功,imageId:{},fileName:{}", imageDTO.getImageId(), fileName);
|
|
|
+
|
|
|
+
|
|
|
+ // 生成临时文件
|
|
|
+ String fileSuffix = getFileSuffix(fileName);
|
|
|
+ File tempFile = File.createTempFile("upload_temp_", fileSuffix);
|
|
|
tempFile.deleteOnExit();
|
|
|
|
|
|
// 将字节数组写入临时文件
|
|
|
try (FileOutputStream fos = new FileOutputStream(tempFile)) {
|
|
|
- fos.write(imageDTO.getImageByte());
|
|
|
+ fos.write(imageBytes);
|
|
|
fos.flush();
|
|
|
}
|
|
|
|
|
|
- Part[] parts = {file1, new StringPart("businessNo", formMap.get("businessNo").toString()),
|
|
|
- new StringPart("operatorCode",
|
|
|
- formMap.get("operatorCode").toString()), new StringPart("comCode",
|
|
|
- formMap.get("comCode").toString()),
|
|
|
- new StringPart("fileGroup", formMap.get("fileGroup").toString())};
|
|
|
-
|
|
|
+ // 构造请求参数
|
|
|
+ FilePart filePart = new FilePart("file", tempFile);
|
|
|
+ Part[] parts = {
|
|
|
+ filePart,
|
|
|
+ new StringPart("businessNo", businessNo),
|
|
|
+ new StringPart("operatorCode", operatorCode),
|
|
|
+ new StringPart("comCode", comCode),
|
|
|
+ new StringPart("fileGroup", fileGroup)
|
|
|
+ };
|
|
|
+
|
|
|
+ // 发送请求
|
|
|
String result = HttpUtil.sendPostFromFile(parts, properties.getUploadUrl());
|
|
|
+
|
|
|
if (StringUtils.isEmpty(result)) {
|
|
|
+ logger.error("国任上传影像失败,接口返回为空,imageId:{}", imageDTO.getImageId());
|
|
|
throw new SystemException("国任,影像上传失败");
|
|
|
}
|
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(result);
|
|
|
+ Integer resultCode = StringUtils.toInt(jsonObject.get("resultCode"));
|
|
|
|
|
|
- if (StringUtils.toInt(jsonObject.get("resultCode")) != 0) {
|
|
|
- throw new SystemException("国任,影像上传失败");
|
|
|
+ if (resultCode == null || resultCode != 0) {
|
|
|
+ String resultMsg = jsonObject.getString("resultMsg");
|
|
|
+ logger.error("国任上传影像失败,resultCode:{},resultMsg:{},imageId:{}", resultCode, resultMsg, imageDTO.getImageId());
|
|
|
+ throw new SystemException("国任,影像上传失败:" + resultMsg);
|
|
|
}
|
|
|
+
|
|
|
imageIds.add(imageDTO.getImageId());
|
|
|
+ logger.info("国任上传影像成功,imageId:{},businessNo:{}", imageDTO.getImageId(), businessNo);
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("国任上传影像异常:{}", e.getMessage());
|
|
|
- // 上传的影像存入redis
|
|
|
- insImagesUploadCacheComponent.setUploadImageCache(insuranceUploadImageVo.getOrder().getInsuranceCompanyCode(), map);
|
|
|
- throw new SystemException("国任,影像上传失败,类型:" + insuranceImageVo.getImageType());
|
|
|
+ logger.error("国任上传影像异常:{},imageId:{}", e.getMessage(), imageDTO.getImageId(), e);
|
|
|
+ insImagesUploadCacheComponent.setUploadImageCache(insuranceUploadImageVo.getOrder().getInsuranceCompanyCode(), resultMap);
|
|
|
+ throw new SystemException("国任,影像上传失败,类型:" + imageVo.getImageType());
|
|
|
}
|
|
|
}
|
|
|
- map.put(insuranceImageVo.getImageCode(), imageIds);
|
|
|
- });
|
|
|
|
|
|
- insImagesUploadCacheComponent.setUploadImageCache(insuranceUploadImageVo.getOrder().getInsuranceCompanyCode(), map);
|
|
|
+ if (CollUtil.isNotEmpty(imageIds)) {
|
|
|
+ resultMap.put(imageVo.getImageCode(), imageIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将上传成功的影像存入缓存
|
|
|
+ insImagesUploadCacheComponent.setUploadImageCache(insuranceUploadImageVo.getOrder().getInsuranceCompanyCode(), resultMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据影像类型获取fileGroup
|
|
|
+ * DZ—单证影像, YC-验车影像
|
|
|
+ */
|
|
|
+ private String getFileGroup(InsuranceImageVo imageVo) {
|
|
|
+ String imageType = imageVo.getImageType();
|
|
|
+ if (StringUtils.isEmpty(imageType)) {
|
|
|
+ return "DZ";
|
|
|
+ }
|
|
|
+ // 验车相关的影像类型使用YC
|
|
|
+ if (imageType.contains("验车") || imageType.contains("YC")) {
|
|
|
+ return "YC";
|
|
|
+ }
|
|
|
+ // 默认使用单证影像
|
|
|
+ return "DZ";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 工具方法:从文件名中提取后缀(如 "test.txt" → "txt")
|
|
|
*/
|
|
|
- private static String getFileSuffix(String fileName) {
|
|
|
- if (fileName.contains(".")) {
|
|
|
- return fileName.substring(fileName.lastIndexOf("."));
|
|
|
+ private String getFileSuffix(String fileName) {
|
|
|
+ if (StringUtils.isEmpty(fileName)) {
|
|
|
+ return ".bin"; // 默认后缀
|
|
|
+ }
|
|
|
+ int lastIndexOf = fileName.lastIndexOf(".");
|
|
|
+ if (lastIndexOf == -1) {
|
|
|
+ return ".bin";
|
|
|
}
|
|
|
- return "bin"; // 默认后缀(二进制文件)
|
|
|
+ return fileName.substring(lastIndexOf);
|
|
|
}
|
|
|
|
|
|
|