Ver código fonte

Merge remote-tracking branch 'origin/master'

syh 4 anos atrás
pai
commit
ab10fc43b4
41 arquivos alterados com 496 adições e 192 exclusões
  1. 6 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  2. 0 1
      jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java
  3. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  4. 3 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  5. 5 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  6. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/message/handle/impl/EmailSendMsgHandle.java
  7. 10 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java
  8. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  9. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java
  10. 0 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java
  11. 0 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyPlayableReportRetryJob.java
  12. 126 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  13. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java
  14. 39 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  15. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java
  16. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java
  17. 15 3
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  18. 4 3
      module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatCheckinDataController.java
  19. 0 9
      module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinData.java
  20. 23 0
      module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinSubData.java
  21. 2 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatCheckinDataMapper.java
  22. 1 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatCheckinDataMapper.xml
  23. 2 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatCheckinDataService.java
  24. 4 3
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatCheckinDataServiceImpl.java
  25. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/controller/CtopAdlabProjectDetailController.java
  26. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/entity/CtopAdlabProjectDetail.java
  27. 9 9
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java
  28. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java
  29. 0 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java
  30. 88 13
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  31. 13 15
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java
  32. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java
  33. 23 74
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  34. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java
  35. 0 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java
  36. 4 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java
  37. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  38. 12 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java
  39. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ParseInstallPackageController.java
  40. 23 11
      module-toutiao/src/main/resources/json_template/bytedance_video_report_mapping.json
  41. 6 1
      pom.xml

+ 6 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -20,7 +20,6 @@ public class AccountReportConstants {
     /** 单体实例 */
     private static AccountReportConstants instance;
 
-
     /**
      * @return 返回 instance
      */
@@ -35,10 +34,11 @@ public class AccountReportConstants {
      * 字典数据
      */
     //头条字段映射
-    public static Map<String, Map<String,Object>> dicMap = new HashMap<>();
+    public static Map<String, Map<String,Object>> dicMapBy = new HashMap<>();
     //快手字段映射
     public static Map<String, Map<String,Object>> dicMapKs = new HashMap<>();
-
+    //头条视频报表字段映射
+    public static Map<String, Map<String,Object>> dicMapByVideo= new HashMap<>();
     /**
      * 初始化字典
      */
@@ -46,9 +46,10 @@ public class AccountReportConstants {
         //加载json文件
         Object jsonBy=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
         Object jsonKs=JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
+        Object jsonByVideo=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
         //json 转为map存为静态常量
-        dicMap=JsonResourceUtil.jsonToMap(jsonBy);
+        dicMapBy=JsonResourceUtil.jsonToMap(jsonBy);
         dicMapKs=JsonResourceUtil.jsonToMap(jsonKs);
+        dicMapByVideo=JsonResourceUtil.jsonToMap(jsonByVideo);
     }
-
 }

+ 0 - 1
jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java

@@ -95,7 +95,6 @@ public class ActivitiProcessController {
                 }
                 return false;
             }).collect(Collectors.toList());
-
         }
         if(null!=list&&!list.isEmpty()){
             List<ActZprocess> getList = new ArrayList<>();

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

@@ -133,7 +133,7 @@ public class TestController {
 
         List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
 
-        while (list != null) {
+        while (list != null && list.size() > 0) {
             for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                 MusicInfo musicInfo = new MusicInfo();
                 musicInfo.setExtId(crawlerDouyinMusicTask.getId());
@@ -157,7 +157,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "init").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【同步歌曲】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             MusicInfo musicInfo = new MusicInfo();
@@ -184,7 +184,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "done").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【解析分类】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             QueryWrapper<MusicInfo> queryWrapper1 = new QueryWrapper<>();

+ 3 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -16,6 +16,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: 10MB

+ 5 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -13,6 +13,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: -1
@@ -122,7 +125,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-  # configuration:
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   #  map-underscore-to-camel-case: false
   #分页pageHelper
 pagehelper:

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/message/handle/impl/EmailSendMsgHandle.java

@@ -34,6 +34,7 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
             helper.setSubject(es_title);
             helper.setText(es_content, true);
             mailSender.send(message);
+
         } catch (MessagingException e) {
             e.printStackTrace();
         }

+ 10 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java

@@ -112,6 +112,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
             crawlerDouyinMusicTask.setStatus("parsed");
             crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
         }catch (Exception e){
+            CrawlerDouyinMusicTask crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusicTask.setId(musicInfo.getExtId());
+            crawlerDouyinMusicTask.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
             e.printStackTrace();
         }
     }
