|
@@ -3,15 +3,12 @@ package com.jkcredit.illegal.info.task;
|
|
|
import com.jkcredit.illegal.info.constant.CommonConstant;
|
|
|
import com.jkcredit.illegal.info.model.SendDingMsgResponseObject;
|
|
|
import com.jkcredit.illegal.info.util.DingRobotUtil;
|
|
|
-import com.xxl.job.core.biz.model.ReturnT;
|
|
|
-import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.Objects;
|
|
|
-
|
|
|
/**
|
|
|
* @author xusonglin
|
|
|
* @version V1.0
|
|
@@ -22,8 +19,9 @@ public class ExceptionListenerTask {
|
|
|
@Autowired
|
|
|
StringRedisTemplate stringRedisTemplate;
|
|
|
|
|
|
- @XxlJob("personIllegalInfoTask")
|
|
|
- public ReturnT<String> personIllegalInfoTask(String param) {
|
|
|
+
|
|
|
+ @Scheduled(cron = "0 0/5 * * * ?", zone = "Asia/Shanghai")
|
|
|
+ public void personIllegalInfoTask() {
|
|
|
int timeOutCount = 0;
|
|
|
int queryFailedCount = 0;
|
|
|
String timeOut = stringRedisTemplate.boundValueOps(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT).get();
|
|
@@ -44,7 +42,7 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (queryFailedCount >10) {
|
|
|
+ if (queryFailedCount > 10) {
|
|
|
errorMessage += "数据源返回结果异常";
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
@@ -53,11 +51,10 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_TIME_OUT);
|
|
|
stringRedisTemplate.delete(CommonConstant.PERSON_ILLEGAL_INFO_QUERY_FAILED);
|
|
|
- return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
- @XxlJob("vehicleIllegalInfoTask")
|
|
|
- public ReturnT<String> vehicleIllegalInfoTask(String param) {
|
|
|
+ @Scheduled(cron = "0 0/5 * * * ?", zone = "Asia/Shanghai")
|
|
|
+ public void vehicleIllegalInfoTask() {
|
|
|
int timeOutCount = 0;
|
|
|
int queryFailedCount = 0;
|
|
|
String timeOut = stringRedisTemplate.boundValueOps(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT).get();
|
|
@@ -78,7 +75,7 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (queryFailedCount >10) {
|
|
|
+ if (queryFailedCount > 10) {
|
|
|
errorMessage += "数据源返回结果异常";
|
|
|
SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(errorMessage);
|
|
|
if (sendDingMsgResponseObject.getCode() != 1) {
|
|
@@ -87,13 +84,5 @@ public class ExceptionListenerTask {
|
|
|
}
|
|
|
stringRedisTemplate.delete(CommonConstant.VEHICLE_ILLEGAL_INFO_TIME_OUT);
|
|
|
stringRedisTemplate.delete(CommonConstant.VEHICLE_ILLEGAL_INFO_QUERY_FAILED);
|
|
|
- return ReturnT.SUCCESS;
|
|
|
- }
|
|
|
-
|
|
|
- @XxlJob("dingdingTestTask")
|
|
|
- public ReturnT<String> dingdingTestTask(String param) {
|
|
|
- String message = "社会风险预警-测试";
|
|
|
- SendDingMsgResponseObject sendDingMsgResponseObject = DingRobotUtil.sendDingRobotMsg(message);
|
|
|
- return ReturnT.SUCCESS;
|
|
|
}
|
|
|
}
|