|
|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
+import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
import com.jzg.commons.entity.quote.vo.*;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
import com.jzg.commons.entity.quote.vo.base.LoginBase;
|
|
|
@@ -19,6 +20,7 @@ import com.jzg.quotation.commons.entity.DetectLoginRequest;
|
|
|
import com.jzg.quotation.commons.entity.GetCaptchaRequest;
|
|
|
import com.jzg.quotation.commons.entity.GetCaptchaResponse;
|
|
|
import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
|
|
|
+import com.jzg.quotation.commons.utils.TimeProcessing;
|
|
|
import com.jzg.quotation.guoshou.crawler.component.GsCrawlerLoginComponent;
|
|
|
import com.jzg.quotation.guoshou.crawler.component.GsCrawlerRequestComponent;
|
|
|
import com.jzg.quotation.guoshou.crawler.constant.GsConstants;
|
|
|
@@ -27,7 +29,7 @@ import com.jzg.quotation.guoshou.crawler.entity.response.*;
|
|
|
import com.jzg.quotation.guoshou.crawler.service.GuoshouCrawlerRequest;
|
|
|
import com.jzg.quotation.guoshou.crawler.util.DateUtils;
|
|
|
import com.jzg.quotation.guoshou.crawler.util.FirstMatchUtils;
|
|
|
-import com.jzg.quotation.guoshou.crawler.util.QrCodeReader;
|
|
|
+import com.jzg.quotation.guoshou.crawler.util.ModularDataProcessor;
|
|
|
import com.jzg.quotation.guoshou.crawler.util.RsaUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -38,14 +40,14 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
import org.apache.pdfbox.text.PDFTextStripper;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
@@ -63,6 +65,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
|
|
|
private final GsCrawlerRequestComponent gsCrawlerRequestComponent;
|
|
|
private final GsCrawlerLoginComponent gsCrawlerLoginComponent;
|
|
|
+ private final ModularDataProcessor dataProcessor;
|
|
|
private final StringRedisTemplate redisTemplate;
|
|
|
private final RsaUtils rsaUtils;
|
|
|
private final OrgClient orgClient;
|
|
|
@@ -91,7 +94,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
configInfo.put("username", username);
|
|
|
configInfo.put("password", password);
|
|
|
attributionInformationVo.setConfigInfo(configInfo);
|
|
|
- return getLoginInfo(attributionInformationVo) != null;
|
|
|
+ return gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo) != null;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -101,23 +104,28 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
public QuoteResultsVo quote(QuoteVo quoteVo) throws Exception {
|
|
|
OrderBase order = quoteVo.getOrder();
|
|
|
AttributionInformationVo attributionInformationVo = order.getAttributionInformationVo();
|
|
|
- CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
// 查询loginInfo
|
|
|
- UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
- String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
- String token = JSONObject.parseObject(redisValue).getString("token");
|
|
|
- String userID = JSONObject.parseObject(redisValue).getString("userID");
|
|
|
- JSONObject bindInfo = getBindInfo(redisValue, loginInfo);
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
+ CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
+ RedisResultDTO redisResultDTO = loginInfo.getRedisResultDTO();
|
|
|
+ String token = redisResultDTO.getToken();
|
|
|
+ String userID = redisResultDTO.getUserID();
|
|
|
+ JSONObject bindInfo = getBindInfo(token, loginInfo);
|
|
|
if (bindInfo.isEmpty()) {
|
|
|
log.error("未匹配到归属信息,username:{}, gsName:{}", "140123198503130219", "腾晟保险代理有限公司山西分公司");
|
|
|
throw new RuntimeException("请输入正确的归属信息");
|
|
|
}
|
|
|
log.info("绑定信息查询成功,userAgentName:{}", bindInfo.getString("userAgentName"));
|
|
|
// 调用订单号接口
|
|
|
- InsuranceApplicationEntity insuranceApplicationEntity = new InsuranceApplicationEntity(redisValue, bindInfo, loginInfo, rsaUtils.encrypt(carInfoVo.getLicenseNo()),
|
|
|
- rsaUtils.encrypt(JSONObject.parseObject(redisValue).getString("userID")), carInfoVo.getEnergyTypeCode());
|
|
|
- String orderNo = gsCrawlerRequestComponent.queryOrderNo(insuranceApplicationEntity, redisValue);
|
|
|
+ InsuranceApplicationEntity insuranceApplicationEntity = new InsuranceApplicationEntity(redisResultDTO, bindInfo, loginInfo, rsaUtils.encrypt(carInfoVo.getLicenseNo()),
|
|
|
+ rsaUtils.encrypt(redisResultDTO.getUserID()), carInfoVo.getEnergyTypeCode());
|
|
|
+ String orderNo = gsCrawlerRequestComponent.queryOrderNo(insuranceApplicationEntity, token);
|
|
|
log.info("获取订单号成功,orderId:{}", orderNo);
|
|
|
+
|
|
|
+ // 获取销售归属信息
|
|
|
+ JSONObject jsonObject = gsCrawlerRequestComponent.salesFCBelongInfo(token, orderNo, bindInfo);
|
|
|
+ String businessNatureCode = jsonObject.getString("businessNatureCode");
|
|
|
+
|
|
|
// 获取保险信息
|
|
|
InsuranceInformationRequest informationRequest = new InsuranceInformationRequest(rsaUtils.encrypt(bindInfo.getString("userAgentCode")), orderNo, "");
|
|
|
CarInsuranceQueryResponse.CarInsuranceData insuranceInformation = gsCrawlerRequestComponent.getInsuranceInformation(informationRequest, token);
|
|
|
@@ -126,15 +134,21 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
//查询车型
|
|
|
List<GsCrawlerCarQueryResponse.VehicleModelDetail> vehicleModelDetails = gsCrawlerRequestComponent.carQuery(carQueryRequest, token);
|
|
|
GsCrawlerCarQueryResponse.VehicleModelDetail vehicleModelDetail = CarModelsFilterUtils.to(vehicleModelDetails, carInfoVo);
|
|
|
+
|
|
|
if (vehicleModelDetail == null) {
|
|
|
log.error("未匹配到车辆信息,vin:{}, seatCount:{}", carInfoVo.getVinNo());
|
|
|
throw new RuntimeException("暂未查询到车型");
|
|
|
}
|
|
|
- JSONObject jsonObject = gsCrawlerRequestComponent.salesFCBelongInfo(token, orderNo, bindInfo);
|
|
|
- String businessNatureCode = jsonObject.getString("businessNatureCode");
|
|
|
+
|
|
|
log.info("车辆信息查询成功,standardName:{}, seat:{}", vehicleModelDetail.getStandardName(), vehicleModelDetail.getSeat());
|
|
|
+ // 查询获取承保方式
|
|
|
+// ProductUnderwriteRequest request = new ProductUnderwriteRequest("","",businessNatureCode,"","","","");
|
|
|
+// gsCrawlerRequestComponent.getUnderwritingById(token,request);
|
|
|
+
|
|
|
+
|
|
|
// 封装submit参数
|
|
|
SubmitInsuranceInformationRequest submitInsuranceInformationRequest = new SubmitInsuranceInformationRequest(orderNo, quoteVo, vehicleModelDetail, loginInfo, bindInfo, insuranceInformation, userID, orgClient, businessNatureCode);
|
|
|
+ log.info("submit提交参数:{}{}", JSONObject.toJSONString(submitInsuranceInformationRequest));
|
|
|
SubmitResponse submitResponse = gsCrawlerRequestComponent.submitInsuranceInformationRequest(submitInsuranceInformationRequest, token);
|
|
|
if ("500".equals(submitResponse.getStatus())) {
|
|
|
throw new RuntimeException("提交保险信息失败" + submitResponse.getMsg());
|
|
|
@@ -156,7 +170,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
}
|
|
|
// 加密转换查询
|
|
|
//String encrypt_userCode = gsCrawlerRequestComponent.getEncryptionConvert(userID, token);
|
|
|
- return calculation(orderNo, redisValue, quoteVo, insuranceInformation, loginInfo, vehicleModelDetail, bindInfo, businessNatureCode);
|
|
|
+ return calculation(orderNo, redisResultDTO, quoteVo, insuranceInformation, loginInfo, vehicleModelDetail, bindInfo, businessNatureCode,jsonObject);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -164,9 +178,8 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
AttributionInformationVo attributionInformationVo = underwritingVo.getOrder().getAttributionInformationVo();
|
|
|
String ordersNo = underwritingVo.getOrder().getOrdersNo();
|
|
|
JSONObject quoteInfo = JSONObject.parseObject(redisTemplate.opsForValue().get(GsConstants.GS_REDIS_QUOTE_KEY + ordersNo));
|
|
|
- UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
- String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
- JSONObject res = gsCrawlerRequestComponent.doCompleteTask(new OrderEntity(quoteInfo), redisValue);
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
+ JSONObject res = gsCrawlerRequestComponent.doCompleteTask(new OrderEntity(quoteInfo), loginInfo.getRedisResultDTO().getToken());
|
|
|
log.info("核保结果:{}", res);
|
|
|
UnderwritingResultsVo underwritingResultsVo = new UnderwritingResultsVo();
|
|
|
if (!"核保通过".equals(res.getString("msg"))) {
|
|
|
@@ -180,7 +193,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
underwritingResultsVo.setCompanyOrderNo(quoteInfo.getString("orderId"));
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.PAY_PENDING);
|
|
|
underwritingResultsVo.setUnderwritingResult(res.getString("msg"));
|
|
|
- underwritingResultsVo.setPaymentLink(getPayUrl(quoteInfo, redisValue));
|
|
|
+ underwritingResultsVo.setPaymentLink(getPayUrl(quoteInfo, loginInfo.getRedisResultDTO()));
|
|
|
} else {
|
|
|
underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
|
|
|
}
|
|
|
@@ -227,32 +240,31 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
|
|
|
@Override
|
|
|
public PaymentLinkResultsVo getPaymentLink(PaymentLinkVo paymentLinkVo) throws Exception {
|
|
|
+ InsOrders insOrders = paymentLinkVo.getInsOrders();
|
|
|
AttributionInformationVo attributionInformationVo = paymentLinkVo.getOrder().getAttributionInformationVo();
|
|
|
- String ordersNo = paymentLinkVo.getOrder().getOrdersNo();
|
|
|
- JSONObject quoteInfo = JSONObject.parseObject(redisTemplate.opsForValue().get(GsConstants.GS_REDIS_QUOTE_KEY + ordersNo));
|
|
|
- getLoginInfo(attributionInformationVo);
|
|
|
- String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
PaymentLinkResultsVo paymentLinkResultsVo = new PaymentLinkResultsVo();
|
|
|
- paymentLinkResultsVo.setPaymentLink(getPayUrl(quoteInfo, redisValue));
|
|
|
+ //paymentLinkResultsVo.setPaymentLink(getPayUrl(quoteInfo, redisValue));
|
|
|
return paymentLinkResultsVo;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public String getPayUrl(JSONObject quoteInfo, String redisValue) {
|
|
|
+ public String getPayUrl(JSONObject quoteInfo,RedisResultDTO redisResultDTO) {
|
|
|
// 核保通过 获取订单详情
|
|
|
- Map<String, Object> detailData = new HashMap<>();
|
|
|
- detailData.put("orderNo", quoteInfo.getString("orderId"));
|
|
|
- detailData.put("structureId", JSONObject.parseObject(redisValue).getString("structureId"));
|
|
|
- detailData.put("userCode", JSONObject.parseObject(redisValue).getString("username"));
|
|
|
- detailData.put("userLoginType", "1");
|
|
|
- detailData.put("sellCode", null);
|
|
|
- detailData.put("systemSource", "gstc");
|
|
|
- JSONObject doMesOrderDetailRes = gsCrawlerRequestComponent.doMesOrderDetail(redisValue, quoteInfo);
|
|
|
- // 提取支付链接
|
|
|
- String payUrl = JSONObject.parseObject(doMesOrderDetailRes.getString("data")).getString("payUrl");
|
|
|
- JSONObject tokenResponse = gsCrawlerRequestComponent.getTokenUrl(getTokenData(payUrl), redisValue);
|
|
|
- ResponseDTO shareInfo = gsCrawlerRequestComponent.getShareInfo(tokenResponse, redisValue);
|
|
|
- return QrCodeReader.parseQrCodeUrl(shareInfo.getData().getUrl());
|
|
|
+// Map<String, Object> detailData = new HashMap<>();
|
|
|
+// detailData.put("orderNo", quoteInfo.getString("orderId"));
|
|
|
+// detailData.put("structureId", JSONObject.parseObject(redisValue).getString("structureId"));
|
|
|
+// detailData.put("userCode", JSONObject.parseObject(redisValue).getString("username"));
|
|
|
+// detailData.put("userLoginType", "1");
|
|
|
+// detailData.put("sellCode", null);
|
|
|
+// detailData.put("systemSource", "gstc");
|
|
|
+// JSONObject doMesOrderDetailRes = gsCrawlerRequestComponent.doMesOrderDetail(redisValue, quoteInfo);
|
|
|
+// // 提取支付链接
|
|
|
+// String payUrl = JSONObject.parseObject(doMesOrderDetailRes.getString("data")).getString("payUrl");
|
|
|
+// JSONObject tokenResponse = gsCrawlerRequestComponent.getTokenUrl(getTokenData(payUrl), redisValue);
|
|
|
+// ResponseDTO shareInfo = gsCrawlerRequestComponent.getShareInfo(tokenResponse, redisValue);
|
|
|
+ // return QrCodeReader.parseQrCodeUrl(shareInfo.getData().getUrl());
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -263,17 +275,16 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
String value = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_QUOTE_KEY + orderBase.getOrdersNo());
|
|
|
JSONObject quote = JSONObject.parseObject(value);
|
|
|
// 查询loginInfo
|
|
|
- UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
- String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
// 获取归属信息
|
|
|
- JSONObject bindInfo = getBindInfo(redisValue, loginInfo);
|
|
|
+ JSONObject bindInfo = getBindInfo(loginInfo.getRedisResultDTO().getToken(), loginInfo);
|
|
|
// 1. 自动生成订单
|
|
|
GenerateDataRequest generateDataRequest = new GenerateDataRequest(quote);
|
|
|
- gsCrawlerRequestComponent.doAutoGenerate(generateDataRequest, redisValue);
|
|
|
+ gsCrawlerRequestComponent.doAutoGenerate(generateDataRequest, loginInfo.getRedisResultDTO().getToken());
|
|
|
// 2. 获取订单详情
|
|
|
- JSONObject doMesOrderDetail = gsCrawlerRequestComponent.doMesOrderDetail(redisValue, quote);
|
|
|
+ JSONObject doMesOrderDetail = gsCrawlerRequestComponent.doMesOrderDetail(loginInfo.getRedisResultDTO().getToken(), quote);
|
|
|
// 3. 获取上传状态
|
|
|
- gsCrawlerRequestComponent.getUploadSuccess(redisValue, quote);
|
|
|
+ gsCrawlerRequestComponent.getUploadSuccess(loginInfo.getRedisResultDTO().getToken(), quote);
|
|
|
// 4. 查询日志
|
|
|
JSONObject logData = new JSONObject();
|
|
|
logData.put("orderNo", quote.getString("orderId"));
|
|
|
@@ -284,7 +295,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
logData.put("oriSysOperatorKey", "RU0yZW0y");
|
|
|
logData.put("bancassuranceFlag", 0);
|
|
|
logData.put("checkOrganizationFlag", "0");
|
|
|
- QueryLogResponse queryLogResponse = gsCrawlerRequestComponent.doQueryLog(redisValue, logData);
|
|
|
+ QueryLogResponse queryLogResponse = gsCrawlerRequestComponent.doQueryLog(loginInfo.getRedisResultDTO().getToken(), logData);
|
|
|
String JQ_Policy = "";
|
|
|
String SY_Policy = "";
|
|
|
String JYX_Policy = "";
|
|
|
@@ -296,7 +307,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
logData.put("oriSysOperator", "E11_user");
|
|
|
logData.put("oriSysOperatorKey", "RTExZTEx");
|
|
|
logData.put("vinUseChangeStatusFlag", "1");
|
|
|
- queryLogResponse = gsCrawlerRequestComponent.doQueryLog(redisValue, logData);
|
|
|
+ queryLogResponse = gsCrawlerRequestComponent.doQueryLog(loginInfo.getRedisResultDTO().getToken(), logData);
|
|
|
}
|
|
|
QueryLogResponse.DataDTO responseData = queryLogResponse.getData();
|
|
|
// 解析投保单号
|
|
|
@@ -312,13 +323,13 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
redisTemplate.opsForValue().set(GsConstants.GS_REDIS_QUOTE_KEY + orderBase.getOrdersNo() + ":SY_Policy:", SY_Policy, GsConstants.REDIS_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
|
|
redisTemplate.opsForValue().set(GsConstants.GS_REDIS_QUOTE_KEY + orderBase.getOrdersNo() + ":JYX_Policy:", JYX_Policy, GsConstants.REDIS_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
|
|
// 再次获取订单详情
|
|
|
- gsCrawlerRequestComponent.doMesOrderDetail(redisValue, quote);
|
|
|
+ gsCrawlerRequestComponent.doMesOrderDetail(loginInfo.getRedisResultDTO().getToken(), quote);
|
|
|
} else {
|
|
|
- log.info("查询QueryLog日志{}", queryLogResponse.getMsg());
|
|
|
+ log.info("查询QueryLog日志{}", JSONObject.toJSONString(queryLogResponse));
|
|
|
throw new RuntimeException("获取报价日志失败{}:" + queryLogResponse.getMsg());
|
|
|
}
|
|
|
|
|
|
- JSONObject upload = upload(insuranceUploadImageVo.getImageVoList(), JQ_Policy, SY_Policy, JYX_Policy, loginInfo, bindInfo, quote, redisValue);
|
|
|
+ JSONObject upload = upload(insuranceUploadImageVo.getImageVoList(), JQ_Policy, SY_Policy, JYX_Policy, loginInfo, bindInfo, quote, loginInfo.getRedisResultDTO().getToken());
|
|
|
if (!"200".equals(upload.getString("code"))) {
|
|
|
throw new RuntimeException("上传失败" + upload.getString("message"));
|
|
|
} else {
|
|
|
@@ -336,18 +347,17 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
AttributionInformationVo attributionInformationVo = downloadPolicyVo.getOrder().getAttributionInformationVo();
|
|
|
OrderBase orderBase = downloadPolicyVo.getOrder();
|
|
|
JSONObject quote = JSONObject.parseObject(redisTemplate.opsForValue().get(GsConstants.GS_REDIS_QUOTE_KEY + orderBase.getOrdersNo()));
|
|
|
- UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
- String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
// 1. 获取订单列表
|
|
|
DoMesOrdersRequest doMesOrdersRequest = new DoMesOrdersRequest(loginInfo.getAesCode(), "");
|
|
|
- JSONObject mesOrders = gsCrawlerRequestComponent.doMesOrders(doMesOrdersRequest, redisValue);
|
|
|
+ JSONObject mesOrders = gsCrawlerRequestComponent.doMesOrders(doMesOrdersRequest, loginInfo.getRedisResultDTO().getToken());
|
|
|
JSONObject order = JSONObject.parseObject(JSONObject.toJSONString(mesOrders.getJSONObject("data").getJSONArray("data").get(0)));
|
|
|
quote.put("orderId", order.getString("orderNo"));
|
|
|
// 获取订单详情
|
|
|
- JSONObject jsonObject = gsCrawlerRequestComponent.doMesOrderDetail(redisValue, quote);
|
|
|
- JSONObject tokenResponse = gsCrawlerRequestComponent.getTokenUrl(getTokenData(JSONObject.toJSONString(jsonObject)), redisValue);
|
|
|
+ JSONObject jsonObject = gsCrawlerRequestComponent.doMesOrderDetail(loginInfo.getRedisResultDTO().getToken(), quote);
|
|
|
+ JSONObject tokenResponse = gsCrawlerRequestComponent.getTokenUrl(getTokenData(JSONObject.toJSONString(jsonObject)), loginInfo.getRedisResultDTO().getToken());
|
|
|
String id = tokenResponse.getJSONObject("data").getString("id");
|
|
|
- JSONObject orderDetail = gsCrawlerRequestComponent.getOrderDetail(id, redisValue);
|
|
|
+ JSONObject orderDetail = gsCrawlerRequestComponent.getOrderDetail(id, loginInfo.getRedisResultDTO().getToken());
|
|
|
JSONArray dzbdList = orderDetail.getJSONObject("data").getJSONArray("list");
|
|
|
// 遍历保单列表,赋值对应URL
|
|
|
String syxUrl = "";
|
|
|
@@ -426,7 +436,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
@Override
|
|
|
public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) throws Exception {
|
|
|
AttributionInformationVo attributionInformationVo = orderStatusVo.getOrder().getAttributionInformationVo();
|
|
|
- UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
+ UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + attributionInformationVo.getConfigInfo().get("username"));
|
|
|
// 1. 获取订单列表
|
|
|
DoMesOrdersRequest doMesOrdersRequest = new DoMesOrdersRequest(loginInfo.getAesCode(), rsaUtils.encrypt(orderStatusVo.getCarInfo().getLicenseNo()));
|
|
|
@@ -492,36 +502,8 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
return resultVo;
|
|
|
}
|
|
|
|
|
|
- public String getRedisKey(AttributionInformationVo attributionInformationVo) {
|
|
|
- String username = attributionInformationVo.getConfigInfo().get("username");
|
|
|
- String value = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + username);
|
|
|
- if (StringUtils.isEmpty(value)) {
|
|
|
- gsCrawlerLoginComponent.login(attributionInformationVo);
|
|
|
- value = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY + username);
|
|
|
- if (StringUtils.isEmpty(value)) {
|
|
|
- getRedisKey(attributionInformationVo);
|
|
|
- }
|
|
|
- }
|
|
|
- return value;
|
|
|
- }
|
|
|
|
|
|
|
|
|
- public UserInfoResponse.UserData getLoginInfo(AttributionInformationVo attributionInformationVo) {
|
|
|
- String username = attributionInformationVo.getConfigInfo().get("username");
|
|
|
- String redisValue = getRedisKey(attributionInformationVo);
|
|
|
- UserInfoResponse loginInfo = gsCrawlerRequestComponent.getLoginInfo(redisValue);
|
|
|
- if (loginInfo == null || !"200".equals(loginInfo.getStatus())) {
|
|
|
- log.warn("登录信息接口响应异常,重新获取用户信息,username:{}", loginInfo.getMsg());
|
|
|
- redisTemplate.delete(GsConstants.GS_REDIS_LOGIN_KEY + username);
|
|
|
- redisValue = getRedisKey(attributionInformationVo);
|
|
|
- loginInfo = gsCrawlerRequestComponent.getLoginInfo(redisValue);
|
|
|
- if (loginInfo == null || !"200".equals(loginInfo.getStatus())) {
|
|
|
- getLoginInfo(attributionInformationVo);
|
|
|
- }
|
|
|
- }
|
|
|
- return loginInfo.getData();
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public void qutoationCrawler(InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
@@ -529,9 +511,9 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public JSONObject getBindInfo(String redisValue, UserInfoResponse.UserData loginInfo) {
|
|
|
+ public JSONObject getBindInfo(String token, UserInfoResponse.UserData loginInfo) {
|
|
|
// 获取绑定信息
|
|
|
- List<JSONObject> bindInfoData = gsCrawlerRequestComponent.getBindInfo(redisValue, loginInfo.getUserCode());
|
|
|
+ List<JSONObject> bindInfoData = gsCrawlerRequestComponent.getBindInfo(token, loginInfo.getUserCode());
|
|
|
if (CollectionUtil.isEmpty(bindInfoData)) {
|
|
|
log.error("绑定信息为空,username:{}");
|
|
|
throw new RuntimeException("未查询到归属信息");
|
|
|
@@ -555,11 +537,11 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
return bindInfo;
|
|
|
}
|
|
|
|
|
|
- public QuoteResultsVo calculation(String orderNo, String redisValue, QuoteVo quoteVo, CarInsuranceQueryResponse.CarInsuranceData insuranceInformation, UserInfoResponse.UserData loginInfo,
|
|
|
- GsCrawlerCarQueryResponse.VehicleModelDetail vehicleModelDetail, JSONObject bindInfo, String businessNatureCode) {
|
|
|
+ public QuoteResultsVo calculation(String orderNo,RedisResultDTO redisResultDTO, QuoteVo quoteVo, CarInsuranceQueryResponse.CarInsuranceData insuranceInformation, UserInfoResponse.UserData loginInfo,
|
|
|
+ GsCrawlerCarQueryResponse.VehicleModelDetail vehicleModelDetail, JSONObject bindInfo, String businessNatureCode,JSONObject jsonObject) {
|
|
|
try {
|
|
|
- String token = JSONObject.parseObject(redisValue).getString("token");
|
|
|
- String userID = JSONObject.parseObject(redisValue).getString("userID");
|
|
|
+ String token = redisResultDTO.getToken();
|
|
|
+ String userID = redisResultDTO.getUserID();
|
|
|
CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
CustomerInfoVo policyHolderInfo = quoteVo.getPolicyHolderInfo();
|
|
|
RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
|
|
|
@@ -640,10 +622,12 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
List<InsuranceInitResponse.ClauseInfo> clauseInfoList = insuranceInitData.getClauseInfoList();
|
|
|
// TODO 配置险种参数
|
|
|
configClauseInfo(clauseInfoList, quoteVo);
|
|
|
+
|
|
|
DoCalculateRequest doCalculateRequest = new DoCalculateRequest(desensitizationJson, orderVo, clauseInfoList, syShow, loginInfo, bindInfo);
|
|
|
PremiumCalculateResponse premiumCalculateResponse = gsCrawlerRequestComponent.doCalculate(doCalculateRequest, token);
|
|
|
- return repeat(premiumCalculateResponse, orderNo, redisValue, quoteVo, insuranceInformation, loginInfo,
|
|
|
- vehicleModelDetail, bindInfo, businessNatureCode, token, syShow);
|
|
|
+ log.info("报价返回信息========:{}{}", JSONObject.toJSONString(premiumCalculateResponse));
|
|
|
+ return repeat(premiumCalculateResponse, orderNo, redisResultDTO, quoteVo, insuranceInformation, loginInfo,
|
|
|
+ vehicleModelDetail, bindInfo, businessNatureCode, token, syShow,userID,jsonObject);
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
@@ -653,33 +637,491 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public void get_fcxdata(QuoteVo quoteVo,String token,String userID,String businessNatureCode,UserInfoResponse.UserData loginInfo,String orderNo,String seat,JSONObject jsonObject){
|
|
|
+ List<AccidentalDrivingVo> accidentalDrivings = quoteVo.getAccidentalDrivings();
|
|
|
+ if (CollectionUtil.isNotEmpty(accidentalDrivings)){
|
|
|
+ for (AccidentalDrivingVo accidentalDriving : accidentalDrivings) {
|
|
|
+ // 1
|
|
|
+ MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
|
+ formData.add("convert", userID);
|
|
|
+ JSONObject encryptionConvert = gsCrawlerRequestComponent.encryptionConvert(formData,token);
|
|
|
+ String encrypt_userCode = encryptionConvert.getString("data");
|
|
|
+ // 2
|
|
|
+ MultiValueMap<String, String> data2 = new LinkedMultiValueMap<>();
|
|
|
+ data2.add("userCode", encrypt_userCode);
|
|
|
+ data2.add("loginUserType", "1");
|
|
|
+ data2.add("isApp", "1");
|
|
|
+ JSONObject employeeLogin = gsCrawlerRequestComponent.employeeLogin(data2,token);
|
|
|
+
|
|
|
+ JSONObject empData = employeeLogin.getJSONObject("data");
|
|
|
+ String managerId = empData.getString("id");
|
|
|
+ String saleAgreementNo = empData.getString("saleAgreementNo");
|
|
|
+ String userName = empData.getString("userName");
|
|
|
+ String branchOfficeName = empData.getString("branchOfficeName");
|
|
|
+ //3
|
|
|
+ MultiValueMap<String, String> data3 = new LinkedMultiValueMap<>();
|
|
|
+ data3.add("productId",accidentalDriving.getProductCode() );
|
|
|
+ data3.add("managerId", managerId);
|
|
|
+ data3.add("businessNatureCode",businessNatureCode);
|
|
|
+ data3.add("comCode", loginInfo.getUserDepartment());
|
|
|
+ JSONObject productInfo = gsCrawlerRequestComponent.getProductInfoById(data3,token);
|
|
|
+
|
|
|
+ //4
|
|
|
+ MultiValueMap<String, String> data4 = new LinkedMultiValueMap<>();
|
|
|
+ data4.add("thisId",orderNo );
|
|
|
+
|
|
|
+ JSONObject individualVo = gsCrawlerRequestComponent.getIndividualVo(data4,token);
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject data5 = new JSONObject();
|
|
|
+ data5.put("productId",accidentalDriving.getProductCode() );
|
|
|
+ data5.put("carUserNatureCode", "8A");
|
|
|
+ data5.put("passengersNumber",seat);
|
|
|
+ data5.put("carKindCode","A0");
|
|
|
+ JSONObject fromCarModelCheck = gsCrawlerRequestComponent.fromCarModelCheck(data5,token);
|
|
|
+
|
|
|
+
|
|
|
+ MultiValueMap<String, String> data6 = new LinkedMultiValueMap<>();
|
|
|
+ data6.add("productId",accidentalDriving.getProductCode() );
|
|
|
+ data6.add("managerId", managerId);
|
|
|
+ data6.add("businessNatureCode",businessNatureCode);
|
|
|
+ data6.add("comCode", loginInfo.getUserDepartment());
|
|
|
+ JSONObject underwritingById = gsCrawlerRequestComponent.getUnderwritingById(data6,token);
|
|
|
+ JSONObject next_data = underwritingById.getJSONObject("data");
|
|
|
+ // -------------------- 5. underwritingPre --------------------
|
|
|
+ next_data.put("carOrderId", orderNo);
|
|
|
+ next_data.put("systemSource", "fromCar");
|
|
|
+ next_data.put("comCode",loginInfo.getUserDepartment());
|
|
|
+ JSONObject underwritingPre = gsCrawlerRequestComponent.underwritingPre(next_data,token,loginInfo.getRedisResultDTO().getBid());
|
|
|
+ String preId = underwritingPre.getJSONObject("data").getString("preId");
|
|
|
+ String salesman = jsonObject.getString("salesman");
|
|
|
+ String saleAgreementNo1 = jsonObject.getString("saleAgreementNo");
|
|
|
+ String businessNatureName = jsonObject.getString("businessNatureName");
|
|
|
+ String channelType = jsonObject.getString("channelType");
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject data7 = new JSONObject();
|
|
|
+ data7.put("productId",accidentalDriving.getProductCode() );
|
|
|
+ data7.put("managerId", managerId);
|
|
|
+ data7.put("businessNatureCode",businessNatureCode);
|
|
|
+ data7.put("salesman",salesman);
|
|
|
+ JSONObject findAgentRate = gsCrawlerRequestComponent.findAgentRate(data7,token);
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject data7vo = gsCrawlerRequestComponent.getIndividualVo(data4,token);
|
|
|
+
|
|
|
+
|
|
|
+ MultiValueMap<String, String> data8 = new LinkedMultiValueMap<>();
|
|
|
+ data8.add("productId",accidentalDriving.getProductCode() );
|
|
|
+ data8.add("managerId", managerId);
|
|
|
+ data8.add("businessNatureCode",businessNatureCode);
|
|
|
+ data8.add("comCode", loginInfo.getUserDepartment());
|
|
|
+
|
|
|
+ data8.add("preId", preId);
|
|
|
+ data8.add("isPreUnderwriting","1");
|
|
|
+ data8.add("systemSource", "fromCar");
|
|
|
+ JSONObject data8vo = gsCrawlerRequestComponent.getUnderwritingById(data8,token);
|
|
|
+ JSONObject voString = data8vo.getJSONObject("data");
|
|
|
+
|
|
|
+ // 获取模块化列表(JSONArray)
|
|
|
+ JSONArray second_data = voString.getJSONArray("modularList");
|
|
|
+ if (second_data == null || second_data.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ dataProcessor.processModularData(second_data,accidentalDriving.getProductCode(),quoteVo,seat, jsonObject,loginInfo,branchOfficeName,voString);
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject underwritingVariablePremiumVariablePremium = gsCrawlerRequestComponent.underwritingVariablePremiumVariablePremium(voString,token);
|
|
|
+ System.out.println("==================");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void processModularData(JSONArray modularList, String productId,QuoteVo quoteVo, String seat,JSONObject jsonObject,UserInfoResponse.UserData loginInfo,String branchOfficeName,JSONObject data8vo) {
|
|
|
+
|
|
|
+ // 白名单产品ID
|
|
|
+ List<String> validProductIds = List.of(
|
|
|
+ "fd2dc8abe5f94eacbc8efd3bf62a8581",
|
|
|
+ "39f47efbd6004899b4fa7c80bfdba801",
|
|
|
+ "54b7cce17316444aade70427d8abea0a",
|
|
|
+ "7e1108d1db2c428d8cf35e3e6896bb15",
|
|
|
+ "fc9cd193ce444508b355b5d5522ffc00",
|
|
|
+ "71d3c2271fe5404d82c78fb07d116cf0",
|
|
|
+ "77bcfb9bff014a93bfca0ed792c30258",
|
|
|
+ "new-2d0bc85a46c799ff4ad0c8521348",
|
|
|
+ "f65730fe001a4c998aabc1d2e7258a96"
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!validProductIds.contains(productId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
+ CustomerInfoVo policyHolderInfo = quoteVo.getPolicyHolderInfo();
|
|
|
+ CustomerInfoVo insuredPersonInfo = quoteVo.getInsuredPersonInfo();
|
|
|
+ for (int i = 0; i < modularList.size(); i++) {
|
|
|
+ JSONObject modular = modularList.getJSONObject(i);
|
|
|
+ Integer sortNo = modular.getInteger("sortNo");
|
|
|
+ if (sortNo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONArray infoList = modular.getJSONArray("ncispUnderwritingInfoList");
|
|
|
+ if (infoList == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONArray newInfoList = new JSONArray();
|
|
|
+ // ====================== sortNo = 0 ======================
|
|
|
+ if (sortNo == 0) {
|
|
|
+ for (int j = 0; j < infoList.size(); j++) {
|
|
|
+ JSONObject item = infoList.getJSONObject(j);
|
|
|
+ String fieldName = item.getString("backEndTranslationNameYl");
|
|
|
+ String type = item.getString("type");
|
|
|
+
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ switch (fieldName) {
|
|
|
+ case "customerName":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encryptedName = RsaUtils.encrypt(policyHolderInfo.getName());
|
|
|
+ item.put("fieldValue", encryptedName);
|
|
|
+ item.put("fieldValueName", encryptedName);
|
|
|
+ break;
|
|
|
+ case "mobile":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encryptedPhone = RsaUtils.encrypt(policyHolderInfo.getMobile());
|
|
|
+ item.put("fieldValue", encryptedPhone);
|
|
|
+ item.put("fieldValueName", encryptedPhone);
|
|
|
+ break;
|
|
|
+ case "identifyType":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ item.put("fieldValue", "idCard");
|
|
|
+ item.put("fieldValueName", "居民身份证");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "identifyNumber":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encryptedIdNo = RsaUtils.encrypt(policyHolderInfo.getIdentifyNumber());
|
|
|
+ item.put("fieldValue", encryptedIdNo);
|
|
|
+ item.put("fieldValueName", encryptedIdNo);
|
|
|
+ break;
|
|
|
+ case "age":
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "sex":
|
|
|
+ String sexVal = item.getString("fieldValueName");
|
|
|
+ if ("2".equals(sexVal)) {
|
|
|
+ item.put("fieldValueName", "女");
|
|
|
+ } else {
|
|
|
+ item.put("fieldValueName", "男");
|
|
|
+ }
|
|
|
+ item.put("fieldValue", "1");
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "identifyEffectiveStartDate":
|
|
|
+ String today = LocalDate.now().toString();
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "0");
|
|
|
+ item.put("display", "block");
|
|
|
+ item.put("minDate", "1900-01-01");
|
|
|
+ item.put("maxDate", today);
|
|
|
+ break;
|
|
|
+ case "identifyEffectiveTerm":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("fieldValue", "100");
|
|
|
+ item.put("mustFill", "0");
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "citizenship":
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "provinceCode":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ item.put("fieldDescribe", "省市地区");
|
|
|
+ item.put("fieldValue", policyHolderInfo.getProvinceCode());
|
|
|
+ item.put("fieldValueName", policyHolderInfo.getProvince());
|
|
|
+ item.put("areaCodeList", List.of(policyHolderInfo.getProvinceCode(),
|
|
|
+ policyHolderInfo.getCityCode(),
|
|
|
+ policyHolderInfo.getCountyCode()
|
|
|
+ ));
|
|
|
+ item.put("remarks", policyHolderInfo.getProvince());
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "cityCode":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ item.put("fieldValue", policyHolderInfo.getCityCode());
|
|
|
+ item.put("fieldValueName", policyHolderInfo.getCity());
|
|
|
+ item.put("remarks", policyHolderInfo.getCity());
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "districtCode":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ item.put("fieldValue", policyHolderInfo.getCountyCode());
|
|
|
+ item.put("fieldValueName", policyHolderInfo.getCounty());
|
|
|
+ item.put("remarks", policyHolderInfo.getCounty());
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "email":
|
|
|
+ if (item.get("type") == null) {
|
|
|
+ item.put("display", "block");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newInfoList.add(item);
|
|
|
+ }
|
|
|
+ modular.put("selected", true);
|
|
|
+ modular.put("ncispUnderwritingInfoList", newInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // ====================== sortNo = 100 ======================
|
|
|
+ else if (sortNo == 100) {
|
|
|
+ for (int j = 0; j < infoList.size(); j++) {
|
|
|
+ JSONObject item = infoList.getJSONObject(j);
|
|
|
+ String fieldName = item.getString("backEndTranslationNameYl");
|
|
|
+ String type = item.getString("type");
|
|
|
+
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ switch (fieldName) {
|
|
|
+ case "relationToApplicantCode":
|
|
|
+ item.put("fieldValue", "1");
|
|
|
+ item.put("fieldValueName", "本人");
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "customerName":
|
|
|
+ item.put("display", "none");
|
|
|
+ String bbEncName = RsaUtils.encrypt(insuredPersonInfo.getName());
|
|
|
+ item.put("fieldValue", bbEncName);
|
|
|
+ item.put("fieldValueName", bbEncName);
|
|
|
+ break;
|
|
|
+ case "mobile":
|
|
|
+ item.put("display", "none");
|
|
|
+ String bbEncPhone = RsaUtils.encrypt(insuredPersonInfo.getMobile());
|
|
|
+ item.put("fieldValue", bbEncPhone);
|
|
|
+ item.put("fieldValueName", bbEncPhone);
|
|
|
+ break;
|
|
|
+ case "identifyType":
|
|
|
+ item.put("display", "none");
|
|
|
+ item.put("fieldValueName", "居民身份证");
|
|
|
+ break;
|
|
|
+ case "identifyNumber":
|
|
|
+ item.put("display", "none");
|
|
|
+ String bbEncIdNo = RsaUtils.encrypt(insuredPersonInfo.getIdentifyNumber());
|
|
|
+ item.put("fieldValue", bbEncIdNo);
|
|
|
+ item.put("fieldValueName", bbEncIdNo);
|
|
|
+ break;
|
|
|
+ case "sex":
|
|
|
+ String sexVal = item.getString("fieldValueName");
|
|
|
+ item.put("fieldValueName", "2".equals(sexVal) ? "女" : "男");
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "citizenship":
|
|
|
+ case "age":
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "identifyEffectiveStartDate":
|
|
|
+ String today = LocalDate.now().toString();
|
|
|
+ item.put("minDate", "1900-01-01");
|
|
|
+ item.put("maxDate", today);
|
|
|
+ item.put("display", "none");
|
|
|
+ item.put("mustFill", "0");
|
|
|
+ break;
|
|
|
+ case "identifyEffectiveTerm":
|
|
|
+ item.put("display", "none");
|
|
|
+ item.put("mustFill", "0");
|
|
|
+ break;
|
|
|
+ case "provinceCode":
|
|
|
+ item.put("fieldValue", insuredPersonInfo.getProvinceCode());
|
|
|
+ item.put("fieldValueName", insuredPersonInfo.getProvince());
|
|
|
+ item.put("fieldDescribe", "省市地区");
|
|
|
+ item.put("remarks", insuredPersonInfo.getProvince());
|
|
|
+ item.put("areaCodeList", List.of(
|
|
|
+ insuredPersonInfo.getProvinceCode(),
|
|
|
+ insuredPersonInfo.getCityCode(),
|
|
|
+ insuredPersonInfo.getCountyCode()
|
|
|
+ ));
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "cityCode":
|
|
|
+ item.put("fieldValue", insuredPersonInfo.getCityCode());
|
|
|
+ item.put("fieldValueName", insuredPersonInfo.getCity());
|
|
|
+ item.put("remarks", insuredPersonInfo.getCity());
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ case "districtCode":
|
|
|
+ item.put("fieldValue", insuredPersonInfo.getCountyCode());
|
|
|
+ item.put("fieldValueName", insuredPersonInfo.getCounty());
|
|
|
+ item.put("remarks", insuredPersonInfo.getCounty());
|
|
|
+ item.put("display", "none");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newInfoList.add(item);
|
|
|
+ }
|
|
|
+ modular.put("selected", true);
|
|
|
+ modular.put("ncispUnderwritingInfoList", newInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // ====================== sortNo = 200 ======================
|
|
|
+ else if (sortNo == 200) {
|
|
|
+ for (int j = 0; j < infoList.size(); j++) {
|
|
|
+ JSONObject item = infoList.getJSONObject(j);
|
|
|
+ String fieldName = item.getString("backEndTranslationNameYl");
|
|
|
+
|
|
|
+ if (item.get("type") == null) {
|
|
|
+ switch (fieldName) {
|
|
|
+ case "licensePlateNo":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encLicense = RsaUtils.encrypt(carInfoVo.getLicenseNo());
|
|
|
+ item.put("fieldValue", encLicense);
|
|
|
+ item.put("fieldValueName", encLicense);
|
|
|
+ break;
|
|
|
+ case "engineNumber":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encEngine = RsaUtils.encrypt(carInfoVo.getEngineNo());
|
|
|
+ item.put("fieldValue", encEngine);
|
|
|
+ item.put("fieldValueName", encEngine);
|
|
|
+ break;
|
|
|
+ case "frameNo":
|
|
|
+ item.put("fieldType", "-1");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ String encVin = RsaUtils.encrypt(carInfoVo.getVinNo());
|
|
|
+ item.put("fieldValue", encVin);
|
|
|
+ item.put("fieldValueName", encVin);
|
|
|
+ break;
|
|
|
+ case "passengersNumber":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ String seatNum = carInfoVo.getSeatCount();
|
|
|
+ item.put("fieldValue", seatNum);
|
|
|
+ item.put("fieldValueName", seatNum + "座");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ case "carUserNatureCode":
|
|
|
+ item.put("readonly", "1");
|
|
|
+ item.put("fieldValue", "8A");
|
|
|
+ item.put("fieldValueName", "家庭自用");
|
|
|
+ item.put("mustFill", "2");
|
|
|
+ item.put("display", "block");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newInfoList.add(item);
|
|
|
+ }
|
|
|
+ modular.put("selected", true);
|
|
|
+ modular.put("ncispUnderwritingInfoList", newInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // ====================== sortNo = 300 / 600 ======================
|
|
|
+ else if (sortNo == 300 || sortNo == 600) {
|
|
|
+ for (int j = 0; j < infoList.size(); j++) {
|
|
|
+ JSONObject item = infoList.getJSONObject(j);
|
|
|
+ String fieldName = item.getString("backEndTranslationNameYl");
|
|
|
+ if (item.get("type") == null && "passengersNumber".equals(fieldName)) {
|
|
|
+ item.put("fieldValue", String.valueOf(seat));
|
|
|
+ item.put("fieldValueName", seat + "座");
|
|
|
+ newInfoList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // ====================== sortNo = 9999 ======================
|
|
|
+ else if (sortNo == 9999) {
|
|
|
+ for (int j = 0; j < infoList.size(); j++) {
|
|
|
+ JSONObject item = infoList.getJSONObject(j);
|
|
|
+ String fieldName = item.getString("backEndTranslationNameYl");
|
|
|
+ if (item.get("type") == null && "mark1".equals(fieldName)) {
|
|
|
+ item.put("display", "block");
|
|
|
+ newInfoList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ modular.put("selected", true);
|
|
|
+ modular.put("ncispUnderwritingInfoList", newInfoList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static MultiValueMap<String, String> jsonToMultiValueMap(JSONObject json) {
|
|
|
+ MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
|
|
+
|
|
|
+ if (json == null || json.isEmpty()) {
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 遍历所有 key
|
|
|
+ for (String key : json.keySet()) {
|
|
|
+ Object value = json.get(key);
|
|
|
+ // 转成字符串(null 转空串)
|
|
|
+ String strValue = value == null ? "" : String.valueOf(value);
|
|
|
+ map.add(key, strValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 重复报价处理(处理重复投保问题)
|
|
|
*
|
|
|
* @param premiumCalculateResponse 报价响应
|
|
|
* @return 最终报价结果
|
|
|
*/
|
|
|
- public QuoteResultsVo repeat(PremiumCalculateResponse premiumCalculateResponse, String orderNo, String redisValue, QuoteVo quoteVo, CarInsuranceQueryResponse.CarInsuranceData insuranceInformation, UserInfoResponse.UserData loginInfo,
|
|
|
- GsCrawlerCarQueryResponse.VehicleModelDetail vehicleModelDetail, JSONObject bindInfo, String businessNatureCode, String token, String syShow) {
|
|
|
+ public QuoteResultsVo repeat(PremiumCalculateResponse premiumCalculateResponse, String orderNo,RedisResultDTO redisResultDTO, QuoteVo quoteVo, CarInsuranceQueryResponse.CarInsuranceData insuranceInformation, UserInfoResponse.UserData loginInfo,
|
|
|
+ GsCrawlerCarQueryResponse.VehicleModelDetail vehicleModelDetail, JSONObject bindInfo, String businessNatureCode, String token, String syShow,String userID,JSONObject jsonObject) {
|
|
|
QuoteResultsVo quoteResultsVo = new QuoteResultsVo();
|
|
|
// 2. 处理商业险重复投保
|
|
|
String jqRepeatinfo = "";
|
|
|
String syRepeatinfo = "";
|
|
|
String msg = premiumCalculateResponse.getMsg();
|
|
|
- String doubleMsg = premiumCalculateResponse.getData().getDoubleMsg();
|
|
|
- if (msg.contains("商业险") && msg.contains("重复投保")) {
|
|
|
- String sy = DateUtils.getTime(doubleMsg);
|
|
|
- log.info("商业险重复投保,更新开始日期,newChesunStartDate:{}", sy);
|
|
|
- // 重新报价
|
|
|
- return calculation(orderNo, redisValue, quoteVo, insuranceInformation, loginInfo,
|
|
|
- vehicleModelDetail, bindInfo, businessNatureCode);
|
|
|
-
|
|
|
+ if (msg.contains("商业险") && msg.contains("重复投保") && msg.contains("保险期间:")) {
|
|
|
+ if (msg.contains("<br")) {
|
|
|
+ String sy = DateUtils.getTime(msg);
|
|
|
+ log.info("商业险重复投保,更新开始日期,newChesunStartDate:{}", sy);
|
|
|
+ RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
|
|
|
+ biRiskInfoVo.setStartDate("");
|
|
|
+ biRiskInfoVo.setEndDate("");
|
|
|
+ // 重新报价
|
|
|
+ return calculation(orderNo, redisResultDTO, quoteVo, insuranceInformation, loginInfo,
|
|
|
+ vehicleModelDetail, bindInfo, businessNatureCode,jsonObject);
|
|
|
+ }else {
|
|
|
+ quoteResultsVo.setErrorMessage(msg);
|
|
|
+ quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+ }
|
|
|
} // 3. 处理交强险重复投保
|
|
|
- else if (msg.contains("交强险") && msg.contains("重复投保")) {
|
|
|
- String jq = DateUtils.getTime(doubleMsg);
|
|
|
- quoteVo.getCiRiskInfoVo().setStartDate(jq);
|
|
|
- return calculation(orderNo, redisValue, quoteVo, insuranceInformation, loginInfo,
|
|
|
- vehicleModelDetail, bindInfo, businessNatureCode);
|
|
|
+ else if (msg.contains("交强险") && msg.contains("重复投保") && msg.contains("终保日期")) {
|
|
|
+ if (msg.contains("保单号") && msg.contains("起保日期") && msg.contains("终保日期")) {
|
|
|
+ String startTime = extractDuplicateEndTime(msg);
|
|
|
+ String endTime = TimeProcessing.minusOneSecondAfterYear(startTime);
|
|
|
+ quoteVo.getCiRiskInfoVo().setStartDate(startTime);
|
|
|
+ quoteVo.getCiRiskInfoVo().setEndDate(endTime);
|
|
|
+ return calculation(orderNo, redisResultDTO, quoteVo, insuranceInformation, loginInfo,
|
|
|
+ vehicleModelDetail, bindInfo, businessNatureCode,jsonObject);
|
|
|
+ }else {
|
|
|
+ quoteResultsVo.setErrorMessage(msg);
|
|
|
+ quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+ }
|
|
|
} // 4. 报价失败处理
|
|
|
else if (!"200".equals(premiumCalculateResponse.getStatus())) {
|
|
|
String info = "";
|
|
|
@@ -695,9 +1137,26 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
quoteResultsVo.setErrorMessage(errorMsg);
|
|
|
quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
} else if ("200".equals(premiumCalculateResponse.getStatus())) {
|
|
|
- FeeCalculateResponse.DataDTO dataDTO = gsCrawlerRequestComponent.creatOrder(token, CreatOrderRequest.creatOrderRequest(premiumCalculateResponse.getData(), syShow, redisValue, loginInfo));
|
|
|
+
|
|
|
+ get_fcxdata( quoteVo, token, userID, businessNatureCode, loginInfo, orderNo,vehicleModelDetail.getSeat(),jsonObject);
|
|
|
+
|
|
|
+
|
|
|
+ FeeCalculateResponse.DataDTO dataDTO = gsCrawlerRequestComponent.creatOrder(token, CreatOrderRequest.creatOrderRequest(premiumCalculateResponse.getData(), syShow,redisResultDTO.getUserID(), loginInfo));
|
|
|
Object businessCalcFeeVo = dataDTO.getBusinessCalcFeeVo();
|
|
|
- String sy_discountRate = "";
|
|
|
+
|
|
|
+ return processCalcSuccessResult(premiumCalculateResponse, quoteVo, token);
|
|
|
+ } else {
|
|
|
+ quoteResultsVo.setErrorMessage("报价失败");
|
|
|
+ quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+ }
|
|
|
+ return quoteResultsVo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+
|
|
|
+
|
|
|
+ String sy_discountRate = "";
|
|
|
String discountRate = "";
|
|
|
if (businessCalcFeeVo != null) {
|
|
|
sy_discountRate = JSONObject.parseObject(JSONObject.toJSONString(businessCalcFeeVo)).getString("'discountRate'");
|
|
|
@@ -713,8 +1172,8 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
saveRedis.put("username", loginInfo.getUserCode());
|
|
|
saveRedis.put("businessOffice", loginInfo.getUserDepartment());
|
|
|
saveRedis.put("structureId", loginInfo.getProvincialCom());
|
|
|
- saveRedis.put("userCode", JSONObject.parseObject(redisValue).getString("userID"));
|
|
|
- saveRedis.put("token", JSONObject.parseObject(redisValue).getString("token"));
|
|
|
+ saveRedis.put("userCode", redisResultDTO.getUserID());
|
|
|
+ saveRedis.put("token",redisResultDTO.getToken());
|
|
|
saveRedis.put("license", quoteVo.getCarInfoVo().getLicenseNo());
|
|
|
saveRedis.put("zhanghao_info", loginInfo.getProvincialCom());
|
|
|
saveRedis.put("gs_info", JSONObject.toJSONString(bindInfo));
|
|
|
@@ -728,6 +1187,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
if ("200".equals(premiumCalculateResponse.getStatus())) {
|
|
|
PremiumCalculateResponse.OrderVoDTO resOrderVo = premiumCalculateResponse.getData().getOrderVo();
|
|
|
tranNo = resOrderVo.getTransactionNo();
|
|
|
+
|
|
|
orderId = resOrderVo.getOrderNo();
|
|
|
}
|
|
|
saveRedis.put("orderId", orderId);
|
|
|
@@ -735,14 +1195,23 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
saveRedis.put("bj_res", JSONObject.toJSONString(premiumCalculateResponse));
|
|
|
saveRedis.put("bjresdata", JSON.toJSONString(premiumCalculateResponse.getData()));
|
|
|
redisTemplate.opsForValue().set(GsConstants.GS_REDIS_QUOTE_KEY + quoteVo.getOrder().getOrdersNo(), JSONObject.toJSONString(saveRedis), GsConstants.REDIS_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
|
|
- return processCalcSuccessResult(premiumCalculateResponse, quoteVo, token);
|
|
|
- } else {
|
|
|
- quoteResultsVo.setErrorMessage("报价失败");
|
|
|
- quoteResultsVo.setQuoteStatusEnum(InsOrderStatusEnum.QUOTE_FAIL);
|
|
|
+
|
|
|
+ * */
|
|
|
+
|
|
|
+
|
|
|
+ // 截取重复投保终保日期
|
|
|
+ private static final Pattern DUPLICATE_END_TIME_PATTERN = Pattern.compile("终保日期 (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})");
|
|
|
+ private String extractDuplicateEndTime(String returnMessage) {
|
|
|
+ Matcher matcher = DUPLICATE_END_TIME_PATTERN.matcher(returnMessage);
|
|
|
+ if (matcher.find()) {
|
|
|
+ String shortEndTime = matcher.group(1);
|
|
|
+ return shortEndTime + ":00";
|
|
|
}
|
|
|
- return quoteResultsVo;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 处理报价成功结果
|
|
|
*
|
|
|
@@ -1008,7 +1477,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
/**
|
|
|
* 图片上传
|
|
|
*/
|
|
|
- public JSONObject upload(List<InsuranceImageVo> imageVoList, String JQ_Policy, String SY_Policy, String JYX_Policy, UserInfoResponse.UserData loginInfo, JSONObject bindInfo, JSONObject quoteInfo, String redisValue) {
|
|
|
+ public JSONObject upload(List<InsuranceImageVo> imageVoList, String JQ_Policy, String SY_Policy, String JYX_Policy, UserInfoResponse.UserData loginInfo, JSONObject bindInfo, JSONObject quoteInfo, String token) {
|
|
|
String ryMessage = null; // 人员照片错误
|
|
|
String rybMessage = null; // 人员照片背面错误
|
|
|
String clMessage = null; // 行驶证照片错误
|
|
|
@@ -1018,7 +1487,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
InsuranceImageVo.ImageDTO imageDTO = insuranceImageVo.getImageBase64List().get(0);
|
|
|
// 构建图片请求参数
|
|
|
ImageUploadRequest uploadRequest = new ImageUploadRequest(imageDTO, quoteInfo, loginInfo, JQ_Policy, SY_Policy, imageType);
|
|
|
- CheckImageResponse checkImage = gsCrawlerRequestComponent.doCheckImage(redisValue, uploadRequest);
|
|
|
+ CheckImageResponse checkImage = gsCrawlerRequestComponent.doCheckImage(token, uploadRequest);
|
|
|
if (!"200".equals(checkImage.getStatus()) && !"201".equals(checkImage.getStatus())) {
|
|
|
log.error("图片上传失败:{}", checkImage.getMsg());
|
|
|
String imageMsg = checkImage.getMsg();
|
|
|
@@ -1043,7 +1512,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
continue;
|
|
|
}
|
|
|
UploadImagesRequest imageBusinessRequest = new UploadImagesRequest(loginInfo, JQ_Policy, SY_Policy, imageType, checkImage.getData(), quoteInfo, imageDTO.getImageBase64Str());
|
|
|
- gsCrawlerRequestComponent.uploadImages(imageBusinessRequest, redisValue);
|
|
|
+ gsCrawlerRequestComponent.uploadImages(imageBusinessRequest, token);
|
|
|
}
|
|
|
|
|
|
// 构建返回结果
|
|
|
@@ -1093,7 +1562,7 @@ public class GuoshouCrawlerRequestImpl implements GuoshouCrawlerRequest {
|
|
|
public void revocation(String orderNo) {
|
|
|
// String userName = "";
|
|
|
// // 查询loginInfo
|
|
|
-// UserInfoResponse.UserData loginInfo = getLoginInfo(attributionInformationVo);
|
|
|
+// UserInfoResponse.UserData loginInfo = gsCrawlerLoginComponent.getLoginInfo(attributionInformationVo);
|
|
|
// String redisValue = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_LOGIN_KEY+ attributionInformationVo.getConfigInfo().get("username"));
|
|
|
// String quote = redisTemplate.opsForValue().get(GsConstants.GS_REDIS_QUOTE_KEY + orderNo);
|
|
|
// String token = JSONObject.parseObject(redisValue).getString("token");
|