@@ -153,7 +157,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                     for (int i = 0; i < size; i++){
                         CrawlerDouyinMusicTask crawlerDouyinMusicTask = crawlerDouyinMusicTaskService.getById(dataNode.get(i).asLong());
                         if(crawlerDouyinMusicTask == null){
-                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask(); 
+                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
                             crawlerDouyinMusicTask.setId(dataNode.get(i).asLong());
                             crawlerDouyinMusicTask.setStatus("init");
                             crawlerDouyinMusicTaskService.replaceInto(crawlerDouyinMusicTask);
@@ -162,6 +166,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                 }
             }
         } catch (IOException e) {
+            CrawlerDouyinMusicTask crawlerDouyinMusic = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusic.setId(musicInfo.getExtId());
+            crawlerDouyinMusic.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusic);
             e.printStackTrace();
         }
         return musicInfo;
@@ -169,7 +177,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
     public static void main(String[] args){
         DouyinMusicServiceImpl douyinMusicService = new DouyinMusicServiceImpl();
         MusicInfo musicInfo = new MusicInfo();
-        musicInfo.setExtId(6705193173741733889L);
+        musicInfo.setExtId(12646L);
         douyinMusicService.getMusicInfo(musicInfo);
     }
 }

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -58,7 +58,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/bybt0916.csv");
+            PrintStream out = new PrintStream("D:/bybt0929.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java

@@ -57,7 +57,7 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/tttm0831.csv");
+            PrintStream out = new PrintStream("D:/tttm0903.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 0 - 5
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java

@@ -2,21 +2,16 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
 import org.jeecg.common.util.DateUtils;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;

+ 0 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyPlayableReportRetryJob.java

@@ -2,11 +2,8 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportPlayableRetry;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

+ 126 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -0,0 +1,126 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by JQ.bi on 2020.09.27
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/kuaishou/videoReport")
+public class KsVideoReportCtrl {
+
+    @Autowired
+    IKsVideoReportService ksVideoReportService;
+
+    @PostMapping("/list")
+    public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            result.setSuccess(false);
+        } else {
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+            String target = requestBody.getString("target");
+            String order = requestBody.getString("order");
+            int pageSize= requestBody.getInteger("pageSize");
+            int pageNo= requestBody.getInteger("pageNo");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
+
+            try {
+                if(accountIds.isEmpty()){
+                    accountIds=null;
+                }
+                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/report/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        JSONArray columns=requestBody.getJSONArray("columns");
+        if(columns.isEmpty()){
+            log.error("请选择需要导出的字段");
+        }
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs,columns);
+        List<String> titles= new ArrayList<>();
+        titles.add("视频");
+        titles.add("视频名称");
+        titles.add("项目名称");
+        titles.add("上传时间");
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs,columns));
+        //此处增加两个元素是为了保证数据顺序
+        columns.add(0,"url");
+        columns.add(1,"materialName");
+        columns.add(2,"projectName");
+        columns.add(3,"createTime");
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        if(accountIds.isEmpty()){
+            accountIds=null;
+        }
+        String startDate = requestBody.getString("startDate");
+        String endDate = requestBody.getString("endDate");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        List<JSONObject> excelData= ksVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
+        if(excelData.isEmpty()){
+            return;
+        }
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            columns.forEach(k->{
+                temp.add(data.get(k.toString()));
+            });
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "快手视频报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "快手视频报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
+        }
+    }
+
+}

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface KsVideoReportMapper {
+
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("target") String target, @Param("order") String order);
+
+}

+ 39 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper">
+
+    <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.signature,
+        t2.url,
+        t2.cover_url AS coverUrl,
+        t2.material_name materialName,
+        (
+        SELECT
+        project_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id
+        ) AS projectName,
+        t2.create_time AS createTime,
+        ${filed}
+        FROM
+        ctop_kuaishou_report_daily_material t1
+        LEFT JOIN ctop_material_info t2 ON t1.signature = t2. CODE
+        LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
+        WHERE
+        t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        <if test="accountIds != null">
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        </if>
+        AND t2.url!=""
+        GROUP BY t1.signature
+        ORDER BY ${target} ${order}
+    </select>
+</mapper>

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+
+public interface IKsVideoReportService {
+
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, int pageSize, int pageNo);
+
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
+}

