huangpingkang пре 1 година
родитељ
комит
3b1f68cbf6

+ 24 - 19
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/DianZhongServiceImpl.java

@@ -136,27 +136,32 @@ public class DianZhongServiceImpl implements IDianZhongService {
                 String url = task.getString("url");
                 String type = task.getString("type");
                 String clientId = task.getString("client_id");
-                log.info("开始下载点众数据 taskId:{}, clientId:{}, type:{}", taskId, clientId, type);
-                downloadFileRestTemplate.execute(url, org.springframework.http.HttpMethod.GET, null,
-                        (ResponseExtractor<Void>) response -> {
-                            try (BufferedReader reader = new BufferedReader(
-                                    new InputStreamReader(response.getBody(), StandardCharsets.UTF_8))) {
-                                String line;
-                                while ((line = reader.readLine()) != null) {
-                                    if ("user".equals(type)) {
-                                        getDZUser(line);
-                                        getDZLogin(line);
-                                        getDZActivation(line);
-                                        getDZRegister(line, statDate);
-                                    } else if ("order".equals(type)) {
-                                        getDZOrder(line);
+                try {
+                    log.info("开始下载点众数据 taskId:{}, clientId:{}, type:{}", taskId, clientId, type);
+                    downloadFileRestTemplate.execute(url, org.springframework.http.HttpMethod.GET, null,
+                            (ResponseExtractor<Void>) response -> {
+                                try (BufferedReader reader = new BufferedReader(
+                                        new InputStreamReader(response.getBody(), StandardCharsets.UTF_8))) {
+                                    String line;
+                                    while ((line = reader.readLine()) != null) {
+                                        if ("user".equals(type)) {
+                                            getDZUser(line);
+                                            getDZLogin(line);
+                                            getDZActivation(line);
+                                            getDZRegister(line, statDate);
+                                        } else if ("order".equals(type)) {
+                                            getDZOrder(line);
+                                        }
                                     }
                                 }
-                            }
-                            return null;
-                        });
-                dianZhongMapper.updateTaskDownloaded(taskId);
-                log.info("下载点众数据成功 taskId:{}, clientId:{}, type:{}", taskId, clientId, type);
+                                return null;
+                            });
+                    dianZhongMapper.updateTaskDownloaded(taskId);
+                    log.info("下载点众数据成功 taskId:{}, clientId:{}, type:{}", taskId, clientId, type);
+                } catch (Exception e) {
+                    log.error("下载点众数据失败 taskId:{}, clientId:{}, type:{}", taskId, clientId, type, e);
+                }
+
             }
         }
     }