|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
+import cn.com.ctop.common.utils.DateUtils;
|
|
|
import cn.com.ctop.crawler.modules.account.entity.KuaishouAdAccount;
|
|
|
import cn.com.ctop.crawler.modules.account.service.IKuaishouAdAccountService;
|
|
|
import cn.com.ctop.kuaishou.modules.app.entity.AppAd;
|
|
@@ -20,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -35,6 +38,57 @@ public class AdCoverController {
|
|
|
private IKuaishouAdAccountService kuaishouAdAccountService;
|
|
|
@Autowired
|
|
|
private ISysCategoryService sysCategoryService;
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "/summary/today", method = RequestMethod.GET)
|
|
|
+ public Result<Map<String, Object>> getTodaySummary() {
|
|
|
+ Result<Map<String, Object>> result = new Result<Map<String, Object>>();
|
|
|
+ QueryWrapper<AppAd> appAdWrapper = new QueryWrapper<AppAd>();
|
|
|
+ QueryWrapper<AppVideo> appVideoWrapper = new QueryWrapper<AppVideo>();
|
|
|
+ QueryWrapper<KuaishouAdAccount> advertiserWrapper = new QueryWrapper<KuaishouAdAccount>();
|
|
|
+ QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String now = sdf.format(new Date());
|
|
|
+ String startDate = now + " 00:00:00";
|
|
|
+ String endDate = now + " 23:59:59";
|
|
|
+ appAdWrapper.between("time", startDate, endDate);
|
|
|
+ appVideoWrapper.between("time", startDate, endDate);
|
|
|
+ advertiserWrapper.between("create_time", startDate, endDate);
|
|
|
+ productWrapper.between("create_time", startDate, endDate);
|
|
|
+ productWrapper.groupBy("product");
|
|
|
+ int appAdCount = appAdService.count(appAdWrapper);
|
|
|
+ int appVideoCount = appVideoService.count(appVideoWrapper);
|
|
|
+ int advertiserCount = kuaishouAdAccountService.count(advertiserWrapper);
|
|
|
+ int productCount = kuaishouAdAccountService.count(productWrapper);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("adCount", appAdCount);
|
|
|
+ map.put("videoCount", appVideoCount);
|
|
|
+ map.put("advertiserCount", advertiserCount);
|
|
|
+ map.put("productCount", productCount);
|
|
|
+ result.setResult(map);
|
|
|
+ result.setSuccess(true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "/summary/all", method = RequestMethod.GET)
|
|
|
+ public Result<Map<String, Object>> getAllSummary() {
|
|
|
+ Result<Map<String, Object>> result = new Result<Map<String, Object>>();
|
|
|
+ QueryWrapper<KuaishouAdAccount> productWrapper = new QueryWrapper<KuaishouAdAccount>();
|
|
|
+ productWrapper.groupBy("product");
|
|
|
+ int appAdCount = appAdService.count();
|
|
|
+ int appVideoCount = appVideoService.count();
|
|
|
+ int advertiserCount = kuaishouAdAccountService.count();
|
|
|
+ int productCount = kuaishouAdAccountService.count(productWrapper);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("adCount", appAdCount);
|
|
|
+ map.put("videoCount", appVideoCount);
|
|
|
+ map.put("advertiserCount", advertiserCount);
|
|
|
+ map.put("productCount", productCount);
|
|
|
+ result.setResult(map);
|
|
|
+ result.setSuccess(true);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value="/feeds", method = RequestMethod.GET)
|
|
|
public Result<List<AppAd>> getVideoList(HttpServletRequest req){
|