yumeng 2 bulan lalu
induk
melakukan
ec44070e40

+ 3 - 3
job-bytedance/pom.xml

@@ -9,7 +9,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.1.3.RELEASE</version>
+        <version>2.3.12.RELEASE</version>
         <relativePath/>
     </parent>
     <properties>
@@ -177,7 +177,7 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
-  <!--      <dependency>
+        <dependency>
             <groupId>redis.clients</groupId>
             <artifactId>jedis</artifactId>
             <version>3.1.0</version>
@@ -186,7 +186,7 @@
             <groupId>org.redisson</groupId>
             <artifactId>redisson</artifactId>
             <version>3.36.0</version>
-        </dependency>-->
+        </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>

+ 7 - 6
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceReportNewServiceImpl.java

@@ -7,6 +7,7 @@ import cn.com.ctop.job.bytedance.data.mapper.AccountReportNewMapper;
 import cn.com.ctop.job.bytedance.data.service.IBytedanceReportNewService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
+import cn.com.ctop.job.bytedance.data.utils.RateLimitUtil;
 import cn.com.ctop.job.bytedance.utils.FieldsConfig;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -22,6 +23,8 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
     @Autowired
     private AccountReportNewMapper accountReportNewMapper;
 
+    @Autowired
+    private RateLimitUtil rateLimitUtil;
 
     private String urlPath = "http://192.168.0.85:8765/webhook/bytedance_account_report";
     private static JSONArray metrics = new JSONArray();
@@ -45,11 +48,9 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
             Map<String, String> headers = new HashMap<>();
             headers.put("Access-Token", accessToken);
             String s = null;
-           /* if (rateLimitUtil.acquire("1635316529903624", url)) {*/
+            if (rateLimitUtil.acquire("1635316529903624", url)) {
                 s = HttpUtils.httpGet(url, paramsMap, headers);
-          /*  }*/
-
-
+            }
             JSONObject result = JSONObject.parseObject(s);
             List<BytedanceAdvertiserReportHourly> hours = new ArrayList<>();
             Integer code = result.getInteger("code");
@@ -153,9 +154,9 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
             Map<String, String> headers = new HashMap<>();
             headers.put("Access-Token", oauthToken);
             String s = null;
-        /*    if (rateLimitUtil.acquire("1635316529903624", url)) {*/
+            if (rateLimitUtil.acquire("1635316529903624", url)) {
                 s = HttpUtils.httpGet(url, paramsMap, headers);
-        /*    }*/
+            }
             JSONObject result = JSONObject.parseObject(s);
             List<BytedanceAdvertiserReportDaily> dailies = new ArrayList<>();
             Integer code = result.getInteger("code");

+ 2 - 6
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/RateLimitUtil.java

@@ -1,4 +1,3 @@
-/*
 package cn.com.ctop.job.bytedance.data.utils;
 
 import com.google.common.collect.ImmutableMap;
@@ -38,10 +37,8 @@ public class RateLimitUtil {
             .put("/open_api/2/tools/site/get/", 10)
             .build();
 
-    */
-/**
-     * 自定义限流规则
-     *//*
+
+
 
     public boolean acquire(String devAppId, String url) {
         URI uri = URI.create(url);
@@ -62,4 +59,3 @@ public class RateLimitUtil {
         return redissonClient.getRateLimiter(key).tryAcquire(1, 1, TimeUnit.SECONDS);
     }
 }
-*/

+ 0 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/RedisConfig.java

@@ -1,4 +1,3 @@
-/*
 package cn.com.ctop.job.bytedance.utils;
 
 import org.redisson.Redisson;
@@ -69,4 +68,3 @@ public class RedisConfig {
         return template;
     }
 }
-*/

+ 13 - 0
xxl-job-core/pom.xml

@@ -22,6 +22,19 @@
 			<version>${netty-all.version}</version>
 		</dependency>
 		<dependency>
+			<groupId>io.netty</groupId>
+			<artifactId>netty-all</artifactId>
+			<version>4.1.33.Final</version>
+			<exclusions>
+				<!-- 排除这个特定版本的 netty-all -->
+				<exclusion>
+					<groupId>io.netty</groupId>
+					<artifactId>netty-all</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<dependency>
 			<groupId>com.google.code.gson</groupId>
 			<artifactId>gson</artifactId>
 			<version>${gson.version}</version>