|
@@ -147,7 +147,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
ctx.init(null, tm, new SecureRandom());
|
|
ctx.init(null, tm, new SecureRandom());
|
|
|
c.setSSLSocketFactory(ctx.getSocketFactory());
|
|
c.setSSLSocketFactory(ctx.getSocketFactory());
|
|
|
c.setHostnameVerifier((h, s) -> true);
|
|
c.setHostnameVerifier((h, s) -> true);
|
|
|
- } catch (Exception e) { throw new RuntimeException(e); }
|
|
|
|
|
|
|
+ } catch (Exception e) { throw new SystemException(e.getMessage()); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ====================== 登录 ======================
|
|
// ====================== 登录 ======================
|
|
@@ -177,7 +177,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
public Map<String, Object> xbQuery(String username, String cookie, CarInfoVo car) throws Exception {
|
|
public Map<String, Object> xbQuery(String username, String cookie, CarInfoVo car) throws Exception {
|
|
|
log.info("开始续保查询");
|
|
log.info("开始续保查询");
|
|
|
boolean special = SPECIAL_USERS.contains(username) || SPECIAL_ACCOUNT_XN.equals(username);
|
|
boolean special = SPECIAL_USERS.contains(username) || SPECIAL_ACCOUNT_XN.equals(username);
|
|
|
-
|
|
|
|
|
|
|
+ CarInfoVo carCopy = JSONObject.parseObject(JSONObject.toJSONString(car), CarInfoVo.class);
|
|
|
HttpHeaders headers = special ? buildSpecialHeaders(cookie, true) : buildHtmlHeaders(cookie);
|
|
HttpHeaders headers = special ? buildSpecialHeaders(cookie, true) : buildHtmlHeaders(cookie);
|
|
|
if (special) {
|
|
if (special) {
|
|
|
get(ORIGIN + "/htcsp/ShakeHandsAction.do?cmd=menuControl&ip=172.16.100.27&host=9000&menuCode=car_001&messageClickType=&mesFlag=", headers, null);
|
|
get(ORIGIN + "/htcsp/ShakeHandsAction.do?cmd=menuControl&ip=172.16.100.27&host=9000&menuCode=car_001&messageClickType=&mesFlag=", headers, null);
|
|
@@ -188,7 +188,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
String quotationNo = extractQuotationNo(body, special);
|
|
String quotationNo = extractQuotationNo(body, special);
|
|
|
log.info("quotationNo: {}", quotationNo);
|
|
log.info("quotationNo: {}", quotationNo);
|
|
|
|
|
|
|
|
- Map<String, Object> dataMap = buildXbQueryMap(car, quotationNo);
|
|
|
|
|
|
|
+ Map<String, Object> dataMap = buildXbQueryMap(carCopy, quotationNo);
|
|
|
Map<String, Object> encrypted = encrypt(dataMap);
|
|
Map<String, Object> encrypted = encrypt(dataMap);
|
|
|
log.info("xbQuery encrypted: {}", encrypted);
|
|
log.info("xbQuery encrypted: {}", encrypted);
|
|
|
|
|
|
|
@@ -303,6 +303,8 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
|
|
private record StepResult(HtCrawlerQuoteResponse.DataDTO data, String personalInsuredJSON) { }
|
|
private record StepResult(HtCrawlerQuoteResponse.DataDTO data, String personalInsuredJSON) { }
|
|
|
|
|
|
|
|
|
|
+ private record DuplQuoteResult(QuoteVo q, Boolean dupl) { }
|
|
|
|
|
+
|
|
|
private void saveOrder(QuoteVo q, CoreResult c) {
|
|
private void saveOrder(QuoteVo q, CoreResult c) {
|
|
|
HtCrawlerOrder o = new HtCrawlerOrder();
|
|
HtCrawlerOrder o = new HtCrawlerOrder();
|
|
|
o.setOrdersNo(q.getOrder().getOrdersNo());
|
|
o.setOrdersNo(q.getOrder().getOrdersNo());
|
|
@@ -317,7 +319,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
CarInfoVo car, String modelcodexh, String cookie, String quotationNo) throws Exception {
|
|
CarInfoVo car, String modelcodexh, String cookie, String quotationNo) throws Exception {
|
|
|
HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
|
|
HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
|
|
|
HtCrawlerConfigureParameters.class, attr.getConfigInfo());
|
|
HtCrawlerConfigureParameters.class, attr.getConfigInfo());
|
|
|
- params.setFullComCode(mmap.get("comCode").toString());
|
|
|
|
|
|
|
+ params.setFullComCode(params.getComCode());
|
|
|
//参数格式保持一致
|
|
//参数格式保持一致
|
|
|
car.setPurchasePrice(car.getPurchasePrice().replace(".00", ""));
|
|
car.setPurchasePrice(car.getPurchasePrice().replace(".00", ""));
|
|
|
//车辆查询
|
|
//车辆查询
|
|
@@ -325,6 +327,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
new HtCrawlerCarQueryRequest(car, modelcodexh), req.getHeaders1(), car);
|
|
new HtCrawlerCarQueryRequest(car, modelcodexh), req.getHeaders1(), car);
|
|
|
//过滤车型
|
|
//过滤车型
|
|
|
HtCrawlerCarQueryResponse.DataDTO.DataListDTO carDTO = CarModelsFilterUtils.to(dataDTO.getDatalist(), car);
|
|
HtCrawlerCarQueryResponse.DataDTO.DataListDTO carDTO = CarModelsFilterUtils.to(dataDTO.getDatalist(), car);
|
|
|
|
|
+ log.info("过滤后的车型carDTO: {}", JSONObject.toJSONString(carDTO));
|
|
|
//保存车辆信息
|
|
//保存车辆信息
|
|
|
executeSaveCarQuery(carDTO, dataDTO, car, cookie);
|
|
executeSaveCarQuery(carDTO, dataDTO, car, cookie);
|
|
|
//车型查询
|
|
//车型查询
|
|
@@ -423,27 +426,82 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
|
|
private StepResult executeQuoteSteps(QuoteVo q, String quotationNo, LoginDTO dto,
|
|
private StepResult executeQuoteSteps(QuoteVo q, String quotationNo, LoginDTO dto,
|
|
|
String cookie, PreResult pre, Map<String, Object> gsInfo) {
|
|
String cookie, PreResult pre, Map<String, Object> gsInfo) {
|
|
|
- HttpHeaders h = buildQuoteStep1Headers(cookie);
|
|
|
|
|
- HtCrawlerSaveOneStepRequest r = new HtCrawlerSaveOneStepRequest(q, pre.carDTO(), pre.params(), quotationNo, pre.dataDTO(), dto, gsInfo);
|
|
|
|
|
- String body = req.saveOneStept(r, h).getBody().toString();
|
|
|
|
|
- String mealid = extractMealId(body);
|
|
|
|
|
- //机动车损失保险
|
|
|
|
|
- String limitAmount = extractLimitAmount(body);
|
|
|
|
|
- log.info("mealid: {}", mealid);
|
|
|
|
|
- log.info("limitAmount: {}", limitAmount);
|
|
|
|
|
- //组装驾意险参数,没有就空字符串
|
|
|
|
|
- String personalInsuredJSON = buildPersonalInsuredJSON(q);
|
|
|
|
|
-
|
|
|
|
|
- h = buildQuoteStep2Headers(cookie);
|
|
|
|
|
- //组装报价参数
|
|
|
|
|
- HtCrawlerQuoteRequest qr = new HtCrawlerQuoteRequest(q, mealid, limitAmount, "", personalInsuredJSON);
|
|
|
|
|
- //报价第一次
|
|
|
|
|
- String decryptData = req.quote(qr, h);
|
|
|
|
|
- //处理重复投保返回终保日期的
|
|
|
|
|
- q = handleQuoteErrors(decryptData, q);
|
|
|
|
|
- //处理可能的录入的校验码有误
|
|
|
|
|
- HtCrawlerQuoteResponse.DataDTO data = resolveQuoteResponse(q, decryptData, mealid, limitAmount, h, personalInsuredJSON);
|
|
|
|
|
- return new StepResult(data, personalInsuredJSON);
|
|
|
|
|
|
|
+ // 初始化重试次数和最大重试阈值
|
|
|
|
|
+ int modelCodeRetryCount = 0;
|
|
|
|
|
+ final int MAX_MODEL_CODE_RETRY = 2; // 限制最大重试次数,避免死循环
|
|
|
|
|
+ String currentModelCodexh = pre.carDTO().getModelcodexh();
|
|
|
|
|
+ PreResult currentPre = pre;
|
|
|
|
|
+ while (modelCodeRetryCount < MAX_MODEL_CODE_RETRY) {
|
|
|
|
|
+ String decryptData = "";
|
|
|
|
|
+ try {
|
|
|
|
|
+ HttpHeaders h = buildQuoteStep1Headers(cookie);
|
|
|
|
|
+ HtCrawlerSaveOneStepRequest r = new HtCrawlerSaveOneStepRequest(q, currentPre.carDTO(),
|
|
|
|
|
+ currentPre.params(), quotationNo, currentPre.dataDTO(), dto, gsInfo);
|
|
|
|
|
+ String body = req.saveOneStept(r, h).getBody().toString();
|
|
|
|
|
+ String mealid = extractMealId(body);
|
|
|
|
|
+ //机动车损失保险
|
|
|
|
|
+ String limitAmount = extractLimitAmount(body);
|
|
|
|
|
+ log.info("mealid: {}", mealid);
|
|
|
|
|
+ log.info("limitAmount: {}", limitAmount);
|
|
|
|
|
+ //组装驾意险参数,没有就空字符串
|
|
|
|
|
+ String personalInsuredJSON = buildPersonalInsuredJSON(q);
|
|
|
|
|
+
|
|
|
|
|
+ h = buildQuoteStep2Headers(cookie);
|
|
|
|
|
+ //组装报价参数
|
|
|
|
|
+ HtCrawlerQuoteRequest qr = new HtCrawlerQuoteRequest(q, mealid, limitAmount, "", personalInsuredJSON);
|
|
|
|
|
+ //报价第一次
|
|
|
|
|
+ decryptData = req.quote(qr, h);
|
|
|
|
|
+ //处理重复投保返回终保日期的
|
|
|
|
|
+ DuplQuoteResult duplQuoteResult = handleQuoteErrors(decryptData, q);
|
|
|
|
|
+ if (duplQuoteResult.dupl()) {
|
|
|
|
|
+ qr = new HtCrawlerQuoteRequest(duplQuoteResult.q(), mealid, limitAmount, "", personalInsuredJSON);
|
|
|
|
|
+ decryptData = req.quote(qr, h);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理可能的录入的校验码有误
|
|
|
|
|
+ HtCrawlerQuoteResponse.DataDTO data = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ data = resolveQuoteResponse(duplQuoteResult, decryptData, mealid,
|
|
|
|
|
+ limitAmount, h, personalInsuredJSON);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ decryptData = e.getMessage();
|
|
|
|
|
+ // 检测modelcodexh不在平台车型范围内的异常
|
|
|
|
|
+ if (decryptData.contains("errrorFlag") && decryptData.contains("carChange")) {
|
|
|
|
|
+ modelCodeRetryCount++;
|
|
|
|
|
+ log.warn("检测到modelcodexh[{}]不在平台车型范围内,开始第{}次重试获取新编码",
|
|
|
|
|
+ currentModelCodexh, modelCodeRetryCount);
|
|
|
|
|
+
|
|
|
|
|
+ // 提取新的modelcodexh
|
|
|
|
|
+ Map<String, Object> map = MAPPER.readValue(decryptData, Map.class);
|
|
|
|
|
+ List<Map<String, String>> list = (List)map.get("carModelList");
|
|
|
|
|
+ String newModelCodexh = list.get(0).get("vehiclecode");
|
|
|
|
|
+
|
|
|
|
|
+ currentModelCodexh = newModelCodexh;
|
|
|
|
|
+
|
|
|
|
|
+ // 重新执行报价预处理流程
|
|
|
|
|
+ AttributionInformationVo attr = q.getOrder().getAttributionInformationVo();
|
|
|
|
|
+ currentPre = prepareQuote(attr, gsInfo, q.getCarInfoVo(),
|
|
|
|
|
+ currentModelCodexh, cookie, quotationNo);
|
|
|
|
|
+ log.info("已重新执行prepareQuote,新modelcodexh:{}", currentModelCodexh);
|
|
|
|
|
+
|
|
|
|
|
+ // 跳过当前循环,重新执行报价流程
|
|
|
|
|
+ continue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException(decryptData);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return new StepResult(data, personalInsuredJSON);
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ modelCodeRetryCount++;
|
|
|
|
|
+ if (modelCodeRetryCount >= MAX_MODEL_CODE_RETRY) {
|
|
|
|
|
+ throw new SystemException(decryptData);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 重试前短暂休眠,避免高频请求
|
|
|
|
|
+ sleep(SHORT_DELAY_MS);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new SystemException("报价失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private String extractMealId(String body) {
|
|
private String extractMealId(String body) {
|
|
@@ -518,13 +576,11 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ====================== 报价错误处理 ======================
|
|
// ====================== 报价错误处理 ======================
|
|
|
- private QuoteVo handleQuoteErrors(String decryptData, QuoteVo q) {
|
|
|
|
|
- boolean hasError = decryptData.contains("erroeInfo") || decryptData.contains("errrorFlag");
|
|
|
|
|
- if (!hasError) return q;
|
|
|
|
|
- if (decryptData.contains("发生重复投保") && decryptData.contains("终保日期") && !decryptData.contains("重复投保的其它公司")) {
|
|
|
|
|
- return handleDuplicateInsurance(decryptData, q);
|
|
|
|
|
|
|
+ private DuplQuoteResult handleQuoteErrors(String decryptData, QuoteVo q) {
|
|
|
|
|
+ if (decryptData.contains("发生重复投保") && decryptData.contains("终保日期") ) {//&& !decryptData.contains("重复投保的其它公司")
|
|
|
|
|
+ return new DuplQuoteResult(handleDuplicateInsurance(decryptData, q), true);
|
|
|
}
|
|
}
|
|
|
- return q;
|
|
|
|
|
|
|
+ return new DuplQuoteResult(q, false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private QuoteVo handleDuplicateInsurance(String decryptData, QuoteVo q) {
|
|
private QuoteVo handleDuplicateInsurance(String decryptData, QuoteVo q) {
|
|
@@ -546,9 +602,9 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
return q;
|
|
return q;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private HtCrawlerQuoteResponse.DataDTO resolveQuoteResponse(QuoteVo q, String decryptData, String mealid, String limitAmount,
|
|
|
|
|
|
|
+ private HtCrawlerQuoteResponse.DataDTO resolveQuoteResponse(DuplQuoteResult duplQuoteResult, String decryptData, String mealid, String limitAmount,
|
|
|
HttpHeaders h, String personalInsuredJSON) {
|
|
HttpHeaders h, String personalInsuredJSON) {
|
|
|
- if (!decryptData.contains("录入的校验码有误") && decryptData.contains("erroeInfo")) {
|
|
|
|
|
|
|
+ if (!decryptData.contains("录入的校验码有误") && decryptData.contains("erroeInfo") && !duplQuoteResult.dupl()) {
|
|
|
log.error("报价失败: {}", decryptData);
|
|
log.error("报价失败: {}", decryptData);
|
|
|
throw new SystemException(ERR_PREFIX + convertResponseMsg(decryptData));
|
|
throw new SystemException(ERR_PREFIX + convertResponseMsg(decryptData));
|
|
|
}
|
|
}
|
|
@@ -561,19 +617,24 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
|
|
for (int i = 0; i < MAX_RETRIES; i++) {
|
|
for (int i = 0; i < MAX_RETRIES; i++) {
|
|
|
String basePartJSON = buildBasePartJSON(list);
|
|
String basePartJSON = buildBasePartJSON(list);
|
|
|
- String response = req.quote(new HtCrawlerQuoteRequest(q, mealid, limitAmount, basePartJSON, personalInsuredJSON), h);
|
|
|
|
|
|
|
+ String response = req.quote(new HtCrawlerQuoteRequest(duplQuoteResult.q(), mealid, limitAmount, basePartJSON, personalInsuredJSON), h);
|
|
|
log.info("resolveQuoteResponse attempt {}/{}: {}", i + 1, MAX_RETRIES, response);
|
|
log.info("resolveQuoteResponse attempt {}/{}: {}", i + 1, MAX_RETRIES, response);
|
|
|
|
|
|
|
|
- HtCrawlerQuoteResponse.DataDTO result = JSONObject.parseObject(response, HtCrawlerQuoteResponse.DataDTO.class);
|
|
|
|
|
|
|
+ HtCrawlerQuoteResponse.DataDTO result = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ result = JSONObject.parseObject(response, HtCrawlerQuoteResponse.DataDTO.class);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new RuntimeException(response);
|
|
|
|
|
+ }
|
|
|
if (result != null && result.getApplicationdto() != null) {
|
|
if (result != null && result.getApplicationdto() != null) {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// autocheckcode 可能不准确,重新获取 quote 刷新验证码
|
|
// autocheckcode 可能不准确,重新获取 quote 刷新验证码
|
|
|
if (response.contains("录入的校验码有误") && i < MAX_RETRIES - 1) {
|
|
if (response.contains("录入的校验码有误") && i < MAX_RETRIES - 1) {
|
|
|
- log.warn("autocheckcode 校验失败,重新获取 quote 刷新验证码 (attempt {}/{})", i + 1, MAX_RETRIES);
|
|
|
|
|
|
|
+ log.warn("验证码 校验失败,重新获取 刷新验证码 (尝试 {}/{})", i + 1, MAX_RETRIES);
|
|
|
// 必须传空 basePart,接口才会返回新的 basePart 列表(含新 autocheckcode)
|
|
// 必须传空 basePart,接口才会返回新的 basePart 列表(含新 autocheckcode)
|
|
|
- String fresh = req.quote(new HtCrawlerQuoteRequest(q, mealid, limitAmount, "", personalInsuredJSON), h);
|
|
|
|
|
|
|
+ String fresh = req.quote(new HtCrawlerQuoteRequest(duplQuoteResult.q(), mealid, limitAmount, "", personalInsuredJSON), h);
|
|
|
result = JSONObject.parseObject(fresh, HtCrawlerQuoteResponse.DataDTO.class);
|
|
result = JSONObject.parseObject(fresh, HtCrawlerQuoteResponse.DataDTO.class);
|
|
|
if (result != null && result.getApplicationdto() != null) {
|
|
if (result != null && result.getApplicationdto() != null) {
|
|
|
return result;
|
|
return result;
|
|
@@ -630,7 +691,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
|
|
// ====================== 核保 ======================
|
|
// ====================== 核保 ======================
|
|
|
@Override
|
|
@Override
|
|
|
- public UnderwritingResultsVo underwriting(UnderwritingVo vo) throws JsonProcessingException {
|
|
|
|
|
|
|
+ public UnderwritingResultsVo underwriting(UnderwritingVo vo) {
|
|
|
AttributionInformationVo attr = vo.getOrder().getAttributionInformationVo();
|
|
AttributionInformationVo attr = vo.getOrder().getAttributionInformationVo();
|
|
|
HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
|
|
HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
|
|
|
HtCrawlerConfigureParameters.class, attr.getConfigInfo());
|
|
HtCrawlerConfigureParameters.class, attr.getConfigInfo());
|
|
@@ -642,7 +703,13 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
|
|
|
|
|
HtCrawlerSubmitRequest submit = new HtCrawlerSubmitRequest(vo, params, order.getCiCategory(), order.getBiCategory());
|
|
HtCrawlerSubmitRequest submit = new HtCrawlerSubmitRequest(vo, params, order.getCiCategory(), order.getBiCategory());
|
|
|
String res = req.submit2(submit, req.getHeaders());
|
|
String res = req.submit2(submit, req.getHeaders());
|
|
|
- Map<String, Object> map = MAPPER.readValue(res, Map.class);
|
|
|
|
|
|
|
+ log.info("提交核保结果: {}", res);
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ try {
|
|
|
|
|
+ map = MAPPER.readValue(res, Map.class);
|
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
|
+ throw new SystemException("核保失败,未知异常");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (isUnderwritingFailed(order.getCiCategory(), map, res)) {
|
|
if (isUnderwritingFailed(order.getCiCategory(), map, res)) {
|
|
|
throw new SystemException("核保失败-------" + convertResponseMsg(map.get("MSG").toString()));
|
|
throw new SystemException("核保失败-------" + convertResponseMsg(map.get("MSG").toString()));
|
|
@@ -781,7 +848,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
attr.getUsername(), params.getComCode(), convertCookieToMap(req.getCookie()),
|
|
attr.getUsername(), params.getComCode(), convertCookieToMap(req.getCookie()),
|
|
|
quotationRelaNo + "_", token, updata);
|
|
quotationRelaNo + "_", token, updata);
|
|
|
cache.cacheYingXiangUploaded(quotationRelaNo);
|
|
cache.cacheYingXiangUploaded(quotationRelaNo);
|
|
|
- } catch (Exception e) { throw new RuntimeException(e); }
|
|
|
|
|
|
|
+ } catch (Exception e) { throw new SystemException(e.getMessage()); }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Map<String, Object> fetchUploadInitParam(String token) {
|
|
private Map<String, Object> fetchUploadInitParam(String token) {
|
|
@@ -1087,7 +1154,7 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
|
|
|
for (int i = 0; i < 16; i++) kb.append(alphabet.charAt(r.nextInt(alphabet.length())));
|
|
for (int i = 0; i < 16; i++) kb.append(alphabet.charAt(r.nextInt(alphabet.length())));
|
|
|
String key = kb.toString();
|
|
String key = kb.toString();
|
|
|
return Map.of("sourceCode", 8, "accessToken", CryptoUtil.rsaEncrypt(key),
|
|
return Map.of("sourceCode", 8, "accessToken", CryptoUtil.rsaEncrypt(key),
|
|
|
- "data", CryptoUtil.aesEncrypt(MAPPER.writeValueAsString(x), key), "insuredCode", "");
|
|
|
|
|
|
|
+ "data", Objects.requireNonNull(CryptoUtil.aesEncrypt(MAPPER.writeValueAsString(x), key)), "insuredCode", "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public Map<String, Object> decrypt(Map<String, Object> x) throws Exception {
|
|
public Map<String, Object> decrypt(Map<String, Object> x) throws Exception {
|