|
|
@@ -0,0 +1,2270 @@
|
|
|
+package com.ydtech.modules.ins.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fasterxml.jackson.annotation.JsonInclude;
|
|
|
+import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.*;
|
|
|
+import com.ydtech.components.InsAlltrustRequestApiComponents;
|
|
|
+import com.ydtech.constants.InsuranceEnum;
|
|
|
+import com.ydtech.constants.enums.*;
|
|
|
+import com.ydtech.constants.enums.dict.AttachInsureEnum;
|
|
|
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
+import com.ydtech.constants.enums.dict.WhetherEnum;
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
+import com.ydtech.modules.admin.service.SysUserService;
|
|
|
+import com.ydtech.modules.esm.dao.EsmInsAttachInsureDetailsMapper;
|
|
|
+import com.ydtech.modules.esm.dao.EsmInsAttachInsureMapper;
|
|
|
+import com.ydtech.modules.esm.model.EsmInsAttachInsure;
|
|
|
+import com.ydtech.modules.esm.model.EsmInsAttachInsureDetails;
|
|
|
+import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
+import com.ydtech.modules.esm.model.InsTaskImage;
|
|
|
+import com.ydtech.modules.esm.service.*;
|
|
|
+import com.ydtech.modules.ins.dao.InsAlltrustRegionMapper;
|
|
|
+import com.ydtech.modules.ins.model.InsApiLog;
|
|
|
+import com.ydtech.modules.ins.model.guoRen.*;
|
|
|
+import com.ydtech.modules.ins.model.vo.*;
|
|
|
+import com.ydtech.modules.ins.model.ya.CarModel_Req;
|
|
|
+import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
|
|
|
+import com.ydtech.modules.ins.model.yc.*;
|
|
|
+import com.ydtech.modules.ins.model.yc.accident.Accident;
|
|
|
+import com.ydtech.modules.ins.model.yc.accident.response.ResponseYwCvrg;
|
|
|
+import com.ydtech.modules.ins.model.yc.audit.Audit;
|
|
|
+import com.ydtech.modules.ins.model.yc.audit.response.AuditResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.callbackAnOrder.CallbackAnOrder;
|
|
|
+import com.ydtech.modules.ins.model.yc.imageUp.ImageUp;
|
|
|
+import com.ydtech.modules.ins.model.yc.imageUp.response.ImageUpResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.modelsQuery.ModelsQueryResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.modelsQuery.ModelsQueryXml;
|
|
|
+import com.ydtech.modules.ins.model.yc.pay.Pay;
|
|
|
+import com.ydtech.modules.ins.model.yc.pay.response.AccidentResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.pay.response.PayResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.policy.Policy;
|
|
|
+import com.ydtech.modules.ins.model.yc.policy.response.PolicyResponse;
|
|
|
+import com.ydtech.modules.ins.model.yc.ruote.Applicant;
|
|
|
+import com.ydtech.modules.ins.model.yc.ruote.Insured;
|
|
|
+import com.ydtech.modules.ins.model.yc.ruote.Ruote;
|
|
|
+import com.ydtech.modules.ins.model.yc.ruote.Vhlowner;
|
|
|
+import com.ydtech.modules.ins.model.yc.ruote.response.RuoteResponse;
|
|
|
+import com.ydtech.modules.ins.service.InsApiLogService;
|
|
|
+import com.ydtech.modules.ins.service.InsGuoRenApiService;
|
|
|
+import com.ydtech.modules.ins.service.InsTaskHistoryService;
|
|
|
+import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
|
+import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
+import com.ydtech.modules.order.dao.InsTaskImagesMapper;
|
|
|
+import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
+import com.ydtech.modules.order.entity.InsOrders;
|
|
|
+import com.ydtech.modules.order.entity.dto.InsUploadImagesDto;
|
|
|
+import com.ydtech.modules.order.entity.vo.*;
|
|
|
+import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
+import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
+import com.ydtech.modules.order.service.InsTaskImagesService;
|
|
|
+import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
+import com.ydtech.utils.*;
|
|
|
+import com.ydtech.utils.baidu.FileUtil;
|
|
|
+import lombok.Data;
|
|
|
+import net.bytebuddy.implementation.bytecode.Throw;
|
|
|
+import org.apache.commons.httpclient.methods.PostMethod;
|
|
|
+import org.apache.commons.httpclient.methods.multipart.FilePart;
|
|
|
+import org.apache.commons.httpclient.methods.multipart.Part;
|
|
|
+import org.apache.commons.httpclient.methods.multipart.StringPart;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
+import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.nio.charset.Charset;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.Instant;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+
|
|
|
+@Service
|
|
|
+public class InsGuoRenApiServiceImpl implements InsGuoRenApiService {
|
|
|
+
|
|
|
+
|
|
|
+ private static final Logger log = LoggerFactory.getLogger("guoRen");
|
|
|
+
|
|
|
+ @Value("${guoRen.baseUrl}")
|
|
|
+ private String baseUrl;
|
|
|
+ @Value("${guoRen.uploadUrl}")
|
|
|
+ private String uploadUrl;
|
|
|
+ @Value("${guoRen.redirectUrl}")
|
|
|
+ private String redirectUrl;
|
|
|
+
|
|
|
+
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadFilePath;
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String showFileUrl;
|
|
|
+ @Value("${api.url}")
|
|
|
+ private String apiUrl;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsAlltrustRequestApiComponents apiComponents;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private InsAlltrustRegionMapper insAlltrustRegionMapper;
|
|
|
+ @Autowired
|
|
|
+ private InsOrdersComponents insOrdersComponents;
|
|
|
+
|
|
|
+
|
|
|
+ private AuthorityDataXml authorityDataXml = null;
|
|
|
+
|
|
|
+
|
|
|
+ private ObjectMapper xmlMapper = null;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YcBuildData ycBuildData;
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private SysDeptService sysDeptService;
|
|
|
+ @Autowired
|
|
|
+ private EsmRetailService esmRetailService;
|
|
|
+ @Autowired
|
|
|
+ private EsmAgreementService esmAgreementService;
|
|
|
+ @Autowired
|
|
|
+ private EsmAgreementProdService esmAgreementProdService;
|
|
|
+ // @Autowired
|
|
|
+// private EsmUserInternalService esmUserInternalService;
|
|
|
+ @Autowired
|
|
|
+ private InsTaskHistoryService insTaskHistoryService;
|
|
|
+ @Autowired
|
|
|
+ private InsAreaCompanyService insAreaCompanyService;
|
|
|
+ @Autowired
|
|
|
+ private InsOrdersService insOrdersService;
|
|
|
+ // @Autowired
|
|
|
+// private InsTaskImageService insTaskImageService;
|
|
|
+ @Autowired
|
|
|
+ private InsTaskImagesService insTaskImageService;
|
|
|
+ @Autowired
|
|
|
+ private EsmInsAttachInsureMapper esmInsAttachInsureMapper;
|
|
|
+ @Autowired
|
|
|
+ private EsmInsAttachInsureDetailsMapper esmInsAttachInsureDetailsMapper;
|
|
|
+ @Autowired
|
|
|
+ private EsmInsCompanyService esmInsCompanyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ InsApiLogService insApiLogService;
|
|
|
+ @Autowired
|
|
|
+ ConfigureParametersComponents configureParametersComponents;
|
|
|
+ @Autowired
|
|
|
+ InsTaskImagesMapper insTaskImagesMapper;
|
|
|
+
|
|
|
+// private ChannelInfoResp channelInfo = null;
|
|
|
+
|
|
|
+ private static ChannelInfoDto channelInfo = null;
|
|
|
+
|
|
|
+// static {
|
|
|
+// ChannelInfoResp.DataDTO.PrptmainDTO channel = new ChannelInfoResp.DataDTO.PrptmainDTO();
|
|
|
+// channel.setComCode("160700A8");
|
|
|
+// //userCode 取这个
|
|
|
+// channel.setHandlerCode("151315A0");
|
|
|
+//
|
|
|
+// channelInfo = channel;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ //
|
|
|
+ //==============================API 方式
|
|
|
+ //
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取渠道信息
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年08月25日 0025
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult gainChannelInfo(String thirdCode) {
|
|
|
+ Map m = new HashMap();
|
|
|
+ m.put("thirdCode", thirdCode);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(m, "IIRBT00018");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr);
|
|
|
+
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ ChannelInfoResp resp = ResponseDto.buildBody(rest, ChannelInfoResp.class);
|
|
|
+// channelInfo = resp.getData().get(0);
|
|
|
+
|
|
|
+ return HttpResult.ok(resp);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 1 车型查询接口
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult modelsQueryApi(CarInfoVo carInfo) {
|
|
|
+
|
|
|
+ CarModelReq carModelReq = CarModelReq.buildCarModelParam(carInfo);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(carModelReq, "IIRBT00002");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr);
|
|
|
+
|
|
|
+ CarModelResp rest = JsonUtils.toObject(result, CarModelResp.class);
|
|
|
+
|
|
|
+ return HttpResult.ok(rest);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ModelsQueryResponse.VehicleInfo> modelsQuery(CarModel_Req carModelReq) {
|
|
|
+
|
|
|
+
|
|
|
+//
|
|
|
+//
|
|
|
+//// public List<CarModelDTO> modelsQuery(CarModel_Req carModelReq) {
|
|
|
+// // 获取协议配置信息
|
|
|
+// YcConfigureParameters ycConfigureParameters = gainYcConfigParams(carModelReq.getAgreementId());
|
|
|
+//
|
|
|
+//
|
|
|
+// ModelsQueryXml m = buildModelsQueryParam(carModelReq, ycConfigureParameters);
|
|
|
+// ObjectMapper xmlMapper = null;
|
|
|
+//
|
|
|
+// log.info("===永诚--车型查询接口请求开始===");
|
|
|
+// InsApiLog apiLog = httpPost(xmlMapper, m, YcBuildData.API_MODEL);
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+// log.info("===永诚--车型查询接口请求结束===");
|
|
|
+// try {
|
|
|
+// String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
+// ModelsQueryResponse rd = xmlMapper.readValue(cleanStr, ModelsQueryResponse.class);
|
|
|
+// return buildCarModel(rd);
|
|
|
+// } catch (IOException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void gainVehicleModel(YcConfigureParameters ycConfigureParameters, CarInfoVo carInfo) {
|
|
|
+
|
|
|
+ CarModel_Req carModelReq = new CarModel_Req();
|
|
|
+ carModelReq.setFrameNo(carInfo.getFrameNo());
|
|
|
+ carModelReq.setEngineNo(carInfo.getEngineNo());
|
|
|
+ carModelReq.setEnrollDate(carInfo.getRegisterDate().replaceAll("-", ""));
|
|
|
+
|
|
|
+ ModelsQueryXml m = buildModelsQueryParam(carModelReq, ycConfigureParameters);
|
|
|
+ ObjectMapper xmlMapper = null;
|
|
|
+
|
|
|
+ log.info("===永诚--车型查询接口请求开始===");
|
|
|
+ String responseData = httpPost(xmlMapper, m, YcBuildData.API_MODEL);
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+ log.info("===永诚--车型查询接口请求结束===");
|
|
|
+ try {
|
|
|
+ String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
+ ModelsQueryResponse rd = xmlMapper.readValue(cleanStr, ModelsQueryResponse.class);
|
|
|
+ List<ModelsQueryResponse.VehicleInfo> vehicleInfoList = buildCarModel(rd);
|
|
|
+
|
|
|
+ long count = vehicleInfoList.stream().filter(x -> x.getModelCode().equals(carInfo.getModelCode())).count();
|
|
|
+
|
|
|
+ if (count < 1) {
|
|
|
+ //匹配车辆信息
|
|
|
+ vehicleInfoList.stream().forEach(a -> {
|
|
|
+ //购置价匹配
|
|
|
+ if (a.getVehiclePrice().equals(carInfo.getPurchasePrice())) {
|
|
|
+ carInfo.setModelCode(a.getVehicleId());
|
|
|
+// carInfo.setCiModelCode(a.getModelCode());
|
|
|
+ carInfo.setCiCarName(a.getVehicleName());
|
|
|
+ carInfo.setModelcname(a.getVehicleName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new SystemException("车型查询接口异常,请联系管理。");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 车价查询
|
|
|
+// */
|
|
|
+// @Override
|
|
|
+// public HttpResult carPrice(BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
+//
|
|
|
+// RequestDto rDto = RequestDto.builRequestDto();
|
|
|
+// RequestDto.RequestPackage rpackage = rDto.getRPackage();
|
|
|
+//
|
|
|
+//
|
|
|
+// BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
|
|
|
+//
|
|
|
+////// //构造车型信息 获取保险公司车型信息
|
|
|
+//// gainVehicleModel(ycConfigureParameters, yaQuoteInfoVo.getCarInfo());
|
|
|
+//
|
|
|
+// CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
|
|
|
+// VinQueryReq vinQueryReq = new VinQueryReq();
|
|
|
+// vinQueryReq.setFrameNo(carInfo.getFrameNo());
|
|
|
+// vinQueryReq.setLicenseNo(carInfo.getLicenseNo());
|
|
|
+// vinQueryReq.setEngineNo(carInfo.getEngineNo());
|
|
|
+//
|
|
|
+// //vin码查询车辆信息
|
|
|
+// VinQueryResp.DataDTO vinQ = vinQuery(vinQueryReq);
|
|
|
+//
|
|
|
+// //构造请求参数
|
|
|
+// CarPriceReq req = CarPriceReq.buildCarPriceParam(yaQuoteInfoVo, vinQ, channelInfo);
|
|
|
+//
|
|
|
+// //请求参数
|
|
|
+// rpackage.setRBody(req);
|
|
|
+// rDto.setRPackage(rpackage);
|
|
|
+//
|
|
|
+// String bodyStr = JSON.toJSONString(rDto);
|
|
|
+// String result = HttpUtil.sendPost("https://devyun.guorenpcic.com/api/grchannel-interface/httpCurrency/httpJsonCommonEntrance", bodyStr);
|
|
|
+//
|
|
|
+// CarPriceResp rest = JsonUtils.toObject(result, CarPriceResp.class);
|
|
|
+//// if(null == rest){
|
|
|
+//// //返回多条
|
|
|
+//// CarPriceListResp restList = JsonUtils.toObject(result, CarPriceListResp.class);
|
|
|
+//// }
|
|
|
+//
|
|
|
+//// // 获取协议配置信息
|
|
|
+//// YcConfigureParameters ycConfigureParameters = gainYcConfigParams(quoteVo.getAgreementId());
|
|
|
+//
|
|
|
+//
|
|
|
+// return HttpResult.ok("车价查询");
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2 报价-
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult quoteApi(BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
+
|
|
|
+ log.debug("--------报价开始,订单号:{},协议号:{}--------------", quoteVo.getOrderNo(), quoteVo.getAgreementId());
|
|
|
+
|
|
|
+
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo(quoteVo.getAgreementId());
|
|
|
+ if (null == channelInfo) return HttpResult.error("请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
|
|
|
+ InsOrders order = insOrdersService.getById(yaQuoteInfoVo.getOrderNo());
|
|
|
+ CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 1、vin码查询
|
|
|
+ */
|
|
|
+ log.debug("vin码查询开始---");
|
|
|
+ VinQueryReq vinQueryReq = new VinQueryReq();
|
|
|
+ vinQueryReq.setFrameNo(carInfo.getFrameNo());
|
|
|
+ vinQueryReq.setLicenseNo(carInfo.getLicenseNo());
|
|
|
+ vinQueryReq.setEngineNo(carInfo.getEngineNo());
|
|
|
+
|
|
|
+ VinQueryResp.DataDTO vinQ = vinQuery(vinQueryReq);
|
|
|
+ if (null == vinQ) return HttpResult.error("未找到匹配的车辆信息");
|
|
|
+ log.debug("vin码查询通过---");
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2、车价查询
|
|
|
+ */
|
|
|
+ CarPriceResp.DataDTO carPriceResult = carPriceQuery(yaQuoteInfoVo, vinQ);
|
|
|
+ if (null == carPriceResult) return HttpResult.error("车价获取失败");
|
|
|
+// String redisNum = buildCarPriceQueryUidNum(order.getOrderno());
|
|
|
+
|
|
|
+ log.debug("车价查询通过");
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 3、保费计算
|
|
|
+ */
|
|
|
+ PremiumResp.DataDTO premiumResult = premiumQuery(yaQuoteInfoVo, carPriceResult, vinQ);
|
|
|
+
|
|
|
+
|
|
|
+ if (null == premiumResult) return HttpResult.error("保费计算失败");
|
|
|
+ log.debug("保费计算通过");
|
|
|
+
|
|
|
+ //转保
|
|
|
+
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 创建非车订单
|
|
|
+// */
|
|
|
+// nonAutoInsOrder(quoteVo.getAccidentalDrivingVo(), carPriceResult.getInputvo());
|
|
|
+
|
|
|
+ QuoteRespVo quoteRespVo = buildQuoteRespVo(order, premiumResult, yaQuoteInfoVo);
|
|
|
+ //8 生成订单
|
|
|
+ InsAreaCompany iac = response_order(order, quoteRespVo, quoteVo);
|
|
|
+ //生成订单扩展
|
|
|
+ responseOrderExtend(iac, quoteRespVo, premiumResult, carPriceResult.getInputvo());
|
|
|
+ insAreaCompanyService.save(iac);
|
|
|
+
|
|
|
+ quoteRespVo.setCompanyId(iac.getId());
|
|
|
+
|
|
|
+
|
|
|
+// // 获取协议配置信息
|
|
|
+// YcConfigureParameters ycConfigureParameters = gainYcConfigParams(quoteVo.getAgreementId());
|
|
|
+
|
|
|
+// //车价编号临时放入reids
|
|
|
+// RedisUtils.set(redisNum, carPriceResult.getInputvo(), 43200);
|
|
|
+ log.debug("--------报价结束,车牌:{},vin:{}--------------", carInfo.getLicenseNo(), carInfo.getVinNo());
|
|
|
+
|
|
|
+ return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 3 核保
|
|
|
+ *
|
|
|
+ * @param quoteOrderNo
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult auditApi(String quoteOrderNo) {
|
|
|
+ log.debug("----------核保开始,订单号:{}---------", quoteOrderNo);
|
|
|
+
|
|
|
+ //子订单
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
|
|
|
+ AssertionUtils.isEmpty(iac, "订单不存在");
|
|
|
+ if (iac != null) {
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
+ AssertionUtils.isEmpty(channelInfo, "请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+
|
|
|
+ }
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+
|
|
|
+
|
|
|
+ //核保基本赋值
|
|
|
+ iac.setAudittime(LocalDateTime.now());
|
|
|
+ iac.setAuditid(order.getUserid());
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_AUDIT.getCode());
|
|
|
+
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(order.getOrderno());
|
|
|
+
|
|
|
+ //2、核保
|
|
|
+ SubmitAuditResp auditResp = submitAudit(iac);
|
|
|
+
|
|
|
+ //核保状态 0初始值/1通过/2不通过/3 无需核保 9待核保
|
|
|
+ String statusJq = auditResp.getData().get(0).getUnderWriteFlagCI();
|
|
|
+ String statusSy = auditResp.getData().get(0).getUnderWriteFlagBI();
|
|
|
+ if (StringUtils.isEmpty(statusJq) && StringUtils.isEmpty(statusSy))
|
|
|
+ return HttpResult.error("核保失败:" + auditResp.getData().get(0).getMessage());
|
|
|
+
|
|
|
+ //单交 核保状态 0初始值/1通过/2不通过/3 无需核保 9待核保
|
|
|
+ if (StringUtils.isNotEmpty(statusJq) && StringUtils.isEmpty(statusSy)) {
|
|
|
+ if (statusJq.equals("1") || statusJq.equals("3")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ } else if (statusJq.equals("2")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //单商
|
|
|
+ if (StringUtils.isEmpty(statusJq) && StringUtils.isNotEmpty(statusSy)) {
|
|
|
+ if (statusSy.equals("1") || statusSy.equals("3")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ } else if (statusSy.equals("2")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //交商
|
|
|
+ if (StringUtils.isNotEmpty(statusJq) && StringUtils.isNotEmpty(statusSy)) {
|
|
|
+ if (statusJq.equals("2") || statusSy.equals("2")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
+ } else if (statusJq.equals("1") && statusSy.equals("1")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ } else if (statusJq.equals("3") && statusSy.equals("3")) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode())) {
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+ return HttpResult.error(auditResp.getData().get(0).getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ InsUtils.buildOrderStatus(order, iac);
|
|
|
+
|
|
|
+
|
|
|
+ iac.setJqappoint(""); //交强特别约定
|
|
|
+ iac.setSyappoint(""); //商业特别约定
|
|
|
+
|
|
|
+ if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_PAY.getCode())) {
|
|
|
+// //获取缴费地址
|
|
|
+// PayResp.DataDTO payResp = pay(iac);
|
|
|
+// iac.setPaymentLink(payResp.getPayUrl());
|
|
|
+ //获取签名地址
|
|
|
+ SignatureResp.DataDTO signature = signature(iac);
|
|
|
+ if (null == signature) log.error("核保操作:获取签名链接失败");
|
|
|
+ iac.setPaymentLink(signature.getElecapplyurl());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return HttpResult.error("核保操作失败,状态:" + InsOrderStatusEnum.matchKey(iac.getOrderstatus()).getDesc());
|
|
|
+ }
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+ insOrdersService.updateByOrderStatus(order.getOrderno(), order.getOrderstatus());
|
|
|
+
|
|
|
+
|
|
|
+ log.debug("----------核保结束,订单号:{}---------", quoteOrderNo);
|
|
|
+
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取保险公司订单信息
|
|
|
+ *
|
|
|
+ * @param quoteOrderNo
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult insOrderInfo(String iacNo) {
|
|
|
+
|
|
|
+ //子订单
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getById(iacNo);
|
|
|
+ AssertionUtils.isEmpty(iac, "订单不存在");
|
|
|
+ if (iac != null) {
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
+ AssertionUtils.isEmpty(channelInfo, "请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+
|
|
|
+ }
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+
|
|
|
+ InsOrderStatusResp iosr = insOrderStatus(iac);
|
|
|
+
|
|
|
+ if (null != iosr && CollUtil.isNotEmpty(iosr.getData())) {
|
|
|
+
|
|
|
+ InsOrderStatusResp.DataDTO jqDataDTO = iosr.getData().stream().filter(a -> a.getProposalNo().equals(iac.getJqapplyno())).findFirst().orElse(null);
|
|
|
+ InsOrderStatusResp.DataDTO syDataDTO = iosr.getData().stream().filter(b -> b.getProposalNo().equals(iac.getSyapplyno())).findFirst().orElse(null);
|
|
|
+
|
|
|
+ //待核保订单处理
|
|
|
+ if (iac.getOrderstatus().equals(InsOrderStatusEnum.WAIT_AUDIT.getCode())) {
|
|
|
+
|
|
|
+ //单交
|
|
|
+ boolean jqBoo = null != jqDataDTO && null == syDataDTO && jqDataDTO.getUnderwriteFlag().equals("1");
|
|
|
+ //单商
|
|
|
+ boolean syBoo = null != syDataDTO && null == jqDataDTO && syDataDTO.getUnderwriteFlag().equals("1");
|
|
|
+ //交商
|
|
|
+ boolean jqSyBoo = null != syDataDTO && null != jqDataDTO && syDataDTO.getUnderwriteFlag().equals("1") && jqDataDTO.getUnderwriteFlag().equals("1");
|
|
|
+
|
|
|
+ if (jqBoo || syBoo || jqSyBoo) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ //更新支付链接
|
|
|
+ PayResp.DataDTO payResp = pay(iac);
|
|
|
+ iac.setPaymentLink(payResp.getPayUrl());
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean updateFlag = false;
|
|
|
+ if (null != jqDataDTO && StringUtils.isNotEmpty(jqDataDTO.getPolicyNo())) {
|
|
|
+ iac.setJqpolicyno(jqDataDTO.getPolicyNo());
|
|
|
+ updateFlag = true;
|
|
|
+ }
|
|
|
+ if (null != syDataDTO && StringUtils.isNotEmpty(syDataDTO.getPolicyNo())) {
|
|
|
+ iac.setSypolicyno(syDataDTO.getPolicyNo());
|
|
|
+ updateFlag = true;
|
|
|
+ }
|
|
|
+ if (updateFlag) {
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+ order.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+ insOrdersService.updateById(order);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void toBePaidOrderStatus() {
|
|
|
+
|
|
|
+ log.info("《国任定时任务》---------更新订单状态开始---------------");
|
|
|
+ LambdaQueryWrapper<InsAreaCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(InsAreaCompany::getOrderstatus, InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ lqw.gt(InsAreaCompany::getAudittime, LocalDate.now().minusDays(1));
|
|
|
+ //国任
|
|
|
+ lqw.likeRight(InsAreaCompany::getCompanyId, InsuranceEnum.XDCX.getCode());
|
|
|
+ List<InsAreaCompany> list = insAreaCompanyService.list(lqw);
|
|
|
+
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ list.stream().forEach(a -> {
|
|
|
+ insOrderInfo(a.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ log.info("《国任定时任务》---------更新订单状态 结束---------------");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取支付链接 单独用
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年09月26日 0026
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult pay(String companyId) {
|
|
|
+
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo("115");
|
|
|
+ if (null == channelInfo) return HttpResult.error("请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+
|
|
|
+ //子订单
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getById(companyId);
|
|
|
+ if (iac == null) {
|
|
|
+ return HttpResult.error("订单不存在");
|
|
|
+ }
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(order.getOrderno());
|
|
|
+
|
|
|
+// InsuranceSlipResp insuranceSlip = gainInsuranceSlip(yaQuoteInfoVo.getOrderNo());
|
|
|
+
|
|
|
+ //获取缴费地址
|
|
|
+ PayResp.DataDTO payResp = pay(iac);
|
|
|
+ iac.setPaymentLink(payResp.getPayUrl());
|
|
|
+
|
|
|
+// insAreaCompanyService.updateById(iac);
|
|
|
+
|
|
|
+
|
|
|
+ return HttpResult.ok(iac);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 影像上传
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult uploadImageApi(String quoteOrderNo) {
|
|
|
+
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(quoteOrderNo);
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
+ if (null == channelInfo) return HttpResult.error("请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(order.getOrderno());
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 4、投保单保存
|
|
|
+ */
|
|
|
+ InsuranceSlipResp insuranceSlip = insuranceSlip(yaQuoteInfoVo, iac.getInsOrderNo());
|
|
|
+ if (insuranceSlip.getResultCode() == 1) return HttpResult.error(insuranceSlip.getResultMsg());
|
|
|
+ iac.setJqapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoCI());
|
|
|
+ iac.setSyapplyno(insuranceSlip.getData().getProposalNoDetailVo().getProposalNoBI());
|
|
|
+
|
|
|
+
|
|
|
+// String redisNum = buildCarPriceQueryUidNum(yaQuoteInfoVo.getOrderNo());
|
|
|
+// String uid = RedisUtils.get(redisNum);
|
|
|
+// //1、投保单保存
|
|
|
+// InsuranceSlipResp insuranceSlip = insuranceSlip(yaQuoteInfoVo, uid);
|
|
|
+
|
|
|
+// if(insuranceSlip.getResultCode() == 1) return HttpResult.error(insuranceSlip.getResultMsg());
|
|
|
+
|
|
|
+// RedisUtils.setObject(buildInsuranceSlipNum(yaQuoteInfoVo.getOrderNo()),insuranceSlip);
|
|
|
+
|
|
|
+ //影像上传
|
|
|
+ imageUpdate(iac, channelInfo);
|
|
|
+
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+
|
|
|
+
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 影像上传 调用三方
|
|
|
+ */
|
|
|
+ public void imageUpdate(InsAreaCompany iac, ChannelInfoDto channelInfo) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+ Map<String, Object> formMap = new HashMap<>();
|
|
|
+ formMap.put("businessNo", StringUtils.isEmpty(iac.getJqapplyno()) ? iac.getSyapplyno() : iac.getJqapplyno());
|
|
|
+ formMap.put("operatorCode", channelInfo.getHandlerCode());
|
|
|
+ formMap.put("comCode", channelInfo.getComCode());
|
|
|
+ formMap.put("fileGroup", "DZ");
|
|
|
+
|
|
|
+
|
|
|
+ List<InsUploadImagesDto> insUploadImagesDtos = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(iac.getOrderno());
|
|
|
+ insUploadImagesDtos.stream().forEach(a -> {
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+// FilePart file1 = new FilePart(fileName, new File("https://img0.baidu.com/it/u=3021883569,1259262591&fm=253&fmt=auto&app=120&f=JPEG?w=1140&h=641"));
|
|
|
+ FilePart file1 = new FilePart("file", new File(a.getFilePath()));
|
|
|
+
|
|
|
+
|
|
|
+ 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())
|
|
|
+ };
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPostFromFile(parts, uploadUrl);
|
|
|
+ if (StringUtils.isEmpty(result)) throw new SystemException("国任,影像上传失败");
|
|
|
+
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ if (StringUtils.toInt(jsonObject.get("resultCode")) == 0) return;
|
|
|
+ throw new SystemException("国任,影像上传失败,类型:" + a.getImageType());
|
|
|
+
|
|
|
+
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 支付 获取支付url
|
|
|
+ */
|
|
|
+ public PayResp.DataDTO pay(InsAreaCompany iac) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+ PayReq req = PayReq.buildParam(iac, redirectUrl, channelInfo);
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00008");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "获取支付链接,订单号:" + iac.getId());
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ PayResp resp = ResponseDto.buildBody(rest, PayResp.class);
|
|
|
+
|
|
|
+ if (null != rest) return resp.getData();
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 签名链接
|
|
|
+ */
|
|
|
+ public SignatureResp.DataDTO signature(InsAreaCompany iac) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+// PayReq req = PayReq.buildParam(iac, redirectUrl, channelInfo);
|
|
|
+ Map req = new HashMap();
|
|
|
+ req.put("proposalNo", StringUtils.isEmpty(iac.getJqapplyno()) ? iac.getSyapplyno() : iac.getJqapplyno());
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00046");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "获取签名链接,订单号:" + iac.getId());
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ SignatureResp resp = ResponseDto.buildBody(rest, SignatureResp.class);
|
|
|
+
|
|
|
+ if (null != rest) return resp.getData();
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 电子保单
|
|
|
+ */
|
|
|
+ public PolicyResp policyPrint(String policyNo) {
|
|
|
+
|
|
|
+ Map m = new HashMap();
|
|
|
+ m.put("policyNo", policyNo);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(m, "IIRBT00027");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr);
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ PolicyResp resp = ResponseDto.buildBody(rest, PolicyResp.class);
|
|
|
+
|
|
|
+ if (null != resp && resp.getResultCode() == 0) return resp;
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 6 电子保单
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult getPolicyPrintApi(PolicyPrintVo policyPrintVo) {
|
|
|
+
|
|
|
+ //子订单
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getById(policyPrintVo.getCompanyId());
|
|
|
+ AssertionUtils.isEmpty(iac, "订单不存在");
|
|
|
+ if (iac != null) {
|
|
|
+ // 获取协议配置信息
|
|
|
+ ChannelInfoDto channelInfo = gainChannelConfigInfo(iac.getAgreementId());
|
|
|
+ AssertionUtils.isEmpty(channelInfo, "请先配置保险公司渠道信息");
|
|
|
+ this.channelInfo = channelInfo;
|
|
|
+ }
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+
|
|
|
+ Map m = new HashMap();
|
|
|
+ String policyUrl = "https://devyun.guorenpcic.com/api/grsavecarcore/savecarcore/getElePolicyForGrecar?certiNo=";
|
|
|
+ if (policyPrintVo.getRiskCode().equals(InsuranceRisk.TRAFFIC.getCode())) {
|
|
|
+ PolicyResp policyResp = policyPrint(iac.getJqpolicyno());
|
|
|
+ //交强险标志
|
|
|
+ String ciFlag = "https://devyun.guorenpcic.com/api/grsavecarcore/savecarcore/getElePolicyFlagForGrecar?certiNo=" + policyResp.getData();
|
|
|
+ //交强险电子保单
|
|
|
+ String ciPolicy = policyUrl + policyResp.getData();
|
|
|
+
|
|
|
+ String jqFlagUrl = gainCarInsPolicy(ciFlag, "1", order.getLicenseno());
|
|
|
+ String jqUrl = gainCarInsPolicy(ciPolicy, "2", order.getLicenseno());
|
|
|
+ m.put("jqFlagUrl", jqFlagUrl);
|
|
|
+ m.put("jqUrl", jqUrl);
|
|
|
+ }
|
|
|
+ if (policyPrintVo.getRiskCode().equals(InsuranceRisk.BUSINESS.getCode())) {
|
|
|
+
|
|
|
+ PolicyResp policyResp = policyPrint(iac.getSypolicyno());
|
|
|
+ //商业险电子保单
|
|
|
+ String biPolicy = policyUrl + policyResp.getData();
|
|
|
+
|
|
|
+ String syUrl = gainCarInsPolicy(biPolicy, "3", order.getLicenseno());
|
|
|
+ m.put("syUrl", syUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return HttpResult.ok(m);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取车险保单 处理保单文件
|
|
|
+ *
|
|
|
+ * @param licensePlate 车牌号
|
|
|
+ * @param flag 标识 1:交强险标志,2:交强险保单,3:商业险保单
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年09月21日 0021
|
|
|
+ */
|
|
|
+ public String gainCarInsPolicy(String url, String flag, String licensePlate) {
|
|
|
+ String fileName = licensePlate;
|
|
|
+ if (flag.equals("1")) {
|
|
|
+ fileName += "-交强险标志.pdf";
|
|
|
+
|
|
|
+ } else if (flag.equals("2")) {
|
|
|
+ fileName += "-交强险电子保单.pdf";
|
|
|
+
|
|
|
+ } else if (flag.equals("3")) {
|
|
|
+ fileName += "-商业险电子保单.pdf";
|
|
|
+
|
|
|
+ }
|
|
|
+ String dir = "carInsPolicy/" + licensePlate + "/";
|
|
|
+ return FileUtil.netUrlToFile(url, dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驾意外险
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult gainAccidentList(AccidentalDrivingQueryVo accidentalDrivingVo) {
|
|
|
+
|
|
|
+ return null;
|
|
|
+// HttpResult httpResult = new HttpResult();
|
|
|
+//
|
|
|
+// try {
|
|
|
+//// InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
|
|
|
+//// InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+//// if (iac == null) {
|
|
|
+//// return HttpResult.error("报价订单不存在");
|
|
|
+//// }
|
|
|
+//
|
|
|
+// // 获取协议配置信息
|
|
|
+// ChannelInfoResp.DataDTO.PrptmainDTO channelInfo = gainChannelConfigInfo(accidentalDrivingVo.getAgreementId());
|
|
|
+// if(null == channelInfo)return HttpResult.error("请先配置保险公司渠道信息");
|
|
|
+// this.channelInfo = channelInfo;
|
|
|
+//
|
|
|
+//
|
|
|
+// //组装参数
|
|
|
+// Accident accident = Accident.buildPayParam(accidentalDrivingVo, ycConfigureParameters, null);
|
|
|
+//
|
|
|
+// ObjectMapper xmlMapper = null;
|
|
|
+// //接口请求
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询开始======");
|
|
|
+// InsApiLog apiLog = httpPost(xmlMapper, accident, YcBuildData.API_ACCIDENT);
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询结束!======");
|
|
|
+//// verifyRequest(apiLog, iac,InsQuoteFlow.);
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+//
|
|
|
+//
|
|
|
+// String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
+// AccidentResponse accidentResp = xmlMapper.readValue(cleanStr, AccidentResponse.class);
|
|
|
+//
|
|
|
+//
|
|
|
+// if (accidentResp.getHead().getResponseCompleteMessageStatus().getMessageStatusCode().equals("E0000")) {
|
|
|
+// //清空旧的存入表
|
|
|
+// LambdaQueryWrapper<EsmInsAttachInsure> lqw = new LambdaQueryWrapper<EsmInsAttachInsure>();
|
|
|
+// lqw.eq(EsmInsAttachInsure::getCompanyId, accidentalDrivingVo.getCompanyCode());
|
|
|
+// lqw.eq(EsmInsAttachInsure::getSeating, accidentalDrivingVo.getSeatNum());
|
|
|
+// esmInsAttachInsureMapper.delete(lqw);
|
|
|
+//
|
|
|
+// List<ResponseYwCvrg.CvrgList> cList = accidentResp.getResponseYwCvrg().getCvrgList();
|
|
|
+//
|
|
|
+// List<EsmInsAttachInsure> eiaiList = new ArrayList<>();
|
|
|
+// cList.stream().forEach(a -> {
|
|
|
+// EsmInsAttachInsure ati = new EsmInsAttachInsure();
|
|
|
+// ati.setCode(a.getCInsuranceTypeCode());
|
|
|
+// ati.setName(a.getCInsuranceType());
|
|
|
+// ati.setSeating(accidentalDrivingVo.getSeatNum() + "");
|
|
|
+// ati.setCompanyId(accidentalDrivingVo.getCompanyCode());
|
|
|
+// ati.setType(AttachInsureEnum.AI001.getCode());
|
|
|
+// ati.setEnable(WhetherEnum.YES.getCode());
|
|
|
+// ati.setRestrictNum(StringUtils.toInt(a.getNPurchaseLimitsNum()));
|
|
|
+//
|
|
|
+// esmInsAttachInsureMapper.insert(ati);
|
|
|
+// eiaiList.add(ati);
|
|
|
+// });
|
|
|
+//
|
|
|
+//
|
|
|
+// httpResult.setData(eiaiList);
|
|
|
+//// httpResult.setData(accidentResp.getResponseYwCvrg().getCvrgList());
|
|
|
+// httpResult.setMsg(accidentResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription());
|
|
|
+// } else {
|
|
|
+// httpResult.setMsg(accidentResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription());
|
|
|
+// }
|
|
|
+//
|
|
|
+// } catch (SystemException e) {
|
|
|
+// return HttpResult.error(e.getMessage());
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// return HttpResult.error("系统错误,请联系管理员");
|
|
|
+// }
|
|
|
+// return httpResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驾意外险 同步
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HttpResult syncAccidentInsure(AccidentalDrivingQueryVo accidentalDrivingVo) {
|
|
|
+
|
|
|
+
|
|
|
+ //家用车驾乘意外险-山西版(02746425173001)
|
|
|
+ String goodsCode = "02746425173001";
|
|
|
+ NonAutoInsResp.DataDTO nonAutoIns = gainNonAutoInsList(goodsCode);
|
|
|
+
|
|
|
+
|
|
|
+// AccidentResponse ar = gainAccidentInsure(accidentalDrivingVo, null);
|
|
|
+// List<EsmInsAttachInsure> eiaiList = new ArrayList<>();
|
|
|
+
|
|
|
+ if (null != nonAutoIns) {
|
|
|
+ //清空旧的存入表
|
|
|
+ LambdaQueryWrapper<EsmInsAttachInsure> lqw = new LambdaQueryWrapper<EsmInsAttachInsure>();
|
|
|
+ lqw.eq(EsmInsAttachInsure::getCompanyId, accidentalDrivingVo.getCompanyCode());
|
|
|
+ lqw.eq(EsmInsAttachInsure::getSeating, accidentalDrivingVo.getSeatNum());
|
|
|
+ lqw.select(EsmInsAttachInsure::getId);
|
|
|
+ List<EsmInsAttachInsure> eiaiList = esmInsAttachInsureMapper.selectList(lqw);
|
|
|
+
|
|
|
+
|
|
|
+ //删除已经存在的数据
|
|
|
+ if (CollUtil.isNotEmpty(eiaiList)) {
|
|
|
+
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ eiaiList.stream().forEach(i -> {
|
|
|
+ ids.add(i.getId());
|
|
|
+ });
|
|
|
+ LambdaQueryWrapper<EsmInsAttachInsureDetails> lqwDetails = new LambdaQueryWrapper<>();
|
|
|
+ lqwDetails.in(EsmInsAttachInsureDetails::getAttachInsureId, ids);
|
|
|
+ //详情删除
|
|
|
+ esmInsAttachInsureDetailsMapper.delete(lqwDetails);
|
|
|
+
|
|
|
+ // esmInsAttachInsureMapper.delete(lqw);
|
|
|
+ esmInsAttachInsureMapper.deleteBatchIds(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<NonAutoInsResp.DataDTO.ProdListDTO> prodList = nonAutoIns.getProdList();
|
|
|
+
|
|
|
+
|
|
|
+ prodList.stream().forEach(a -> {
|
|
|
+ EsmInsAttachInsure ati = new EsmInsAttachInsure();
|
|
|
+ ati.setCode(a.getProdRisk());
|
|
|
+ ati.setName(a.getProdRisk());
|
|
|
+ ati.setSeating(accidentalDrivingVo.getSeatNum() + "");
|
|
|
+ ati.setCompanyId(accidentalDrivingVo.getCompanyCode());
|
|
|
+ ati.setType(AttachInsureEnum.AI001.getCode());
|
|
|
+ ati.setEnable(WhetherEnum.YES.getCode());
|
|
|
+ ati.setRestrictNum(20);
|
|
|
+
|
|
|
+ esmInsAttachInsureMapper.insert(ati);
|
|
|
+
|
|
|
+
|
|
|
+ AtomicInteger total = new AtomicInteger(0);
|
|
|
+ //具体方案信息
|
|
|
+ a.getProdRiskList().get(0).getProdCvgLiabList().stream().forEach(d -> {
|
|
|
+ EsmInsAttachInsureDetails atiDetails = new EsmInsAttachInsureDetails();
|
|
|
+ atiDetails.setAttachInsureId(ati.getId());
|
|
|
+ atiDetails.setName(d.getLiabName());
|
|
|
+ atiDetails.setCarSum(d.getLiabAmount().toString());
|
|
|
+ atiDetails.setSeatSum(d.getLiabAmount().toString());
|
|
|
+ atiDetails.setPremium(d.getLiabPremium().toString());
|
|
|
+ total.addAndGet(StringUtils.toInt(atiDetails.getPremium()));
|
|
|
+ esmInsAttachInsureDetailsMapper.insert(atiDetails);
|
|
|
+ });
|
|
|
+
|
|
|
+ ati.setPremium(total.get() + "");
|
|
|
+ esmInsAttachInsureMapper.updateById(ati);
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return HttpResult.ok("同步成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驾意外险
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AccidentResponse gainAccidentInsure(AccidentalDrivingQueryVo accidentalDrivingVo, NonAutoInsResp.DataDTO.ProdListDTO.ProdRiskListDTO scheme) {
|
|
|
+// HttpResult httpResult = new HttpResult();
|
|
|
+//
|
|
|
+// // 获取协议配置信息
|
|
|
+// YcConfigureParameters ycConfigureParameters = gainYcConfigParams(accidentalDrivingVo.getAgreementId());
|
|
|
+// //组装参数
|
|
|
+// Accident accident = Accident.buildPayParam(accidentalDrivingVo, ycConfigureParameters, schemeNo);
|
|
|
+//
|
|
|
+// ObjectMapper xmlMapper = null;
|
|
|
+// //接口请求
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询开始======");
|
|
|
+// InsApiLog apiLog = httpPost(xmlMapper, accident, YcBuildData.API_ACCIDENT);
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询结束!======");
|
|
|
+//// verifyRequest(apiLog, iac,InsQuoteFlow.);
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+//
|
|
|
+//
|
|
|
+// String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
+// AccidentResponse accidentResp = null;
|
|
|
+// try {
|
|
|
+// accidentResp = xmlMapper.readValue(cleanStr, AccidentResponse.class);
|
|
|
+// } catch (JsonProcessingException e) {
|
|
|
+// log.error("转换错误 方法:gainAccidentInsure 类:AccidentResponse");
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// return accidentResp;
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public HttpResult callBackApi(HttpServletRequest request) {
|
|
|
+
|
|
|
+ //支付流水号
|
|
|
+ String orderNo = request.getParameter("orderNo");
|
|
|
+ //承保状态 0未承保 1承保
|
|
|
+ String type = request.getParameter("type");
|
|
|
+ //支付结果 0成功 1失败
|
|
|
+ String payResult = request.getParameter("result");
|
|
|
+ //错误信息 有则必传
|
|
|
+ String message = request.getParameter("message");
|
|
|
+ //保单号 多个保单号用:连接
|
|
|
+ String proposalNo = request.getParameter("proposalNo");
|
|
|
+ //投保单号 多个投保单号用:连接
|
|
|
+ String policyNo = request.getParameter("policyNo");
|
|
|
+ //订单号
|
|
|
+ String orderId = request.getParameter("orderId");
|
|
|
+ //验签信息 MD5(要素1+3+2+4+5+6+7+私钥)
|
|
|
+ String signMsg = request.getParameter("signMsg");
|
|
|
+
|
|
|
+ List<String> proposalNoList = Arrays.asList(proposalNo.split(":"));
|
|
|
+
|
|
|
+
|
|
|
+ if (type.equals("1")) {
|
|
|
+
|
|
|
+ LambdaQueryWrapper<InsAreaCompany> lqw = new LambdaQueryWrapper();
|
|
|
+ lqw.or(a -> a.eq(InsAreaCompany::getJqapplyno, proposalNoList.get(0)).eq(InsAreaCompany::getSyapplyno, proposalNoList.get(1)));
|
|
|
+// //交强投保单号查询
|
|
|
+// lqw.eq(StringUtils.isNotEmpty(param.getCiPolicyAppNo()), InsAreaCompany::getJqapplyno, param.getCiPolicyAppNo());
|
|
|
+// //商业投保单号查询
|
|
|
+// lqw.eq(StringUtils.isNotEmpty(param.getBizPolicyAppNo()), InsAreaCompany::getSyapplyno, param.getBizPolicyAppNo());
|
|
|
+ InsAreaCompany iac = insAreaCompanyService.getOne(lqw);
|
|
|
+
|
|
|
+
|
|
|
+ if (null != iac) {
|
|
|
+// if (StringUtils.isNotEmpty(param.getBizPolicyNo())) iac.setSypolicyno(param.getBizPolicyNo());
|
|
|
+// if (StringUtils.isNotEmpty(param.getCiPolicyNo())) iac.setJqpolicyno(param.getCiPolicyNo());
|
|
|
+
|
|
|
+ iac.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+
|
|
|
+
|
|
|
+ InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
+ if (StringUtils.toInt(order.getOrderstatus()) < StringUtils.toInt(iac.getOrderstatus())) {
|
|
|
+ order.setOrderstatus(iac.getOrderstatus());
|
|
|
+ }
|
|
|
+
|
|
|
+ insAreaCompanyService.updateById(iac);
|
|
|
+ insOrdersService.updateByOrderStatus(order.getOrderno(), order.getOrderstatus());
|
|
|
+
|
|
|
+ return HttpResult.ok("承保");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return HttpResult.ok("未承保");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description:构造车型查询参数
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年02月08日 0008
|
|
|
+ */
|
|
|
+ private ModelsQueryXml buildModelsQueryParam(CarModel_Req carModelReq, YcConfigureParameters ycConfigureParameters) {
|
|
|
+ ModelsQueryXml m = new ModelsQueryXml();
|
|
|
+ ModelsQueryXml.RequestLabel requestLabel = new ModelsQueryXml.RequestLabel();
|
|
|
+ requestLabel.setSearchKeyword(carModelReq.getFrameNo().substring(0, 8));
|
|
|
+ requestLabel.setVid(carModelReq.getFrameNo());
|
|
|
+ requestLabel.setEngineNo(carModelReq.getEngineNo());
|
|
|
+ requestLabel.setDptCde(ycConfigureParameters.getDptCde());
|
|
|
+ requestLabel.setProno("0326");
|
|
|
+ requestLabel.setMotorTypeCode("11");
|
|
|
+ requestLabel.setCFstRegYm(carModelReq.getEnrollDate());
|
|
|
+ requestLabel.setAuthorityData(ycConfigureParameters.gainAuthorityDataXml());
|
|
|
+
|
|
|
+
|
|
|
+ m.setRequestLabel(requestLabel);
|
|
|
+
|
|
|
+
|
|
|
+ return m;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 构造返回内容,参考永安
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年02月07日 0007
|
|
|
+ */
|
|
|
+ private List<ModelsQueryResponse.VehicleInfo> buildCarModel(ModelsQueryResponse modelsQueryResponse) {
|
|
|
+ List<ModelsQueryResponse.VehicleInfo> vList = modelsQueryResponse.getVehicleInfoList();
|
|
|
+ return vList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private <T> String httpPost(ObjectMapper mapper, T requestData, String apiName) {
|
|
|
+
|
|
|
+ String xmlString = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tns=\"http://newWS.front.app.echannel.ebiz.alltrust.com/\">";
|
|
|
+ xmlString += "<soapenv:Body>";
|
|
|
+ try {
|
|
|
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
+ xmlString += mapper.writeValueAsString(requestData);
|
|
|
+
|
|
|
+ xmlString += "</soapenv:Body>\n" +
|
|
|
+ "</soapenv:Envelope>";
|
|
|
+
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ throw new RuntimeException("永诚API方式-xml转换失败");
|
|
|
+ }
|
|
|
+ String s = HttpXmlUtil.sendPost(apiComponents.getUrl() + apiName, xmlString);
|
|
|
+ return s;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 拷贝永安方法,可以封装
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年02月08日 0008
|
|
|
+ */
|
|
|
+ private void checkEmpty(YaQuoteInfoVo yaQuoteInfoVo) {
|
|
|
+
|
|
|
+ if (yaQuoteInfoVo.getCarInfo() == null) {
|
|
|
+ throw new SystemException("carInfo不能为空!");
|
|
|
+ }
|
|
|
+ if (yaQuoteInfoVo.getPolicyHolderInfo() == null || yaQuoteInfoVo.getInsuredPersonInfo() == null) {
|
|
|
+ throw new SystemException("policyHolderInfo/insuredPersonInfo 不能为空!");
|
|
|
+ }
|
|
|
+ if (yaQuoteInfoVo.getRiskList() == null || yaQuoteInfoVo.getRiskList().size() == 0) {
|
|
|
+ throw new SystemException("riskList 不能为空!");
|
|
|
+ } else {
|
|
|
+ for (RiskInfoVo riskInfoVo : yaQuoteInfoVo.getRiskList()) {
|
|
|
+ if (riskInfoVo.getStartDate() == null || riskInfoVo.getEndDate() == null) {
|
|
|
+ throw new SystemException("riskList.startDate / riskList.endDate不能为空!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新订单 - 子订单 改造为通用
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-10-18
|
|
|
+ */
|
|
|
+ private InsAreaCompany response_order(InsOrders insOrder, QuoteRespVo quoteRespVo, BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
+
|
|
|
+
|
|
|
+ EsmInsCompany eic = esmInsCompanyService.getById(quoteVo.getCompanyId());
|
|
|
+
|
|
|
+
|
|
|
+ //保存订单信息
|
|
|
+ InsAreaCompany insAreaCompany = new InsAreaCompany();
|
|
|
+ insAreaCompany.setOrderno(insOrder.getOrderno());
|
|
|
+ insAreaCompany.setSumpremium(BigDecimal.valueOf(quoteRespVo.getSumPermium()));
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
|
|
|
+ insAreaCompany.setRiskinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getRiskList())));
|
|
|
+ insAreaCompany.setKindinfo(JSONObject.parseArray(JSONObject.toJSONString(quoteRespVo.getKindList())));
|
|
|
+ insAreaCompany.setCreatetime(LocalDateTime.now());
|
|
|
+ insAreaCompany.setInsOrderNo(StringUtils.EMPTY);
|
|
|
+ insAreaCompany.setCompanyId(eic.getId());
|
|
|
+ insAreaCompany.setInscompany(eic.getNamesimple());
|
|
|
+ insAreaCompany.setAgreementId(quoteVo.getAgreementId());
|
|
|
+
|
|
|
+// insAreaCompany.setJqapplyno(proposalNoDetailVo.getProposalNoCI());
|
|
|
+// insAreaCompany.setSyapplyno(proposalNoDetailVo.getProposalNoBI());
|
|
|
+
|
|
|
+ insAreaCompany.setJqStartDate(quoteRespVo.getStartDateJq());
|
|
|
+ insAreaCompany.setJqEndDate(quoteRespVo.getEndDateJq());
|
|
|
+
|
|
|
+ insAreaCompany.setSyStartDate(quoteRespVo.getStartDateSy());
|
|
|
+ insAreaCompany.setSyEndDate(quoteRespVo.getEndDateSy());
|
|
|
+
|
|
|
+ return insAreaCompany;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新订单 - 子订单 补充
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-10-18
|
|
|
+ */
|
|
|
+ private void responseOrderExtend(InsAreaCompany iac, QuoteRespVo quoteRespVo, PremiumResp.DataDTO premiumResult, String carPriceUuid) {
|
|
|
+
|
|
|
+ //交强保费 含税
|
|
|
+ BigDecimal jqPremium = BigDecimal.valueOf(StringUtils.toDouble(premiumResult.getSumPremiumCI()));
|
|
|
+ //商业保费 含税
|
|
|
+ BigDecimal syPremium = BigDecimal.valueOf(StringUtils.toDouble(premiumResult.getSumPremiumBI()));
|
|
|
+
|
|
|
+
|
|
|
+ boolean jq_falg = jqPremium.doubleValue() > 0 ? true : false;
|
|
|
+ //保存订单信息
|
|
|
+ iac.setReptxt(JSONObject.parseObject(JSONObject.toJSONString(premiumResult)));
|
|
|
+ iac.setJqpremium(jqPremium);
|
|
|
+ iac.setSypremium(syPremium);
|
|
|
+ iac.setTaxamount(BigDecimal.valueOf(jq_falg ? quoteRespVo.getTaxAmount() : 0));
|
|
|
+ iac.setScore(StringUtils.toString(premiumResult.getBirate().getBillcomeGroup()));
|
|
|
+
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("出险信息,交强险:");
|
|
|
+ if (CollUtil.isNotEmpty(premiumResult.getCiInsureDemandPay())) {
|
|
|
+ sb.append(premiumResult.getCiInsureDemandPay().size());
|
|
|
+ } else {
|
|
|
+ sb.append("0");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //商业险出险次数
|
|
|
+ iac.setAccidentStrInfo(sb.toString());
|
|
|
+
|
|
|
+ //@TODO 临时用保险公司订单号存放 投保单查询需要
|
|
|
+ iac.setInsOrderNo(carPriceUuid);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static double add(double v1, double v2) {
|
|
|
+
|
|
|
+ BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
|
|
+
|
|
|
+ BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
|
|
+
|
|
|
+ return b1.add(b2).doubleValue();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static String getUserName() {
|
|
|
+
|
|
|
+ return "";
|
|
|
+// String userName = null;
|
|
|
+// Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
|
|
+//
|
|
|
+// if (principal instanceof UserDetails) {
|
|
|
+// userName = ((UserDetails) principal).getUsername();
|
|
|
+// } else {
|
|
|
+// userName = principal.toString();
|
|
|
+// }
|
|
|
+// return userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证远程请求
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年02月22日 0022
|
|
|
+ */
|
|
|
+ private void verifyRequest(InsApiLog apiLog, InsAreaCompany insAreaCompany, InsQuoteFlow iqf) {
|
|
|
+ //增加api日志
|
|
|
+ insApiLogService.insertAsync(new InsApiLog(insAreaCompany, apiLog, iqf));
|
|
|
+ if (StringUtils.isNotEmpty(apiLog.getExceptionMsg())) {
|
|
|
+ throw new SystemException("远程接口调用异常");
|
|
|
+// throw new RuntimeException("远程接口调用异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+// /**
|
|
|
+// * 验证远程请求
|
|
|
+// *
|
|
|
+// * @author: lig
|
|
|
+// * @date: 2023年02月22日 0022
|
|
|
+// */
|
|
|
+// private void verifyRequest(InsApiLog apiLog, InsAreaCompany insAreaCompany) {
|
|
|
+// //增加api日志
|
|
|
+// insApiLogService.insertAsync(new InsApiLog(insAreaCompany, apiLog));
|
|
|
+// if (StringUtils.isNotEmpty(apiLog.getExceptionMsg())) {
|
|
|
+// throw new RuntimeException("远程接口调用异常");
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新api log
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-03-21
|
|
|
+ */
|
|
|
+ private void updateApiLog(InsApiLog apiLog, InsAreaCompany iac) {
|
|
|
+ if (null != apiLog && null != iac) {
|
|
|
+ apiLog.setOrderNo(StringUtils.toString(iac.getId()));
|
|
|
+// apiLog.setOrderStatus(iac.getOrderstatus());
|
|
|
+ insApiLogService.UpdateAsync(apiLog);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, String> gainRegionCode(String address) {
|
|
|
+
|
|
|
+// log.debug("*********永诚API方式 - 身份证地址解析 参数:" + address);
|
|
|
+ Map<String, String> m = IDCardUtils.addressResolution(address);
|
|
|
+ if (null == m) return null;
|
|
|
+ String city = m.get("city");
|
|
|
+ String district = m.get("district");
|
|
|
+// if(StringUtils.isNullOrEmpty(district)){
|
|
|
+// //第二级赋值到第三级
|
|
|
+// district = city;
|
|
|
+// }
|
|
|
+
|
|
|
+ List<InsAlltrustRegion> areaList = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotEmpty(district)) {
|
|
|
+ //查询地区
|
|
|
+ LambdaQueryWrapper<InsAlltrustRegion> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(InsAlltrustRegion::getArea, district);
|
|
|
+ areaList = insAlltrustRegionMapper.selectList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //如果地区查不到 用城市当地区查
|
|
|
+ if (null == areaList || areaList.size() < 1) {
|
|
|
+ LambdaQueryWrapper<InsAlltrustRegion> cityLqw = new LambdaQueryWrapper<>();
|
|
|
+ cityLqw.eq(InsAlltrustRegion::getArea, city);
|
|
|
+ areaList = insAlltrustRegionMapper.selectList(cityLqw);
|
|
|
+ }
|
|
|
+ if (null != areaList && areaList.size() > 0) {
|
|
|
+ Map rMap = new HashMap();
|
|
|
+ rMap.put("provinceCode", areaList.get(0).getProvinceCode());
|
|
|
+ rMap.put("cityCode", areaList.get(0).getCityCode());
|
|
|
+ rMap.put("areaCode", areaList.get(0).getAreaCode());
|
|
|
+ return rMap;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void buildRegion(Ruote m) {
|
|
|
+ //车主
|
|
|
+ Vhlowner owner = m.getRequestLabel().getCondition().getVhlowner();
|
|
|
+ //被保人
|
|
|
+ Insured i = m.getRequestLabel().getCondition().getInsured();
|
|
|
+ //投保人
|
|
|
+ Applicant a = m.getRequestLabel().getCondition().getApplicant();
|
|
|
+
|
|
|
+
|
|
|
+ String provinceCode = "provinceCode";
|
|
|
+ String cityCode = "cityCode";
|
|
|
+ String areaCode = "areaCode";
|
|
|
+// owner.getCAreaCde()
|
|
|
+
|
|
|
+ Map<String, String> ownerMap = gainRegionCode(owner.getCWaddress());
|
|
|
+ if (null != ownerMap && ownerMap.size() > 0) {
|
|
|
+ owner.setCProvince(ownerMap.get(provinceCode));
|
|
|
+ owner.setCCity(ownerMap.get(cityCode));
|
|
|
+ owner.setCCounty(ownerMap.get(areaCode));
|
|
|
+ //清空格式化 自建数据
|
|
|
+ owner.setCWaddress(null);
|
|
|
+ } else {
|
|
|
+ throw new SystemException("永诚 - 车主地区获取失败,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> iMap = gainRegionCode(i.getCClntAddr());
|
|
|
+ if (null != iMap && iMap.size() > 0) {
|
|
|
+ i.setCProvince(iMap.get(provinceCode));
|
|
|
+ i.setCCity(iMap.get(cityCode));
|
|
|
+ i.setCCounty(iMap.get(areaCode));
|
|
|
+ } else {
|
|
|
+ throw new SystemException("永诚 - 被保人地区获取失败,请联系管理员");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> aMap = gainRegionCode(a.getCClntAddr());
|
|
|
+ if (null != aMap && aMap.size() > 0) {
|
|
|
+ a.setCProvince(aMap.get(provinceCode));
|
|
|
+ a.setCCity(aMap.get(cityCode));
|
|
|
+ a.setCCounty(aMap.get(areaCode));
|
|
|
+ } else {
|
|
|
+ throw new SystemException("永诚 - 投保人地区获取失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 构造回调
|
|
|
+// * 依赖 buildCallBack
|
|
|
+// *
|
|
|
+// * @author: lig
|
|
|
+// * @date: 2023-05-06
|
|
|
+// */
|
|
|
+// private InsAreaCompany buildCallBack(InsAreaCompany iac, CallBackRequest param) {
|
|
|
+// //正常回调 与 补传回调
|
|
|
+// if (StringUtils.isNotEmpty(param.getStatus())) {
|
|
|
+// iac = buildCallBackStatus(iac, param.getStatus());
|
|
|
+// } else {
|
|
|
+// if (StringUtils.isNotEmpty(param.getJqstatus())) {
|
|
|
+// iac = buildCallBackStatus(iac, param.getJqstatus());
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(param.getSystatus())) {
|
|
|
+// iac = buildCallBackStatus(iac, param.getSystatus());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// return iac;
|
|
|
+// }
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 构造回调状态
|
|
|
+// *
|
|
|
+// * @author: lig
|
|
|
+// * @date: 2023-05-06
|
|
|
+// */
|
|
|
+// private InsAreaCompany buildCallBackStatus(InsAreaCompany iac, String status) {
|
|
|
+// if (status.equals("9")) {
|
|
|
+// iac.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+// //更新支付连接
|
|
|
+// log.debug("准备进入获取支付连接######################");
|
|
|
+// iac = getPayUrlApi(iac);
|
|
|
+// log.debug("结束 - 准备进入获取支付连接######################");
|
|
|
+// }
|
|
|
+// if (status.equals("3")) {
|
|
|
+// iac.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
|
|
|
+// }
|
|
|
+// if (status.equals("1")) {
|
|
|
+// iac.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+// }
|
|
|
+// return iac;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// /**
|
|
|
+// * 通过修改参数后 报价
|
|
|
+// *
|
|
|
+// * @author: lig
|
|
|
+// * @date: 2023年05月17日 0017
|
|
|
+// */
|
|
|
+// private RuoteResponse quoteApiByEdit(Ruote m) {
|
|
|
+//
|
|
|
+// RuoteResponse rd = null;
|
|
|
+//
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - (修改参数后)报价开始======");
|
|
|
+// InsApiLog apiLog = httpPost(xmlMapper, m, YcBuildData.API_QUOTE);
|
|
|
+// log.debug("=========永诚API方式 - xml请求 - (修改参数后)报价结束!======");
|
|
|
+// verifyRequest(apiLog, null, InsQuoteFlow.Q_S_0);
|
|
|
+//
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+//
|
|
|
+// try {
|
|
|
+// String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
+// rd = xmlMapper.readValue(cleanStr, RuoteResponse.class);
|
|
|
+//
|
|
|
+//
|
|
|
+// } catch (IOException e) {
|
|
|
+// log.error("=========永诚API方式 - xml请求 - (修改参数后)报价 错误:" + e.getMessage());
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+// return rd;
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 请求API接口,返回对象
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年05月18日 0018
|
|
|
+ */
|
|
|
+ private <T> T requestApi(Object m, T response, InsAreaCompany iac, String reqUrl, InsQuoteFlow iqf) {
|
|
|
+// private Object aaa(T m,T ruoteResponse,InsAreaCompany iac){
|
|
|
+ //6 接口请求
|
|
|
+ log.debug("=========永诚API方式 - xml请求 - {}开始======", iqf.getDesc());
|
|
|
+ String s = httpPost(xmlMapper, m, reqUrl);
|
|
|
+ log.debug("=========永诚API方式 - xml请求 - {}结束!======", iqf.getDesc());
|
|
|
+// verifyRequest(apiLog, iac, iqf);
|
|
|
+
|
|
|
+// String responseData = apiLog.getResponseData();
|
|
|
+ String cleanStr = YcBuildData.cleanResponseStr(s);
|
|
|
+// Object rd = null;
|
|
|
+ try {
|
|
|
+ response = (T) xmlMapper.readValue(cleanStr, response.getClass());
|
|
|
+ return response;
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ log.debug("=========永诚API方式 - xml请求 - {}解析报错:{}", iqf.getDesc(), e.getMessage());
|
|
|
+// throw new RuntimeException(e);
|
|
|
+ throw new SystemException("请求接口失败,对象转换错误,请联系管理员。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// private boolean gainResultFlag(RuoteResponse rd,Ruote m){
|
|
|
+// boolean flag = false;
|
|
|
+// if (null == rd) {
|
|
|
+// throw new SystemException("远程请求报价失败");
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (rd.getHead().getErrorCode().equals("000000")) {
|
|
|
+// //获取失败
|
|
|
+// boolean fail = !(StringUtils.isNotEmpty(rd.getVhl().getCQryCdeJQ()) || StringUtils.isNotEmpty(rd.getVhl().getCQryCdeSY()));
|
|
|
+// if (fail) {
|
|
|
+// //如果类型错误,修改类型后,继续报价
|
|
|
+// if (StringUtils.isNotEmpty(rd.getVhl().getCBusType())) {
|
|
|
+// //修改类型继续报价
|
|
|
+// m.getRequestLabel().getCondition().getVhl().setCBusType(rd.getVhl().getCBusType());
|
|
|
+// rd = requestApi(m, new RuoteResponse(), iac, YcBuildData.API_QUOTE, InsQuoteFlow.Q_S_0);
|
|
|
+// if (null == rd) return HttpResult.error("远程请求报价失败");
|
|
|
+// if (fail) {
|
|
|
+// throw new SystemException(rd.getHead().getErrorMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// throw new SystemException(rd.getHead().getErrorMessage());
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// throw new SystemException(rd.getHead().getErrorMessage());
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取渠道配置信息
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年08月25日 0025
|
|
|
+ */
|
|
|
+ private ChannelInfoDto gainChannelConfigInfo(String agreementId) {
|
|
|
+ ChannelInfoDto channelInfo = new ChannelInfoDto();
|
|
|
+ configureParametersComponents.toEntity(channelInfo, agreementId);
|
|
|
+ return channelInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造 响应 QuoteRespVo
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-08-21
|
|
|
+ */
|
|
|
+ public static QuoteRespVo buildQuoteRespVo(InsOrders insOrder, PremiumResp.DataDTO rd, YaQuoteInfoVo yaQuoteInfoVo) {
|
|
|
+
|
|
|
+
|
|
|
+// if(CollUtil.isEmpty(rd.getItemVOList())){
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ //交强保费 含税
|
|
|
+ BigDecimal jqPremiumBig = BigDecimal.valueOf(StringUtils.toDouble(rd.getSumPremiumCI()));
|
|
|
+ //商业保费 含税
|
|
|
+ BigDecimal syPremiumBig = BigDecimal.valueOf(StringUtils.toDouble(rd.getSumPremiumBI()));
|
|
|
+ //车船税保费 含税
|
|
|
+ BigDecimal taxPremiumBig = BigDecimal.valueOf(StringUtils.toDouble(rd.getSumPayTax()));
|
|
|
+ //保费合计
|
|
|
+ BigDecimal sumPermium = jqPremiumBig.add(syPremiumBig).add(taxPremiumBig);
|
|
|
+
|
|
|
+// //交强保费 含税
|
|
|
+// double jqPremium = 0;
|
|
|
+
|
|
|
+ List<QuoteKindRespVo> kindRespVoList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ QuoteRespVo quoteRespVo = new QuoteRespVo();
|
|
|
+ quoteRespVo.setStartDateJq(rd.getCiStartDate());
|
|
|
+ quoteRespVo.setEndDateJq(rd.getCiEndDate());
|
|
|
+ quoteRespVo.setStartDateSy(rd.getBiStartDate());
|
|
|
+ quoteRespVo.setEndDateSy(rd.getBiEndDate());
|
|
|
+
|
|
|
+
|
|
|
+ rd.getItemVOList().stream().forEach(a -> {
|
|
|
+ //交强:0507,商业:0518
|
|
|
+ if (a.getRiskCode().equals("0507")) {
|
|
|
+ }
|
|
|
+ if (a.getRiskCode().equals("0518")) {
|
|
|
+ kindRespVoList.add(buildQuoteKindList(a));
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ List<QuoteRiskRespVo> riskList1 = new ArrayList<>();
|
|
|
+// List<QuoteKindRespVo> kindList1 = new ArrayList<>();
|
|
|
+ List<RiskInfoVo> riskList = yaQuoteInfoVo.getRiskList();
|
|
|
+ for (RiskInfoVo riskInfoVo : riskList) {
|
|
|
+ if ("0507".equals(riskInfoVo.getRiskCode()) && jqPremiumBig != null) {
|
|
|
+ QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
+ risk.setRiskCode("0507");
|
|
|
+ risk.setRiskName("机动车交通事故责任强制保险");
|
|
|
+ risk.setPremium(jqPremiumBig.doubleValue());
|
|
|
+ risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
+ risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
+ riskList1.add(risk);
|
|
|
+ }
|
|
|
+ if ("0510".equals(riskInfoVo.getRiskCode()) && syPremiumBig != null) {
|
|
|
+ QuoteRiskRespVo risk = new QuoteRiskRespVo();
|
|
|
+ risk.setRiskCode("0510");
|
|
|
+ risk.setRiskName("机动车商业保险");
|
|
|
+ risk.setPremium(syPremiumBig.doubleValue());
|
|
|
+ risk.setStartDate(riskInfoVo.getStartDate());
|
|
|
+ risk.setEndDate(riskInfoVo.getEndDate());
|
|
|
+ riskList1.add(risk);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ quoteRespVo.setRiskList(riskList1);
|
|
|
+ quoteRespVo.setKindList(kindRespVoList);
|
|
|
+
|
|
|
+
|
|
|
+ PremiumResp.DataDTO.ItemVOListDTO itemVoListDto = rd.getItemVOList().get(0);
|
|
|
+
|
|
|
+
|
|
|
+ quoteRespVo.setCiSumPermium(jqPremiumBig.add(taxPremiumBig).doubleValue());//交强险和车船税合计
|
|
|
+ quoteRespVo.setSumPermium(sumPermium.doubleValue());//保费合计
|
|
|
+ quoteRespVo.setTaxAmount(taxPremiumBig.doubleValue());//车船税
|
|
|
+ quoteRespVo.setTotalAdjustRate(1);
|
|
|
+ quoteRespVo.setILogPreUdwMess(StringUtils.toString(rd.getBirate().getBillcomeGroup()));//评分
|
|
|
+ quoteRespVo.setOrderno(insOrder.getOrderno()); //订单号
|
|
|
+ quoteRespVo.setJqPremium(jqPremiumBig.doubleValue());
|
|
|
+ quoteRespVo.setSyPremium(syPremiumBig.doubleValue());
|
|
|
+
|
|
|
+
|
|
|
+ return quoteRespVo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造 商业险数据 通过报价 响应数据
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-08-21
|
|
|
+ */
|
|
|
+ public static QuoteKindRespVo buildQuoteKindList(PremiumResp.DataDTO.ItemVOListDTO dto) {
|
|
|
+
|
|
|
+ QuoteKindRespVo kind = new QuoteKindRespVo();
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.A.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.A.getCode());
|
|
|
+ kind.setKindName(InsurKind.A.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.B.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.B.getCode());
|
|
|
+ kind.setKindName(InsurKind.B.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.D3.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.D3.getCode());
|
|
|
+ kind.setKindName(InsurKind.D3.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.D4.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.D4.getCode());
|
|
|
+ kind.setKindName(InsurKind.D4.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setUnitAmount(StringUtils.toDouble(dto.getUnitAmount()));
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.MJ1.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.MJ1.getCode());
|
|
|
+ kind.setKindName(InsurKind.MJ1.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.MJ2.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.MJ2.getCode());
|
|
|
+ kind.setKindName(InsurKind.MJ2.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.MJ3.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.MJ3.getCode());
|
|
|
+ kind.setKindName(InsurKind.MJ3.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.MJ4.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.MJ4.getCode());
|
|
|
+ kind.setKindName(InsurKind.MJ4.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+ if (dto.getKindCode().equals(InsurKindGuoRen.L.getCode())) {
|
|
|
+ kind = new QuoteKindRespVo();
|
|
|
+ kind.setKindCode(InsurKind.L.getCode());
|
|
|
+ kind.setKindName(InsurKind.L.getDesc());
|
|
|
+ kind.setAmount(dto.getAmount());
|
|
|
+ kind.setCoveragePremium(dto.getPremium());
|
|
|
+ }
|
|
|
+// if(dto.getKindCode().equals(InsurKindGuoRen.BD.getCode())){
|
|
|
+// kind = new QuoteKindRespVo();
|
|
|
+// kind.setKindCode(InsurKind.BD.getCode());
|
|
|
+// kind.setKindName(InsurKind.BD.getDesc());
|
|
|
+// kind.setAmount(dto.getAmount());
|
|
|
+// kind.setCoveragePremium(dto.getPremium());
|
|
|
+// }
|
|
|
+ return kind;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造 车价查询uid编号
|
|
|
+ */
|
|
|
+ private String buildCarPriceQueryUidNum(String orderNo) {
|
|
|
+ String redisNum = orderNo + "-guoRen" + "-CarPriceQuery-uid";
|
|
|
+ return redisNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造 投保单的redis key
|
|
|
+ */
|
|
|
+ private String buildInsuranceSlipNum(String orderNo) {
|
|
|
+ String redisNum = orderNo + "-guoRen" + "-InsuranceSlipNum";
|
|
|
+ return redisNum;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取投保单
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年09月13日 0013
|
|
|
+ */
|
|
|
+ private InsuranceSlipResp gainInsuranceSlip(String orderNo) {
|
|
|
+
|
|
|
+ String s = RedisUtils.get(buildInsuranceSlipNum(orderNo));
|
|
|
+
|
|
|
+ InsuranceSlipResp insuranceSlip = JSON.parseObject(s, InsuranceSlipResp.class);
|
|
|
+
|
|
|
+// InsuranceSlipResp insuranceSlip = (InsuranceSlipResp) JSON.parse(buildInsuranceSlipNum(orderNo));
|
|
|
+// InsuranceSlipResp insuranceSlip = (InsuranceSlipResp) RedisUtils.getObject(buildInsuranceSlipNum(orderNo));
|
|
|
+ return insuranceSlip;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * vin码查询车辆信息
|
|
|
+ *
|
|
|
+ * @return VinQueryResp.DataDTO
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年08月18日 0018
|
|
|
+ */
|
|
|
+ public VinQueryResp.DataDTO vinQuery(VinQueryReq vinQueryReq) {
|
|
|
+ VinQueryReq req = VinQueryReq.buildParam2(vinQueryReq, channelInfo);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00009");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "vin码查询车辆,车牌号:" + vinQueryReq.getLicenseNo());
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+
|
|
|
+ if (rest.getPlatformCode().equals("T0000000")) {
|
|
|
+ VinQueryResp resp = ResponseDto.buildBody(rest, VinQueryResp.class);
|
|
|
+ if (resp.getResultCode() == 1) {
|
|
|
+ throw new SystemException(resp.getResultMsg() == null ? "未找到车辆信息" : resp.getResultMsg());
|
|
|
+ }
|
|
|
+ return resp.getData().get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 车价查询
|
|
|
+ */
|
|
|
+ public CarPriceResp.DataDTO carPriceQuery(BaseQuoteInfoVo yaQuoteInfoVo, VinQueryResp.DataDTO vinQ) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+ CarPriceReq req = CarPriceReq.buildCarPriceParam(yaQuoteInfoVo, vinQ, channelInfo);
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00003");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "车价查询,车牌:" + yaQuoteInfoVo.getCarInfo().getLicenseNo());
|
|
|
+// String result = HttpUtil.sendPost(baseUrl, bodyStr);
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+
|
|
|
+
|
|
|
+ if (rest.getPlatformCode().equals("T0000000")) {
|
|
|
+
|
|
|
+ //多条
|
|
|
+ CarPriceMuchResp respMuch = ResponseDto.buildBody(rest, CarPriceMuchResp.class);
|
|
|
+
|
|
|
+ //单条
|
|
|
+ if (CollUtil.isEmpty(respMuch.getData().getCars())) {
|
|
|
+ CarPriceResp resp = ResponseDto.buildBody(rest, CarPriceResp.class);
|
|
|
+
|
|
|
+ if (resp.getResultCode() == 1) {
|
|
|
+ throw new SystemException(resp.getResultMsg() == null ? "未获取到车价信息,请联系管理员" : resp.getResultMsg());
|
|
|
+ }
|
|
|
+ return resp.getData();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ CarPriceMuchResp.DataDTO.CarsDTO confirmCarMuch = new CarPriceMuchResp.DataDTO.CarsDTO();
|
|
|
+ CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
|
|
|
+// //匹配车型
|
|
|
+ //车辆年款不能超过注册日期
|
|
|
+ List<CarPriceMuchResp.DataDTO.CarsDTO> vehicleInfoList = respMuch.getData().getCars().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(), a.getCarYear())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //匹配的车辆信息数据 为空
|
|
|
+ if (CollUtil.isEmpty(vehicleInfoList)) {
|
|
|
+ confirmCarMuch = respMuch.getData().getCars().get(0);
|
|
|
+ } else {
|
|
|
+ //匹配的车辆信息数据
|
|
|
+ CarPriceMuchResp.DataDTO.CarsDTO matchVehicleInfo = vehicleInfoList.stream().filter(a -> a.getCarYear().equals(carInfo.getPurchasePrice())).findFirst().orElse(null);
|
|
|
+ if (null != matchVehicleInfo) {
|
|
|
+ confirmCarMuch = matchVehicleInfo;
|
|
|
+ } else {
|
|
|
+ //匹配的车辆信息数据里 未匹配成功 默认选择第一条
|
|
|
+ //排序 年款降序 金额升序
|
|
|
+ vehicleInfoList = vehicleInfoList.stream().sorted(Comparator.comparing(CarPriceMuchResp.DataDTO.CarsDTO::getCarYear)
|
|
|
+ .thenComparing((o1, o2) -> Integer.compare(StringUtils.toInt(o2.getCarYear()), StringUtils.toInt(o1.getCarYear()))).reversed())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ confirmCarMuch = vehicleInfoList.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return carPriceQueryMuch(respMuch.getData().getInputvo(), confirmCarMuch, yaQuoteInfoVo.getCarInfo().getLicenseNo());
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// if (resp.getResultCode() == 1) {
|
|
|
+// throw new SystemException(resp.getResultMsg() == null ? "未获取到车价信息,请联系管理员" : resp.getResultMsg());
|
|
|
+// }
|
|
|
+// return resp.getData();
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * (多条)车价查询
|
|
|
+ */
|
|
|
+ public CarPriceResp.DataDTO carPriceQueryMuch(String uuid, CarPriceMuchResp.DataDTO.CarsDTO carsDTO, String licenseNo) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+ CarPriceMuchReq req = new CarPriceMuchReq();
|
|
|
+ req.setUuid(uuid);
|
|
|
+ req.setCarPriceMuchResp(carsDTO);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00017");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "再次车价查询,车牌:" + licenseNo);
|
|
|
+// String result = HttpUtil.sendPost(baseUrl, bodyStr);
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+
|
|
|
+
|
|
|
+ if (rest.getPlatformCode().equals("T0000000")) {
|
|
|
+
|
|
|
+ CarPriceResp resp = ResponseDto.buildBody(rest, CarPriceResp.class);
|
|
|
+
|
|
|
+ if (resp.getResultCode() == 1) {
|
|
|
+ throw new SystemException(resp.getResultMsg() == null ? "未获取到车价信息,请联系管理员" : resp.getResultMsg());
|
|
|
+ }
|
|
|
+ return resp.getData();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保费计算
|
|
|
+ */
|
|
|
+ public PremiumResp.DataDTO premiumQuery(BaseQuoteInfoVo yaQuoteInfoVo, CarPriceResp.DataDTO carPriceResult, VinQueryResp.DataDTO vinQ) {
|
|
|
+
|
|
|
+ //请求信息列表
|
|
|
+ List<String> requestInfoList = new ArrayList<>();
|
|
|
+
|
|
|
+ boolean boo = true;
|
|
|
+ //构造请求参数
|
|
|
+ PremiumReq req = PremiumReq.buildQuoteParam(yaQuoteInfoVo, carPriceResult, vinQ);
|
|
|
+ PremiumResp resp = null;
|
|
|
+ StringBuffer flag = new StringBuffer();
|
|
|
+ while (boo) {
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00004");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "保费计算 |" + flag + ",车牌:" + yaQuoteInfoVo.getCarInfo().getLicenseNo());
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ resp = ResponseDto.buildBody(rest, PremiumResp.class);
|
|
|
+ if (rest.getPlatformCode().equals("T0000000")) {
|
|
|
+
|
|
|
+// //警告
|
|
|
+// if (resp.getResultCode() == 0) throw new SystemException(resp.getResultMsg());
|
|
|
+
|
|
|
+ //1、 交强险重复投保 替换时间
|
|
|
+ boo = buildCiRepeatParam(boo, resp, requestInfoList, req);
|
|
|
+ if (boo) {
|
|
|
+ flag.append("重复投保处理 |");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //2、 转保
|
|
|
+ boo = buildCheckCodeParam(resp, requestInfoList, req);
|
|
|
+ if (boo) {
|
|
|
+ flag.append("转保处理 |");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.getData().setCiStartDate(req.getCi().getPrpTmain().getStartDate());
|
|
|
+ resp.getData().setCiEndDate(req.getCi().getPrpTmain().getEndDate());
|
|
|
+
|
|
|
+ resp.getData().setBiStartDate(req.getBi().getPrpTmain().getStartDate());
|
|
|
+ resp.getData().setBiEndDate(req.getBi().getPrpTmain().getEndDate());
|
|
|
+
|
|
|
+ if (null != resp && resp.getResultCode() == 1)
|
|
|
+ throw new SystemException(resp.getResultMsg() == null ? "保费计算失败,请联系管理员" : resp.getResultMsg());
|
|
|
+ if (null != resp) return resp.getData();
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 投保单保存
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年08月18日 0018
|
|
|
+ */
|
|
|
+ public InsuranceSlipResp insuranceSlip(BaseQuoteInfoVo yaQuoteInfoVo, String carPriceNum) {
|
|
|
+
|
|
|
+ //构造请求参数
|
|
|
+ InsuranceSlipReq req = InsuranceSlipReq.buildParam(yaQuoteInfoVo, carPriceNum);
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00006");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "投保单保存,车牌号:" + yaQuoteInfoVo.getCarInfo().getLicenseNo());
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ InsuranceSlipResp resp = ResponseDto.buildBody(rest, InsuranceSlipResp.class);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提交核保
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-08-23
|
|
|
+ */
|
|
|
+ public SubmitAuditResp submitAudit(InsAreaCompany iac) {
|
|
|
+ //构造请求参数
|
|
|
+ SubmitAuditReq req = SubmitAuditReq.buildParam(iac, channelInfo);
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIRBT00007");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "核保提交");
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ SubmitAuditResp resp = ResponseDto.buildBody(rest, SubmitAuditResp.class);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 投保单状态
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-09-26
|
|
|
+ */
|
|
|
+ public InsOrderStatusResp insOrderStatus(InsAreaCompany iac) {
|
|
|
+// //构造请求参数
|
|
|
+// SubmitAuditReq req = SubmitAuditReq.buildParam(insuranceSlip, channelInfo);
|
|
|
+
|
|
|
+
|
|
|
+ List<String> proposalNos = new ArrayList<>();
|
|
|
+ String jqNo = iac.getJqapplyno();
|
|
|
+ String syNo = iac.getSyapplyno();
|
|
|
+ if (StringUtils.isNotEmpty(jqNo)) {
|
|
|
+ proposalNos.add(jqNo);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(syNo)) {
|
|
|
+ proposalNos.add(syNo);
|
|
|
+ }
|
|
|
+ Map paramMap = new HashMap();
|
|
|
+ paramMap.put("proposalNos", proposalNos);
|
|
|
+
|
|
|
+
|
|
|
+ //投保单状态查询
|
|
|
+ String bodyStr = RequestDto.builRequestDto(paramMap, "IIRBT00010");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "投保单状态查询");
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ InsOrderStatusResp resp = ResponseDto.buildBody(rest, InsOrderStatusResp.class);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 非车列表
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年09月18日 0018
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public NonAutoInsResp.DataDTO gainNonAutoInsList(String goodsCode) {
|
|
|
+
|
|
|
+
|
|
|
+ Map bodyMap = new HashMap();
|
|
|
+ Map bodyParamsMap = new HashMap();
|
|
|
+ bodyParamsMap.put("goodsCode", goodsCode);
|
|
|
+ bodyMap.put("data", bodyParamsMap);
|
|
|
+
|
|
|
+ bodyMap.put("systemCode", "TQDL");
|
|
|
+ bodyMap.put("requestTime", Instant.now().getEpochSecond() * 1000);
|
|
|
+
|
|
|
+// String params = JSON.toJSONString(bodyMap);
|
|
|
+
|
|
|
+
|
|
|
+ String bodyStr = RequestDto.builRequestDto(bodyMap, "IIIRBT00053");
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "获取非车列表,产品号:" + goodsCode);
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ NonAutoInsResp resp = ResponseDto.buildBody(rest, NonAutoInsResp.class);
|
|
|
+
|
|
|
+// ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+// SubmitAuditResp resp = ResponseDto.buildBody(rest, SubmitAuditResp.class);
|
|
|
+ if (null != resp.getData()) return resp.getData();
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建非车订单
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023-09-28
|
|
|
+ */
|
|
|
+ public SubmitAuditResp nonAutoInsOrder(AccidentalDrivingVo accidentalDrivingVo, String carPriceUuid) {
|
|
|
+
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo = new BaseQuoteInfoVo();
|
|
|
+ VinQueryResp.DataDTO vinQ = new VinQueryResp.DataDTO();
|
|
|
+ //构造请求参数
|
|
|
+ NonAutoInsOrderReq req = NonAutoInsOrderReq.buildParam(yaQuoteInfoVo, vinQ, accidentalDrivingVo, channelInfo, carPriceUuid);
|
|
|
+ String bodyStr = RequestDto.builRequestDto(req, "IIIRBT00054");
|
|
|
+
|
|
|
+ String result = HttpUtil.sendPost(baseUrl, bodyStr, log, "创建非车订单");
|
|
|
+
|
|
|
+ ResponseDto rest = JSON.parseObject(result, ResponseDto.class);
|
|
|
+ SubmitAuditResp resp = ResponseDto.buildBody(rest, SubmitAuditResp.class);
|
|
|
+
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造交强险重复投保参数
|
|
|
+ *
|
|
|
+ * @param boo true 继续请求
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年10月13日 0013
|
|
|
+ */
|
|
|
+ private boolean buildCiRepeatParam(boolean boo, PremiumResp resp, List<String> requestInfoList, PremiumReq req) {
|
|
|
+ //1. 交强重复投保 替换日期重新报价
|
|
|
+ if (resp.getResultCode() == 1 && resp.getResultMsg().contains("重复投保") && resp.getResultMsg().contains("终保日期") && resp.getResultMsg().contains("交强险平台")) {
|
|
|
+
|
|
|
+ String ciMsg = resp.getResultMsg();
|
|
|
+ requestInfoList.add(ciMsg);
|
|
|
+ //终保日期
|
|
|
+ String coverageEndDate = ciMsg.substring(ciMsg.indexOf("终保日期") + 5, ciMsg.indexOf("终保日期") + 5 + 16);
|
|
|
+
|
|
|
+ LocalDateTime start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.DATETIME_PATTERN_EXT1);
|
|
|
+
|
|
|
+ String newStartDate = "";
|
|
|
+ String newEndDate = "";
|
|
|
+
|
|
|
+ //及时起保
|
|
|
+ if (start.getHour() > 0 && start.getHour() < 59) {
|
|
|
+ LocalDateTime end = start.plusYears(1L);
|
|
|
+ newStartDate = DateTimeUtil.format(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ newEndDate = DateTimeUtil.format(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+
|
|
|
+ req.getCi().getPrpTmain().setStartHour(StringUtils.toString(start.getHour()));
|
|
|
+ req.getCi().getPrpTmain().setEndHour(StringUtils.toString(start.getHour()));
|
|
|
+
|
|
|
+ req.getCi().getPrpTmain().setImmeValidStartDate(newStartDate);
|
|
|
+ req.getCi().getPrpTmain().setImmeValidEndDate(newStartDate);
|
|
|
+ req.getCi().getPrpTmain().setImmeValiFlag("1");
|
|
|
+
|
|
|
+// req.getCi().getPrpTmain()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
+ newStartDate = DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ req.getCi().getPrpTmain().setStartDate(newStartDate);
|
|
|
+ req.getCi().getPrpTmain().setEndDate(newEndDate);
|
|
|
+
|
|
|
+ req.getCi().getPrptitemkindList().get(0).setStartDate(newStartDate);
|
|
|
+ req.getCi().getPrptitemkindList().get(0).setEndDate(newEndDate);
|
|
|
+
|
|
|
+
|
|
|
+ System.err.println("国任新起:" + newStartDate);
|
|
|
+ System.err.println("国任新止:" + newEndDate);
|
|
|
+
|
|
|
+
|
|
|
+ return true;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构造交强险 商业险 转报code
|
|
|
+ *
|
|
|
+ * @param boo true 继续请求
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年10月13日 0013
|
|
|
+ */
|
|
|
+ private boolean buildCheckCodeParam(PremiumResp resp, List<String> requestInfoList, PremiumReq req) {
|
|
|
+
|
|
|
+ String ciCheckCode = resp.getData().getCicheckCode();
|
|
|
+ String biCheckCode = resp.getData().getBicheckCode();
|
|
|
+ if (StringUtils.isNotEmpty(ciCheckCode) || StringUtils.isNotEmpty(biCheckCode)) {
|
|
|
+ System.err.println("转保。。。。。。。。。。");
|
|
|
+ System.err.println("转保。。。。。。。。。。");
|
|
|
+ System.err.println("转保。。。。。。。。。。");
|
|
|
+ CheckCodeResp ccResp = gainCheckCode(ciCheckCode, biCheckCode);
|
|
|
+ req.getCi().getPrpTmain().setAnswer(ccResp.getJqImageCode());
|
|
|
+ req.getBi().getPrpTmain().setAnswer(ccResp.getSyImageCode());
|
|
|
+ requestInfoList.add("转保单");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取图片验证码 校验的code
|
|
|
+ *
|
|
|
+ * @author: lig
|
|
|
+ * @date: 2023年10月13日 0013
|
|
|
+ */
|
|
|
+ private CheckCodeResp gainCheckCode(String jqImageStr, String syImageStr) {
|
|
|
+ String sendBody = "";
|
|
|
+ Map bodyMap = new HashMap();
|
|
|
+ bodyMap.put("jqImage", StringUtils.toString(jqImageStr, ""));
|
|
|
+ bodyMap.put("syImage", StringUtils.toString(syImageStr, ""));
|
|
|
+ sendBody = JsonUtils.toJson(bodyMap);
|
|
|
+ String ocrStr = HttpUtil.sendPost("http://47.92.254.66:8088/getres", sendBody);
|
|
|
+
|
|
|
+ CheckCodeResp checkCodeResp = JSONUtil.toBean(ocrStr, CheckCodeResp.class);
|
|
|
+ return checkCodeResp;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Data
|
|
|
+ class CheckCodeResp {
|
|
|
+ @JsonProperty(value = "jqImageCode")
|
|
|
+ String jqImageCode;
|
|
|
+ @JsonProperty(value = "syImageCode")
|
|
|
+ String syImageCode;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|