|
@@ -24,65 +24,77 @@ public class ExceptionListenerTask {
|
|
|
public void personIllegalInfoTask() {
|
|
|
int timeOutCount = 0;
|
|
|
int queryFailedCount = 0;
|
|
|
+ int totalCount = 0;
|
|
|
String timeOut = stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT).get();
|
|
|
String queryFailed = stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_QUERY_FAILED).get();
|
|
|
+ String total = stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_COUNT).get();
|
|
|
if (timeOut != null) {
|
|
|
timeOutCount = Integer.parseInt(timeOut);
|
|
|
}
|
|
|
if (queryFailed != null) {
|
|
|
queryFailedCount = Integer.parseInt(queryFailed);
|
|
|
}
|
|
|
+ if (total != null) {
|
|
|
+ totalCount = Integer.parseInt(total);
|
|
|
+ }
|
|
|
|
|
|
- String errorMessage = "社会风险预警-人员核验接口失败,失败原因:";
|
|
|
+ StringBuilder errorMessage = new StringBuilder("社会风险预警-人员核验接口失败,失败原因:");
|
|
|
if (timeOutCount > 10) {
|
|
|
- errorMessage += "数据源超时";
|
|
|
- SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
+ errorMessage.append("数据源超时, 超时比例 ").append(timeOutCount / totalCount);
|
|
|
+ SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("personIllegalInfoTask, 发送钉钉异常:社会风险预警-人员核验接口失败-数据源超时");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (queryFailedCount > 10) {
|
|
|
- errorMessage += "数据源返回结果异常";
|
|
|
- SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
+ errorMessage.append("数据源返回结果异常,异常比例 ").append(queryFailedCount / totalCount);
|
|
|
+ SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("personIllegalInfoTask, 发送钉钉异常:社会风险预警-人员核验接口失败-数据源返回结果异常");
|
|
|
}
|
|
|
}
|
|
|
stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT);
|
|
|
stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_QUERY_FAILED);
|
|
|
+ stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_COUNT);
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 0/5 * * * ?", zone = "Asia/Shanghai")
|
|
|
public void vehicleIllegalInfoTask() {
|
|
|
int timeOutCount = 0;
|
|
|
int queryFailedCount = 0;
|
|
|
+ int totalCount = 0;
|
|
|
String timeOut = stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT).get();
|
|
|
String queryFailed = stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_QUERY_FAILED).get();
|
|
|
+ String total = stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_COUNT).get();
|
|
|
if (timeOut != null) {
|
|
|
timeOutCount = Integer.parseInt(timeOut);
|
|
|
}
|
|
|
if (queryFailed != null) {
|
|
|
queryFailedCount = Integer.parseInt(queryFailed);
|
|
|
}
|
|
|
+ if (total != null) {
|
|
|
+ totalCount = Integer.parseInt(total);
|
|
|
+ }
|
|
|
|
|
|
- String errorMessage = "社会风险预警-车辆核验接口失败,失败原因:";
|
|
|
+ StringBuilder errorMessage = new StringBuilder("社会风险预警-车辆核验接口失败,失败原因:");
|
|
|
if (timeOutCount > 10) {
|
|
|
- errorMessage += "数据源超时";
|
|
|
- SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
+ errorMessage.append("数据源超时,超时比例 ").append(timeOutCount / totalCount);
|
|
|
+ SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("vehicleIllegalInfoTask, 发送钉钉异常:社会风险预警-车辆核验接口失败-数据源超时");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (queryFailedCount > 10) {
|
|
|
- errorMessage += "数据源返回结果异常";
|
|
|
- SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
+ errorMessage.append("数据源返回结果异常,异常比例 ").append(queryFailedCount / totalCount);
|
|
|
+ SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("vehicleIllegalInfoTask, 发送钉钉异常:社会风险预警-车辆核验接口失败-数据源返回结果异常");
|
|
|
}
|
|
|
}
|
|
|
stringRedisTemplate.delete(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT);
|
|
|
stringRedisTemplate.delete(CommonConstant.VEHICLE_ILLEGAL_INFO_QUERY_FAILED);
|
|
|
+ stringRedisTemplate.delete(CommonConstant.VEHICLE_ILLEGAL_INFO_COUNT);
|
|
|
}
|
|
|
}
|