浏览代码

按照项目进行数据重跑

yumeng 4 年之前
父节点
当前提交
9e78a5dc4b

+ 35 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -69,12 +69,47 @@ public class TestController {
     private IBytedanceReportService bytedanceReportService;
     @Autowired
     private IKuaishouInterfaceService2 kuaishouInterfaceService2;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
 
 
+    @GetMapping(value = "/getDailyDataByProjectId")
+    public String getDailyDataByProjectId(Long projectId, String startDate, String endDate) {
+        Result<String> result = new Result<>();
+        try {
+
+            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+            userAllocationQueryWrapper.eq("project_id", projectId);
+            userAllocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
+            if (!Check.isNull(list)) {
+                for (UserAllocation allocation : list) {
+                    Long accountId = allocation.getAccountId();
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("media_id", 2);
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    if (!Check.isNull(ctopOauthTokens)) {
+                        historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
+
+                    }
+                }
+
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+        return "success";
+    }
+
+
     @GetMapping(value = "/getDailyDataByAccountId")
     public String getDailyDataByAccountId(Long accountId) {
         Result<String> result = new Result<>();
@@ -617,9 +652,6 @@ public class TestController {
     }
 
 
-    @Autowired
-    private IUserAllocationService userAllocationService;
-
     @GetMapping(value = "/getPlanAndGroupByAccount")
     public void getPlanAndGroupByAccount(Long accountId) {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();

+ 1 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -16,7 +16,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +92,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                             JSONObject dataJson = resultJson.getJSONObject("data");
                             KuaiShouDailyReportTask dailyReportTask = new KuaiShouDailyReportTask();
                             dailyReportTask.setAccountId(accountId);
-                            dailyReportTask.setStatDate(startDate);
+                            dailyReportTask.setStatDate(endDate);
                             dailyReportTask.setTaskId(dataJson.getString("task_id"));
                             dailyReportTask.setViewType(type);
                             dailyReportTask.setTaskStatus(0);