|
|
@@ -4,7 +4,6 @@ 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.core.JsonProcessingException;
|
|
|
import com.ydtech.config.properties.YongchengApiConfigurationProperties;
|
|
|
@@ -173,8 +172,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
//车辆年款不能超过注册日期
|
|
|
List<ModelsQueryResponse.VehicleInfo> vehicleInfoList =
|
|
|
- rd.getVehicleInfoList().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(),
|
|
|
- a.getVehicleYear())).sorted(Comparator.comparing(ModelsQueryResponse.VehicleInfo::getVehiclePrice)).collect(Collectors.toList());
|
|
|
+ rd.getVehicleInfoList().stream().filter(a -> DateTimeUtil.dateIsAfter(carInfo.getRegisterDate(), a.getVehicleYear())).sorted(Comparator.comparing(ModelsQueryResponse.VehicleInfo::getVehiclePrice)).collect(Collectors.toList());
|
|
|
|
|
|
//匹配的车辆信息数据 为空
|
|
|
if (CollUtil.isEmpty(vehicleInfoList)) {
|
|
|
@@ -247,7 +245,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
* @throws JsonProcessingException
|
|
|
*/
|
|
|
private RuoteResponse getResponse(Ruote m, String vinNo, List<String> requestInfoList) throws JsonProcessingException {
|
|
|
- boolean boo = false;
|
|
|
+ boolean boo;
|
|
|
RuoteResponse rr = yongchengRequestApiComponents.newPremiumXnyCalculation(m);
|
|
|
//交强
|
|
|
m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ("");
|
|
|
@@ -259,19 +257,38 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if ("009999".equals(rr.getHead().getErrorCode()) && (rr.getHead().getErrorMessage().contains("车主") || rr.getHead().getErrorMessage().contains("投保人") || rr.getHead().getErrorMessage().contains("被保人"))) {
|
|
|
return rr;
|
|
|
}
|
|
|
- //处理返回信息
|
|
|
- //1、交强险重复投保处理
|
|
|
- boo = ciRepetitionInsure(rr, m, requestInfoList);
|
|
|
- if (!boo) {
|
|
|
- InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 交强险重复投保处理", vinNo);
|
|
|
- rr = this.getResponse(m, vinNo, requestInfoList);
|
|
|
- }
|
|
|
|
|
|
- //1、商业险重复投保处理
|
|
|
- boo = commerceRepetitionInsure(rr, m, requestInfoList);
|
|
|
- if (!boo) {
|
|
|
- InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 商业险重复投保处理", vinNo);
|
|
|
- rr = this.getResponse(m, vinNo, requestInfoList);
|
|
|
+
|
|
|
+ String errorMsg = rr.getHead().getErrorMessage();
|
|
|
+
|
|
|
+
|
|
|
+ if (rr.getHead().getErrorCode().equals("009999") && errorMsg.contains("重复投保")) {
|
|
|
+ // 商业险
|
|
|
+ boolean appSYFlag = "Y".equals(m.getRequestLabel().getCondition().getBase().getAppSYFlag());
|
|
|
+ // 交强险
|
|
|
+ boolean cAppJqFlag = "Y".equals(m.getRequestLabel().getCondition().getBase().getCAppJqFlag());
|
|
|
+
|
|
|
+ if(errorMsg.contains("机动车综合商业保险")){
|
|
|
+ cAppJqFlag = false;
|
|
|
+ }else if(errorMsg.contains("机动车交通事故强制险")) {
|
|
|
+ appSYFlag = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理返回信息
|
|
|
+ //1、交强险重复投保处理
|
|
|
+ boo = ciRepetitionInsure(rr, m, requestInfoList, cAppJqFlag);
|
|
|
+ if (!boo) {
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 交强险重复投保处理", vinNo);
|
|
|
+ rr = this.getResponse(m, vinNo, requestInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //1、商业险重复投保处理
|
|
|
+ boo = commerceRepetitionInsure(rr, m, requestInfoList, appSYFlag);
|
|
|
+ if (!boo) {
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.AICS.getPinyin(), "\n\n---------> {} - 商业险重复投保处理", vinNo);
|
|
|
+ rr = this.getResponse(m, vinNo, requestInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//2、转保处理
|
|
|
@@ -306,13 +323,13 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
private StringBuilder getErrorInfo(RuoteResponse rr) {
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("车主省市县码值不符合规范")) {
|
|
|
- sb.append("|永诚 - 保司 - 车主地区自动解析失败");
|
|
|
+ sb.append("|永诚 - 保司 - 车主地区自动解析失败,请检查车主地区县级市名称已变更");
|
|
|
}
|
|
|
if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("投保人省市县码值不符合规范")) {
|
|
|
- sb.append("|永诚 - 保司 - 投保人地区自动解析失败");
|
|
|
+ sb.append("|永诚 - 保司 - 投保人地区自动解析失败,请检查投保人地区县级市名称已变更");
|
|
|
}
|
|
|
if (rr.getHead().getErrorCode().equals("E0001") && rr.getHead().getErrorMessage().equals("被保人省市县码值不符合规范")) {
|
|
|
- sb.append("|永诚 - 保司 - 被保人地区自动解析失败");
|
|
|
+ sb.append("|永诚 - 保司 - 被保人地区自动解析失败,请检查被保人地区县级市名称已变更");
|
|
|
}
|
|
|
return sb;
|
|
|
}
|
|
|
@@ -365,11 +382,10 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
/**
|
|
|
* 报价 交强险 重复 投保业务处理
|
|
|
*/
|
|
|
- public boolean ciRepetitionInsure(RuoteResponse rr, Ruote m, List<String> requestInfoList) {
|
|
|
+ public boolean ciRepetitionInsure(RuoteResponse rr, Ruote m, List<String> requestInfoList, boolean cAppJqFlag) {
|
|
|
String errorMsg = rr.getHead().getErrorMessage();
|
|
|
|
|
|
- if (rr.getHead().getErrorCode().equals("009999") &&
|
|
|
- errorMsg.contains("重复投保") && "Y".equals(m.getRequestLabel().getCondition().getBase().getCAppJqFlag())) {
|
|
|
+ if (cAppJqFlag) {
|
|
|
requestInfoList.add(errorMsg);
|
|
|
log.info("永诚API方式 - xml请求 ------------报价 -> 交强重复投保----------------");
|
|
|
|
|
|
@@ -377,8 +393,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if (!errorMsg.contains("终保日期")) {
|
|
|
throw new SystemException(errorMsg);
|
|
|
}
|
|
|
- String coverageEndDate = errorMsg.substring(errorMsg.indexOf("终保日期") + 5,
|
|
|
- errorMsg.indexOf("终保日期") + 5 + 16);
|
|
|
+ String coverageEndDate = errorMsg.substring(errorMsg.indexOf("终保日期") + 5, errorMsg.indexOf("终保日期") + 5 + 16);
|
|
|
|
|
|
LocalDateTime start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.DATETIME_PATTERN_EXT1);
|
|
|
LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
@@ -409,10 +424,10 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
/**
|
|
|
* 报价 商业 重复 投保业务处理
|
|
|
*/
|
|
|
- public boolean commerceRepetitionInsure(RuoteResponse rr, Ruote m, List<String> requestInfoList) {
|
|
|
+ public boolean commerceRepetitionInsure(RuoteResponse rr, Ruote m, List<String> requestInfoList, boolean appSYFlag) {
|
|
|
String errorMsg = rr.getHead().getErrorMessage();
|
|
|
- if (rr.getHead().getErrorCode().equals("009999") && errorMsg.contains("重复投保") &&
|
|
|
- "Y".equals(m.getRequestLabel().getCondition().getBase().getAppSYFlag())) {
|
|
|
+
|
|
|
+ if (appSYFlag) {
|
|
|
requestInfoList.add(errorMsg);
|
|
|
log.info("永诚API方式 - xml请求 ------------报价 -> 商业险重复投保----------------");
|
|
|
|
|
|
@@ -420,8 +435,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if (!errorMsg.contains("保险止期")) {
|
|
|
throw new SystemException(errorMsg);
|
|
|
}
|
|
|
- String coverageEndDate = errorMsg.substring(errorMsg.indexOf("保险止期") + 6,
|
|
|
- errorMsg.indexOf("保险止期") + 6 + 19);
|
|
|
+ String coverageEndDate = errorMsg.substring(errorMsg.indexOf("保险止期") + 6, errorMsg.indexOf("保险止期") + 6 + 19);
|
|
|
LocalDateTime start;
|
|
|
|
|
|
if (coverageEndDate.contains("23:59:59")) {
|
|
|
@@ -470,8 +484,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
//终保日期
|
|
|
String coverageEndDate = ciMsg.substring(ciMsg.indexOf("终保日期") + 5, ciMsg.indexOf("终保日期") + 5 + 12);
|
|
|
|
|
|
- LocalDateTime start = DateTimeUtil.parseLocalDateTime(coverageEndDate,
|
|
|
- DateTimeUtil.UNSIGNED_DATETIME_PATTERN_EXT1);
|
|
|
+ LocalDateTime start = DateTimeUtil.parseLocalDateTime(coverageEndDate, DateTimeUtil.UNSIGNED_DATETIME_PATTERN_EXT1);
|
|
|
LocalDateTime end = start.plusYears(1L).minusDays(1L);
|
|
|
|
|
|
String newStartDate = DateTimeUtil.getStartTimeOfDayStr(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
@@ -686,8 +699,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(iac.getAgreementId());
|
|
|
//组装参数
|
|
|
- Pay pay = Pay.buildPayParam(iac, ycConfigureParameters.gainAuthorityDataXml(),
|
|
|
- apiComponents.getPayCallBack());
|
|
|
+ Pay pay = Pay.buildPayParam(iac, ycConfigureParameters.gainAuthorityDataXml(), apiComponents.getPayCallBack());
|
|
|
//接口请求
|
|
|
PayResponse payResp = yongchengRequestApiComponents.newGetPayNo(pay);
|
|
|
|
|
|
@@ -723,8 +735,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
//0 支付回调 1核保回调 5直接返回字符串信息
|
|
|
String type = "5";
|
|
|
//组装参数
|
|
|
- CallbackAnOrder o = CallbackAnOrder.buildCallbackAnOrderParam(iac,
|
|
|
- ycConfigureParameters.gainAuthorityDataXml(), type);
|
|
|
+ CallbackAnOrder o = CallbackAnOrder.buildCallbackAnOrderParam(iac, ycConfigureParameters.gainAuthorityDataXml(), type);
|
|
|
|
|
|
//接口请求
|
|
|
try {
|
|
|
@@ -749,8 +760,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
DrivingInsuranceDto drivingInsuranceDto = new DrivingInsuranceDto();
|
|
|
drivingInsuranceDto.setPolicyNumber(param.getYwPolicyNo());
|
|
|
drivingInsuranceDto.setApplicationNumber(param.getYwPolicyAppNo());
|
|
|
- JSONArray objects =
|
|
|
- JSON.parseArray(JSON.toJSONString(Collections.singletonList(drivingInsuranceDto)));
|
|
|
+ JSONArray objects = JSON.parseArray(JSON.toJSONString(Collections.singletonList(drivingInsuranceDto)));
|
|
|
iac.setCrossInsurance(objects);
|
|
|
}
|
|
|
|
|
|
@@ -772,8 +782,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
} else {
|
|
|
//失败原因
|
|
|
- log.info(String.format("永诚API方式 - 补传回调 - 失败,交强保单号:{} ,商业保单号:{},类型:{}", param.getCiPolicyNo(),
|
|
|
- param.getBizPolicyNo(),
|
|
|
+ log.info(String.format("永诚API方式 - 补传回调 - 失败,交强保单号:{} ,商业保单号:{},类型:{}", param.getCiPolicyNo(), param.getBizPolicyNo(),
|
|
|
param.getType()));
|
|
|
return HttpResult.error(param.getMessage());
|
|
|
}
|
|
|
@@ -876,8 +885,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
cipDto.setJyUrl(jyUrl);
|
|
|
}
|
|
|
|
|
|
- return HttpResult.ok(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription()
|
|
|
- , cipDto);
|
|
|
+ return HttpResult.ok(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription(), cipDto);
|
|
|
|
|
|
} else {
|
|
|
throw new SystemException(pResp.getHead().getResponseCompleteMessageStatus().getMessageStatusDescription());
|
|
|
@@ -945,7 +953,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
* 驾意外险 查询
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpResult< List<EsmInsAttachInsure>> accidentQuery(AccidentalDrivingQueryVo accidentalDrivingVo) {
|
|
|
+ public HttpResult<List<EsmInsAttachInsure>> accidentQuery(AccidentalDrivingQueryVo accidentalDrivingVo) {
|
|
|
//初始化redisKey
|
|
|
StringBuilder redisKey = new StringBuilder();
|
|
|
redisKey.append(YC_AGREEMENT_KEY);
|
|
|
@@ -981,8 +989,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
//将insAttachInsureList存入redis
|
|
|
if (!insAttachInsureList.isEmpty()) {
|
|
|
- redisTemplate.opsForValue().set(redisKey.toString(), JSON.toJSONString(insAttachInsureList),
|
|
|
- YC_ACCIDENTAL_DRIVING_TIME,
|
|
|
+ redisTemplate.opsForValue().set(redisKey.toString(), JSON.toJSONString(insAttachInsureList), YC_ACCIDENTAL_DRIVING_TIME,
|
|
|
TimeUnit.DAYS);
|
|
|
}
|
|
|
|
|
|
@@ -1005,8 +1012,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if (!Objects.isNull(redisTemplate.opsForValue().get(redisKey.toString()))) {
|
|
|
String redisValue = String.valueOf(redisTemplate.opsForValue().get(redisKey.toString()));
|
|
|
if (StringUtils.isNotEmpty(redisValue)) {
|
|
|
- List<EsmInsAttachInsureDetails> esmInsAttachInsureDetails = JSON.parseArray(redisValue,
|
|
|
- EsmInsAttachInsureDetails.class);
|
|
|
+ List<EsmInsAttachInsureDetails> esmInsAttachInsureDetails = JSON.parseArray(redisValue, EsmInsAttachInsureDetails.class);
|
|
|
return HttpResult.ok(esmInsAttachInsureDetails);
|
|
|
}
|
|
|
}
|
|
|
@@ -1029,8 +1035,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
//将esmInsAttachInsureDetails存入redis
|
|
|
if (!esmInsAttachInsureDetails.isEmpty()) {
|
|
|
- redisTemplate.opsForValue().set(redisKey.toString(), JSON.toJSONString(esmInsAttachInsureDetails),
|
|
|
- YC_ACCIDENTAL_DRIVING_TIME
|
|
|
+ redisTemplate.opsForValue().set(redisKey.toString(), JSON.toJSONString(esmInsAttachInsureDetails), YC_ACCIDENTAL_DRIVING_TIME
|
|
|
, TimeUnit.DAYS);
|
|
|
}
|
|
|
return HttpResult.ok(esmInsAttachInsureDetails);
|
|
|
@@ -1136,11 +1141,9 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if (param.getResult().equals("0")) {
|
|
|
LambdaQueryWrapper<InsAreaCompany> lqw = new LambdaQueryWrapper<>();
|
|
|
//交强投保单号查询
|
|
|
- lqw.eq(StringUtils.isNotEmpty(param.getCiPolicyAppNo()), InsAreaCompany::getJqapplyno,
|
|
|
- param.getCiPolicyAppNo());
|
|
|
+ lqw.eq(StringUtils.isNotEmpty(param.getCiPolicyAppNo()), InsAreaCompany::getJqapplyno, param.getCiPolicyAppNo());
|
|
|
//商业投保单号查询
|
|
|
- lqw.eq(StringUtils.isNotEmpty(param.getBizPolicyAppNo()), InsAreaCompany::getSyapplyno,
|
|
|
- param.getBizPolicyAppNo());
|
|
|
+ lqw.eq(StringUtils.isNotEmpty(param.getBizPolicyAppNo()), InsAreaCompany::getSyapplyno, param.getBizPolicyAppNo());
|
|
|
InsAreaCompany iac = insAreaCompanyService.getOne(lqw);
|
|
|
|
|
|
if (null != iac) {
|
|
|
@@ -1162,15 +1165,13 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
|
|
|
//支付后 手工确认意外险
|
|
|
} else {
|
|
|
- log.info(String.format("永诚API方式 - 回调 - 信息,订单不存在,交强保单号:{} ,商业保单号:{}", param.getCiPolicyNo(),
|
|
|
- param.getBizPolicyNo()));
|
|
|
+ log.info(String.format("永诚API方式 - 回调 - 信息,订单不存在,交强保单号:{} ,商业保单号:{}", param.getCiPolicyNo(), param.getBizPolicyNo()));
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
//失败原因
|
|
|
param.getMessage();
|
|
|
- log.info(String.format("永诚API方式 - 回调 - 失败,交强保单号:{} ,商业保单号:{},类型:{}", param.getCiPolicyNo(),
|
|
|
- param.getBizPolicyNo(),
|
|
|
+ log.info(String.format("永诚API方式 - 回调 - 失败,交强保单号:{} ,商业保单号:{},类型:{}", param.getCiPolicyNo(), param.getBizPolicyNo(),
|
|
|
param.getType()));
|
|
|
}
|
|
|
return HttpResult.ok(param);
|
|
|
@@ -1182,8 +1183,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
* @author: lig
|
|
|
* @date: 2023年02月08日 0008
|
|
|
*/
|
|
|
- private ModelsQueryXml buildModelsQueryParam(CarModel_Req carModelReq,
|
|
|
- YcConfigureParameters ycConfigureParameters) {
|
|
|
+ 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));
|
|
|
@@ -1425,8 +1425,7 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
|
|
|
if (insured.getIdentifyNumber().equals(applicant.getIdentifyNumber())) {
|
|
|
applicantPersonAreaVo = insuredPersonAreaVo;
|
|
|
} else {
|
|
|
- applicantPersonAreaVo = sysAreaService.queryByAddressYc(applicant.getAddr(),
|
|
|
- applicant.getIdentifyNumber());
|
|
|
+ applicantPersonAreaVo = sysAreaService.queryByAddressYc(applicant.getAddr(), applicant.getIdentifyNumber());
|
|
|
}
|
|
|
|
|
|
if (!Objects.isNull(ownerPersonAreaVo)) {
|