|
|
@@ -1,45 +1,36 @@
|
|
|
-package com.ydtech.modules.ins.service.impl;
|
|
|
+package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.fasterxml.jackson.annotation.JsonInclude;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
-import com.fasterxml.jackson.databind.*;
|
|
|
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
|
|
-import com.ydtech.components.InsAlltrustRequestApiComponents;
|
|
|
+import com.ydtech.config.properties.YongchengApiConfigurationProperties;
|
|
|
+import com.ydtech.constants.InsuranceEnum;
|
|
|
import com.ydtech.constants.SysConstants;
|
|
|
-import com.ydtech.constants.enums.InsQuoteFlow;
|
|
|
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.service.EsmAgreementProdService;
|
|
|
-import com.ydtech.modules.esm.service.EsmAgreementService;
|
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
-import com.ydtech.modules.esm.service.EsmRetailService;
|
|
|
import com.ydtech.modules.ins.dao.InsAlltrustRegionMapper;
|
|
|
-import com.ydtech.modules.ins.model.InsApiLog;
|
|
|
import com.ydtech.modules.ins.model.dto.CarInsDateDto;
|
|
|
import com.ydtech.modules.ins.model.dto.CarInsPolicyDto;
|
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
|
import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
|
|
|
import com.ydtech.modules.ins.model.vo.QuoteRespVo;
|
|
|
-import com.ydtech.modules.ins.model.vo.RiskInfoVo;
|
|
|
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.CallBackRequest;
|
|
|
+import com.ydtech.modules.ins.model.yc.InsAlltrustRegion;
|
|
|
+import com.ydtech.modules.ins.model.yc.YcBuildData;
|
|
|
+import com.ydtech.modules.ins.model.yc.YcConfigureParameters;
|
|
|
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;
|
|
|
@@ -58,11 +49,10 @@ import com.ydtech.modules.ins.model.yc.ruote.Base;
|
|
|
import com.ydtech.modules.ins.model.yc.ruote.Ruote;
|
|
|
import com.ydtech.modules.ins.model.yc.ruote.response.RuoteResponse;
|
|
|
import com.ydtech.modules.ins.model.yc.ruote.response.TfiWarnListResponse;
|
|
|
-import com.ydtech.modules.ins.service.InsAlltrustApiService;
|
|
|
import com.ydtech.modules.ins.service.InsApiLogService;
|
|
|
-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.components.yongcheng.YongchengRequestApiComponents;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
|
|
|
@@ -70,6 +60,8 @@ 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.order.service.YongchengOrderApiService;
|
|
|
+import com.ydtech.modules.order.utils.InsuranceLog;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import com.ydtech.utils.*;
|
|
|
import com.ydtech.utils.baidu.FileUtil;
|
|
|
@@ -90,18 +82,17 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Service
|
|
|
-public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
+public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger("alltrust");
|
|
|
|
|
|
@Autowired
|
|
|
- private InsAlltrustRequestApiComponents apiComponents;
|
|
|
+ private YongchengApiConfigurationProperties apiComponents;
|
|
|
|
|
|
@Autowired
|
|
|
-
|
|
|
private InsAlltrustRegionMapper insAlltrustRegionMapper;
|
|
|
- @Autowired
|
|
|
|
|
|
+ @Autowired
|
|
|
private InsOrdersComponents insOrdersComponents;
|
|
|
|
|
|
//请求信息列表
|
|
|
@@ -141,48 +132,28 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
@Autowired
|
|
|
ConfigureParametersComponents configureParametersComponents;
|
|
|
|
|
|
-
|
|
|
- private ObjectMapper gainXmlMapper() {
|
|
|
- ObjectMapper xmlMapper = new XmlMapper();
|
|
|
-
|
|
|
- xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
|
- xmlMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
|
|
|
- xmlMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
- xmlMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);
|
|
|
- xmlMapper.enable(MapperFeature.USE_STD_BEAN_NAMING);
|
|
|
- xmlMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
|
|
|
- return xmlMapper;
|
|
|
- }
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private YongchengRequestApiComponents yongchengRequestApiComponents;
|
|
|
|
|
|
//
|
|
|
//==============================API 方式
|
|
|
//
|
|
|
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("-", ""));
|
|
|
-
|
|
|
- log.info("===永诚--车型查询接口请求 =====参数确认:--" + ycConfigureParameters.getDptCde() + "===");
|
|
|
+ carModelReq.setEnrollDate(carInfo.getRegisterDate().replace("-", ""));
|
|
|
ModelsQueryXml m = buildModelsQueryParam(carModelReq, ycConfigureParameters);
|
|
|
-
|
|
|
- log.info("===永诚--车型查询接口请求开始--" + carInfo.getLicenseNo() + "===");
|
|
|
- String responseData = httpPostResultLog(m, YcBuildData.API_MODEL, "永诚API方式 - 车型查询(vin:" + carInfo.getVinNo() + ") - ");
|
|
|
-
|
|
|
- AssertionUtils.isEmpty(responseData, "永诚 车型查询接口响应返回空!");
|
|
|
- log.info("===永诚--车型查询接口请求结束--" + carInfo.getLicenseNo() + "===");
|
|
|
- ModelsQueryResponse rd = null;
|
|
|
+ ModelsQueryResponse rd;
|
|
|
try {
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
- rd = gainXmlMapper().readValue(cleanStr, ModelsQueryResponse.class);
|
|
|
-
|
|
|
+ rd = yongchengRequestApiComponents.newQueryVehicleTypes(m);
|
|
|
} catch (IOException e) {
|
|
|
throw new SystemException("车型查询接口异常,请联系管理。");
|
|
|
}
|
|
|
|
|
|
- if (CollUtil.isEmpty(rd.getVehicleInfoList())) throw new SystemException("永诚车型库查找失败");
|
|
|
+ if (CollUtil.isEmpty(rd.getVehicleInfoList())) {
|
|
|
+ throw new SystemException("永诚车型库查找失败");
|
|
|
+ }
|
|
|
|
|
|
//车辆年款不能超过注册日期
|
|
|
List<ModelsQueryResponse.VehicleInfo> vehicleInfoList = rd.getVehicleInfoList().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(), a.getVehicleYear())).sorted(Comparator.comparing(ModelsQueryResponse.VehicleInfo::getVehiclePrice)).collect(Collectors.toList());
|
|
|
@@ -199,9 +170,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
//金额升序
|
|
|
vehicleInfoList = rd.getVehicleInfoList().stream().sorted(Comparator.comparing(ModelsQueryResponse.VehicleInfo::getVehiclePrice)).collect(Collectors.toList());
|
|
|
- buildCarInfo(carInfo, rd.getVehicleInfoList().get(0));
|
|
|
+ buildCarInfo(carInfo, vehicleInfoList.get(0));
|
|
|
return;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//匹配的车辆信息数据
|
|
|
@@ -227,24 +197,18 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public HttpResult quoteApi(BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
+ public HttpResult quoteApi(BaseQuoteVo<AccidentalDrivingVo> quoteVo) throws JsonProcessingException {
|
|
|
|
|
|
requestInfoList = new ArrayList<>();
|
|
|
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(quoteVo.getAgreementId());
|
|
|
-
|
|
|
BaseQuoteInfoVo yaQuoteInfoVo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
|
|
|
-
|
|
|
CarInfoVo carInfo = yaQuoteInfoVo.getCarInfo();
|
|
|
|
|
|
//构造车辆信息
|
|
|
gainVehicleModel(ycConfigureParameters, carInfo);
|
|
|
-
|
|
|
- InsAreaCompany iac = null;
|
|
|
-
|
|
|
InsOrders order = insOrdersService.getById(yaQuoteInfoVo.getOrderNo());
|
|
|
-
|
|
|
AccidentalDrivingVo adVo = quoteVo.getAccidentalDrivingVo();
|
|
|
|
|
|
//组装参数
|
|
|
@@ -254,25 +218,33 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
RuoteResponse rr = null;
|
|
|
boolean boo = false;
|
|
|
- boolean isRenewal = true;
|
|
|
boolean isBiRepeat = true;
|
|
|
- String textHead = "==========永诚API方式 - 车架号:" + carInfo.getVinNo() + " - 报价 ";
|
|
|
+ String vinNo = carInfo.getVinNo();
|
|
|
+
|
|
|
while (!boo) {
|
|
|
- rr = requestApi(m, new RuoteResponse(), iac, YcBuildData.API_QUOTE, InsQuoteFlow.Q_S_0, textHead);
|
|
|
- if (rr.getHead().getErrorCode().equals("009999") && (rr.getHead().getErrorMessage().contains("车主") || rr.getHead().getErrorMessage().contains("投保人") || rr.getHead().getErrorMessage().contains("被保人")))
|
|
|
+ rr = yongchengRequestApiComponents.newPremiumXnyCalculation(m);
|
|
|
+ //交强
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ("");
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCQryCdeJQ("");
|
|
|
+ //商业
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCCheckCodeSY("");
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCQryCdeSY("");
|
|
|
+
|
|
|
+ if (rr.getHead().getErrorCode().equals("009999") && (rr.getHead().getErrorMessage().contains("车主") || rr.getHead().getErrorMessage().contains("投保人") || rr.getHead().getErrorMessage().contains("被保人"))) {
|
|
|
return HttpResult.error(rr.getHead().getErrorMessage());
|
|
|
+ }
|
|
|
//处理返回信息
|
|
|
//1、交强险重复投保处理
|
|
|
boo = ciRepetitionInsure(rr, m);
|
|
|
if (!boo) {
|
|
|
- textHead += " - 交强险重复投保处理 ";
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 交强险重复投保处理", vinNo);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
//2、转保处理
|
|
|
boo = reinsurance(rr, m);
|
|
|
if (!boo) {
|
|
|
- textHead += " - 转保处理 ";
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 转保处理", vinNo);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -281,24 +253,12 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
boo = biRepetitionInsure(rr, m);
|
|
|
if (!boo) {
|
|
|
isBiRepeat = false;
|
|
|
- textHead += " - 商业险日期处理 ";
|
|
|
- continue;
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 商业险日期处理", vinNo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int codeErrorNum = 0;
|
|
|
- if (codeErrorNum > 3) {
|
|
|
- boo = true;
|
|
|
- }
|
|
|
- //转保验证码错误
|
|
|
- boo = reinsuranceCodeError(rr, m);
|
|
|
- if (!boo) {
|
|
|
- codeErrorNum++;
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- if (null == rr) return HttpResult.error("远程请求报价失败");
|
|
|
+
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("车主省市县码值不符合规范")) {
|
|
|
sb.append("|永诚 - 保司 - 车主地区自动解析失败");
|
|
|
@@ -319,18 +279,12 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
QuoteRespVo quoteRespVo = YcBuildData.buildQuoteRespVo(order, rr, yaQuoteInfoVo);
|
|
|
//8 生成订单
|
|
|
- iac = response_order(order, quoteRespVo, m, rr, quoteVo);
|
|
|
-
|
|
|
+ InsAreaCompany iac = response_order(order, quoteRespVo, m, rr, quoteVo);
|
|
|
quoteRespVo.setCompanyId(iac.getId());
|
|
|
|
|
|
- //查询码交强
|
|
|
- String queryCodeJq = rr.getVhl().getCQryCdeJQ();
|
|
|
- //查询码商业
|
|
|
- String queryCodeSy = rr.getVhl().getCQryCdeSY();
|
|
|
-
|
|
|
- order.setOwnerinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getOwnerInfo())));
|
|
|
- order.setInsureinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getInsuredPersonInfo())));
|
|
|
- order.setApplyinfo(JSONObject.parseObject(JSONObject.toJSONString(yaQuoteInfoVo.getPolicyHolderInfo())));
|
|
|
+ order.setOwnerinfo(JSON.parseObject(JSON.toJSONString(yaQuoteInfoVo.getOwnerInfo())));
|
|
|
+ order.setInsureinfo(JSON.parseObject(JSON.toJSONString(yaQuoteInfoVo.getInsuredPersonInfo())));
|
|
|
+ order.setApplyinfo(JSON.parseObject(JSON.toJSONString(yaQuoteInfoVo.getPolicyHolderInfo())));
|
|
|
|
|
|
insOrdersService.updateById(order);
|
|
|
if (CollUtil.isNotEmpty(requestInfoList)) {
|
|
|
@@ -341,7 +295,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 报价 交强险 重复 投保业务处理
|
|
|
*/
|
|
|
@@ -353,12 +306,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
//截取0 到 机动车交通事故强制险
|
|
|
String ciMsg = errorMsg;
|
|
|
-
|
|
|
//终保日期
|
|
|
String coverageEndDate = ciMsg.substring(ciMsg.indexOf("终保日期") + 5, ciMsg.indexOf("终保日期") + 5 + 16);
|
|
|
-
|
|
|
LocalDateTime start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.DATETIME_PATTERN_EXT1);
|
|
|
-
|
|
|
LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
String newStartDate = DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
if (start.getHour() > 0) {
|
|
|
@@ -369,10 +319,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
String newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
System.err.println("新起:" + newStartDate);
|
|
|
System.err.println("新止:" + newEndDate);
|
|
|
-
|
|
|
CarInsDateDto cidd = Base.buildInsDate(newStartDate, newEndDate);
|
|
|
|
|
|
-
|
|
|
m.getRequestLabel().getCondition().getBase().setTInsrncBgnTmJQ(cidd.getStartDate());
|
|
|
m.getRequestLabel().getCondition().getBase().setTInsrncEndTmJQ(cidd.getEndDate());
|
|
|
m.getRequestLabel().getCondition().getBase().setCImmeffMrk(cidd.isForthwith() ? "1" : "0");
|
|
|
@@ -401,11 +349,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
if (null == tfiWarnData) return true;
|
|
|
|
|
|
-
|
|
|
//截取0 到 机动车交通事故强制险
|
|
|
String ciMsg = tfiWarnData.getWarnMessage();
|
|
|
requestInfoList.add(ciMsg);
|
|
|
-
|
|
|
if (ciMsg.contains("终保日期: 以上为所有结果信息")) return true;
|
|
|
|
|
|
//终保日期
|
|
|
@@ -423,14 +369,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
m.getRequestLabel().getCondition().getBase().setTInsrncEndTmSY(newEndDate);
|
|
|
|
|
|
//转保信息清空 重新报价
|
|
|
- m.getRequestLabel().getCondition().getVhl().setCQryCdeJQ(null);
|
|
|
- m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ(null);
|
|
|
-
|
|
|
- m.getRequestLabel().getCondition().getVhl().setCCheckCodeSY(null);
|
|
|
- m.getRequestLabel().getCondition().getVhl().setCQryCdeSY(null);
|
|
|
m.getRequestLabel().getCondition().getVhl().setCBusType("0");
|
|
|
|
|
|
-
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
@@ -508,7 +448,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public HttpResult auditApi(String quoteOrderNo) {
|
|
|
- String logNo = String.format("(日志号:%s)", IPUtil.gainServerNo());
|
|
|
//子订单
|
|
|
InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(quoteOrderNo);
|
|
|
InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
@@ -516,11 +455,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
|
|
|
|
|
|
//车主
|
|
|
- CustomerInfoVo ownerInfo = JSON.parseObject(order.getOwnerinfo().toJSONString(), CustomerInfoVo.class);
|
|
|
+ CustomerInfoVo ownerInfo = order.getOwnerinfo().toJavaObject(CustomerInfoVo.class);
|
|
|
//被保人
|
|
|
- CustomerInfoVo insureInfo = JSON.parseObject(order.getInsureinfo().toJSONString(), CustomerInfoVo.class);
|
|
|
+ CustomerInfoVo insureInfo = order.getInsureinfo().toJavaObject(CustomerInfoVo.class);
|
|
|
//投保人
|
|
|
- CustomerInfoVo applyInfo = JSON.parseObject(order.getApplyinfo().toJSONString(), CustomerInfoVo.class);
|
|
|
+ CustomerInfoVo applyInfo = order.getApplyinfo().toJavaObject(CustomerInfoVo.class);
|
|
|
//组装参数
|
|
|
Audit m = Audit.buildAuditParam(ownerInfo, insureInfo, applyInfo, ycConfigureParameters, iac);
|
|
|
|
|
|
@@ -531,14 +470,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
m.getRequestLabel().getCondition().getCustomer().setCCity(insureProvinceData.get(1));
|
|
|
m.getRequestLabel().getCondition().getCustomer().setCCounty(insureProvinceData.get(2));
|
|
|
|
|
|
- //接口请求
|
|
|
- String responseData = httpPostResultLog(m, YcBuildData.API_AUDIT, "永诚API方式 - 核保(订单号:" + iac.getId() + ")(车牌号:" + order.getLicenseno() + ") - ");
|
|
|
- AssertionUtils.isEmpty(responseData, logNo + "核保请求超时请重试。");
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
try {
|
|
|
- AuditResponse rd = gainXmlMapper().readValue(cleanStr, AuditResponse.class);
|
|
|
-
|
|
|
+ AuditResponse rd = yongchengRequestApiComponents.newXnyUnderwritingService(m);
|
|
|
if (rd.getResponseHead().getReturnCode().equals("E0001") && rd.getResponseHead().getReturnMessage().contains("核保时间需要小于起保日期")) {
|
|
|
throw new SystemException("核保请求异常,请重试核保。");
|
|
|
}
|
|
|
@@ -566,7 +499,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
buildOrderStatus(order, iac);
|
|
|
|
|
|
} else {
|
|
|
- throw new SystemException(logNo + "核保失败,车牌号:" + order.getLicenseno() + " ," + rd.getResponseHead().getReturnMessage());
|
|
|
+ throw new SystemException("核保失败,车牌号:" + order.getLicenseno() + " ," + rd.getResponseHead().getReturnMessage());
|
|
|
}
|
|
|
|
|
|
iac.setAuditid(StpUtil.getLoginId().toString());
|
|
|
@@ -581,7 +514,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
//获取缴费地址
|
|
|
getPayUrlApi(iac);
|
|
|
}
|
|
|
- log.info(logNo + "车牌号:" + order.getLicenseno() + ",永诚核保未获取缴费地址,状态为:" + InsOrderStatusEnum.matchKey(iac.getOrderstatus()).getDesc());
|
|
|
+ log.info("车牌号:" + order.getLicenseno() + ",永诚核保未获取缴费地址,状态为:" + InsOrderStatusEnum.matchKey(iac.getOrderstatus()).getDesc());
|
|
|
insAreaCompanyService.updateById(iac);
|
|
|
insOrdersService.updateById(order);
|
|
|
return HttpResult.ok("核保操作成功");
|
|
|
@@ -615,17 +548,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
//组装参数
|
|
|
//接口请求
|
|
|
ImageUp iUp = ImageUp.buildImageUpParam(order, ycConfigureParameters, a.getBase64String(), a.getImageType());
|
|
|
- ObjectMapper xmlMapper = gainXmlMapper();
|
|
|
- //接口请求
|
|
|
-// apiLog = httpPost(xmlMapper, iUp, YcBuildData.API_UPLOAD);
|
|
|
- String responseData = httpPostResultLog(iUp, YcBuildData.API_UPLOAD, logNo + "永诚API方式(车牌号:)" + order.getLicenseno() + " - 影像上传 - " + iUp.getNewImgUpLoadInfoRequest().getRequestBase().getPicTureName() + " - ");
|
|
|
- AssertionUtils.isEmpty(responseData, logNo + "永诚影像上传失败,请重试。");
|
|
|
try {
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
- log.error("===永诚API方式--上传影像清洗返回参数:" + cleanStr);
|
|
|
- ImageUpResponse iur = xmlMapper.readValue(cleanStr, ImageUpResponse.class);
|
|
|
-
|
|
|
- } catch (IOException e) {
|
|
|
+ ImageUpResponse imageUpResponse = yongchengRequestApiComponents.newImageUp(iUp);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
e.printStackTrace();
|
|
|
log.error("===永诚API方式--上传影像报错:" + e.getMessage());
|
|
|
throw new SystemException("系统错误,请联系管理员");
|
|
|
@@ -648,15 +573,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
|
|
|
//组装参数
|
|
|
Pay pay = Pay.buildPayParam(iac, ycConfigureParameters.gainAuthorityDataXml(), apiComponents.getPayCallBack());
|
|
|
-
|
|
|
- ObjectMapper xmlMapper = gainXmlMapper();
|
|
|
//接口请求
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取缴费链接开始======");
|
|
|
- String responseData = httpPostResultLog(pay, YcBuildData.API_PAY, "永诚API方式 - 获取缴费链接 - ");
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取缴费链接结束!======");
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
- PayResponse payResp = xmlMapper.readValue(cleanStr, PayResponse.class);
|
|
|
+ PayResponse payResp = yongchengRequestApiComponents.newGetPayNo(pay);
|
|
|
|
|
|
if (payResp.getReturnCode().equals("E0000")) {
|
|
|
iac.setPaymentLink(payResp.getPayTransUrl());
|
|
|
@@ -681,7 +599,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
InsOrders order = insOrdersService.getById(iac.getOrderno());
|
|
|
AssertionUtils.isEmpty(iac, "报价订单不存在");
|
|
|
|
|
|
- if (StringUtils.isEmpty(iac.getAgreementId())) return HttpResult.error("协议号空");
|
|
|
+ if (StringUtils.isEmpty(iac.getAgreementId())) {
|
|
|
+ return HttpResult.error("协议号空");
|
|
|
+ }
|
|
|
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
|
|
|
@@ -691,14 +611,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
CallbackAnOrder o = CallbackAnOrder.buildCallbackAnOrderParam(iac, ycConfigureParameters.gainAuthorityDataXml(), type);
|
|
|
|
|
|
//接口请求
|
|
|
- String respData = httpPostResultLog(o, YcBuildData.API_ORDER_QUERY, "永诚API方式 - 补传回调 - ");
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(respData);
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(cleanStr)) {
|
|
|
- if (cleanStr.equals("账户不存在或没有权限")) return HttpResult.ok("账户不存在或没有权限");
|
|
|
+ try {
|
|
|
+ String cleanStr = yongchengRequestApiComponents.payCallback(o);
|
|
|
CallBackRequest param = CallBackRequest.buildCallBackParam(cleanStr);
|
|
|
-
|
|
|
log.info("永诚API方式 - 补传回调 - 参数:{},车牌号:{}", JSON.toJSONString(param), order.getLicenseno());
|
|
|
|
|
|
//成功
|
|
|
@@ -736,6 +651,8 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
return HttpResult.error(param.getMessage());
|
|
|
}
|
|
|
return HttpResult.ok("操作成功,状态已更新。");
|
|
|
+ } catch (JsonProcessingException jsonProcessingException) {
|
|
|
+ jsonProcessingException.printStackTrace();
|
|
|
}
|
|
|
|
|
|
throw new SystemException("获取支付连接失败");
|
|
|
@@ -751,12 +668,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
lqw.gt(InsAreaCompany::getAudittime, LocalDate.now().minusDays(1));
|
|
|
List<InsAreaCompany> list = insAreaCompanyService.list(lqw);
|
|
|
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
- list.stream().forEach(a -> {
|
|
|
+ if (null != list && !list.isEmpty()) {
|
|
|
+ list.forEach(a -> {
|
|
|
callbackAnOrder(a.getId());
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -803,13 +719,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
} else if (insFlag.equals("ds")) {//单商
|
|
|
String syUrl = gainExistCarInsPolicy(licensePlate + sybd, licensePlate);
|
|
|
-
|
|
|
if (StringUtils.isNotEmpty(syUrl)) {
|
|
|
cipDto.setSyUrl(syUrl);
|
|
|
return HttpResult.ok(cipDto);
|
|
|
}
|
|
|
} else if (insFlag.equals("js")) {//交商业
|
|
|
-
|
|
|
String syUrl = gainExistCarInsPolicy(licensePlate + sybd, licensePlate);
|
|
|
String jqFlagUrl = gainExistCarInsPolicy(licensePlate + jqbz, licensePlate);
|
|
|
String jqUrl = gainExistCarInsPolicy(licensePlate + jqbd, licensePlate);
|
|
|
@@ -822,22 +736,15 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
|
|
|
String policyNo = policyPrintVo.getRiskCode().equals("0507") ? iac.getJqpolicyno() : iac.getSypolicyno();
|
|
|
//组装参数
|
|
|
Policy p = Policy.buildPolicyParam(policyNo, ycConfigureParameters.gainAuthorityDataXml());
|
|
|
- ObjectMapper xmlMapper = gainXmlMapper();
|
|
|
-
|
|
|
//接口请求
|
|
|
- String responseData = httpPostResultLog(p, YcBuildData.API_GUARANTEE_SLIP, "车牌号:" + order.getLicenseno() + ",永诚API方式 - 获取保单 - ");
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
|
|
|
try {
|
|
|
- PolicyResponse pResp = xmlMapper.readValue(cleanStr, PolicyResponse.class);
|
|
|
-
|
|
|
+ PolicyResponse pResp = yongchengRequestApiComponents.dzbdWeb(p);
|
|
|
if (pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusCode().equals("E0000")) {
|
|
|
|
|
|
//标志
|
|
|
@@ -872,7 +779,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
throw new SystemException("获取支付连接失败");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -885,19 +791,11 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(accidentalDrivingVo.getAgreementId());
|
|
|
-
|
|
|
//组装参数
|
|
|
Accident accident = Accident.buildPayParam(accidentalDrivingVo, ycConfigureParameters, null);
|
|
|
|
|
|
- ObjectMapper xmlMapper = gainXmlMapper();
|
|
|
- //接口请求
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询开始======");
|
|
|
- String responseData = httpPostResultLog(accident, YcBuildData.API_ACCIDENT, "永诚API方式 - 获取意健险方案及险种 - ");
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询结束!======");
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
try {
|
|
|
- AccidentResponse accidentResp = xmlMapper.readValue(cleanStr, AccidentResponse.class);
|
|
|
+ AccidentResponse accidentResp = yongchengRequestApiComponents.newQueryYwCvrgWeb(accident);
|
|
|
|
|
|
if (accidentResp.getHead().getResponseCompleteMessageStatus().getMessageStatusCode().equals("E0000")) {
|
|
|
//清空旧的存入表
|
|
|
@@ -918,7 +816,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
ati.setType(AttachInsureEnum.AI001.getCode());
|
|
|
ati.setEnable(WhetherEnum.YES.getCode());
|
|
|
ati.setRestrictNum(StringUtils.toInt(a.getNPurchaseLimitsNum()));
|
|
|
-
|
|
|
esmInsAttachInsureMapper.insert(ati);
|
|
|
eiaiList.add(ati);
|
|
|
});
|
|
|
@@ -1016,27 +913,17 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
*/
|
|
|
@Override
|
|
|
public AccidentResponse gainAccidentInsure(AccidentalDrivingQueryVo accidentalDrivingVo, String schemeNo) {
|
|
|
- HttpResult httpResult = new HttpResult();
|
|
|
-
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(accidentalDrivingVo.getAgreementId());
|
|
|
//组装参数
|
|
|
Accident accident = Accident.buildPayParam(accidentalDrivingVo, ycConfigureParameters, schemeNo);
|
|
|
|
|
|
- ObjectMapper xmlMapper = gainXmlMapper();
|
|
|
- //接口请求
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询开始======");
|
|
|
- String responseData = httpPostResultLog(accident, YcBuildData.API_ACCIDENT, "永诚API方式 - 获取意健险方案及险种 - ");
|
|
|
- log.debug("=========永诚API方式 - xml请求 - 获取意健险方案及险种查询结束!======");
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
- AccidentResponse accidentResp = null;
|
|
|
try {
|
|
|
- accidentResp = xmlMapper.readValue(cleanStr, AccidentResponse.class);
|
|
|
+ return yongchengRequestApiComponents.newQueryYwCvrgWeb(accident);
|
|
|
} catch (JsonProcessingException e) {
|
|
|
log.error("转换错误 方法:gainAccidentInsure 类:AccidentResponse");
|
|
|
throw new SystemException(e.getMessage());
|
|
|
}
|
|
|
- return accidentResp;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1044,7 +931,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public HttpResult callBackApi(CallBackRequest param) {
|
|
|
-
|
|
|
//成功
|
|
|
if (param.getResult().equals("0")) {
|
|
|
LambdaQueryWrapper<InsAreaCompany> lqw = new LambdaQueryWrapper();
|
|
|
@@ -1098,89 +984,10 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
requestLabel.setMotorTypeCode("11");
|
|
|
requestLabel.setCFstRegYm(carModelReq.getEnrollDate());
|
|
|
requestLabel.setAuthorityData(ycConfigureParameters.gainAuthorityDataXml(ycConfigureParameters));
|
|
|
-
|
|
|
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;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 日志返回处理
|
|
|
- *
|
|
|
- * @author: lig
|
|
|
- * @date: 2023年09月02日 0002
|
|
|
- */
|
|
|
- private <T> String httpPostResultLog(T requestData, String apiName, String textHead) {
|
|
|
-
|
|
|
- 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 {
|
|
|
-
|
|
|
- ObjectMapper xmlMapper = new XmlMapper();
|
|
|
- xmlMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
|
- xmlMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
|
|
|
- xmlMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
- xmlMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE);
|
|
|
- xmlMapper.enable(MapperFeature.USE_STD_BEAN_NAMING);
|
|
|
- xmlMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
|
|
|
-
|
|
|
- xmlString += xmlMapper.writeValueAsString(requestData);
|
|
|
-
|
|
|
- xmlString += "</soapenv:Body>\n" +
|
|
|
- "</soapenv:Envelope>";
|
|
|
-
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
- throw new RuntimeException("永诚API方式-xml转换失败");
|
|
|
- }
|
|
|
-// InsApiLog iplog = HttpXmlUtil.sendXmlPost(apiComponents.getUrl() + apiName, xmlString);
|
|
|
- String responseString = HttpXmlUtil.sendXmlPostReq(apiComponents.getUrl() + apiName, xmlString, log, textHead);
|
|
|
- if (StringUtils.isEmpty(responseString)) {
|
|
|
- try {
|
|
|
- Thread.sleep(1000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- responseString = HttpXmlUtil.sendXmlPostReq(apiComponents.getUrl() + apiName, xmlString, log, "《二次请求》" + textHead);
|
|
|
-
|
|
|
- }
|
|
|
- return responseString;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @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不能为空!");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 新订单 - 子订单
|
|
|
@@ -1190,7 +997,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
*/
|
|
|
private InsAreaCompany response_order(InsOrders insOrder, QuoteRespVo quoteRespVo, Ruote requestData, RuoteResponse responseData, BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
|
|
|
-
|
|
|
//交强保费 含税
|
|
|
double jqPremium = StringUtils.toDouble(responseData.getBase().getNBefTaxPrmJQ()) + StringUtils.toDouble(responseData.getBase().getNAppTaxAmtJQ());
|
|
|
//商业保费 含税
|
|
|
@@ -1259,37 +1065,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
return b1.add(b2).doubleValue();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 验证远程请求
|
|
|
- *
|
|
|
- * @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("远程接口调用异常");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新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) {
|
|
|
|
|
|
@@ -1366,7 +1141,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
address.replaceAll("开县", "开州区");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
Map<String, String> m = IDCardUtils.addressResolution(address);
|
|
|
if (null == m) return null;
|
|
|
String city = m.get("city");
|
|
|
@@ -1380,7 +1154,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
areaList = insAlltrustRegionMapper.selectList(lqw);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//如果地区查不到 用城市当地区查
|
|
|
if (null == areaList || areaList.size() < 1) {
|
|
|
LambdaQueryWrapper<InsAlltrustRegion> cityLqw = new LambdaQueryWrapper<>();
|
|
|
@@ -1400,7 +1173,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
areaList = insAlltrustRegionMapper.selectList(cityLqw);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (null != areaList && areaList.size() > 0) {
|
|
|
rMap.put("provinceCode", areaList.get(0).getProvinceCode());
|
|
|
rMap.put("cityCode", areaList.get(0).getCityCode());
|
|
|
@@ -1420,7 +1192,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
//投保人
|
|
|
CustomerInfoVo applicant = yaQuoteInfoVo.getPolicyHolderInfo();
|
|
|
|
|
|
-
|
|
|
Map<String, String> ownerMap = null;
|
|
|
//被保人省市区
|
|
|
Map<String, String> insureMap = null;
|
|
|
@@ -1440,26 +1211,21 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isEmpty(ownerProvinceData)) {
|
|
|
-
|
|
|
ownerProvinceData = new ArrayList<>();
|
|
|
//处理地区 车主
|
|
|
ownerMap = gainRegionCode(owner.getAddr(), "车主");
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isEmpty(insuredProvinceData)) {
|
|
|
insuredProvinceData = new ArrayList<>();
|
|
|
//处理地区 被保人
|
|
|
insureMap = gainRegionCode(insured.getAddr(), "被保人");
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isEmpty(applicantProvinceData)) {
|
|
|
-
|
|
|
applicantProvinceData = new ArrayList<>();
|
|
|
//处理地区 投保人
|
|
|
applicantMap = gainRegionCode(applicant.getAddr(), "投保人");
|
|
|
-
|
|
|
}
|
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
@@ -1479,14 +1245,12 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
ownerProvinceData.add(ownerMap.get("provinceCode"));
|
|
|
ownerProvinceData.add(ownerMap.get("cityCode"));
|
|
|
ownerProvinceData.add(ownerMap.get("areaCode"));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isNotEmpty(insureMap)) {
|
|
|
insuredProvinceData.add(insureMap.get("provinceCode"));
|
|
|
insuredProvinceData.add(insureMap.get("cityCode"));
|
|
|
insuredProvinceData.add(insureMap.get("areaCode"));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (CollUtil.isNotEmpty(applicantMap)) {
|
|
|
@@ -1495,11 +1259,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
applicantProvinceData.add(applicantMap.get("areaCode"));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//构造参数
|
|
|
buildRegionParam(m, yaQuoteInfoVo, ownerProvinceData, insuredProvinceData, applicantProvinceData);
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1549,37 +1311,12 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
return iac;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 请求API接口,返回对象
|
|
|
- *
|
|
|
- * @author: lig
|
|
|
- * @date: 2023年05月18日 0018
|
|
|
- */
|
|
|
- private <T> T requestApi(Object m, T response, InsAreaCompany iac, String reqUrl, InsQuoteFlow iqf, String textHead) {
|
|
|
- String responseData = httpPostResultLog(m, reqUrl, textHead);
|
|
|
- if (responseData.contains("报价返回信息异常")) {
|
|
|
- throw new SystemException("永诚报价请求负荷,永诚建议请稍后重试。");
|
|
|
- }
|
|
|
-
|
|
|
- String cleanStr = YcBuildData.cleanResponseStr(responseData);
|
|
|
- try {
|
|
|
-
|
|
|
- response = (T) gainXmlMapper().readValue(cleanStr, response.getClass());
|
|
|
- return response;
|
|
|
- } catch (JsonProcessingException e) {
|
|
|
- log.debug("=========永诚API方式 - xml请求 - {}解析报错:{}", iqf.getDesc(), e.getMessage());
|
|
|
- throw new SystemException("请求接口失败,对象转换错误,请联系管理员。");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private YcConfigureParameters gainYcConfigParams(String agreementId) {
|
|
|
YcConfigureParameters ycConfigureParameters = new YcConfigureParameters();
|
|
|
configureParametersComponents.toEntity(ycConfigureParameters, agreementId);
|
|
|
return ycConfigureParameters;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取车险保单
|
|
|
*
|
|
|
@@ -1599,11 +1336,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
*/
|
|
|
public String gainExistCarInsPolicy(String fileName, String licensePlate) {
|
|
|
String dir = SysConstants.CAR_INS_POLICY + "/" + licensePlate + "/";
|
|
|
-
|
|
|
return FileUtil.fileExist(dir, fileName, uploadFilePath, apiUrl + showFileUrl);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void buildOrderStatus(InsOrders order, InsAreaCompany iac) {
|
|
|
|
|
|
String iacStatus = iac.getOrderstatus();
|
|
|
@@ -1614,7 +1349,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
order.setOrderstatus(iac.getOrderstatus());
|
|
|
} else if (iacStatus.equals(InsOrderStatusEnum.WAIT_AUDIT.getCode()) && orderStatus.equals(InsOrderStatusEnum.QUOTE_ING.getCode())) {
|
|
|
order.setOrderstatus(iac.getOrderstatus());
|
|
|
- } else if (iacStatus.equals(InsOrderStatusEnum.WAIT_PAY.getCode()) && !orderStatus.equals(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode())) {
|
|
|
+ } else if (iacStatus.equals(InsOrderStatusEnum.WAIT_PAY.getCode())) {
|
|
|
order.setOrderstatus(iac.getOrderstatus());
|
|
|
} else if (iacStatus.equals(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode())) {
|
|
|
order.setOrderstatus(iac.getOrderstatus());
|
|
|
@@ -1624,7 +1359,6 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void buildCarInfo(CarInfoVo carInfo, ModelsQueryResponse.VehicleInfo vehicleInfo) {
|
|
|
carInfo.setModelCode(vehicleInfo.getVehicleId());
|
|
|
carInfo.setCiCarName(vehicleInfo.getVehicleName());
|
|
|
@@ -1633,20 +1367,17 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private void buildRegionParam(Ruote m, BaseQuoteInfoVo yaQuoteInfoVo, List<String> ownerProvinceData, List<String> insuredProvinceData, List<String> applicantProvinceData) {
|
|
|
yaQuoteInfoVo.getOwnerInfo().setProvinceData(ownerProvinceData);
|
|
|
m.getRequestLabel().getCondition().getVhlowner().setCProvince(ownerProvinceData.get(0));
|
|
|
m.getRequestLabel().getCondition().getVhlowner().setCCity(ownerProvinceData.get(1));
|
|
|
m.getRequestLabel().getCondition().getVhlowner().setCCounty(ownerProvinceData.get(2));
|
|
|
|
|
|
-
|
|
|
yaQuoteInfoVo.getInsuredPersonInfo().setProvinceData(insuredProvinceData);
|
|
|
m.getRequestLabel().getCondition().getInsured().setCProvince(insuredProvinceData.get(0));
|
|
|
m.getRequestLabel().getCondition().getInsured().setCCity(insuredProvinceData.get(1));
|
|
|
m.getRequestLabel().getCondition().getInsured().setCCounty(insuredProvinceData.get(2));
|
|
|
|
|
|
-
|
|
|
yaQuoteInfoVo.getPolicyHolderInfo().setProvinceData(applicantProvinceData);
|
|
|
m.getRequestLabel().getCondition().getApplicant().setCProvince(applicantProvinceData.get(0));
|
|
|
m.getRequestLabel().getCondition().getApplicant().setCCity(applicantProvinceData.get(1));
|