Prechádzať zdrojové kódy

Merge branch 'V1.1.6'

yumeng 4 rokov pred
rodič
commit
50f3b79944

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -191,6 +191,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/explore/*", "anon");
         filterChainDefinitionMap.put("/ai/batchUpdate/*", "anon");
         filterChainDefinitionMap.put("/ctop/kuaishou/videoReport/*", "anon");
+        //filterChainDefinitionMap.put("/overView/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 331 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialReportOverViewController.java

@@ -0,0 +1,331 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created by JQ.bi on 2021.03.02
+ */
+@Slf4j
+@RestController
+@RequestMapping("/overView")
+public class MaterialReportOverViewController {
+
+    @Autowired
+    private IMaterialReportOverViewService materialReportOverViewService;
+
+    @Autowired
+    private MaterialReportOverViewMapper materialReportOverViewMapper;
+
+    /**
+     *  根据userId递归查询下属,默认到最后一级,返回人员参与项目集合
+     */
+    @PostMapping("/getProjects")
+    public Result<Set<JSONObject>> getProjects(@RequestParam String userId, @RequestParam int mediaId) {
+        Result<Set<JSONObject>> result = new Result<>();
+        if(userId.isEmpty()){
+            result.error500("userId is empty");
+            return result;
+        }
+        //查询所有包含自己的下级
+        Set<String> subordinates= materialReportOverViewService.recursiveQuerySubordinate(userId);
+        //查询并返回所有关联的项目
+        result.setResult(materialReportOverViewService.queryProjectBy(subordinates,mediaId));
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  根据筛选条件查询总消耗、视频总数、爆款视频、有效视频
+     */
+    @PostMapping("/sumData")
+    public Result<Map<String,Object>> sumData(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String, Object> totalModule = materialReportOverViewService.getTotalModule(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(totalModule);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  消耗数据趋势图
+     */
+    @PostMapping("/chartData")
+    public Result<List<JSONObject>> chartData(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result =new Result<>();
+        List<JSONObject> totalChat = materialReportOverViewService.getTotalChat(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(totalChat);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜
+     */
+    @PostMapping("/materialTop")
+    public Result<List<JSONObject>> materialTop(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result = new Result<>();
+        List<JSONObject> topMaterialList = materialReportOverViewService.getTopMaterialList(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(topMaterialList);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜查看更多
+     */
+    @PostMapping("/materialTopViewMore")
+    public Result<PageInfo<JSONObject>> materialTopViewMore(@RequestBody JSONObject params){
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        PageInfo<JSONObject> pageInfo = materialReportOverViewService.getTopMaterialList(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"),
+                params.getString("channelType"),
+                params.getString("md5"),
+                params.getString("target")==null?"cost":params.getString("target"),
+                params.getString("order")==null?"desc":params.getString("order"),
+                params.getInteger("pageNo"),
+                params.getInteger("pageSize")
+                );
+        result.setResult(pageInfo);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜查看更多导出报表
+     */
+    @PostMapping("/excel")
+    public void getExcelReport(@RequestBody JSONObject params,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            materialReportOverViewService.exportBytedanceExcel(params,request,response);
+        } else if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            materialReportOverViewService.exportKuaishouExcel(params,request,response);
+
+        }
+    }
+
+    /**
+     *  Top设计排行榜
+     */
+    @PostMapping("/designTop")
+    public Result<PageInfo<JSONObject>> designTop(@RequestBody JSONObject params){
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        PageInfo<JSONObject> topMaterialList = materialReportOverViewService.getTopDesignList(
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getString("userId"),
+                params.getString("target"),
+                params.getString("order"),
+                params.getInteger("pageSize"),
+                params.getInteger("pageNo"));
+        result.setResult(topMaterialList);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  标签占比饼状图
+     */
+    //TODO 需等标签库重构完
+    @PostMapping("/tagProportionAnalyse")
+    public Result<JSONObject> tagProportionAnalyse(){
+        return null;
+    }
+
+    /**
+     *  素材详情页
+     */
+    @PostMapping("/materialDetailInfo")
+    public Result<JSONObject> materialDetailInfo(@RequestBody JSONObject params){
+        Result<JSONObject> result= new Result<>();
+        result.setResult(materialReportOverViewService.getMaterialDetailInfo(params.getInteger("mediaId"),
+                params.getString("md5")));
+        result.setSuccess(true);
+        return result;
+
+    }
+
+    @PostMapping("/getProjectIdByMd5")
+    public Result<Long> getProjectIdByMd5(@RequestBody JSONObject params){
+        Result<Long> result= new Result<>();
+        if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result.setResult(materialReportOverViewMapper.queryBytedanceProjectIdByMd5(params.getString("md5")));
+        } else if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result.setResult(materialReportOverViewMapper.queryKuaishouProjectIdByMd5(params.getString("md5")));
+        }
+        result.setSuccess(true);
+        return result;
+    }
+
+    @PostMapping("/materialDetailCost")
+    public Result<Map<String,Object>> materialDetailCost(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("cost",materialReportOverViewMapper.queryBytedanceCostByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailClick")
+    public Result<Map<String,Object>> materialDetailClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("click",materialReportOverViewMapper.queryBytedanceClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailMaterialShow")
+    public Result<Map<String,Object>> materialDetailMaterialShow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("materialShow",materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPlay100Rate")
+    public Result<Map<String,Object>> materialDetailPlay100Rate(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("play100Rate",materialReportOverViewMapper.queryBytedancePlay100RateByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailLikeMaterial")
+    public Result<Map<String,Object>> materialDetailLikeMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("likeMaterial",materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailCommentMaterial")
+    public Result<Map<String,Object>> materialDetailCommentMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("commentMaterial",materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailShareMaterial")
+    public Result<Map<String,Object>> materialDetailShareMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("shareMaterial",materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailFollow")
+    public Result<Map<String,Object>> materialDetailFollow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("follow",materialReportOverViewMapper.queryBytedanceFollowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailCharge")
+    public Result<Map<String,Object>> materialDetailCharge(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("charge",materialReportOverViewMapper.queryKuaishouChargeByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPhotoShow")
+    public Result<Map<String,Object>> materialDetailPhotoShow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("photoShow",materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPhotoClick")
+    public Result<Map<String,Object>> materialDetailPhotoClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("photoClick",materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailAClick")
+    public Result<Map<String,Object>> materialDetailAClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("aclick",materialReportOverViewMapper.queryKuaishouAClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailBClick")
+    public Result<Map<String,Object>> materialDetailBClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("bclick",materialReportOverViewMapper.queryKuaishouBClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailActivation")
+    public Result<Map<String,Object>> materialDetailActivation(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("activation",materialReportOverViewMapper.queryKuaishouActivationByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPlay3sRate")
+    public Result<Map<String,Object>> materialDetailPlay3sRate(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("play3sRate",materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+
+    @PostMapping("/materialDetailChat")
+    public Result<List<JSONObject>> materialDetailChat(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result= new Result<>();
+        result.setResult(materialReportOverViewService.getMaterialDetailChat(params.getInteger("mediaId"),
+                params.getString("md5")));
+        result.setSuccess(true);
+        return result;
+    }
+}

+ 117 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialReportOverViewMapper.java

@@ -0,0 +1,117 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+public interface MaterialReportOverViewMapper {
+
+    Set<String> recursiveQuerySubordinateByLeader(@Param("leaderId") String leaderId);
+
+    Set<String> recursiveQuerySubordinateByLeaders(@Param("leaderIds") Set<String> leaderIds);
+
+    Set<String> recursiveQuerySubordinateByUserId(@Param("userId") String userId);
+
+    //查询用户参与的项目
+    Set<JSONObject> queryProjectBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);
+
+    JSONArray queryProjectIdBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);
+
+    //查询头条总消耗
+    BigDecimal queryBytedanceCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询快手总消耗
+    BigDecimal queryKuaishouCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询素材总数
+    Long queryMaterialCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询今日上新素材数
+    Long queryNewMaterialCount(@Param("statDate") String statDate, @Param("projects") JSONArray projects);
+
+    //查询头条消耗数据趋势
+    List<JSONObject> queryBytedanceChat(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    List<JSONObject> queryBytedanceChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询快手消耗数据趋势
+    List<JSONObject> queryKuaishouChat(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    List<JSONObject> queryKuaishouChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //头条素材排行榜
+    List<JSONObject> queryBytedanceTopMaterial(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查看更多
+    List<JSONObject> queryBytedanceMaterialReport(@Param("filed") String filed, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                                  @Param("md5") String md5, @Param("target") String target, @Param("order") String order);
+
+    Long queryBytedanceMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                           @Param("md5") String md5);
+
+    //快手素材排行榜
+    List<JSONObject> queryKuaishouTopMaterial(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查看更多
+    List<JSONObject> queryKuaishouMaterialReport(@Param("filed") String filed, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                                 @Param("channelType") String channelType, @Param("md5") String md5, @Param("target") String target, @Param("order") String order);
+
+    Long queryKuaishouMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                          @Param("channelType") String channelType, @Param("md5") String md5);
+
+    //设计排行榜
+    List<JSONObject> queryTopDesign(String startDate, String endDate, Set<String> userIds, String target, String order);
+
+    Long queryTopDesignCount(String startDate, String endDate, Set<String> userIds);
+
+    //素材详情页
+
+    JSONObject queryBytedanceVideoDetail(String md5);
+
+    JSONObject queryKuaishouVideoDetail(String md5);
+
+    //数据概览
+    Long queryBytedanceProjectIdByMd5(String md5);
+
+    Long queryKuaishouProjectIdByMd5(String md5);
+
+    List<JSONObject> queryBytedanceCostByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceMaterialShowByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedancePlay100RateByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceLikeMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceCommentMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceShareMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceFollowByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouChargeByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPhotoShowByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPhotoClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouAClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouBClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouActivationByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPlay3sRateByMd5(String md5, Long project);
+
+    //数据趋势
+    List<JSONObject> queryBytedanceVideoChat(String md5);
+
+    List<JSONObject> queryKuaishouVideoChat(String md5);
+
+}

+ 925 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -0,0 +1,925 @@
+<?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="org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper">
+
+    <select id="recursiveQuerySubordinateByLeader" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE leader_id = #{leaderId}
+          and status = 1
+          and del_flag = 0
+    </select>
+
+    <select id="recursiveQuerySubordinateByLeaders" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE
+        status = 1
+        and del_flag = 0
+        and leader_id in
+        <foreach collection="leaderIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="recursiveQuerySubordinateByUserId" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE leader_id = (select leader_id from sys_user where id = #{userId})
+          and status = 1
+          and del_flag = 0
+
+    </select>
+
+    <select id="queryProjectBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT DISTINCT
+        t1.project_id as projectId,
+        t1.project_name as projectName
+        FROM
+        ctop_project_member t1
+        LEFT JOIN ctop_project t2 on t1.project_id=t2.id
+        WHERE
+        t2.media_id IN
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.project_name is not null and t1.project_name!=''
+        ORDER BY t2.create_time desc
+    </select>
+
+    <select id="queryProjectIdBy" resultType="long">
+        SELECT DISTINCT
+        t1.project_id as projectId
+        FROM
+        ctop_project_member t1
+        LEFT JOIN ctop_project t2 on t1.project_id=t2.id
+        WHERE
+        t2.media_id IN
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+    </select>
+
+    <select id="queryBytedanceCost" resultType="java.math.BigDecimal">
+        SELECT
+        sum(cost)
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+    </select>
+
+    <select id="queryKuaishouCost" resultType="java.math.BigDecimal">
+        SELECT
+        sum(charge)
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+    </select>
+
+    <select id="queryMaterialCount" resultType="long">
+        SELECT
+        count(id) from ctop_material_info
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')>= #{startDate}
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')&lt;= #{endDate}
+    </select>
+
+    <select id="queryNewMaterialCount" resultType="long">
+        SELECT
+        count(id) from ctop_material_info
+        WHERE
+        DATE_FORMAT(create_time, '%Y-%m-%d')= #{statDate}
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="queryBytedanceChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(cost) as cost,
+        stat_datetime as statDate
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        group by stat_datetime
+        order by stat_datetime
+    </select>
+
+    <select id="queryBytedanceChatGroupMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(cost) as cost,
+        DATE_FORMAT(stat_datetime, '%Y-%m') as statDate
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        group by DATE_FORMAT(stat_datetime, '%Y-%m')
+        order by stat_datetime asc
+    </select>
+
+    <select id="queryKuaishouChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) as cost,
+        stat_date as statDate
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        group by stat_date
+        order by stat_date
+    </select>
+
+    <select id="queryKuaishouChatGroupMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) as cost,
+        DATE_FORMAT(stat_date, '%Y-%m') as statDate
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        group by DATE_FORMAT(stat_date, '%Y-%m')
+        order by stat_date
+    </select>
+
+    <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"塑造") as  tag
+        FROM
+        (SELECT md5 signature,
+        IFNULL(toutiao_url, '') AS url,
+        cover_url AS coverUrl,
+        material_name AS materialName,
+        sum(cost) AS cost from etl_report_bytedance_video
+        where 1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        AND md5!=''
+        GROUP BY md5
+        ORDER BY cost DESC
+        LIMIT 5) t1
+        ORDER BY cost DESC
+    </select>
+
+    <select id="queryBytedanceMaterialReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.md5 signature,
+        IFNULL(t1.toutiao_url, '') AS url,
+        t1.cover_url AS coverUrl,
+        t1.material_name AS materialName,
+        t1.project_name AS projectName,
+        t1.material_create_time AS createTime,
+        ${filed}
+        FROM
+        etl_report_bytedance_video t1
+        WHERE
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.md5= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        GROUP BY t1.md5
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryBytedanceMaterialReportCount" resultType="java.lang.Long">
+        select count(1) from(
+        SELECT
+        count(1)
+        FROM
+        etl_report_bytedance_video t1
+        WHERE
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.md5= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        GROUP BY t1.md5) t
+    </select>
+
+    <select id="queryKuaishouTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=t1.signature and status=1),"塑造") as
+        tag
+        FROM
+        (select sum(charge) as charge,signature
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ORDER BY charge desc
+        limit 5
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        ORDER BY charge desc
+    </select>
+
+    <select id="queryKuaishouMaterialReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        t2.channel_name AS channel,
+        t2.state_date as createTime
+        FROM
+        (select ${filed}
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.signature= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        where 1=1
+        <if test="channelType !=null and channelType != ''">
+            AND t2.channel_type= #{channelType}
+        </if>
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryKuaishouMaterialReportCount" resultType="java.lang.Long">
+        SELECT
+        count(1)
+        FROM
+        (select t1.signature
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.signature= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        where 1=1
+        <if test="channelType !=null and channelType != ''">
+            AND t2.channel_type= #{channelType}
+        </if>
+    </select>
+
+    <select id="queryTopDesign" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT rowNumber,
+        userName,
+        roleName,
+        cost
+        from(
+        SELECT (@i:=@i+1) AS rowNumber,
+        userName,
+        roleName,
+        cost
+        from(
+        SELECT
+        user_name AS userName,
+        role_name AS roleName,
+        sum(cost) cost
+        FROM
+        etl_design_daily_report,(SELECT @i:=0) i
+        where
+        stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        AND user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        user_id
+        ORDER BY
+        ${target} ${order}) t) t1
+    </select>
+
+    <select id="queryTopDesignCount" resultType="java.lang.Long">
+        SELECT
+        count(1)
+        FROM
+        (
+        SELECT
+        count(1)
+        FROM
+        etl_design_daily_report
+        where
+        stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        AND user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        user_id ) t
+    </select>
+
+    <select id="queryBytedanceVideoDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t.url,
+               t.cover_url                                                                           as coverUrl,
+               t.id                                                                                  as materialId,
+               t.material_name                                                                       as materialName,
+               t2.`second`,
+               '头条'                                                                                  as madia,
+               GROUP_CONCAT((SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
+               t.create_time                                                                         as createTime,
+               t2.size,
+               '内部'                                                                                  as channelType,
+               t.`code`,
+               ''                                                                                  as materialType,
+               t2.height,
+               t2.width,
+               '北京汇创思拓数字科技有限公司'                                                                      as supplier,
+               IFNULL((SELECT leader_name from sys_user where id = t1.clip_id), '')                  as leaderName,
+               IFNULL(t1.clip_name, '')                                                                 clipName,
+               IFNULL(t1.shot_name, '')                                                                 shotName,
+               IFNULL(t1.plan_name, '')                                                                 planName
+        FROM ctop_material_info t
+                 LEFT JOIN ctop_material_ascription t1 on t.`code` = t1.material_id
+                 LEFT JOIN ctop_material_parameter t2 on t.`code` = t2.material_id
+        where t.code = #{md5}
+        GROUP BY t.code
+    </select>
+
+    <select id="queryKuaishouVideoDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.url,
+               t1.cover_url                                                                           as coverUrl,
+               t.id                                                                                  as materialId,
+               t.material_name                                                                       as materialName,
+               t2.`second`,
+               '快手'                                                                                  as madia,
+               GROUP_CONCAT((SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
+               t.create_time                                                                         as createTime,
+               t2.size,
+               t1.channel_name                                                                       as channelType,
+               t1.`video_code` as 'code',
+               ''                                                                                    as materialType,
+               t2.height,
+               t2.width,
+               '北京汇创思拓数字科技有限公司'                                                                      as supplier,
+               IFNULL(t1.design_team_leader_name, '')                                                as leaderName,
+               IFNULL(t1.clip_name, '')                                                                 clipName,
+               IFNULL(t1.shot_name, '')                                                                 shotName,
+               IFNULL(t1.plan_name, '')                                                                 planName
+        FROM ctop_etl_kuaishou_video_info t1
+                 LEFT JOIN ctop_material_info t ON t.`code` = t1.video_code
+                 LEFT JOIN ctop_material_parameter t2 on t.`code` = t2.material_id
+        where t1.video_code = #{md5}
+        GROUP BY t1.video_code
+    </select>
+
+    <select id="queryBytedanceVideoChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(cost)                           AS cost,
+               DATE_FORMAT(stat_datetime, '%Y-%m') AS statDate
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        GROUP BY DATE_FORMAT(stat_datetime, '%Y-%m')
+        ORDER BY stat_datetime ASC
+    </select>
+
+    <select id="queryKuaishouVideoChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(charge)                     AS cost,
+               DATE_FORMAT(stat_date, '%Y-%m') AS statDate
+        FROM ctop_etl_kuaishou_account_material_report_daily
+        WHERE signature = #{md5}
+        GROUP BY DATE_FORMAT(stat_date, '%Y-%m')
+        ORDER BY stat_date
+    </select>
+
+    <select id="queryBytedanceProjectIdByMd5" resultType="java.lang.Long">
+        SELECT
+            project_id
+        FROM
+            etl_report_bytedance_video
+        WHERE
+            md5 = #{md5}
+          AND project_id IS NOT NULL
+        LIMIT 1
+    </select>
+
+    <select id="queryKuaishouProjectIdByMd5" resultType="java.lang.Long">
+        SELECT
+            project_id
+        FROM
+            ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+            signature = #{md5}
+          AND project_id IS NOT NULL
+        LIMIT 1
+    </select>
+
+    <select id="queryBytedanceCostByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select cost
+        from (
+                 SELECT ROUND(sum(cost), 2) cost,
+                        1 as                num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT ROUND(MAX(cost), 2) top,
+                        2 as                num
+                 FROM (
+                          SELECT sum(cost) cost
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(cost), 2) average,
+                        3 as                num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select click
+        from (
+                 SELECT sum(click) click,
+                        1 as       num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT MAX(click) top,
+                        2 as       num
+                 FROM (
+                          SELECT sum(click) click
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(click), 0) average,
+                        3 as                 num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceMaterialShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select materialShow
+        from (
+                 SELECT sum(material_show) materialShow,
+                     1 as num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT MAX(materialShow) top,
+                     2 as num
+                 FROM (
+                          SELECT sum(material_show) materialShow
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(material_show), 0) average,
+                     3 as num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+
+    </select>
+
+    <select id="queryBytedancePlay100RateByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select play100Rate
+        from (
+        SELECT ifnull(round(sum(play100_feed_break) / sum(material_show), 2),0) play100Rate,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT ifnull(MAX(play100Rate),0) top,
+            2 as num
+        FROM (
+                 SELECT round(sum(play100_feed_break) / sum(material_show), 2) play100Rate
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ifnull(ROUND(sum(play100_feed_break) / sum(material_show), 2),0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceLikeMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select likeMaterial
+        from (
+        SELECT sum(like_material) likeMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(likeMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(like_material) likeMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(like_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceCommentMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select commentMaterial
+        from (
+        SELECT sum(comment_material) commentMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(commentMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(comment_material) commentMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(comment_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceShareMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select shareMaterial
+        from (
+        SELECT sum(share_material) shareMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(shareMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(share_material) shareMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(share_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceFollowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select follow
+        from (
+        SELECT sum(follow) follow,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(follow) top,
+            2 as num
+        FROM (
+                 SELECT sum(follow) follow
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(follow), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouChargeByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select charge
+        from (
+                 SELECT ROUND(sum(charge), 2) charge,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT ROUND(MAX(charge), 2) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(charge) charge
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(charge), 2) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPhotoShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select photoShow
+        from (
+                 SELECT sum(photo_show) photoShow,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(photoShow) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(photo_show) photoShow
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(photo_show), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPhotoClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select photoClick
+        from (
+                 SELECT sum(photo_click) photoClick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(photoClick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(photo_click) photoClick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(photo_click), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouAClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select aclick
+        from (
+                 SELECT sum(aclick) aclick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(aclick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(aclick) aclick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(aclick), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouBClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select bclick
+        from (
+                 SELECT sum(bclick) bclick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(bclick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(bclick) bclick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(bclick), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouActivationByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select activation
+        from (
+                 SELECT sum(activation) activation,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(activation) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(activation) activation
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(activation), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPlay3sRateByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select play3sRate
+        from (
+                 SELECT round(sum(play_3s_count) / sum(aclick), 2) play3sRate,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT ROUND(MAX(play3sRate), 2) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(play_3s_count) / sum(aclick) play3sRate
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(sum(play_3s_count) / sum(aclick), 2) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+</mapper>

+ 53 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMaterialReportOverViewService.java

@@ -0,0 +1,53 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public interface IMaterialReportOverViewService {
+
+    //递归查询下级
+    Set<String> recursiveQuerySubordinate(String userId);
+
+    //查询用户参与的项目
+    Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId);
+
+    JSONArray queryProjectIdBy(Set<String> userIds, int mediaId);
+
+    //查询总消耗、视频总数、爆款视频数、有效是视频数
+    Map<String,Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //查询消耗趋势图
+    List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //查询标签占比图
+    JSONObject getTagProportion(int mediaId, String startDate, String endDate, int tagId);
+
+    //查询Top素材排行榜
+    List<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //素材查看更多
+    PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects, String channelType, String md5, String target, String order, int pageNo, int pageSize);
+
+    //导出
+    void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response);
+
+    void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response);
+
+    //查询设计人员排行榜
+    PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId, String target, String order, int pageSize, int pageNo);
+
+    // 视频详情页
+    JSONObject getMaterialDetailInfo(int mediaId, String md5);
+
+    Map<String,Object> materialDetailAnalyse(int mediaId, String md5);
+
+    List<JSONObject> getMaterialDetailChat(int mediaId, String md5);
+
+}

+ 396 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java

@@ -0,0 +1,396 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.util.*;
+
+@Slf4j
+@Service
+public class MaterialReportOverViewServiceImpl implements IMaterialReportOverViewService {
+
+    @Autowired
+    private MaterialReportOverViewMapper materialReportOverViewMapper;
+
+    @Autowired
+    private ISysRoleService roleService;
+
+    @Override
+    public Set<String> recursiveQuerySubordinate(String userId) {
+        Set<String> result;
+        //查询当前用户是否存在下级
+        Set<String> subordinate = materialReportOverViewMapper.recursiveQuerySubordinateByLeader(userId);
+        if (subordinate.isEmpty()) {
+            subordinate.add(userId);
+            return subordinate;
+        } else {
+            result = querySubordinate(subordinate, subordinate);
+            result.add(userId);
+        }
+        return result;
+    }
+
+    @Override
+    public Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId) {
+        JSONArray mediaIds = new JSONArray();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            mediaIds.add(1);
+            mediaIds.add(3);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            mediaIds.add(2);
+            mediaIds.add(4);
+        }
+        return materialReportOverViewMapper.queryProjectBy(userIds, mediaIds);
+    }
+
+    @Override
+    public JSONArray queryProjectIdBy(Set<String> userIds, int mediaId) {
+        JSONArray mediaIds = new JSONArray();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            mediaIds.add(1);
+            mediaIds.add(3);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            mediaIds.add(2);
+            mediaIds.add(4);
+        }
+        return materialReportOverViewMapper.queryProjectIdBy(userIds, mediaIds);
+    }
+
+    @Override
+    public Map<String, Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects) {
+        Map<String, Object> result = new HashMap<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            BigDecimal cost = materialReportOverViewMapper.queryBytedanceCost(startDate, endDate, projects);
+            BigDecimal lastCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
+            result.put("cost", cost);
+            result.put("costLink", countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
+            result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
+            result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
+            result.put("hot", 0);
+            result.put("valid", 0);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
+            BigDecimal lastCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
+            result.put("cost", cost);
+            result.put("costLink", countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
+            result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
+            result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
+            result.put("hot", 0);
+            result.put("valid", 0);
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects) {
+        List<JSONObject> result = new ArrayList<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        try {
+            if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+                if (DateUtils.isMoreSixMonth(startDate, endDate)) {
+                    result = materialReportOverViewMapper.queryBytedanceChatGroupMonth(startDate, endDate, projects);
+                } else {
+                    result = materialReportOverViewMapper.queryBytedanceChat(startDate, endDate, projects);
+                }
+            } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+                if (DateUtils.isMoreSixMonth(startDate, endDate)) {
+                    result = materialReportOverViewMapper.queryKuaishouChatGroupMonth(startDate, endDate, projects);
+                } else {
+                    result = materialReportOverViewMapper.queryKuaishouChat(startDate, endDate, projects);
+                }
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    @Override
+    public JSONObject getTagProportion(int mediaId, String startDate, String endDate, int tagId) {
+        return null;
+    }
+
+    @Override
+    public List<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects) {
+        List<JSONObject> result = new ArrayList<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceTopMaterial(startDate, endDate, projects);
+
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouTopMaterial(startDate, endDate, projects);
+        }
+        return result;
+    }
+
+    @Override
+    public PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects
+            , String channelType, String md5, String target, String order, int pageNo, int pageSize) {
+        PageInfo<JSONObject> result = new PageInfo<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
+            PageHelper.startPage(pageNo, pageSize, false);
+            List<JSONObject> list = materialReportOverViewMapper.queryBytedanceMaterialReport(filedAll, startDate, endDate, projects, md5, target, order);
+            Long count = materialReportOverViewMapper.queryBytedanceMaterialReportCount(startDate, endDate, projects, md5);
+            result.setTotal(count);
+            result.setList(list);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+            PageHelper.startPage(pageNo, pageSize, false);
+            List<JSONObject> list = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, startDate, endDate, projects, channelType, md5, target, order);
+            Long count = materialReportOverViewMapper.queryKuaishouMaterialReportCount(startDate, endDate, projects, channelType, md5);
+            result.setTotal(count);
+            result.setList(list);
+        }
+        return result;
+    }
+
+    @Override
+    public void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
+        JSONArray projects= requestBody.getJSONArray("projects");
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
+        }
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
+            //默认消耗必查
+            columns.add("cost");
+        }
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo, columns);
+        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo, columns));
+
+        titles.add(0, "唯一标识");
+        titles.add(1, "视频");
+        titles.add(2, "视频名称");
+        titles.add(3, "项目名称");
+        columns.add(0, "signature");
+        columns.add(1, "url");
+        columns.add(2, "materialName");
+        columns.add(3, "projectName");
+
+        List<JSONObject> excelData = materialReportOverViewMapper.queryBytedanceMaterialReport(filed, requestBody.getString("startDate"), requestBody.getString("endDate"),
+                projects, requestBody.getString("md5"),requestBody.getString("target")==null?"cost":requestBody.getString("target")
+                , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
+
+        if (null != excelData && 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());
+        }
+    }
+
+    @Override
+    public void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
+        JSONArray projects= requestBody.getJSONArray("projects");
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
+        }
+        JSONArray columns2 = new JSONArray();
+        columns2.add(0, "signature");
+        columns2.add(1, "url");
+        columns2.add(2, "projectName");
+        columns2.add(3, "materialName");
+        JSONArray columns = requestBody.getJSONArray("columns");
+        for (int i = 0; i < columns.size(); i++) {
+            columns2.add(columns2.size(), columns.getString(i));
+        }
+        List<String> titles = getfileIds(AccountReportConstants.kuaishouVideoReportDict, columns2);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+        List<JSONObject> excelData = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, requestBody.getString("startDate"), requestBody.getString("endDate"),
+                projects, requestBody.getString("channelType"),requestBody.getString("md5"), requestBody.getString("target")==null?"cost":requestBody.getString("target")
+                , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
+        if (null != excelData && excelData.isEmpty()) {
+            return;
+        }
+        List<List<Object>> excelList = new ArrayList<>();
+        for (int i = 0; i < excelData.size(); i++) {
+            List<Object> temp = new ArrayList<>();
+            JSONObject jsonObject = excelData.get(i);
+            for (int j = 0; j < columns2.size(); j++) {
+                String key = columns2.getString(j);
+                String value = jsonObject.getString(key);
+                temp.add(value);
+            }
+            excelList.add(temp);
+        }
+
+        try {
+            String[] strings = titles.toArray(new String[]{});
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "快手素材报表", strings, excelList);
+            HttpUtils.setResponseHeader(response, "快手素材.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    @Override
+    public PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId, String target, String order, int pageSize, int pageNo) {
+        PageInfo<JSONObject> result = new PageInfo<>();
+        Set<String> subordinate = this.recursiveQuerySubordinate(userId);
+        if (subordinate.isEmpty()) {
+            subordinate = materialReportOverViewMapper.recursiveQuerySubordinateByUserId(userId);
+        }
+        PageHelper.startPage(pageNo, pageSize, false);
+        List<JSONObject> topDesign = materialReportOverViewMapper.queryTopDesign(startDate, endDate, subordinate, target, order);
+        Long count = materialReportOverViewMapper.queryTopDesignCount(startDate, endDate, subordinate);
+        result.setList(topDesign);
+        result.setTotal(count);
+        return result;
+    }
+
+    @Override
+    public JSONObject getMaterialDetailInfo(int mediaId, String md5) {
+        JSONObject result = new JSONObject();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceVideoDetail(md5);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouVideoDetail(md5);
+
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> materialDetailAnalyse(int mediaId, String md5) {
+        Map<String, Object> result = new HashMap<>();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            Long projectId = materialReportOverViewMapper.queryBytedanceProjectIdByMd5(md5);
+            result.put("cost", materialReportOverViewMapper.queryBytedanceCostByMd5(md5, projectId));
+            result.put("click", materialReportOverViewMapper.queryBytedanceClickByMd5(md5, projectId));
+            result.put("materialShow", materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(md5, projectId));
+            result.put("play100Rate", materialReportOverViewMapper.queryBytedancePlay100RateByMd5(md5, projectId));
+            result.put("likeMaterial", materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(md5, projectId));
+            result.put("commentMaterial", materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(md5, projectId));
+            result.put("shareMaterial", materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(md5, projectId));
+            result.put("follow", materialReportOverViewMapper.queryBytedanceFollowByMd5(md5, projectId));
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            Long projectId = materialReportOverViewMapper.queryKuaishouProjectIdByMd5(md5);
+            result.put("charge", materialReportOverViewMapper.queryKuaishouChargeByMd5(md5, projectId));
+            result.put("photoShow", materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(md5, projectId));
+            result.put("photoClick", materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(md5, projectId));
+            result.put("aclick", materialReportOverViewMapper.queryKuaishouAClickByMd5(md5, projectId));
+            result.put("bclick", materialReportOverViewMapper.queryKuaishouBClickByMd5(md5, projectId));
+            result.put("activation", materialReportOverViewMapper.queryKuaishouActivationByMd5(md5, projectId));
+            result.put("play3sRate", materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(md5, projectId));
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
+        List<JSONObject> result = new ArrayList<>();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceVideoChat(md5);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouVideoChat(md5);
+        }
+        return result;
+    }
+
+    //递归查询
+    private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
+        if (leaderIds.isEmpty()) {
+            return result;
+        }
+        Set<String> temp = materialReportOverViewMapper.recursiveQuerySubordinateByLeaders(leaderIds);
+        result.addAll(temp);
+        querySubordinate(temp, result);
+        return result;
+    }
+
+    //当项目为空的时候,根据当前登录人查询可查看的所有项目集合
+    private JSONArray getProjectsByCurrentUser(int mediaId) {
+        String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
+        //TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
+        String roleCode = roleService.getRoleCodeByUserId(currentUser);
+        if (roleCode.equals("admin")) {
+            return null;
+        }
+        return queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
+    }
+    private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
+        List<String> titles = new ArrayList<>();
+        for (int i = 0; i < columns.size(); i++) {
+            String string = columns.getString(i);
+            Map<String, Object> stringObjectMap = kuaishouVideoReportMap.get(string);
+            if (Check.isNull(stringObjectMap)) {
+                titles.add("-");
+                continue;
+            }
+            Object comment = stringObjectMap.get("comment");
+            titles.add(String.valueOf(comment));
+
+        }
+        return titles;
+    }
+
+    //环比计算
+    private  BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
+        BigDecimal link = new BigDecimal(0);
+        if (numB.compareTo(BigDecimal.ZERO)!=0) {
+            link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
+        }
+        return link;
+    }
+
+}

+ 32 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.orderplatform.controller;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
@@ -14,6 +16,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Slf4j
 @RestController
 @RequestMapping("/platform/designer")
@@ -92,6 +98,32 @@ DesignerCommitProcessCtrl {
     }
 
     /**
+     *   设计组长批量派单
+     */
+    @PostMapping("/batchAssign")
+    public Result<Map<String,Object>> batchAssign(@RequestBody JSONObject params) {
+        Result<Map<String,Object>> result = new Result<>();
+        Map<String,Object> assignResult= new HashMap<>();
+        JSONArray ids=params.getJSONArray("id");
+        PlatformMaterial platformMaterial= new PlatformMaterial(params.getString("plan"),params.getString("shot"),params.getString("clip"));
+        ids.forEach(id->{
+            //物料状态->脚本待上传
+            platformMaterial.setId(Long.valueOf(id.toString()));
+            platformMaterial.setMaterialStatus(1);
+            platformMaterial.setScriptStatus(0);
+            boolean ok = platformMaterialService.updateById(platformMaterial);
+            if (ok) {
+                assignResult.put(platformMaterial.getId().toString(),"物料派单成功");
+            }else {
+                assignResult.put(platformMaterial.getId().toString(),"物料派单失败");
+            }
+        });
+        result.setResult(assignResult);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
      *  设计组长修改指派人
      */
     @PostMapping("/assignAgain")

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformMaterial.java

@@ -92,4 +92,13 @@ public class PlatformMaterial {
 
 	@TableField(exist = false)
 	private String clipName;
+
+	public PlatformMaterial() {
+	}
+
+	public PlatformMaterial(String plan, String shot, String clip) {
+		this.plan = plan;
+		this.shot = shot;
+		this.clip = clip;
+	}
 }

+ 9 - 3
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -101,6 +101,12 @@ spring:
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
+#      datasource:
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0
@@ -125,9 +131,9 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-  #  configuration:
-  #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-  #  map-underscore-to-camel-case: false
+    configuration:
+      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    map-underscore-to-camel-case: false
   #分页pageHelper
 pagehelper:
   helper-dialect: mysql

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

@@ -241,7 +241,7 @@ public class KsVideoReportCtrl {
                         HttpServletRequest request,
                         HttpServletResponse response) {
         Result<PageInfo<JSONObject>> result = new Result<>();
-        try {
+    try {
 
 
             if (Check.isNull(requestBody)) {

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

@@ -93,7 +93,7 @@ public class BytedanceNewPlanReportCtrl {
     }
 
     /**
-     * 查询所有的快手运营
+     * 查询所有的头条运营
      */
     @PostMapping("/report/AllOperator")
     public Result<List<JSONObject>> getAllOperator() {