|
@@ -2,6 +2,7 @@ package com.tzld.piaoquan.risk.control.job;
|
|
|
|
|
|
import com.tzld.piaoquan.risk.control.service.sync.BlacklistSyncService;
|
|
|
import com.tzld.piaoquan.risk.control.service.sync.config.ApolloConfigService;
|
|
|
+import com.xxl.job.core.biz.model.ReturnT;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -36,7 +37,7 @@ public class BlacklistSyncJobHandler {
|
|
|
* XXL-JOB任务执行方法,每234秒执行一次
|
|
|
*/
|
|
|
@XxlJob("blacklistSyncJob")
|
|
|
- public void execute() throws Exception {
|
|
|
+ public ReturnT<String> execute(String params) throws Exception {
|
|
|
// 为XXL-JOB任务设置traceId
|
|
|
String traceId = "JOB-" + UUID.randomUUID().toString().replace("-", "").substring(0, 12);
|
|
|
MDC.put("logTraceId", traceId);
|
|
@@ -66,6 +67,7 @@ public class BlacklistSyncJobHandler {
|
|
|
log.info("同步统计信息: {}", statistics);
|
|
|
|
|
|
log.info("XXL-JOB任务执行完成,耗时: {}ms,统计信息: {}", duration, statistics);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
String errorMsg = "黑名单同步任务执行失败: " + e.getMessage();
|
|
@@ -73,7 +75,7 @@ public class BlacklistSyncJobHandler {
|
|
|
log.error("XXL-JOB任务执行异常", e);
|
|
|
|
|
|
// 重新抛出异常,让XXL-JOB记录任务失败
|
|
|
- throw e;
|
|
|
+ return ReturnT.FAIL;
|
|
|
} finally {
|
|
|
// 清理MDC
|
|
|
MDC.remove("logTraceId");
|