|
@@ -31,6 +31,8 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
private String illegalInfoUrl;
|
|
private String illegalInfoUrl;
|
|
@Value("${illegalInfo.vehicleUrl}")
|
|
@Value("${illegalInfo.vehicleUrl}")
|
|
private String vehicleIllegalInfoUrl;
|
|
private String vehicleIllegalInfoUrl;
|
|
|
|
+ @Value("${illegalInfo.vehicleOwnerValidateUrl}")
|
|
|
|
+ private String vehicleOwnerValidateUrl;
|
|
@Value("${illegalInfo.decodeKey}")
|
|
@Value("${illegalInfo.decodeKey}")
|
|
private String decodeKey;
|
|
private String decodeKey;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -105,7 +107,7 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
|
|
|
|
Long startTime = System.currentTimeMillis();
|
|
Long startTime = System.currentTimeMillis();
|
|
String result = OkHttpUtil.doPost(vehicleIllegalInfoUrl, body, CommonConstant.VEHICLE_TIME_OUT);
|
|
String result = OkHttpUtil.doPost(vehicleIllegalInfoUrl, body, CommonConstant.VEHICLE_TIME_OUT);
|
|
- log.info("调用上游接口-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParam.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
|
|
|
|
+ log.info("调用上游接口-checkVehicleIllegalInfo-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParam.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
if (StringUtils.isBlank(result)) {
|
|
if (StringUtils.isBlank(result)) {
|
|
log.info("checkVehicleIllegalInfoRequestError-流水号:{}, 入参:{}, 请求上游失败无返回", requestParam.getTraceId(), body);
|
|
log.info("checkVehicleIllegalInfoRequestError-流水号:{}, 入参:{}, 请求上游失败无返回", requestParam.getTraceId(), body);
|
|
stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT).increment();
|
|
stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT).increment();
|
|
@@ -310,4 +312,46 @@ public class IllegalInfoServiceImpl implements IllegalInfoService {
|
|
}
|
|
}
|
|
return illegalInfoResult;
|
|
return illegalInfoResult;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public VehicleOwnerValidateResult vehicleOwnerValidate(String params) {
|
|
|
|
+ try {
|
|
|
|
+ params = AesUtil.decryAES(decodeKey, params);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.info("解析参数失败, 入参:{}", params);
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ VehicleOwnerValidateRequestParam requestParam = getVehicleOwnerValidateRequestParam(params);
|
|
|
|
+ String body = JSON.toJSONString(requestParam);
|
|
|
|
+
|
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
|
+ String result = OkHttpUtil.doPost(vehicleOwnerValidateUrl, body, CommonConstant.VEHICLE_TIME_OUT);
|
|
|
|
+ log.info("调用上游接口-vehicleOwnerValidate-流水号:{}, 入参:{}, 返回:{}, 时延:{}", requestParam.getTraceId(), body, result, System.currentTimeMillis() - startTime);
|
|
|
|
+ if (StringUtils.isBlank(result)) {
|
|
|
|
+ log.info("vehicleOwnerValidateRequestError-流水号:{}, 入参:{}, 请求上游失败无返回", requestParam.getTraceId(), body);
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ VehicleOwnerValidateResult vehicleOwnerValidateResult = JSON.toJavaObject(JSON.parseObject(result), VehicleOwnerValidateResult.class);
|
|
|
|
+ // code0表示结果正常,其他表示异常
|
|
|
|
+ if (!vehicleOwnerValidateResult.getCode().equals("0")
|
|
|
|
+ || vehicleOwnerValidateResult.getResult().equals("2")) {
|
|
|
|
+ // 查询错误,不计费
|
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new VehicleOwnerValidateChargeObject(vehicleOwnerValidateResult, false, requestParam.getTraceId())));
|
|
|
|
+ log.info("vehicleOwnerValidateResultError-流水号:{}, 上游结果异常", requestParam.getTraceId());
|
|
|
|
+ } else {
|
|
|
|
+ // 查询成功,计费
|
|
|
|
+ CHARGE_LOGGER.info(JSON.toJSONString(new VehicleOwnerValidateChargeObject(vehicleOwnerValidateResult, true, requestParam.getTraceId())));
|
|
|
|
+ }
|
|
|
|
+ return vehicleOwnerValidateResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private VehicleOwnerValidateRequestParam getVehicleOwnerValidateRequestParam(String params) {
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(params);
|
|
|
|
+ VehicleOwnerValidateRequestParam requestParam = new VehicleOwnerValidateRequestParam();
|
|
|
|
+ requestParam.setName(jsonObject.getString("name"));
|
|
|
|
+ requestParam.setPlateNumber(jsonObject.getString("plateNumber"));
|
|
|
|
+ requestParam.setTraceId(jsonObject.getString("traceId"));
|
|
|
|
+ requestParam.setPlateColor(jsonObject.getString("plateColor"));
|
|
|
|
+ return requestParam;
|
|
|
|
+ }
|
|
}
|
|
}
|