+ 32 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
+import cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class KsVideoReportServiceImpl implements IKsVideoReportService {
+
+    @Autowired
+    KsVideoReportMapper ksVideoReportMapper;
+
+    @Override
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<JSONObject> jsonObjectList=ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        return new PageInfo<>(jsonObjectList);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order) {
+        return ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+    }
+
+}

+ 15 - 3
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -148,8 +148,20 @@
     "comment": "表单提交率"
   },
   "formCountCost": {
-    "filed": "CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as eventCreditGrantAppCost ",
-    "comment": "授信成本"
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as formCountCost ",
+    "comment": "表单提交成本"
+  },
+  "nextDayOpen": {
+    "filed": "sum(t1.event_next_day_stay) as nextDayOpen ",
+    "comment": "次留数"
+  },
+  "nextDayOpenCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_next_day_stay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_next_day_stay),3) end as nextDayOpenCost ",
+    "comment": "次留成本"
+  },
+  "nextDayOpenRate": {
+    "filed": "CASE WHEN sum(t1.event_next_day_stay) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.bclick)*100,2),'%') end as nextDayOpenRate ",
+    "comment": "次留率"
   },
   "eventJinJianLandingPage": {
     "filed": "sum(t1.event_jin_jian_landing_page) as eventJinJianLandingPage ",
@@ -168,7 +180,7 @@
     "comment": "落地页授信成本"
   },
   "eventCreditGrantLandingPageRate": {
-    "filed": "CASE WHEN sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') end as formCountRate ",
+    "filed": "CASE WHEN sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') end as eventCreditGrantLandingPageRate ",
     "comment": "落地页授信率"
   },
   "submit": {

+ 4 - 3
module-oa/src/main/java/cn/com/ctop/oa/modules/controller/WechatCheckinDataController.java

@@ -3,6 +3,7 @@ package cn.com.ctop.oa.modules.controller;
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
+import cn.com.ctop.oa.modules.entity.WechatCheckinSubData;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -68,10 +69,10 @@ public class WechatCheckinDataController {
     @AutoLog(value = "考勤打卡明细-分页列表查询")
     @ApiOperation(value = "考勤打卡明细-分页列表查询", notes = "考勤打卡明细-分页列表查询")
     @PostMapping(value = "/queryPageList")
-    public Result<PageInfo<WechatCheckinData>> queryPageList(@RequestBody Map<String, Object> paramsMap) {
-        Result<PageInfo<WechatCheckinData>> result = new Result<>();
+    public Result<PageInfo<WechatCheckinSubData>> queryPageList(@RequestBody Map<String, Object> paramsMap) {
+        Result<PageInfo<WechatCheckinSubData>> result = new Result<>();
         try {
-            PageInfo<WechatCheckinData> pageData = wechatCheckinDataService.selectPageList(paramsMap);
+            PageInfo<WechatCheckinSubData> pageData = wechatCheckinDataService.selectPageList(paramsMap);
             if (!Check.isNull(pageData)) {
                 result.setResult(pageData);
                 result.setSuccess(true);

+ 0 - 9
module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinData.java

@@ -137,13 +137,4 @@ public class WechatCheckinData {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
-
-    /**
-     * 员工名
-     */
-    private String userName;
-    /**
-     * 部门名
-     */
-    private String departName;
 }

+ 23 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/entity/WechatCheckinSubData.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.oa.modules.entity;
+
+import lombok.Data;
+
+/**
+ * 企业微信用户
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-09-15
+ */
+@Data
+public class WechatCheckinSubData extends WechatCheckinData {
+
+    /**
+     * 员工名
+     */
+    private String userName;
+    /**
+     * 部门名
+     */
+    private String departName;
+}

+ 2 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/WechatCheckinDataMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.oa.modules.mapper;
 
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
+import cn.com.ctop.oa.modules.entity.WechatCheckinSubData;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import java.util.List;
@@ -17,5 +18,5 @@ public interface WechatCheckinDataMapper extends BaseMapper<WechatCheckinData> {
 
     WechatCheckinData queryEntityByMap(Map<String, Object> paramsMap);
 
-    List<WechatCheckinData> selectPageList(Map<String, Object> paramsMap);
+    List<WechatCheckinSubData> selectPageList(Map<String, Object> paramsMap);
 }

+ 1 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/mapper/xml/WechatCheckinDataMapper.xml

@@ -22,7 +22,7 @@
     </select>
 
 
-    <select id="selectPageList" resultType="cn.com.ctop.oa.modules.entity.WechatCheckinData">
+    <select id="selectPageList" resultType="cn.com.ctop.oa.modules.entity.WechatCheckinSubData">
         SELECT
         ck.id,
         ck.depart_id,

+ 2 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IWechatCheckinDataService.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.oa.modules.service;
 
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
+import cn.com.ctop.oa.modules.entity.WechatCheckinSubData;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.github.pagehelper.PageInfo;
 
@@ -15,5 +16,5 @@ import java.util.Map;
 public interface IWechatCheckinDataService extends IService<WechatCheckinData> {
     void getCheckinData(String starttime, String endtime);
 
-    PageInfo<WechatCheckinData> selectPageList(Map<String, Object> paramsMap);
+    PageInfo<WechatCheckinSubData> selectPageList(Map<String, Object> paramsMap);
 }

+ 4 - 3
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatCheckinDataServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.oa.modules.constant.QYWxConstant;
 import cn.com.ctop.oa.modules.entity.WechatCheckinData;
+import cn.com.ctop.oa.modules.entity.WechatCheckinSubData;
 import cn.com.ctop.oa.modules.entity.WechatUserList;
 import cn.com.ctop.oa.modules.mapper.WechatCheckinDataMapper;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
@@ -119,7 +120,7 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
                         }
                     }
                 } else {
-                    log.error("获取打卡数据异常");
+                    log.error("获取打卡数据异常,数据-> {}",resultJson);
                 }
             }
         } catch (Exception e) {
@@ -128,7 +129,7 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
     }
 
     @Override
-    public PageInfo<WechatCheckinData> selectPageList(Map<String, Object> paramsMap) {
+    public PageInfo<WechatCheckinSubData> selectPageList(Map<String, Object> paramsMap) {
         Integer pageNo = (Integer) paramsMap.get(PAGE_NO);
         if (null == pageNo || pageNo == 0) {
             pageNo = 1;
@@ -148,7 +149,7 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
             paramsMap.put(STOP_TIME, stopTime);
         }
         PageHelper.startPage(pageNo, pageSize);
-        List<WechatCheckinData> list = wechatCheckinDataMapper.selectPageList(paramsMap);
+        List<WechatCheckinSubData> list = wechatCheckinDataMapper.selectPageList(paramsMap);
         return new PageInfo<>(list);
     }
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/controller/CtopAdlabProjectDetailController.java

@@ -61,8 +61,8 @@ public class CtopAdlabProjectDetailController {
             queryWrapper.eq("opt_status", requestBody.getString("optStatus"));
         }
         if (!requestBody.getJSONArray("createTime").isEmpty()) {
-            queryWrapper.ge("create_time", requestBody.getJSONArray("createTime").get(0).toString());
-            queryWrapper.le("create_time", requestBody.getJSONArray("createTime").get(1).toString());
+            queryWrapper.ge("create_time", requestBody.getJSONArray("createTime").get(0));
+            queryWrapper.le("create_time", requestBody.getJSONArray("createTime").get(1));
         }
         Page<CtopAdlabProjectDetail> page = new Page<>(pageNo, pageSize);
         IPage<CtopAdlabProjectDetail> pageList = ctopAdlabProjectDetailService.page(page, queryWrapper);

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/entity/CtopAdlabProjectDetail.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.adlab.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -21,6 +22,7 @@ public class CtopAdlabProjectDetail {
 	/**userId*/
 	private String userId;
 	/**accountId*/
+	@Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
 	private Long accountId;
 	/**campaignId*/
 	private Long campaignId;

+ 9 - 9
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

@@ -46,8 +46,8 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按天汇总", notes = "头条视频按天汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoList")
 	 public Result bytedanceVideoInfoList(@RequestParam(name = "startDate") String startDate,
-										 @RequestParam(name = "endDate") String endDate,
-										 HttpServletRequest req){
+                                          @RequestParam(name = "endDate") String endDate,
+                                          HttpServletRequest req){
 		 Result result = new Result();
 		 int days = DateUtils.dateDiff(startDate, endDate);
 		 List<String> dateList = new ArrayList<>();
@@ -81,9 +81,9 @@ public class ByteDanceVideoReportDailyController {
 	@ApiOperation(value = "头条视频单个账户按天汇总", notes = "头条视频单个账户按天汇总")
 	@GetMapping(value = "/videoInfoListByAccountId")
 	public Result videoInfoListByAccountId(@RequestParam(name = "startDate") String startDate,
-										 @RequestParam(name = "endDate") String endDate,
-										   @RequestParam(name = "accountId") Long accountId,
-										 HttpServletRequest req){
+                                           @RequestParam(name = "endDate") String endDate,
+                                           @RequestParam(name = "accountId") Long accountId,
+                                           HttpServletRequest req){
 		Result result = new Result();
 		int days = DateUtils.dateDiff(startDate, endDate);
 		List<String> dateList = new ArrayList<>();
@@ -144,7 +144,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按周汇总", notes = "头条视频按周汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListWeek")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoListWeek(@RequestBody DateDTO dateDTO,
-																		   HttpServletRequest req){
+                                                                                   HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 
 		 Integer pageNo = dateDTO.getPageNo();
@@ -166,7 +166,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频汇总", notes = "头条视频汇总")
 	 @PostMapping(value = "/videoInfoListTotal")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> videoInfoListTotal(@RequestBody DateDTO dateDTO,
-																		HttpServletRequest req){
+                                                                           HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 		 Integer pageNo = dateDTO.getPageNo();
 		 Integer pageSize = dateDTO.getPageSize();
@@ -186,7 +186,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按月汇总", notes = "头条视频按月汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListMonth")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoListMonth(@RequestBody DateDTO dateDTO,
-																			   HttpServletRequest req){
+                                                                                    HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 
 		 if(StringUtils.isBlank(dateDTO.getSignature())){
@@ -210,7 +210,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按天明细", notes = "头条视频按天明细")
 	 @PostMapping(value = "/bytedanceVideoInfoListDetail")
 	 public Result<List<ByteDanceVideoReportDaily>> bytedanceVideoInfoListDetail(@RequestBody DateDTO dateDTO,
-																		   HttpServletRequest req){
+                                                                                 HttpServletRequest req){
 		 Result<List<ByteDanceVideoReportDaily>> result = new Result();
 		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListDetail(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getAccountIds());
 		 result.setResult(list);

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java

@@ -114,11 +114,11 @@ public class BytedanceAccountReportCtrl {
         if(columns.isEmpty()){
             log.error("请选择需要导出的字段");
         }
-        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMap,columns);
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapBy,columns);
         List<String> titles= new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMap,columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapBy,columns));
         //此处增加两个元素是为了保证数据有序
         columns.add(0,"accountId");
         columns.add(1,"authName");

+ 0 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java

@@ -2,10 +2,7 @@ package cn.com.ctop.toutiao.modules.report.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportPlayableRetry;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import lombok.extern.slf4j.Slf4j;
@@ -35,8 +32,6 @@ public class BytedanceInterfaceController {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
-    @Autowired
     private IBytedanceInterfaceService bytedanceInterfaceService;
 
 
@@ -183,7 +178,4 @@ public class BytedanceInterfaceController {
         return result;
     }
 
-
-
-
 }

+ 88 - 13
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -1,20 +1,31 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
- *  Created by JQ.bi on 2020.09.21
+ * Created by JQ.bi on 2020.09.21
  */
 @Slf4j
 @RestController
@@ -25,27 +36,91 @@ public class BytedanceVideoReportCtrl {
     IBytedanceVideoReportService bytedanceVideoReportService;
 
     @PostMapping("/list")
-    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+    public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
 
-        Result<List<JSONObject>> result = new Result<>();
+        Result<PageInfo<JSONObject>> result = new Result<>();
         if (requestBody.isEmpty()) {
             log.error("request body is empty");
             result.setSuccess(false);
+        } else {
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+            String target = requestBody.getString("target");
+            String order = requestBody.getString("order");
+            int pageSize= requestBody.getInteger("pageSize");
+            int pageNo= requestBody.getInteger("pageNo");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
+
+            try {
+                if(accountIds.isEmpty()){
+                    accountIds=null;
+                }
+                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/report/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        JSONArray columns=requestBody.getJSONArray("columns");
+        if(columns.isEmpty()){
+            log.error("请选择需要导出的字段");
         }
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo,columns);
+        List<String> titles= new ArrayList<>();
+        titles.add("视频");
+        titles.add("视频名称");
+        titles.add("项目名称");
+        titles.add("上传时间");
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo,columns));
+        //此处增加两个元素是为了保证数据顺序
+        columns.add(0,"url");
+        columns.add(1,"materialName");
+        columns.add(2,"projectName");
+        columns.add(3,"createTime");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        if(accountIds.isEmpty()){
+            accountIds=null;
+        }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
-        try {
-            List<JSONObject> listData= null;
-            result.setResult(listData);
-            result.setSuccess(true);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.setSuccess(false);
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        List<JSONObject> excelData= bytedanceVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
+        if(excelData.isEmpty()){
+            return;
+        }
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            columns.forEach(k->{
+                temp.add(data.get(k.toString()));
+            });
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "头条视频报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "头条视频报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
         }
-        return result;
     }
 
 }

+ 13 - 15
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java

@@ -17,16 +17,14 @@ import java.util.List;
  */
 public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVideoReportDaily> {
 
-    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId")Long accountId);
+    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId") Long accountId);
 
-    String getCompanyIdByAccountId(@Param("accountId")Long accountId);
+    String getCompanyIdByAccountId(@Param("accountId") Long accountId);
 
-    BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds")List<Long> accountIds);
+    BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);
 
     void updateHuanbiByDateAndSignature(@Param("date") Date date, @Param("signature") String signature, @Param("huanbi") BigDecimal huanbi);
 
-    List<ByteDanceVideoReportDaily> videoInfoListWeek(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("role") String role, @Param("userId") String userId, @Param("signature") String signature, @Param("companyId") String companyId, @Param("cost") BigDecimal cost);
-
     String getRoleCodeByUserId(@Param("userId") String userId);
 
     String getCompanyIdByUserId(@Param("userId") String userId);
@@ -47,36 +45,36 @@ public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVid
 
     List<AccountVideoDTO> accountVideoMap();
 
-    void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList")List<AccountVideoDTO> accountVideoDTOList);
+    void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList") List<AccountVideoDTO> accountVideoDTOList);
 
     //admin角色查询视频报表
     List<ByteDanceVideoReportDaily> videoInfoListGroupAdmin(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //teamLeader角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupdesignTeamLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupdesignTeamLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //平面设计角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupPlaneAndPlaneLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupPlaneAndPlaneLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //编导角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupPlan(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupPlan(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //剪辑角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupClip(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupClip(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //拍摄
-    List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //运营
     List<ByteDanceVideoReportDaily> videoInfoListGroupOperator(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     List<ByteDanceVideoReportDaily> videoInfoListGroupOtherRoles(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
-    List<Long> getAccountIdByprojectIds(@Param("projectIds")List<Long> projectIds);
+    List<Long> getAccountIdByprojectIds(@Param("projectIds") List<Long> projectIds);
 
-    List<Long> getAccountIdsByOperatorIdAndMediaId(@Param("userId")String userId);
+    List<Long> getAccountIdsByOperatorIdAndMediaId(@Param("userId") String userId);
 
-    List<Long> getAccountIds(@Param("companyId")String companyId, @Param("signature")String signature);
+    List<Long> getAccountIds(@Param("companyId") String companyId, @Param("signature") String signature);
 
-    List<Long> getAccountIdsByUserIdAndMediaIds(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<Long> getAccountIdsByUserIdAndMediaIds(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 }

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java

@@ -8,5 +8,6 @@ import java.util.List;
 
 public interface BytedanceVideoReportMapper {
 
-    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("accountIds") String startDate,@Param("accountIds") String endDate,@Param("accountIds") String target,@Param("accountIds") String order);
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("target") String target,@Param("order") String order);
+
 }

+ 23 - 74
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -1,90 +1,39 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceAccountReportMapper">
+<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceVideoReportMapper">
 
-    <select id="queryTodayReportByAccount" resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            ROUND(sum(cost),2) cost,
-            sum(show_num) showNum,
-            sum(click) click,
-            sum(convert_num) as convertNum
-        FROM
-            ctop_bytedance_report_advertiser_daily
-        WHERE
-            stat_datetime = #{statDate} '00:00:00'
-          AND advertiser_id= #{accountId}
-    </select>
-
-    <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        t2.account_id as accountId,
-        t2.auth_name as authName,
-        ${filed}
-        FROM ctop_bytedance_report_advertiser_hourly t1
-        left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
-        WHERE t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-        group by t1.advertiser_id
-        order by ${target} ${order}
-    </select>
-
-    <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
+        t1.signature,
+        t2.url,
+        t2.cover_url as converUrl,
+        t2.material_name AS materialName,
+        (
         SELECT
-        ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) as convertNum
+        project_name
         FROM
-        ctop_bytedance_report_advertiser_hourly
+        ctop_project t4
         WHERE
-        stat_datetime = #{statDate}
-        and stat_hour &lt;= #{hour}
-        AND advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-    </select>
-
-    <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        t4.id = t3.project_id
+        ) AS projectName,
+        t2.create_time as createTime,
         ${filed}
         FROM
-        ctop_bytedance_report_advertiser_hourly t1
-        WHERE
-        t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-    </select>
-
-    <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) as convertNum,
-        stat_hour as statHour
-        FROM
-        ctop_bytedance_report_advertiser_hourly
+        ctop_bytedance_video_report_daily t1
+        left join ctop_material_info t2 on t1.signature=t2.code
+        LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE
-        stat_datetime = #{statDate}
-        AND advertiser_id in
+        t1.stat_datetime >= #{startDate}
+        AND t1.stat_datetime &lt;= #{endDate}
+        <if test="accountIds != null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        GROUP BY
-        stat_hour
-        ORDER BY
-        stat_hour ASC
+        </if>
+        AND t2.url!=""
+        GROUP BY t1.signature
+        ORDER BY ${target} ${order}
     </select>
 </mapper>

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java

@@ -25,7 +25,7 @@ public interface IByteDanceVideoReportDailyService extends IService<ByteDanceVid
 
     List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost, Long[] accountIds, String sort);
 
-    PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds,String sort);
+    PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort);
 
     List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds);
 

