|
|
@@ -47,6 +47,7 @@ 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.*;
|
|
|
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.*;
|
|
|
import com.ydtech.modules.order.components.ConfigureParametersComponents;
|
|
|
import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
@@ -93,6 +94,10 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
private ObjectMapper xmlMapper = null;
|
|
|
|
|
|
+ //请求信息列表
|
|
|
+ List<String> requestInfoList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Autowired
|
|
|
private YcBuildData ycBuildData;
|
|
|
@@ -325,6 +330,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
@Override
|
|
|
public HttpResult quoteApi(BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
|
|
|
|
|
|
+ requestInfoList = new ArrayList<>();
|
|
|
|
|
|
// 获取协议配置信息
|
|
|
YcConfigureParameters ycConfigureParameters = gainYcConfigParams(quoteVo.getAgreementId());
|
|
|
@@ -367,15 +373,23 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
while (!boo) {
|
|
|
rr = requestApi(m, new RuoteResponse(), iac, YcBuildData.API_QUOTE, InsQuoteFlow.Q_S_0);
|
|
|
//处理返回信息
|
|
|
- //1、起保日期处理
|
|
|
+ //1、交强险重复投保处理
|
|
|
+ boo = ciRepetitionInsure(rr, m);
|
|
|
+ if (!boo) continue;
|
|
|
|
|
|
//2、转报处理
|
|
|
boo = reinsurance(rr, m);
|
|
|
if (!boo) continue;
|
|
|
|
|
|
- if (null == rr) return HttpResult.error("远程请求报价失败");
|
|
|
- if (!rr.getHead().getErrorCode().equals("000000")) return HttpResult.error(rr.getHead().getErrorMessage());
|
|
|
+ //3、商业险日期处理
|
|
|
+ boo = biRepetitionInsure(rr, m);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ if (null == rr) return HttpResult.error("远程请求报价失败");
|
|
|
+ if (!rr.getHead().getErrorCode().equals("000000")) return HttpResult.error(rr.getHead().getErrorMessage());
|
|
|
+
|
|
|
+
|
|
|
// RuoteResponse rr = requestApi(m, new RuoteResponse(), iac, YcBuildData.API_QUOTE, InsQuoteFlow.Q_S_0);
|
|
|
// if (null == rr) return HttpResult.error("远程请求报价失败");
|
|
|
// if (!rr.getHead().getErrorCode().equals("000000")) return HttpResult.error(rr.getHead().getErrorMessage());
|
|
|
@@ -399,6 +413,9 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
// updateApiLog(apiLog, iac);
|
|
|
quoteRespVo.setCompanyId(iac.getId());
|
|
|
|
|
|
+ requestInfoList.stream().forEach(c ->{
|
|
|
+ System.err.println("========请求流程信息==========:"+c);
|
|
|
+ });
|
|
|
|
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
|
|
|
@@ -469,44 +486,90 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 报价 重复投保业务处理
|
|
|
+ * 报价 交强险 重复 投保业务处理
|
|
|
*/
|
|
|
- public boolean repetitionInsure(RuoteResponse rr, Ruote m) {
|
|
|
-// if (rr.getHead().getErrorCode().equals("009999") && rr.getHead().getErrorMessage().indexOf("重复投保") > 1) {
|
|
|
-//
|
|
|
-// String errorMsg = rr.getHead().getErrorMessage();
|
|
|
-// //截取0 到 机动车交通事故强制险
|
|
|
-// String ciMsg = errorMsg.substring(0, errorMsg.indexOf("机动车交通事故强制险"));
|
|
|
-//
|
|
|
-// String cCheckCodeJQ = rr.getVhl().getCCheckCodeJQ();
|
|
|
-// String cCheckCodeSY = rr.getVhl().getCCheckCodeSY();
|
|
|
-//
|
|
|
-// //转保调用自动识别转保码
|
|
|
-// if (StringUtils.isNotEmpty(cCheckCodeJQ) || StringUtils.isNotEmpty(cCheckCodeSY)) {
|
|
|
-// //调用python ocr
|
|
|
-// String sendBody = "";
|
|
|
-// Map bodyMap = new HashMap();
|
|
|
-// bodyMap.put("jqImage", StringUtils.isNotEmpty(cCheckCodeJQ) ? cCheckCodeJQ : "");
|
|
|
-// bodyMap.put("syImage", StringUtils.isNotEmpty(cCheckCodeSY) ? cCheckCodeSY : "");
|
|
|
-// sendBody = JsonUtils.toJson(bodyMap);
|
|
|
-// String ocrStr = HttpUtil.sendPost("http://47.92.254.66:8088/getres", sendBody);
|
|
|
-// Map ocrMap = JsonUtils.toObject(ocrStr, Map.class);
|
|
|
-//
|
|
|
-//
|
|
|
-// m.getRequestLabel().getCondition().getVhl().setCBusType("2");
|
|
|
-// //交强
|
|
|
-// m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ(ocrMap.get("jqImageCode").toString());
|
|
|
-//// m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ(ocrMap.get("jqImageCode").toString());
|
|
|
-// m.getRequestLabel().getCondition().getVhl().setCQryCdeJQ(rr.getVhl().getCQryCdeJQ());
|
|
|
-//
|
|
|
-// //商业
|
|
|
-// m.getRequestLabel().getCondition().getVhl().setCCheckCodeSY(ocrMap.get("syImageCode").toString());
|
|
|
-// m.getRequestLabel().getCondition().getVhl().setCQryCdeSY(rr.getVhl().getCQryCdeSY());
|
|
|
-//
|
|
|
-// return false;
|
|
|
+ public boolean ciRepetitionInsure(RuoteResponse rr, Ruote m) {
|
|
|
+ String errorMsg = rr.getHead().getErrorMessage();
|
|
|
+ if (rr.getHead().getErrorCode().equals("009999") && errorMsg.contains("重复投保") && errorMsg.contains("机动车交通事故强制险") && errorMsg.contains("终保日期")) {
|
|
|
+ requestInfoList.add(errorMsg);
|
|
|
+
|
|
|
+ //截取0 到 机动车交通事故强制险
|
|
|
+ String ciMsg = errorMsg.substring(0, errorMsg.indexOf("机动车交通事故强制险"));
|
|
|
+
|
|
|
+ //终保日期
|
|
|
+ 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){
|
|
|
+ end = start.plusYears(1L);
|
|
|
+ newStartDate = DateTimeUtil.format(start, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ System.err.println("新起:" + newStartDate);
|
|
|
+ System.err.println("新止:" + newEndDate);
|
|
|
+
|
|
|
+ m.getRequestLabel().getCondition().getBase().setTInsrncBgnTmJQ(newStartDate);
|
|
|
+ m.getRequestLabel().getCondition().getBase().setTInsrncEndTmJQ(newEndDate);
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报价 商业险 重复 投保业务处理
|
|
|
+ */
|
|
|
+ public boolean biRepetitionInsure(RuoteResponse rr, Ruote m) {
|
|
|
+
|
|
|
+ if (rr.getHead().getErrorCode().equals("000000") && null != rr.getTfiWarnList() && CollUtil.isNotEmpty(rr.getTfiWarnList().getTfiWarnData())) {
|
|
|
+
|
|
|
+
|
|
|
+// List<TfiWarnListResponse.TfiWarnData> tfiWarnData = rr.getTfiWarnList().getTfiWarnData().stream().filter(item -> null != item).filter(item -> StringUtils.isNotEmpty(item.getWarnMessage())).collect(Collectors.toList());
|
|
|
+ TfiWarnListResponse.TfiWarnData tfiWarnData = rr.getTfiWarnList().getTfiWarnData().stream().filter(item -> null != item).filter(item -> StringUtils.isNotEmpty(item.getWarnMessage())).filter(item -> item.getWarnMessage().contains("终保日期")).findFirst().orElse(null);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//
|
|
|
-// }
|
|
|
-// }
|
|
|
+ //截取0 到 机动车交通事故强制险
|
|
|
+ String ciMsg = tfiWarnData.getWarnMessage();
|
|
|
+ requestInfoList.add(ciMsg);
|
|
|
+
|
|
|
+
|
|
|
+ //终保日期
|
|
|
+ String coverageEndDate = ciMsg.substring(ciMsg.indexOf("终保日期") + 5, ciMsg.indexOf("终保日期") + 5 + 12);
|
|
|
+
|
|
|
+ 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);
|
|
|
+ String newEndDate = DateTimeUtil.getEndTimeOfDayStr(end, DateTimeUtil.DATETIME_PATTERN);
|
|
|
+ System.err.println("商业新起:" + newStartDate);
|
|
|
+ System.err.println("商业新止:" + newEndDate);
|
|
|
+
|
|
|
+ m.getRequestLabel().getCondition().getBase().setTInsrncBgnTmSY(newStartDate);
|
|
|
+ m.getRequestLabel().getCondition().getBase().setTInsrncEndTmSY(newEndDate);
|
|
|
+
|
|
|
+ //转保信息清空 重新报价
|
|
|
+ rr.getVhl().setCQryCdeJQ("");
|
|
|
+ rr.getVhl().setCQryCdeSY("");
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCCheckCodeJQ("");
|
|
|
+ m.getRequestLabel().getCondition().getVhl().setCCheckCodeSY("");
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
return true;
|
|
|
|
|
|
|
|
|
@@ -522,6 +585,7 @@ public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
|
|
|
|
|
|
//转保调用自动识别转保码
|
|
|
if (StringUtils.isNotEmpty(cCheckCodeJQ) || StringUtils.isNotEmpty(cCheckCodeSY)) {
|
|
|
+ requestInfoList.add(rr.getHead().getErrorMessage());
|
|
|
//调用python ocr
|
|
|
String sendBody = "";
|
|
|
Map bodyMap = new HashMap();
|