|
@@ -3,6 +3,8 @@ package cn.com.ctop.job.bytedance.handler;
|
|
/**
|
|
/**
|
|
* Created by JQ.bi on 2020.11.16
|
|
* Created by JQ.bi on 2020.11.16
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.toutiao.modules.report.service.IRuleByteDanceAccountService;
|
|
import cn.com.ctop.toutiao.modules.report.service.IRuleByteDanceAccountService;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
@@ -11,6 +13,7 @@ import com.xxl.job.core.log.XxlJobLogger;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
@@ -23,18 +26,20 @@ public class RuleDataAccountCleanJob {
|
|
@Autowired
|
|
@Autowired
|
|
private IRuleByteDanceAccountService ruleByteDanceAccountService;
|
|
private IRuleByteDanceAccountService ruleByteDanceAccountService;
|
|
|
|
|
|
- private ExecutorService executorPool = Executors.newFixedThreadPool(6);
|
|
|
|
|
|
+ private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
|
|
|
@XxlJob("ruleDataAccountCleanJob")
|
|
@XxlJob("ruleDataAccountCleanJob")
|
|
public ReturnT<String> execute(String param) throws Exception {
|
|
public ReturnT<String> execute(String param) throws Exception {
|
|
XxlJobLogger.log("规则预警账户维度数据开始清洗");
|
|
XxlJobLogger.log("规则预警账户维度数据开始清洗");
|
|
if (null == param || "".equals(param.trim())) {
|
|
if (null == param || "".equals(param.trim())) {
|
|
- XxlJobLogger.log("参数异常");
|
|
|
|
- return ReturnT.FAIL;
|
|
|
|
|
|
+ List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
|
|
|
|
+ tokens.forEach(token -> executorService.submit(()->ruleByteDanceAccountService.cleanRuleDataAccount(token.getAccountId())));
|
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
|
+ }else{
|
|
|
|
+ Long accountId = Long.parseLong(param);
|
|
|
|
+ ruleByteDanceAccountService.cleanRuleDataAccount(accountId);
|
|
|
|
+ XxlJobLogger.log("规则预警账户维度数据清洗结束");
|
|
|
|
+ return ReturnT.SUCCESS;
|
|
}
|
|
}
|
|
- Long accountId = Long.parseLong(param);
|
|
|
|
- ruleByteDanceAccountService.cleanRuleDataAccount(accountId);
|
|
|
|
- XxlJobLogger.log("规则预警账户维度数据清洗结束");
|
|
|
|
- return ReturnT.SUCCESS;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|