+ 0 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -20,11 +20,8 @@ public interface IBytedanceAccountReportService {
 
     List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
 
-    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList);
-
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort, Integer yn);
 
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort, Integer yn);
 
-    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, Long projectId, int pageNum, int pageSize, String sort);
 }

+ 4 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java

@@ -1,12 +1,14 @@
 package cn.com.ctop.toutiao.modules.report.service;
 
 import com.alibaba.fastjson.JSONArray;
-import netscape.javascript.JSObject;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
 public interface IBytedanceVideoReportService {
 
-    List<JSObject>  getVideoReportBy(JSONArray accountIds,String startDate,String endDate,String target,String order);
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo);
 
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -66,7 +66,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
         List<JSONObject> result=new ArrayList<>();
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapBy);
         if (startDate.equals(endDate)) {
             List<JSONObject> after = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
             List<JSONObject> before = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
@@ -99,7 +99,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapBy);
         if (startDate.equals(endDate)) {
             result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
             JSONObject afterSum = bytedanceAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);

+ 12 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java

@@ -3,7 +3,9 @@ package cn.com.ctop.toutiao.modules.report.service.impl;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceVideoReportMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoReportService;
 import com.alibaba.fastjson.JSONArray;
-import netscape.javascript.JSObject;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -16,8 +18,15 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
     BytedanceVideoReportMapper bytedanceVideoReportMapper;
 
     @Override
