|
@@ -41,15 +41,29 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
|
String body = JSON.toJSONString(requestParams);
|
|
|
|
|
|
Long startTime = System.currentTimeMillis();
|
|
|
- String result = OkHttpUtil.doPost(illegalInfoUrl, body);
|
|
|
+ String result = OkHttpUtil.doPost(illegalInfoUrl, body, CommonConstant.PERSON_TIME_OUT);
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParams.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 请求上游失败无返回", requestParams.getTraceId(), body);
|
|
|
stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT).increment();
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
- IllegalInfoResult illegalInfoResult = JSON.toJavaObject(JSON.parseObject(result), IllegalInfoResult.class);
|
|
|
+ IllegalInfoResult illegalInfoResult;
|
|
|
+ try {
|
|
|
+ if (StringUtils.isBlank(result)) {
|
|
|
+ illegalInfoResult = new IllegalInfoResult().normalResult();
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new IllegalInfoChargeObject(illegalInfoResult, false, requestParams.getTraceId())));
|
|
|
+ return illegalInfoResult;
|
|
|
+ } else {
|
|
|
+ illegalInfoResult = JSON.toJavaObject(JSON.parseObject(result), IllegalInfoResult.class);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("调用上游接口-流水号:{}, 入参:{}, 解析上游返回异常:{}", requestParams.getTraceId(), body, e);
|
|
|
+ illegalInfoResult = new IllegalInfoResult().normalResult();
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new IllegalInfoChargeObject(illegalInfoResult, false, requestParams.getTraceId())));
|
|
|
+ return illegalInfoResult;
|
|
|
+ }
|
|
|
+
|
|
|
// 返回4个参数,code0表示结果正常,其他表示异常
|
|
|
if (!illegalInfoResult.getCode().equals("0")
|
|
|
|| illegalInfoResult.getIsDrugs().equals("2")
|
|
@@ -77,7 +91,7 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
|
String body = JSON.toJSONString(requestParam);
|
|
|
|
|
|
Long startTime = System.currentTimeMillis();
|
|
|
- String result = OkHttpUtil.doPost(vehicleIllegalInfoUrl, body);
|
|
|
+ String result = OkHttpUtil.doPost(vehicleIllegalInfoUrl, body, CommonConstant.VEHICLE_TIME_OUT);
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParam.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 请求上游失败无返回", requestParam.getTraceId(), body);
|
|
@@ -121,14 +135,29 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
|
String body = JSON.toJSONString(requestParams);
|
|
|
|
|
|
Long startTime = System.currentTimeMillis();
|
|
|
- String result = OkHttpUtil.doPost(illegalInfoUrl, body);
|
|
|
+ String result = OkHttpUtil.doPost(illegalInfoUrl, body, CommonConstant.PERSON_TIME_OUT);
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParams.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
|
if (StringUtils.isBlank(result)) {
|
|
|
log.info("调用上游接口-流水号:{}, 入参:{}, 请求上游失败无返回", requestParams.getTraceId(), body);
|
|
|
stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT).increment();
|
|
|
- return null;
|
|
|
}
|
|
|
- IllegalInfoResult illegalInfoResult = JSON.toJavaObject(JSON.parseObject(result), IllegalInfoResult.class);
|
|
|
+
|
|
|
+ IllegalInfoResult illegalInfoResult;
|
|
|
+ try {
|
|
|
+ if (StringUtils.isBlank(result)) {
|
|
|
+ illegalInfoResult = new IllegalInfoResult().normalResult();
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new IllegalInfoChargeObject(illegalInfoResult, false, requestParams.getTraceId())));
|
|
|
+ return illegalInfoResult;
|
|
|
+ } else {
|
|
|
+ illegalInfoResult = JSON.toJavaObject(JSON.parseObject(result), IllegalInfoResult.class);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("调用上游接口-流水号:{}, 入参:{}, 解析上游返回异常:{}", requestParams.getTraceId(), body, e);
|
|
|
+ illegalInfoResult = new IllegalInfoResult().normalResult();
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new IllegalInfoChargeObject(illegalInfoResult, false, requestParams.getTraceId())));
|
|
|
+ return illegalInfoResult;
|
|
|
+ }
|
|
|
+
|
|
|
// 返回4个参数,code0表示结果正常,其他表示异常
|
|
|
if (!illegalInfoResult.getCode().equals("0")
|
|
|
|| illegalInfoResult.getIsDrugs().equals("2")
|