|
@@ -9,6 +9,8 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
+
|
|
|
/**
|
|
|
* @author xusonglin
|
|
|
* @version V1.0
|
|
@@ -20,27 +22,28 @@ public class ExceptionListenerTask {
|
|
|
StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
|
|
|
- @Scheduled(cron = "0 0/5 * * * ?", zone = "Asia/Shanghai")
|
|
|
+ @Scheduled(cron = "0 0/15 * * * ?", zone = "Asia/Shanghai")
|
|
|
public void personIllegalInfoTask() {
|
|
|
- int timeOutCount = 0;
|
|
|
- int queryFailedCount = 0;
|
|
|
- int totalCount = 0;
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
+ double timeOutCount = 0;
|
|
|
+ double queryFailedCount = 0;
|
|
|
+ double 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);
|
|
|
+ timeOutCount = Double.parseDouble(timeOut);
|
|
|
}
|
|
|
if (queryFailed != null) {
|
|
|
- queryFailedCount = Integer.parseInt(queryFailed);
|
|
|
+ queryFailedCount = Double.parseDouble(queryFailed);
|
|
|
}
|
|
|
if (total != null) {
|
|
|
- totalCount = Integer.parseInt(total);
|
|
|
+ totalCount = Double.parseDouble(total);
|
|
|
}
|
|
|
|
|
|
StringBuilder errorMessage = new StringBuilder("社会风险预警-人员核验接口失败,失败原因:");
|
|
|
if (timeOutCount > 10) {
|
|
|
- errorMessage.append("数据源超时, 超时比例 ").append(timeOutCount / totalCount);
|
|
|
+ errorMessage.append("数据源超时, 超时比例 ").append(decimalFormat.format(timeOutCount / totalCount));
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("personIllegalInfoTask, 发送钉钉异常:社会风险预警-人员核验接口失败-数据源超时");
|
|
@@ -48,7 +51,7 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
|
|
|
if (queryFailedCount > 10) {
|
|
|
- errorMessage.append("数据源返回结果异常,异常比例 ").append(queryFailedCount / totalCount);
|
|
|
+ errorMessage.append("数据源返回结果异常,异常比例 ").append(decimalFormat.format(queryFailedCount / totalCount));
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("personIllegalInfoTask, 发送钉钉异常:社会风险预警-人员核验接口失败-数据源返回结果异常");
|
|
@@ -59,11 +62,12 @@ public class ExceptionListenerTask {
|
|
|
stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_COUNT);
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "0 0/5 * * * ?", zone = "Asia/Shanghai")
|
|
|
+ @Scheduled(cron = "0 0/15 * * * ?", zone = "Asia/Shanghai")
|
|
|
public void vehicleIllegalInfoTask() {
|
|
|
- int timeOutCount = 0;
|
|
|
- int queryFailedCount = 0;
|
|
|
- int totalCount = 0;
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
+ double timeOutCount = 0;
|
|
|
+ double queryFailedCount = 0;
|
|
|
+ double 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();
|
|
@@ -79,7 +83,7 @@ public class ExceptionListenerTask {
|
|
|
|
|
|
StringBuilder errorMessage = new StringBuilder("社会风险预警-车辆核验接口失败,失败原因:");
|
|
|
if (timeOutCount > 10) {
|
|
|
- errorMessage.append("数据源超时,超时比例 ").append(timeOutCount / totalCount);
|
|
|
+ errorMessage.append("数据源超时,超时比例 ").append(decimalFormat.format(timeOutCount / totalCount));
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("vehicleIllegalInfoTask, 发送钉钉异常:社会风险预警-车辆核验接口失败-数据源超时");
|
|
@@ -87,7 +91,7 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
|
|
|
if (queryFailedCount > 10) {
|
|
|
- errorMessage.append("数据源返回结果异常,异常比例 ").append(queryFailedCount / totalCount);
|
|
|
+ errorMessage.append("数据源返回结果异常,异常比例 ").append(decimalFormat.format(queryFailedCount / totalCount));
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage.toString());
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
|
log.info("vehicleIllegalInfoTask, 发送钉钉异常:社会风险预警-车辆核验接口失败-数据源返回结果异常");
|