-    public List<JSObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String target, String order) {
-        return null;
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        return new PageInfo<>(jsonObjectList);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order) {
+        return bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
     }
 
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ParseInstallPackageController.java

@@ -30,8 +30,8 @@ public class ParseInstallPackageController {
                                                           @RequestParam String appType) {
         Result<Map<String, String>> result = new Result<>();
         //在此不需要判断安装包类型拼接后缀
-        //String installPath="C:\\Users\\Arc\\Desktop\\install"+System.currentTimeMillis();
-        String installPath="/data/webpackage/install"+System.currentTimeMillis();
+        String installPath="C:\\Users\\Arc\\Desktop\\install"+System.currentTimeMillis();
+        //String installPath="/data/webpackage/install"+System.currentTimeMillis();
         byte[] bytes = restTemplate.postForObject(installUrl, null, byte[].class);
         if (null == bytes || bytes.length == 0) {
             result.error500("请输入正确的下载链接");

+ 23 - 11
module-toutiao/src/main/resources/json_template/bytedance_video_report_mapping.json

@@ -4,11 +4,11 @@
     "comment": "消耗"
   },
   "showMaterial": {
-    "filed": "sum(t1.show_num) as showMaterial ",
+    "filed": "sum(t1.show_material) as showMaterial ",
     "comment": "展示数"
   },
   "cpm": {
-    "filed": "CASE WHEN sum(t1.cost) / sum(t1.show_num) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.show_num)) * 1000, 2 ) END AS cpm ",
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.show_material) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.show_material)) * 1000, 2 ) END AS cpm ",
     "comment": "平均千次展现费用"
   },
   "clickMaterial": {
@@ -16,7 +16,7 @@
     "comment": "点击数"
   },
   "ctr": {
-    "filed": "CASE WHEN sum(t1.click) / sum(t1.show_num) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.click) / sum(t1.show_num)) * 100,2),'%') END AS ctr ",
+    "filed": "CASE WHEN sum(t1.click) / sum(t1.show_material) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.click) / sum(t1.show_material)) * 100,2),'%') END AS ctr ",
     "comment": "点击率"
   },
   "cpc": {
@@ -24,15 +24,15 @@
     "comment": "平均点击单价"
   },
   "convertMaterial": {
-    "filed": "sum(t1.convert_num) as convertMaterial ",
+    "filed": "sum(t1.convert_material) as convertMaterial ",
     "comment": "转化数"
   },
   "convertCost": {
-    "filed": "CASE WHEN sum(t1.cost) / sum(t1.convert_num) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.convert_num)), 2 ) END AS convertCost ",
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.convert_material) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.convert_material)), 2 ) END AS convertCost ",
     "comment": "转化成本"
   },
   "convertRate": {
-    "filed": "CASE WHEN sum(t1.convert_num) / sum(t1.cost) IS NULL THEN 0 ELSE concat(round(sum(t1.convert_num) / sum(t1.cost)*100,2),'%') end AS convertRate ",
+    "filed": "CASE WHEN sum(t1.convert_material) / sum(t1.cost) IS NULL THEN 0 ELSE concat(round(sum(t1.convert_material) / sum(t1.cost)*100,2),'%') end AS convertRate ",
     "comment": "转化率"
   },
   "downloadStart": {
@@ -48,7 +48,7 @@
     "comment": "安卓开始下载率"
   },
   "downloadFinish": {
-    "filed": "sum(download_finish) as downloadFinish ",
+    "filed": "sum(t1.download_finish) as downloadFinish ",
     "comment": "安卓下载完成数"
   },
   "downloadFinishCost": {
@@ -60,7 +60,7 @@
     "comment": "安卓下载完成率"
   },
   "active": {
-    "filed": "sum(active) as active ",
+    "filed": "sum(t1.active) as active ",
     "comment": "激活数"
   },
   "activeCost": {
@@ -83,6 +83,18 @@
     "filed": " CASE WHEN sum(t1.register) / sum(t1.active) IS NULL THEN 0 ELSE concat(round(sum(t1.register) / sum(t1.active)*100,2),'%') end as activeRegisterRate ",
     "comment": "注册率"
   },
