|
@@ -0,0 +1,46 @@
|
|
|
+package cn.com.ctop.job.bytedance.handler;
|
|
|
+
|
|
|
+import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
+import com.xxl.job.core.biz.model.ReturnT;
|
|
|
+import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
+import com.xxl.job.core.log.XxlJobLogger;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class BytedanceRuleDataJobDistribute {
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
+ @XxlJob("bytedancePlanRuleDataJobDistribute")
|
|
|
+ public ReturnT<String> bytedancePlanRuleDataJobDistribute(String params) throws Exception {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ if(null!=tokens&&!tokens.isEmpty()){
|
|
|
+ //TODO 指定相应的任务id
|
|
|
+ String planUrl = "http://139.186.29.76:8090/jobinfo/trigger?id=87&executorParam=";
|
|
|
+ for(CtopOauthToken token:tokens){
|
|
|
+ String planResult = HttpUtils.httpPostRequest(planUrl+token.getAccountId(),new HashMap<>(),new HashMap<>());
|
|
|
+ XxlJobLogger.log("accountId:{};message:{}",token.getAccountId(),planResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ @XxlJob("bytedanceAccountRuleDataJobDistribute")
|
|
|
+ public ReturnT<String> bytedanceAccountRuleDataJobDistribute(String params) throws Exception {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ if(null!=tokens&&!tokens.isEmpty()){
|
|
|
+ //TODO
|
|
|
+ String accountUrl = "http://139.186.29.76:8090/jobinfo/trigger?id=87&executorParam=";
|
|
|
+ for(CtopOauthToken token:tokens){
|
|
|
+ String accountResult = HttpUtils.httpPostRequest(accountUrl+token.getAccountId(),new HashMap<>(),new HashMap<>());
|
|
|
+ XxlJobLogger.log("accountId:{};message:{}",token.getAccountId(),accountResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+}
|