|
|
@@ -0,0 +1,56 @@
|
|
|
+package cn.com.ctop.job.kuaishou.controller;
|
|
|
+
|
|
|
+import cn.com.ctop.job.kuaishou.data.service.IKuaiShouAccountReportService;
|
|
|
+import cn.com.ctop.job.kuaishou.data.service.IKuaiShouGroupReportService;
|
|
|
+import cn.com.ctop.job.kuaishou.data.utils.Check;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * zian Y
|
|
|
+ * 2022/2/9
|
|
|
+ **/
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/history")
|
|
|
+@Api(tags = "kuaishou")
|
|
|
+@Slf4j
|
|
|
+public class HistoryController {
|
|
|
+ private static ExecutorService dailyExecutorService = Executors.newFixedThreadPool(5);
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouAccountReportService kuaiShouAccountReportService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouGroupReportService groupReportService;
|
|
|
+
|
|
|
+ @GetMapping("/getData")
|
|
|
+ public JSONObject getData(Long advertiserId, String startDate, String endDate) {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ dailyExecutorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+
|
|
|
+ String token = kuaiShouAccountReportService.getTokenByAdvertiserId(advertiserId);
|
|
|
+ if (Check.isNull(token)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ kuaiShouAccountReportService.queryAccountReportDaily(token, advertiserId, startDate, endDate, 1);
|
|
|
+ groupReportService.queryGroupReportDaily(token, advertiserId, startDate, endDate, 1);
|
|
|
+ kuaiShouAccountReportService.queryAccountDailyFlows(token, advertiserId, startDate, endDate, 1, 1, null, 2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ json.put("code", 200);
|
|
|
+ json.put("message", "成功");
|
|
|
+ return json;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|