+  "gameAddiction": {
+    "filed": "sum(t1.game_addiction) as gameAddiction  ",
+    "comment": "关键行为数"
+  },
+  "gameAddictionCost": {
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.game_addiction) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.game_addiction),3) end as gameAddictionCost ",
+    "comment": "关键行为成本"
+  },
+  "gameAddictionRate": {
+    "filed": " CASE WHEN sum(t1.game_addiction) / sum(t1.active) IS NULL THEN 0 ELSE concat(round(sum(t1.game_addiction) / sum(t1.active)*100,2),'%') end as gameAddictionRate ",
+    "comment": "关键行为率"
+  },
   "nextDayOpen": {
     "filed": "sum(t1.next_day_open) as nextDayOpen ",
     "comment": "次留数"
@@ -131,12 +143,12 @@
     "filed": "sum(t1.follow) as follow ",
     "comment": "新增关注数"
   },
-  "likeMaterial": {
-    "filed": "sum(t1.like_num) as likeMaterial ",
+  "likeMaterial": { 
+    "filed": "sum(t1.like_material) as likeMaterial ",
     "comment": "点赞数"
   },
   "shareMaterial": {
-    "filed": "sum(t1.share) as shareMaterial ",
+    "filed": "sum(t1.share_material) as shareMaterial ",
     "comment": "分享数"
   }
 }

+ 6 - 1
pom.xml

@@ -295,7 +295,12 @@
             <version>2.9.2</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
         <!-- Redis -->
         <dependency>
             <groupId>org.springframework.boot</groupId>