Browse Source

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

yumeng 4 years ago
parent
commit
d0b8358260
49 changed files with 1692 additions and 276 deletions
  1. 3 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 54 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  4. 9 11
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  6. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java
  7. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  8. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  9. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml
  10. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  11. 23 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java
  12. 64 22
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  13. 37 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java
  14. 367 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouReportAccountDailyDTOEntity.java
  15. 2 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java
  16. 28 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyZombieJob.java
  17. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  18. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java
  19. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  20. 24 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  21. 10 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  22. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  23. 25 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CollectionSlogansServiceImpl.java
  24. 89 29
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  25. 81 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouZombieCreative.java
  26. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java
  27. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  28. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  29. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouZombieCreativeMapper.java
  30. 55 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  31. 82 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  32. 24 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  33. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouZombieCreativeMapper.xml
  34. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java
  35. 2 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java
  36. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouZombieCreativeService.java
  37. 9 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java
  38. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java
  39. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java
  40. 296 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouZombieCreativeServiceImpl.java
  41. 1 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java
  42. 2 5
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java
  43. 90 31
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  44. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java
  45. 84 92
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml
  46. 52 9
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  47. 4 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java
  48. 1 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  49. 9 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java

+ 3 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1513,14 +1513,14 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     /**
-     * 获取前一天的日期
+     * 以time为节点,获取前几天的日期 yyyy-MM-dd
      *
      * @param
      * @return java.lang.String
      * @throws
      * @author ZHAOXA
      */
-    public static String getLastDay(String time) {
+    public static String getLastDay(String time, int days) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Calendar calendar = Calendar.getInstance();
         Date date = null;
@@ -1532,7 +1532,7 @@ public class DateUtils extends PropertyEditorSupport {
         calendar.setTime(date);
         int day = calendar.get(Calendar.DATE);
         //                      此处修改为+1则是获取后一天
-        calendar.set(Calendar.DATE, day - 1);
+        calendar.set(Calendar.DATE, day - days);
 
         String lastDay = sdf.format(calendar.getTime());
         return lastDay;

+ 54 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -2,13 +2,33 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
-import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
+import cn.com.ctop.common.module.service.IMaterialTagService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -25,13 +45,24 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 素材信息
@@ -65,6 +96,8 @@ public class MaterialInfoController {
     private IProjectMemberService memberService;
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
 
 
     @GetMapping("/supplierWatermark")
@@ -309,40 +342,40 @@ public class MaterialInfoController {
     }
 
     @GetMapping(value = "/listV2")
-    public Map<String,Object> queryPageList(String type,Integer status,Long projectId,String materialName,String code,
-                                                     String startDate,String endDate,String tagCode,
-                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+    public Map<String, Object> queryPageList(String type, Integer status, Long projectId, String materialName, String code,
+                                             String startDate, String endDate, String tagCode,
+                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        List<Long>projectIds = null;
+        List<Long> projectIds = null;
         String userId = user.getId();
         String roleCode = roleService.getRoleCodeByUserId(userId);
-        if(null == tagCode||tagCode.trim().equals("")){
+        if (null == tagCode || tagCode.trim().equals("")) {
             tagCode = null;
         }
-        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")){
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
             //查询所有
-            if(null!=projectId&&projectId!=0){
+            if (null != projectId && projectId != 0) {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
-        }else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)){
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+        } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
-            if(null == projectId||projectId == 0){
+            if (null == projectId || projectId == 0) {
                 projectIds = memberService.selectProjectsByUserId(userId);
-            }else{
+            } else {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
-        }else{
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+        } else {
             //查询自己上传的视频
-            if(null!=projectId&&projectId!=0){
+            if (null != projectId && projectId != 0) {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,userId,pageNo,pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId, pageNo, pageSize);
         }
     }
 
@@ -726,4 +759,5 @@ public class MaterialInfoController {
         result.setResult(pageList);
         return result;
     }
+
 }

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

@@ -149,7 +149,6 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         temp.put("project", projectMember);
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("project_id", projectMember.getProjectId());
-        queryWrapper.eq("account_status", 0);
         queryWrapper.isNotNull("account_id");
         List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
         if (userAllocations.isEmpty()) {

+ 9 - 11
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -127,13 +127,14 @@ public class SampleTest {
 
     @Test
     public void testLoadBytedanceData() {
-        List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
+        List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
         for (UserAllocation allocation : allocations) {
-            for (int i = 2; i < 10; i++) {
+//            for (int i = 2; i < 10; i++) {
                 CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
-                Date getDate = DateUtils.addDay(new Date(), -i);
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            }
+                Date getDate = DateUtils.addDay(new Date(), 0);
+//                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+//            }
         }
     }
 
@@ -190,16 +191,13 @@ public class SampleTest {
 
     @Test
     public void loadBytedanceData(){
-        String strings = "1672894840372238_1674183267750990_1673076203257870_1650079154438157_1670286873337870_1648709018451972_1661556811389966_1676540488471559";
-        String[] tokens = strings.split("_");
-        for (int i=0;i<tokens.length;i++) {
-            Long accountId = Long.parseLong(tokens[i]);
-            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        List<UserAllocation>allocations = allocationService.getByParams(633L,null,0);
+        for (int i=0;i<allocations.size();i++) {
+            CtopOauthToken token = tokenService.getTokenByAccountId(allocations.get(i).getAccountId());
             for(int j=10;j<110;j++){
                 Date getDate = DateUtils.addDay(new Date(), -j);
                 reportService.getAdvertiserReport(token, getDate, getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             }
-
         }
     }
 

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -152,6 +152,9 @@ public class MaterialInfo {
     private BigDecimal cost;
 
     @TableField(exist = false)
+    private BigDecimal bytedanceCost;
+
+    @TableField(exist = false)
     private String realname;
 
     @TableField(exist = false)

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java

@@ -1,7 +1,9 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialParameter;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 素材归属标
@@ -12,4 +14,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MaterialParameterMapper extends BaseMapper<MaterialParameter> {
 
+    JSONObject getMaterialTotalCharge(@Param("signature") String signature);
+
+    JSONObject getByteDanceMaterialTotalCharge(@Param("signature") String signature);
+
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -18,6 +18,8 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
 
     String queryAdvertiserId(@Param("accountId") Long accountId);
 
+    String queryUserIdByAccountId(@Param("accountId") Long accountId);
+
     List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
 
     List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -132,6 +132,9 @@
         <if test="userId!=null">
             and matInfo.user_id = #{userId}
         </if>
+        <if test="code!=null">
+            and matInfo.code = #{code}
+        </if>
         <if test="materialName!=null">
             and matInfo.material_name like concat('%',#{materialName},'%')
         </if>

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml

@@ -2,4 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialParameterMapper">
 
+    <select id="getMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(charge) as charges
+        FROM ctop_kuaishou_report_daily_material
+        WHERE signature = #{signature}
+    </select>
+
+    <select id="getByteDanceMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(cost) as charges
+        FROM ctop_bytedance_video_report_daily
+        WHERE signature = #{signature}
+    </select>
 </mapper>

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -21,6 +21,13 @@
             ctop_user_allocation
         where account_id=#{accountId}
     </select>
+    <select id="queryUserIdByAccountId" resultType="String">
+        select
+            distinct user_id
+        from
+            ctop_user_allocation
+        where account_id=#{accountId}
+    </select>
 
     <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
        select

+ 23 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.common.module.service;
 
+import com.alibaba.fastjson.JSONObject;
+
 public interface IMessageTemplate {
 
     String getMaterialSyncTemplate(String projectName, String accountId, String accountName, String materialName, String reason);
@@ -24,5 +26,25 @@ public interface IMessageTemplate {
 
     String getFeishuMaterialRejectTemplate(String projectName, String materialName, String refuseReason);
 
-    String getCreativeOverRunMessage(Long accountId, Integer creativeCount,String authName);
+    String getCreativeOverRunMessage(Long accountId, Integer creativeCount, String authName);
+
+    /**
+     * 获取僵尸创意提醒通知模板
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    String getZombieCreativeRemindTemplate(JSONObject obj);
+
+    /**
+     * 获取僵尸创意关停通知模板
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    String getZombieCreativeShutDownTemplate(JSONObject obj);
 }

+ 64 - 22
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -1,14 +1,39 @@
 package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.constant.CosConstant;
-import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.SupplierWatermark;
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.entity.TencentWatermarkTemplate;
+import cn.com.ctop.common.module.entity.VideoWatermarkTask;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
-import cn.com.ctop.common.module.service.*;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISupplierWatermarkService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.service.ITencentWatermarkTemplateService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.utils.AesEncryptUtil;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,7 +57,11 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
 import java.nio.channels.FileChannel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -589,13 +618,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
-            insertTagList(code,userId,modalityTagList);
+            insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
-            insertTagList(code,userId,contentTagList);
+            insertTagList(code, userId, contentTagList);
             JSONArray senceTagList = json.getJSONArray("senceTagList");
-            insertTagList(code,userId,senceTagList);
+            insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
-            insertTagList(code,userId,modTagList);
+            insertTagList(code, userId, modTagList);
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
@@ -605,17 +634,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
     }
 
-    private void insertTagList(String code,String userId,JSONArray tagList){
-        if(null!=tagList&&!tagList.isEmpty()){
-            for(int m=0;m<tagList.size();m++){
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            for (int m = 0; m < tagList.size(); m++) {
                 Long tagId = tagList.getLong(m);
                 TagInfo tagInfo = tagInfoService.getById(tagId);
-                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
+                MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
                 setTag.setCategoryId(tagInfo.getTagCategoryId());
                 materialTagInfoService.save(setTag);
             }
         }
     }
+
     @Autowired
     private ITagInfoService tagInfoService;
     @Autowired
@@ -676,14 +706,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
-        Map<String,Object> result = new HashMap<>();
-        PageHelper.startPage(pageNo,pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+        Map<String, Object> result = new HashMap<>();
+        PageHelper.startPage(pageNo, pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
-        if(null!=dailyList&&!dailyList.isEmpty()){
-            for(MaterialInfo info:dailyList){
+        if (null != dailyList && !dailyList.isEmpty()) {
+            for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
@@ -699,8 +729,20 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setToutiaoVideoIsUp(0);
                 }
-
-                //TODO 消耗统计
+                //统计快手总消耗数据
+                JSONObject kuaishous = materialParameterMapper.getMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(kuaishous)) {
+                    materialInfo.setCost(kuaishous.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setCost(new BigDecimal(0));
+                }
+                //统计抖音总消耗数据
+                JSONObject bytedances = materialParameterMapper.getByteDanceMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(bytedances)) {
+                    materialInfo.setBytedanceCost(bytedances.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setBytedanceCost(new BigDecimal(0));
+                }
 
                 Project project = projectService.getById(info.getProjectId());
                 if (!Check.isNull(project)) {
@@ -722,8 +764,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
         }
         pageInfo.setList(setList);
-        result.put("data",pageInfo);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        result.put("data", pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 }

+ 37 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.service.IMessageTemplate;
 import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.stereotype.Service;
 
 @Service
@@ -108,4 +109,40 @@ public class MessageTemplateImpl implements IMessageTemplate {
                 .append("如有疑问,请联系产品:吴永前。");
         return text.toString();
     }
+
+    @Override
+    public String getZombieCreativeRemindTemplate(JSONObject obj) {
+        StringBuilder text = new StringBuilder();
+        text.append("即将成为僵尸创意预警").append("<br/>")
+                .append("您的项目:").append(obj.getString("projectName"))
+                .append("(").append(obj.getString("projectId")).append(")").append("<br/>")
+                .append("广告计划:").append(obj.getString("campaignName"))
+                .append("(").append(obj.getString("campaignId")).append(")").append("<br/>")
+                .append("广告组:").append(obj.getString("unitName"))
+                .append("(").append(obj.getString("unitId")).append(")").append("<br/>")
+                .append("广告创意:").append(obj.getString("creativeName"))
+                .append("(").append(obj.getString("creativeId")).append(")").append("<br/>")
+                .append("当前创意0消耗即将超过5天").append("<br/>")
+                .append("即将变为僵尸创意").append("<br/>")
+                .append("请您及时查看!");
+        return text.toString();
+    }
+
+    @Override
+    public String getZombieCreativeShutDownTemplate(JSONObject obj) {
+        StringBuilder text = new StringBuilder();
+        text.append("已经成为僵尸创意预警").append("<br/>")
+                .append("您的项目:").append(obj.getString("projectName"))
+                .append("(").append(obj.getString("projectId")).append(")").append("<br/>")
+                .append("广告计划:").append(obj.getString("campaignName"))
+                .append("(").append(obj.getString("campaignId")).append(")").append("<br/>")
+                .append("广告组:").append(obj.getString("unitName"))
+                .append("(").append(obj.getString("unitId")).append(")").append("<br/>")
+                .append("广告创意:").append(obj.getString("creativeName"))
+                .append("(").append(obj.getString("creativeId")).append(")").append("<br/>")
+                .append("当前创意0消耗已经超过5天").append("<br/>")
+                .append("已经变为僵尸创意,且已被关停").append("<br/>")
+                .append("请您及时查看!");
+        return text.toString();
+    }
 }

File diff suppressed because it is too large
+ 367 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouReportAccountDailyDTOEntity.java


+ 2 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java

@@ -4,6 +4,7 @@ package cn.com.ctop.job.bytedance.handler;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.enums.NoEn;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
 import org.jeecg.common.util.DateUtils;
@@ -30,7 +31,7 @@ public class WechatAttendanceJob {
     @XxlJob("wechatAttendanceJob")
     public ReturnT<String> execute(String params) throws Exception {
         XxlJobLogger.log("--------考勤和人员数据入库 start ");
-        String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()));
+        String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO1.valueInt());
         long starttime = DateUtils.timeToStamp(beforeDay + " 00:00:00");
         long endtime = DateUtils.timeToStamp(beforeDay + " 23:59:59");
         //更新员工打卡明细表

+ 28 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyZombieJob.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouZombieCreativeService;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 更新僵尸计划数据
+ *
+ * @author jeecg-boot
+ */
+@Component
+public class KuaishouDailyZombieJob {
+    @Autowired
+    private IKuaishouZombieCreativeService kuaishouZombieCreativeService;
+
+    @XxlJob("kuaishouDailyZombie")
+    public ReturnT<String> execute(String param) throws Exception {
+        XxlJobLogger.log("更新僵尸计划数据 start");
+        kuaishouZombieCreativeService.checkZombieProject();
+        XxlJobLogger.log("更新僵尸计划数据 end");
+        return ReturnT.SUCCESS;
+    }
+
+}

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -2,19 +2,31 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
+import cn.com.ctop.common.module.vo.SheetInfoVo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouInfoDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.metadata.Sheet;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 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.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -122,6 +134,30 @@ public class KuaiShouController {
         return result;
     }
 
+    @PostMapping("/exportKuaishouSaleProjectInfo")
+    public void exportKuaishouSaleProjectInfo(@RequestBody KuaishouInfoDTO dto, HttpServletResponse response) throws IOException {
+        Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return ;
+        }
+        //查询总的消耗信息
+        SheetInfoVo totalSheetVo = accountService.getKuaishouSaleProjectInfoSheetVO(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),"", dto.getYn());
+        OutputStream outputStream = response.getOutputStream();
+        String date = DateUtils.formatDate(new Date());
+        HttpUtils.setResponseHeader(response, "快手销售报表" + date + ".xlsx");
+        ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
+        Sheet sheet = new Sheet(1, 0, KuaishouReportAccountDailyDTOEntity.class);
+        sheet.setSheetName(totalSheetVo.getSheetName());
+        excelWriter.write(totalSheetVo.getDetails(), sheet);
+        excelWriter.finish();
+        outputStream.flush();
+        outputStream.close();
+    }
+
     @RequestMapping("/getKuaishouAccountInfoByProjectId")
     public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
         Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,4 +20,6 @@ public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
     Integer checkCreativeCount(@Param("accountId") Long accountId, @Param("unitId") Long unitId);
 
     Integer getCreateCount(Long accountId, String startTime);
+
+    List<JSONObject> checkZombieProject(String date);
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java

@@ -23,4 +23,5 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
     VideoGetvo getVideoGetByPhotoId(@Param("photoId") Long photoId);
 
     List<KuaiShouReportDailyMaterialVo> getPhotoListByDate(@Param("statDate") String statDate);
+
 }

+ 24 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml

@@ -103,5 +103,28 @@
    AND create_channel = 1;
     </select>
 
-
+    <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.id,
+        t1.account_id AS accountId,
+        t1.creative_id AS creativeId,
+        t1.creative_name AS creativeName,
+        t1.campaign_id AS campaignId,
+        t4.campaign_name AS campaignName,
+        t1.unit_id AS unitId,
+        t5.unit_name AS unitName,
+        t3.id AS projectId,
+        t3.project_name AS projectName,
+        t2.user_id AS userId
+        FROM
+        ctop_kuaishou_creative t1
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        LEFT JOIN ctop_kuaishou_campaign t4 ON t1.campaign_id = t4.campaign_id
+        LEFT JOIN ctop_kuaishou_group t5 ON t1.unit_id = t5.unit_id
+        WHERE
+        creative_create_time &lt;= #{date}
+        AND t1. STATUS = 42
+        and t1.put_status = 1
+    </select>
 </mapper>

+ 10 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -108,16 +108,16 @@
     </insert>
 
     <select id="getPhotoList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo">
-           select
-           id as id,
-           photo_id as photoId
-           from
-           ctop_kuaishou_report_daily_material
-           where account_id = #{accountId}
-           <if test="statDate != null and statDate != '' ">
-               and stat_date = #{statDate}
-           </if>
-           group by photo_id
+        select
+        id as id,
+        photo_id as photoId
+        from
+        ctop_kuaishou_report_daily_material
+        where account_id = #{accountId}
+        <if test="statDate != null and statDate != '' ">
+            and stat_date = #{statDate}
+        </if>
+        group by photo_id
 
     </select>
 
@@ -143,5 +143,4 @@
       limit 1
     </select>
 
-
 </mapper>

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java

@@ -1,8 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 素材
  * @Author: jeecg-boot

+ 25 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CollectionSlogansServiceImpl.java

@@ -30,14 +30,16 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
         CollectionSlogans co = new CollectionSlogans();
         String userId = requestJson.getString("userId");
         Long accountId = requestJson.getLong("accountId");
-        if (!Check.isNull(requestJson.getJSONArray("coverSlogansList"))) {
+        JSONArray coverSlogansList = requestJson.getJSONArray("coverSlogansList");
+        JSONArray captionsList = requestJson.getJSONArray("captionsList");
+        if (!Check.isNull(coverSlogansList)) {
             //封面广告语
             co.setType(NoEn.NO1.valueStr());
-            co.setValue(requestJson.getJSONArray("coverSlogansList").toString());
+            co.setValue(coverSlogansList.toString());
         }
-        if (!Check.isNull(requestJson.getJSONArray("captionsList"))) {
+        if (!Check.isNull(captionsList)) {
             co.setType(NoEn.NO2.valueStr());
-            co.setValue(requestJson.getJSONArray("captionsList").toString());
+            co.setValue(captionsList.toString());
         }
         co.setAccountId(accountId);
         co.setUserId(userId);
@@ -45,6 +47,25 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
         if (!Check.isNull(slogansJson)) {
             QueryWrapper<CollectionSlogans> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("id", slogansJson.getInteger("id"));
+            //如果入参中type为delete,则只做修改操作,否则需要判断已有数据和入参数据不能重复
+            if (!"delete".equals(requestJson.getString("type"))) {
+                JSONArray value = slogansJson.getJSONArray("value");
+                if (NoEn.NO1.valueStr().equals(co.getType())) {
+                    for (int i = 0; i < coverSlogansList.size(); i++) {
+                        if (!value.contains(coverSlogansList.get(i))) {
+                            value.add(coverSlogansList.get(i));
+                        }
+                    }
+                    co.setValue(value.toString());
+                } else {
+                    for (int i = 0; i < captionsList.size(); i++) {
+                        if (!value.contains(captionsList.get(i))) {
+                            value.add(captionsList.get(i));
+                        }
+                    }
+                    co.setValue(value.toString());
+                }
+            }
             collectionSlogansMapper.update(co, queryWrapper);
         } else {
             collectionSlogansMapper.insert(co);

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

@@ -46,10 +46,13 @@ public class KsVideoReportCtrl {
             JSONArray accountIds = requestBody.getJSONArray("accountIds");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
+            String clip = requestBody.getString("clip");
+            String shot = requestBody.getString("shot");
+            String plan = requestBody.getString("plan");
             String target = requestBody.getString("target");
             String order = requestBody.getString("order");
-            int pageSize= requestBody.getInteger("pageSize");
-            int pageNo= requestBody.getInteger("pageNo");
+            int pageSize = requestBody.getInteger("pageSize");
+            int pageNo = requestBody.getInteger("pageNo");
 
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
 
@@ -57,7 +60,7 @@ public class KsVideoReportCtrl {
                 if(accountIds.isEmpty()){
                     accountIds=null;
                 }
-                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot,plan,pageSize, pageNo);
                 result.setResult(listData);
                 result.setSuccess(true);
             } catch (Exception e) {
@@ -68,47 +71,105 @@ public class KsVideoReportCtrl {
         return result;
     }
 
-    @PostMapping("/report/excel")
+    @PostMapping("/detail")
+    public Result<List<JSONObject>> getReportDetail(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            result.setSuccess(false);
+        } else {
+
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String signature = requestBody.getString("signature");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
+
+            try {
+                if (accountIds.isEmpty()) {
+                    accountIds = null;
+                }
+                List<JSONObject> listData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filedAll,signature);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/excel")
     public void getExcelReport(@RequestBody JSONObject requestBody,
                                HttpServletRequest request,
                                HttpServletResponse response) {
-        JSONArray columns=requestBody.getJSONArray("columns");
-        if(columns.isEmpty()){
-            log.error("请选择需要导出的字段");
+        //加一个参数区分是table页,还是详情页。
+        String exportType= requestBody.getString("exportType");
+        if(exportType.isEmpty()){
+            return;
         }
-        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));
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
+            //默认消耗必查
+            columns.add("cost");
+        }
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs, columns);
+        List<String> titles = new ArrayList<>();
         //此处增加两个元素是为了保证数据顺序
-        columns.add(0,"url");
-        columns.add(1,"materialName");
-        columns.add(2,"projectName");
-        columns.add(3,"createTime");
+        if(exportType.equals("exportDetail")){
+            titles.add(0,"客户");
+            titles.add(1,"项目名称");
+            titles.add(2,"时间");
+            titles.add(3,"消耗");
+            columns.add(0, "advertiserName");
+            columns.add(1, "projectName");
+            columns.add(2, "statDate");
+        }else{
+            titles.add(0,"唯一标识");
+            titles.add(1,"视频");
+            titles.add(2,"视频名称");
+            titles.add(3,"项目名称");
+            titles.add(4,"上传时间");
+            titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
+            columns.add(0, "signature");
+            columns.add(1, "url");
+            columns.add(2, "materialName");
+            columns.add(3, "projectName");
+            columns.add(4, "createTime");
+        }
+
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if(accountIds.isEmpty()){
-            accountIds=null;
+        if (accountIds.isEmpty()) {
+            accountIds = null;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
+        String signature = requestBody.getString("signature");
+        String clip = requestBody.getString("clip");
+        String shot = requestBody.getString("shot");
+        String plan = requestBody.getString("plan");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
-        List<JSONObject> excelData= ksVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
-        if(excelData.isEmpty()){
+        List<JSONObject> excelData=null;
+        if(exportType.equals("exportTable")){
+            excelData = ksVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order,clip,shot,plan);
+        }else if(exportType.equals("exportDetail")){
+            excelData = ksVideoReportService.getVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+        }
+        if (null!=excelData&&excelData.isEmpty()) {
             return;
         }
-        List<List<Object>> excelList= new ArrayList<>();
-        excelData.forEach(data->{
-            List<Object> temp= new ArrayList<>();
-            columns.forEach(k->{
+        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{
+        try {
             String[] headers = titles.toArray(new String[titles.size()]);
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
@@ -118,9 +179,8 @@ public class KsVideoReportCtrl {
             workbook.write(os);
             os.flush();
             os.close();
-        }catch (IOException e){
+        } catch (IOException e) {
             log.error(e.getMessage());
         }
     }
-
 }

+ 81 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouZombieCreative.java

@@ -0,0 +1,81 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-14
+ */
+@Data
+@TableName("ctop_kuaishou_zombie_creative")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_zombie_creative对象", description = "僵尸计划记录")
+public class KuaishouZombieCreative {
+
+    /**
+     * 编号
+     */
+    @TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "编号")
+    private Integer id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 创意ID
+     */
+    @Excel(name = "创意ID", width = 15)
+    @ApiModelProperty(value = "创意ID")
+    private Long creativeId;
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称", width = 15)
+    @ApiModelProperty(value = "创意名称")
+    private String creativeName;
+    /**
+     * 记录时间
+     */
+    private String recordTime;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+    /**
+     * 状态 0-是僵尸计划,1-无效,不是
+     */
+    @Excel(name = "状态 0-待确认,1-是僵尸计划,2-不是僵尸计划", width = 15)
+    @ApiModelProperty(value = "状态 0-待确认,1-是僵尸计划,2-不是僵尸计划")
+    private String status;
+}

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

@@ -8,6 +8,8 @@ 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);
+    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,@Param("clip") String clip,@Param("shot") String shot,@Param("plan") String plan);
+
+    List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("signature") String signature);
 
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO;
@@ -46,5 +47,5 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<Long> getSaleProjectAccountIds(@Param("userId")String userId, @Param("yn")Integer yn);
 
-
+    List<KuaishouReportAccountDailyDTOEntity> getKuaishouProjectInfoEntity(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectList")List<Long> projectList, @Param("yn")Integer yn);
 }

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

@@ -20,4 +20,6 @@ public interface KuaishouReportDailyCreativeMapper extends BaseMapper<KuaishouRe
     KuaiShouCleanMaterialReport calculationMaterialReport(@Param("signature") String signature);
 
     void loadProgramCreativeDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    List<JSONObject> checkZombieProject(@Param("date") String date);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author: jeecg-boot
+ * @date: 2020-10-14
+ * @cersion: V1.0
+ */
+public interface KuaishouZombieCreativeMapper extends BaseMapper<KuaishouZombieCreative> {
+
+}

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

@@ -3,20 +3,16 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper">
 
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        SELECT * from (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,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.clip_id=u.id where t3.material_id=t1.signature limit 1) AS clip,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where t3.material_id=t1.signature limit 1) AS shot,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where t3.material_id=t1.signature limit 1) AS plan,
+        t2.cover_url as converUrl,
+        t2.material_name AS 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
@@ -34,6 +30,53 @@
         </if>
         AND t2.url!=""
         GROUP BY t1.signature
+        ) t
+        WHERE t.clip like '%${clip}%'
+        AND (t.shot LIKE '%%' or t.shot is null)
+        AND t.plan like '%${plan}%'
         ORDER BY ${target} ${order}
     </select>
+
+    <select id="queryVideoDetailBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.stat_date as statDate,
+        t1.signature,
+        t2.url,
+        t2.cover_url as converUrl,
+        t2.material_name AS materialName,
+        (
+        SELECT
+        project_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id
+        ) AS projectName,
+        (
+        SELECT
+        advertiser_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id limit 1
+        ) AS advertiserName,
+        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.signature=#{signature}
+        AND 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,t1.stat_date
+    </select>
 </mapper>

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

@@ -1139,5 +1139,87 @@
             limit 50
         </if>
     </select>
+    <select id="getKuaishouProjectInfoEntity"
+            resultType="cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity">
+        select
+        concat(#{startDate}, '~' , #{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        (SELECT project_name FROM ctop_project where id = b.project_id) as 'projectName',
+        (select name from ctop_advertiser where id = b.advertiser_id) as 'advertiserName',
+        (
+        select realname from sys_user where id = (
+        select responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'responsibleName',
+        (
+        select realname from sys_user where id = (
+        select design_responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'designResponsibleName',
+        ifnull(round(sum(a.charge),3),0) as 'charge',
+        ifnull(sum(a.photo_show),0) as 'photoShow', -- 封面曝光数
+        ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
+        ifnull(sum(a.aclick),0) as 'aclick', -- 素材曝光数
+        ifnull(sum(a.bclick),0) as 'bclick', -- 行为数
+        ifnull(sum(a.activation),0) as 'activation', -- 激活数
+        ifnull(sum(a.submit),0) as 'submit', -- 提交按钮点击数
+        ifnull(sum(a.event_register),0) as 'eventRegister', -- 注册数
+        ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay', -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
+        case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then
+        concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',
+        case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then
+        concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate', -- 行为率
+        (case
+        when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
+        then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
+        then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN ( sum(a.bclick) is not null and sum(a.bclick) != 0)
+        THEN round(sum(a.charge) / sum(a.bclick),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        ifnull(sum(a.photo_share),0) as 'photoShare', -- 分享数
+        ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
+        ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
+        ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
+        ifnull(sum(a.report),0) as 'report', -- 举报数
+        ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
+        ifnull(sum(a.block),0) as 'block', -- 拉黑数
+        ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
+        ifnull(sum(a.download_started),0) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
+        ifnull(sum(a.download_completed),0) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
+        THEN round( ifnull(sum(a.charge),0) / sum(a.event_next_day_stay) ,2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost' -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_account a
+        left join ctop_user_allocation b
+        on a.account_id = b.account_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        and
+        b.project_id in
+        <foreach collection="projectList" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by b.project_id  order by sum(a.charge) desc
+
+    </select>
 
 </mapper>

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

@@ -281,4 +281,28 @@
         signature = #{signature}
     </select>
 
+
+    <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
+      SELECT *FROM
+		(SELECT
+			count(t1.stat_date) AS dates,
+			sum(t1.charge) AS charge,
+			t1.account_id AS accountId,
+			t1.creative_id AS creativeId,
+			t1.creative_name AS creativeName,
+			t1.campaign_id AS campaignId,
+			t1.campaign_name AS campaignName,
+			t1.unit_id AS unitId,
+			t1.unit_name AS unitName,
+			t3.id AS projectId,
+			t3.project_name AS projectName,
+			t2.user_id as userId
+		FROM
+			ctop_kuaishou_report_daily_creative t1
+		LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+		LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        where stat_date >= #{date}
+        GROUP BY t1.account_id,t1.creative_id) as t
+      WHERE t.dates = 5 and t.charge = 0
+    </select>
 </mapper>

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

@@ -0,0 +1,5 @@
+<?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.KuaishouZombieCreativeMapper">
+
+</mapper>

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

@@ -8,7 +8,9 @@ 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);
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo);
 
-    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
+    List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature);
+
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
 }

+ 2 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java

@@ -1,15 +1,13 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
+import cn.com.ctop.common.module.vo.SheetInfoVo;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.github.pagehelper.PageInfo;
-import org.apache.shiro.SecurityUtils;
-import org.jeecg.common.system.vo.LoginUser;
 
-import java.util.ArrayList;
 import java.util.List;
 
 public interface IKuaishouReportDailyAccountService extends IService<KuaishouReportDailyAccount> {
@@ -30,4 +28,5 @@ public interface IKuaishouReportDailyAccountService extends IService<KuaishouRep
 
     PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(List<Long> projectList, Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum, Integer yn);
 
+    SheetInfoVo getKuaishouSaleProjectInfoSheetVO(String startDate, String endDate, List<Long> projectList, int pageNum, int pageSize, String s, Integer yn);
 }

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

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 僵尸计划记录
+ * @Author: jeecg-boot
+ * @Date: 2020-10-14
+ * @Version: V1.0
+ */
+public interface IKuaishouZombieCreativeService extends IService<KuaishouZombieCreative> {
+    /**
+     * 统计僵尸计划
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    void checkZombieProject();
+}

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

@@ -18,15 +18,20 @@ public class KsVideoReportServiceImpl implements IKsVideoReportService {
     KsVideoReportMapper ksVideoReportMapper;
 
     @Override
-    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo) {
         PageHelper.startPage(pageNo,pageSize);
-        List<JSONObject> jsonObjectList=ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        List<JSONObject> jsonObjectList=ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
         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);
+    public List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature) {
+        return ksVideoReportMapper.queryVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan) {
+        return ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
     }
 
 }

+ 3 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java

@@ -180,9 +180,10 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
         JSONObject jsonObject = new JSONObject();
         after.forEach((k, v) -> {
             //去除没法计算的字段
-            if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")) {
+            if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")||before.getString(k).contains("%")) {
                 jsonObject.put(k, "-");
-            } else {
+            }else {
+                System.out.println(k+"--"+after.getBigDecimal(k)+"--"+before.getBigDecimal(k));
                 jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k)==null?zero:after.getBigDecimal(k), before.getBigDecimal(k)==null?zero:before.getBigDecimal(k)));
             }
         });

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

@@ -1,5 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.vo.ByteDanceReportAccountDailyDTOEntity;
+import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
+import cn.com.ctop.common.module.vo.SheetInfoVo;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
@@ -178,4 +181,29 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
         return new PageInfo<>(kuaishouCreativeInfoList);
     }
 
+    @Override
+    public SheetInfoVo getKuaishouSaleProjectInfoSheetVO(String startDate, String endDate, List<Long> projectList, int pageNum, int pageSize, String s, Integer yn) {
+        SheetInfoVo vo = new SheetInfoVo<ByteDanceReportAccountDailyDTOEntity>();
+        if(projectList==null || projectList.size()==0){
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String userId = sysUser.getId();
+            String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
+
+            List<Long> mediaIds = new ArrayList<>();
+            mediaIds.add(2L);
+            mediaIds.add(4L);
+
+            if("admin".equals(roleCode)){
+                projectList = dailyAccountMapper.queryProjectMemberByAdmins(mediaIds);
+            }else{
+                projectList = dailyAccountMapper.queryProjectInfoBySaleId(userId,mediaIds);
+            }
+        }
+
+        List<KuaishouReportAccountDailyDTOEntity> dtos = dailyAccountMapper.getKuaishouProjectInfoEntity(startDate,endDate,projectList,yn);
+        vo.setSheetName("快手销售报表");
+        vo.setDetails(dtos);
+        return vo;
+    }
+
 }

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

@@ -0,0 +1,296 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouZombieCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouZombieCreativeService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.enums.NoEn;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-14
+ */
+@Service
+public class KuaishouZombieCreativeServiceImpl extends ServiceImpl<KuaishouZombieCreativeMapper, KuaishouZombieCreative> implements IKuaishouZombieCreativeService {
+    @Autowired
+    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
+    @Autowired
+    private KuaishouZombieCreativeMapper kuaishouZombieCreativeMapper;
+    @Autowired
+    private KuaiShouCreativeMapper kuaiShouCreativeMapper;
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaiShouUpdateService kuaiShouUpdateService;
+
+    /**
+     * 筛选僵尸计划
+     * 逻辑简述:
+     * 1、以当天时间为节点,往前取五天的数据,若创意消耗(花费)都为0,则获取其数据,并insert为待确认状态的僵尸创意。
+     * 2、获取前一天存储的待确认僵尸计划
+     * 3、步骤二和步骤一的数据作比对筛选,若两组数据都含有该创意时,并且为了保证数据的准确性,还需调用API接口获取当天实时消耗明细,
+     * 若消耗不为0,则表明为真正的僵尸创意,3.1关停创意;3.2然后发送“关停通知”消息;3.3最后更新其状态。
+     * 4、步骤二存在,步骤一不存在说明创意已经活跃,更新其状态为“2”已活跃、反之则是新的待确认僵尸创意,作insert操作
+     * 5、insert操作时,考虑到数据重复的问题,需先查询全部僵尸计划,作筛选比对,已有则更新,否则就新增。
+     * **凡insert数据皆为状态0,待确认僵尸创意,且要发送“提醒通知”。
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+
+    @Override
+    public void checkZombieProject() {
+        //获取五天前的日期 yyyy-MM-dd
+        String date = DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO5.valueInt());
+        //查询五天内花费都为0的数据集
+        List<JSONObject> list = kuaishouReportDailyCreativeMapper.checkZombieProject(date);
+        //查询审核未通过且超过5天的创意集
+        List<JSONObject> olist = kuaiShouCreativeMapper.checkZombieProject(date);
+        if (Check.isNull(list) && Check.isNull(olist)) {
+            return;
+        } else {
+            list.addAll(olist);
+        }
+        //查询数据库中前一天存储的待确认僵尸创意集
+        Map<String, Object> map = new HashMap<>();
+        map.put("record_time", DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO1.valueInt()));
+        map.put("status", NoEn.NO0.valueStr());
+        List<KuaishouZombieCreative> zombieCreatives = kuaishouZombieCreativeMapper.selectByMap(map);
+        if (!Check.isNull(zombieCreatives)) {
+            List<KuaishouZombieCreative> zombiePlans = new ArrayList<>();
+            List<JSONObject> zombieList = new ArrayList<>();
+            //通过账户和创意ID,筛选出确认的僵尸计划账户
+            zombieCreatives.forEach(zombie -> {
+                list.forEach(obj -> {
+                    if (zombie.getAccountId() - obj.getInteger("accountId") == 0 && zombie.getCreativeId() - obj.getInteger("creativeId") == 0) {
+                        QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                        wrapper.eq("id", zombie.getId());
+                        CtopOauthToken token = oauthTokenService.getTokenByAccountId(zombie.getAccountId());
+                        //校验当天是不是依旧不活跃,是则关停,否则更新激活状态
+                        if (isActivation(token, zombie.getCreativeId())) {
+                            //3.1关停创意
+                            Map<String, Object> updateMap = kuaiShouUpdateService.updateCreativeStatus(token.getAccessToken(), zombie.getAccountId(), zombie.getCreativeId(), NoEn.NO2.valueInt(), obj.getString("userId"));
+                            if (!Check.isNull(updateMap) && (boolean) updateMap.get("success")) {
+                                //3.2发送创意关停通知
+                                sendMsg(NoEn.NO2.valueStr(), obj);
+                            }
+                            zombie.setStatus(NoEn.NO1.valueStr());
+                            //记录已确认的僵尸计划集
+                            zombiePlans.add(zombie);
+                            zombieList.add(obj);
+                        } else {
+                            zombie.setStatus(NoEn.NO2.valueStr());
+                        }
+                        //3.3更新状态
+                        kuaishouZombieCreativeMapper.update(zombie, wrapper);
+                        //校验数据为审核未通过数据,并将投放状态设为“暂停”
+                        if (Check.isNull(obj.getInteger("dates"))) {
+                            QueryWrapper<KuaiShouCreative> creativeWrapper = new QueryWrapper<>();
+                            creativeWrapper.eq("id", obj.getString("id"));
+                            KuaiShouCreative creative = new KuaiShouCreative();
+                            //投放状态 1:投放中;2:暂停
+                            creative.setPutStatus(NoEn.NO2.valueInt());
+                            kuaiShouCreativeMapper.update(creative, creativeWrapper);
+                        }
+                    }
+                });
+            });
+            //过滤掉已确认的僵尸数据,剩余活跃的计划
+            zombieCreatives.removeAll(zombiePlans);
+            //更新计划状态为已活跃
+            zombieCreatives.forEach(zom -> {
+                QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                wrapper.eq("id", zom.getId());
+                //状态 0-待确认,1-是僵尸计划,2-已活跃,不是僵尸计划
+                zom.setStatus(NoEn.NO2.valueStr());
+                kuaishouZombieCreativeMapper.update(zom, wrapper);
+            });
+            //过滤掉已确认的数据,新增新一批的僵尸计划
+            list.removeAll(zombieList);
+            insertorUpdate(list);
+        } else {
+            insertorUpdate(list);
+        }
+    }
+
+    /**
+     * 筛选僵尸计划数据,新增或更新操作
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void insertorUpdate(List<JSONObject> list) {
+        //查询库中已有的全部数据
+        List<KuaishouZombieCreative> kuaishouZombieCreatives = kuaishouZombieCreativeMapper.selectList(null);
+        if (!Check.isNull(kuaishouZombieCreatives)) {
+            List<KuaishouZombieCreative> updateList = new ArrayList<>();
+            List<JSONObject> toBeDeleted = new ArrayList<>();
+            //待新增的和库中数据对比筛选,选出相同账户和相同创意的数据
+            list.forEach(obj -> {
+                kuaishouZombieCreatives.forEach(zom -> {
+                    if (zom.getAccountId() - obj.getInteger("accountId") == 0 && zom.getCreativeId() - obj.getInteger("creativeId") == 0) {
+                        updateList.add(zom);
+                        toBeDeleted.add(obj);
+                    }
+                });
+            });
+            //已有的数据作更新操作
+            if (!Check.isNull(updateList)) {
+                updateList.forEach(zom -> {
+                    QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                    wrapper.eq("id", zom.getId());
+                    zom.setStatus(NoEn.NO0.valueStr());
+                    zom.setRecordTime(DateUtils.getNowDate(DateUtils.WEB_FORMAT));
+                    kuaishouZombieCreativeMapper.update(zom, wrapper);
+                });
+            }
+            //去除已有的数据,新的数据作insert
+            list.removeAll(toBeDeleted);
+            insert(list);
+        } else {
+            insert(list);
+        }
+    }
+
+    /**
+     * 新增待确认僵尸数据,并发送消息通知
+     * userAllocation
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void insert(List<JSONObject> list) {
+        list.forEach(obj -> {
+            KuaishouZombieCreative create = new KuaishouZombieCreative();
+            create.setAccountId(obj.getLong("accountId"));
+            create.setCreativeId(obj.getLong("creativeId"));
+            create.setCreativeName(obj.getString("creativeName"));
+            create.setRecordTime(DateUtils.getNowDate(DateUtils.WEB_FORMAT));
+            //状态 0-待确认,1-是僵尸计划,2-已活跃,不是僵尸计划
+            create.setStatus(NoEn.NO0.valueStr());
+            kuaishouZombieCreativeMapper.insert(create);
+            sendMsg(NoEn.NO1.valueStr(), obj);
+        });
+    }
+
+    /**
+     * 发送消息通知
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void sendMsg(String type, JSONObject obj) {
+        String userId = userAllocationMapper.queryUserIdByAccountId(obj.getLong("accountId"));
+        String message = "";
+        if (NoEn.NO1.valueStr().equals(type)) {
+            //提醒通知
+            message = messageTemplate.getZombieCreativeRemindTemplate(obj);
+        } else {
+            //关停通知
+            message = messageTemplate.getZombieCreativeShutDownTemplate(obj);
+        }
+        sendMessageService.sendMessage(userId, message);
+    }
+
+    /**
+     * 检查创意是否激活
+     *
+     * @param
+     * @return boolean
+     * @throws
+     * @author ZHAOXA
+     */
+    private boolean isActivation(CtopOauthToken oauthToken, long creativeId) {
+        boolean flag = true;
+        try {
+            JSONArray creativeIds = new JSONArray();
+            creativeIds.add(creativeId);
+            JSONObject info = getAdvertiserCreativeReportDailyInfo(oauthToken, new Date(), new Date(), creativeIds);
+            if (!Check.isNull(info) && !Check.isNull(info.getBigDecimal("charge"))) {
+                flag = false;
+            }
+        } catch (Exception e) {
+            log.error("校验创意是否激活,异常", e);
+            //异常时,默认为激活状态
+            flag = false;
+        }
+        return flag;
+    }
+
+    private JSONObject getAdvertiserCreativeReportDailyInfo(CtopOauthToken token, Date startDate, Date endDate, JSONArray creativeIds) throws Exception {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+        Map<String, Object> param = new HashMap<String, Object>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", DateUtils.formatDate(startDate));
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", DateUtils.formatDate(endDate));
+        }
+        if (!Check.isNull(creativeIds) && creativeIds.size() > 0) {
+            param.put("creative_ids", creativeIds);
+
+        }
+        param.put("advertiser_id", token.getAccountId());
+        param.put("temporal_granularity", "DAILY");
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            throw new Exception("获取快手广告创意分天报表异常:" + message + ",accountId:" + token.getAccountId());
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return null;
+        }
+        return (JSONObject) details.get(0);
+    }
+
+
+}

+ 1 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java

@@ -356,7 +356,7 @@ public class WechatNoListServiceImpl extends ServiceImpl<WechatNoListMapper, Wec
                 Integer dur = Integer.valueOf(attendance.getStateDuration().replace(" min", ""));
                 if (dur - 60 >= 0) {
                     String checkinDate = attendance.getCheckinDate();
-                    String lastDay = DateUtils.getLastDay(checkinDate);
+                    String lastDay = DateUtils.getLastDay(checkinDate, NoEn.NO1.valueInt());
                     Map<String, Object> map = new HashMap<>();
                     map.put("userId", attendance.getUserId());
                     map.put("checkinDate", lastDay);

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

@@ -468,8 +468,7 @@ public class BytedanceReportController {
      *
      * @return
      */
-    @RequestMapping(value = "/exportBytedanceSaleProjectInfo")
-    @ResponseBody
+    @PostMapping(value = "/exportBytedanceSaleProjectInfo")
     public void exportXxl(@RequestBody BytedanceInfoDTO dto,HttpServletResponse response) throws IOException {
         List<SheetInfoVo> sheets = new ArrayList<>();
         if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
@@ -482,9 +481,7 @@ public class BytedanceReportController {
             dto.setEndDate(dateString);
         }
 
-        if(dto.getPageSize() == 0 ){
-            dto.setPageSize(1000000000);
-        }
+        dto.setPageSize(1000000000);
         //查询总的消耗信息
         SheetInfoVo totalSheetVo = bytedanceAccountReportService.getBytedanceSaleProjectInfoSheetVO(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),dto.getSort(), dto.getYn());
         OutputStream outputStream = response.getOutputStream();

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

@@ -46,18 +46,21 @@ public class BytedanceVideoReportCtrl {
             JSONArray accountIds = requestBody.getJSONArray("accountIds");
             String startDate = requestBody.getString("startDate");
             String endDate = requestBody.getString("endDate");
+            String clip = requestBody.getString("clip");
+            String shot = requestBody.getString("shot");
+            String plan = requestBody.getString("plan");
             String target = requestBody.getString("target");
             String order = requestBody.getString("order");
-            int pageSize= requestBody.getInteger("pageSize");
-            int pageNo= requestBody.getInteger("pageNo");
+            int pageSize = requestBody.getInteger("pageSize");
+            int pageNo = requestBody.getInteger("pageNo");
 
             String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
 
             try {
-                if(accountIds.isEmpty()){
-                    accountIds=null;
+                if (accountIds.isEmpty()) {
+                    accountIds = null;
                 }
-                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot,plan,pageSize, pageNo);
                 result.setResult(listData);
                 result.setSuccess(true);
             } catch (Exception e) {
@@ -68,47 +71,104 @@ public class BytedanceVideoReportCtrl {
         return result;
     }
 
-    @PostMapping("/report/excel")
+    @PostMapping("/detail")
+    public Result<List<JSONObject>> getReportDetail(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            result.setSuccess(false);
+        } else {
+
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String signature = requestBody.getString("signature");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
+
+            try {
+                if (accountIds.isEmpty()) {
+                    accountIds = null;
+                }
+                List<JSONObject> listData = bytedanceVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filedAll,signature);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/excel")
     public void getExcelReport(@RequestBody JSONObject requestBody,
                                HttpServletRequest request,
                                HttpServletResponse response) {
-        JSONArray columns=requestBody.getJSONArray("columns");
-        if(columns.isEmpty()){
-            log.error("请选择需要导出的字段");
+        //加一个参数区分是table页,还是详情页。
+        String exportType= requestBody.getString("exportType");
+        if(exportType.isEmpty()){
+            return;
         }
-        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));
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
+            //默认消耗必查
+            columns.add("cost");
+        }
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo, columns);
+        List<String> titles = new ArrayList<>();
         //此处增加两个元素是为了保证数据顺序
-        columns.add(0,"url");
-        columns.add(1,"materialName");
-        columns.add(2,"projectName");
-        columns.add(3,"createTime");
+        if(exportType.equals("exportDetail")){
+            titles.add(0,"客户");
+            titles.add(1,"项目名称");
+            titles.add(2,"时间");
+            titles.add(3,"消耗");
+            columns.add(0, "advertiserName");
+            columns.add(1, "projectName");
+            columns.add(2, "statDate");
+        }else{
+            titles.add(0,"唯一标识");
+            titles.add(1,"视频");
+            titles.add(2,"视频名称");
+            titles.add(3,"项目名称");
+            titles.add(4,"上传时间");
+            columns.add(0, "signature");
+            columns.add(1, "url");
+            columns.add(2, "materialName");
+            columns.add(3, "projectName");
+            columns.add(4, "createTime");
+        }
+
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if(accountIds.isEmpty()){
-            accountIds=null;
+        if (accountIds.isEmpty()) {
+            accountIds = null;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
+        String signature = requestBody.getString("signature");
+        String clip = requestBody.getString("clip");
+        String shot = requestBody.getString("shot");
+        String plan = requestBody.getString("plan");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
-        List<JSONObject> excelData= bytedanceVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
-        if(excelData.isEmpty()){
+        List<JSONObject> excelData=null;
+        if(exportType.equals("exportTable")){
+            excelData = bytedanceVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order,clip,shot,plan);
+        }else if(exportType.equals("exportDetail")){
+            excelData = bytedanceVideoReportService.getVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+        }
+        if (null!=excelData&&excelData.isEmpty()) {
             return;
         }
-        List<List<Object>> excelList= new ArrayList<>();
-        excelData.forEach(data->{
-            List<Object> temp= new ArrayList<>();
-            columns.forEach(k->{
+        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{
+        try {
             String[] headers = titles.toArray(new String[titles.size()]);
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
@@ -118,9 +178,8 @@ public class BytedanceVideoReportCtrl {
             workbook.write(os);
             os.flush();
             os.close();
-        }catch (IOException e){
+        } catch (IOException e) {
             log.error(e.getMessage());
         }
     }
-
 }

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

@@ -8,6 +8,7 @@ import java.util.List;
 
 public interface BytedanceVideoReportMapper {
 
-    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);
+    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,@Param("clip") String clip,@Param("shot") String shot,@Param("plan") String plan);
 
+    List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("signature") String signature);
 }

+ 84 - 92
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml

@@ -675,202 +675,194 @@
         b.advertiser_id as advertiserId,
         b.advertiser_name as advertiserName,
         a.stat_datetime as statDatetime,
-        sum(a.cost) as cost,  -- 消耗
+        sum(a.cost) as cost,
         d.signature as signature,
         d.video_url as videoUrl,
         e.url as url,
         '-' as materialDesc,
         1 as appType,
-        sum(a.click) as click,   -- 点击数
+        sum(a.click) as click,
         case
         when sum(a.total_play) != 0
         then sum(a.play25_feed_break)/sum(a.total_play)
-        else 0 end as play25FeedBreakRate,  -- 25%进度播放率
+        else 0 end as play25FeedBreakRate,
 
         case
         when sum(a.total_play) != 0
         then sum(a.play_over)/sum(a.total_play)
-        else 0 end as playOverRate,  -- 整体完播率
-
+        else 0 end as playOverRate,
         case
         when sum(a.click) != 0
         then sum(a.convert_material)/sum(a.click)
-        else 0 end as convertRate,  -- 转化率  转化数/点击数*100% !
-        sum(a.active) as active, -- 应用下载-激活
-        sum(a.download_finish) as downloadFinish, -- 应用下载-安卓下载完成
-        sum(a.download_start) as downloadStart, -- 应用下载-安卓下载开始
-        sum(a.install_finish) as installFinish, -- 应用下载-安卓安装完成
-        sum(a.register) as register, -- 应用下载-注册
-        sum(a.pay_count) as payCount, -- 应用下载-付费数
-        sum(a.in_app_uv) as inAppUv, -- 应用下载-到达uv
-        sum(a.in_app_detail_uv) as inAppDetailUv, -- 应用下载-详情页到站uv
-        sum(a.in_app_cart) as inAppCart, -- 应用下载-加入购物车
-        sum(a.in_app_order) as inAppOrder, -- 应用下载-提交订单
-        sum(a.in_app_pay) as inAppPay, -- 应用下载-付费
-        sum(a.phone) as phone, -- 落地页-电话拨打数
-        sum(a.form) as form, --  表单提交数
-        sum(a.map_search) as mapSearch, -- 落地页-地图搜索
-        sum(a.button) as button, -- 落地页-按钮button
-        sum(a.view_material) as viewMaterial, -- 落地页-关键页面浏览
-        sum(a.qq) as qq, -- 落地页-QQ咨询数
-        sum(a.lottery) as lottery, -- 落地页-抽奖数
-        sum(a.vote) as vote, -- 落地页-投票
-        sum(a.redirect) as redirect, -- 落地页-页面跳转
-        sum(a.shopping) as shopping, -- 落地页-商品购买
-        sum(a.consult) as consult, -- 落地页-在线咨询
-        sum(a.wechat) as wechat, -- 落地页-微信
-        sum(a.phone_confirm) as phoneConfirm, -- 落地页-智能电话确认拨打
-        sum(a.phone_connect) as phoneConnect, -- 落地页-智能电话确认接通
-        sum(a.consult_effective) as consultEffective, -- 落地页-智能电话有效咨询
-        sum(a.total_play) as totalPlay, -- 视频-总播放
-        sum(a.valid_play) as validPlay, -- 视频-有效播放
-        sum(a.wifi_play) as wifiPlay, -- 视频-wifi播放
-        sum(a.play25_feed_break) as play25FeedBreak, -- 视频-播放25%进度总数
-        sum(a.play50_feed_break) as play50FeedBreak, -- 视频-播放50%进度总数
-        sum(a.play75_feed_break) as play75FeedBreak, -- 视频-播放75%进度总数
-        sum(a.play100_feed_break) as play100FeedBreak, -- 视频-播放100%进度总数
-        sum(a.advanced_creative_phone_click) as advancedCreativePhoneClick, -- 附加创意-电话按钮
-        sum(a.advanced_creative_counsel_click) as advancedCreativeCounselClick, -- 附加创意-在线咨询
-        sum(a.advanced_creative_form_click) as advancedCreativeFormClick, -- 附加创意-表单提交
-        sum(a.share_material) as shareMaterial, -- 互动数据-分享数
-        sum(a.comment_material) as commentMaterial, -- 互动数据-评论数
-        sum(a.follow) as follow, -- 互动数据-新增关注数
-        sum(a.home_visited) as homeVisited, -- 互动数据-主页访问量
-        sum(a.ies_challenge_click) as iesChallengeClick, -- 互动数据-挑战赛查看数
-        sum(a.ies_music_click) as iesMusicClick, -- 互动数据-音乐查看数
-        sum(a.next_day_open) as nextDayOpen, -- 次留数
+        else 0 end as convertRate,
+        sum(a.active) as active,
+        sum(a.download_finish) as downloadFinish,
+        sum(a.download_start) as downloadStart,
+        sum(a.install_finish) as installFinish,
+        sum(a.register) as register,
+        sum(a.pay_count) as payCount,
+        sum(a.in_app_uv) as inAppUv,
+        sum(a.in_app_detail_uv) as inAppDetailUv,
+        sum(a.in_app_cart) as inAppCart,
+        sum(a.in_app_order) as inAppOrder,
+        sum(a.in_app_pay) as inAppPay,
+        sum(a.phone) as phone,
+        sum(a.form) as form,
+        sum(a.map_search) as mapSearch,
+        sum(a.button) as button,
+        sum(a.view_material) as viewMaterial,
+        sum(a.qq) as qq,
+        sum(a.lottery) as lottery,
+        sum(a.vote) as vote,
+        sum(a.redirect) as redirect,
+        sum(a.shopping) as shopping,
+        sum(a.consult) as consult,
+        sum(a.wechat) as wechat,
+        sum(a.phone_confirm) as phoneConfirm,
+        sum(a.phone_connect) as phoneConnect,
+        sum(a.consult_effective) as consultEffective,
+        sum(a.total_play) as totalPlay,
+        sum(a.valid_play) as validPlay,
+        sum(a.wifi_play) as wifiPlay,
+        sum(a.play25_feed_break) as play25FeedBreak,
+        sum(a.play50_feed_break) as play50FeedBreak,
+        sum(a.play75_feed_break) as play75FeedBreak,
+        sum(a.play100_feed_break) as play100FeedBreak,
+        sum(a.advanced_creative_phone_click) as advancedCreativePhoneClick,
+        sum(a.advanced_creative_counsel_click) as advancedCreativeCounselClick,
+        sum(a.advanced_creative_form_click) as advancedCreativeFormClick,
+        sum(a.share_material) as shareMaterial,
+        sum(a.comment_material) as commentMaterial,
+        sum(a.follow) as follow,
+        sum(a.home_visited) as homeVisited,
+        sum(a.ies_challenge_click) as iesChallengeClick,
+        sum(a.ies_music_click) as iesMusicClick,
+        sum(a.next_day_open) as nextDayOpen,
         case
         when sum(a.active) != 0
         then sum(a.next_day_open)/sum(a.active)
-        else 0 end as nextDayOpenRate, -- 次留率 = 次留数/激活数
+        else 0 end as nextDayOpenRate,
 
         case
         when sum(a.next_day_open) != 0
         then sum(a.cost)/sum(a.next_day_open)
-        else 0 end as nextDayOpenCost, -- 次留成本 = 消耗/次留数
+        else 0 end as nextDayOpenCost,
 
         case when sum(a.pay_count) != 0
         then sum(a.cost)/sum(a.pay_count)
         else 0 end
-        as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
+        as activePayCost,
 
-        sum(a.active_pay_amount) as activePayAmount, -- 应用下载广告数据-付费次数
+        sum(a.active_pay_amount) as activePayAmount,
 
         case
         when sum(a.valid_play) != 0
         then sum(a.cost)/sum(a.valid_play)
-        else 0 end validPlayCost, -- 视频数据-有效播放成本  计算公式:总花费/有效播放数,当天数据可能会有波动,次日早8点后稳定。
-        sum(a.advanced_creative_coupon_addition) as advancedCreativeCouponAddition, -- 附加创意-附加创意卡券领取
-        sum(a.convert_material) as convertMaterial, -- 转化数据-转化数
+        else 0 end validPlayCost,
+        sum(a.advanced_creative_coupon_addition) as advancedCreativeCouponAddition,
+        sum(a.convert_material) as convertMaterial,
 
         case
         when sum(a.active_pay_amount) != 0
         then sum(a.cost)/sum(a.active_pay_amount)
-        else 0 end as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
-        sum(a.download) as download, -- 落地页转化数据-下载开始
-
+        else 0 end as activePayCost,
+        sum(a.download) as download,
         case
         when sum(a.click) != 0
         then sum(a.cost) / sum(a.click)
-        else 0 end                           as cpc,                            -- 平均点击单价
-        sum(a.location_click) as locationClick, -- 互动数据-POI点击数
+        else 0 end                           as cpc,
+        sum(a.location_click) as locationClick,
 
         case
         when sum(a.show_material) != 0
         then sum(a.click)/sum(a.show_material)
-        else 0 end as ctr, -- 展现数据-点击率   广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
+        else 0 end as ctr,
 
         case
         when sum(a.show_material) != 0
         then sum(a.cost)/sum(a.show_material)*1000
-        else 0 end cpm, -- 平均千次展现费用  广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
-        sum(a.wifi_play_rate) as wifiPlayRate, -- 视频数据-WiFi播放占比
-        sum(a.like_material) as likeMaterial, -- 互动数据-点赞数
+        else 0 end cpm,
+        sum(a.wifi_play_rate) as wifiPlayRate,
+        sum(a.like_material) as likeMaterial,
 
         case
         when sum(a.active) != 0
         then sum(a.cost)/sum(a.active)
-        else 0 end activeCost, -- 应用下载广告数据-激活成本  计算方式:总花费/激活数。
+        else 0 end activeCost,
 
         case
         when sum(a.game_addiction) != 0
         then sum(a.cost)/sum(a.game_addiction)
-        else 0 end as gameAddictionCost, -- 应用下载广告数据-关键行为成本  广告主为每个有APP内关键行为的用户所付出的成本,计算公式是总花费/关键行为数。当天数据可能会有波动,次日早8点后稳定。
-        sum(a.game_addiction) as gameAddiction, -- 应用下载广告数据-关键行为数
+        else 0 end as gameAddictionCost,
+        sum(a.game_addiction) as gameAddiction,
 
         case
         when sum(a.click) != 0
         then sum(a.active)/sum(a.click)
-        else 0 end as activeRate, -- 应用下载广告数据-激活率   计算方式:激活数/点击数*100%
+        else 0 end as activeRate,
 
         case
         when sum(a.active) != 0
         then sum(a.game_addiction)/sum(a.active)
-        else 0 end gameAddictionRate, -- 应用下载广告数据-关键行为率  关键行为用户占激活用户的比例
-
+        else 0 end gameAddictionRate,
         case
         when sum(a.active) != 0
         then sum(a.register)/sum(a.active)
-        else 0 end as activeRegisterRate, -- 应用下载广告数据-注册率   注册用户占激活用户的比例
-
+        else 0 end as activeRegisterRate,
 
         case
         when sum(a.download_finish) != 0
         then sum(a.cost)/sum(a.download_finish)
-        else 0 end as downloadFinishCost, -- 应用下载广告数据-安卓下载完成成本 计算方式:总花费/安卓下载完成数。
+        else 0 end as downloadFinishCost,
 
 
         case
         when sum(a.register) != 0
         then sum(a.cost)/sum(a.register)
-        else 0 end as activeRegisterCost, -- 应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
-        sum(a.show_material) as showMaterial, -- 展现数据-展示数
+        else 0 end as activeRegisterCost,
+        sum(a.show_material) as showMaterial,
 
         case
         when sum(a.download_start) != 0
         then sum(a.download_finish)/sum(a.download_start)
-        else 0 end as downloadFinishRate, -- 应用下载广告数据-安卓下载完成率  计算方式:安卓下载完成数/安卓下载开始数
+        else 0 end as downloadFinishRate,
 
         case
         when sum(a.download_finish) != 0
         then sum(a.install_finish)/sum(a.download_finish)
-        else 0 end as installFinishRate, -- 应用下载广告数据-安卓安装完成率  计算方式:安卓安装完成数/安卓下载完成数
-        sum(a.coupon) as coupon, -- 落地页转化数据-建站卡券领取
-        sum(a.coupon_single_page) as couponSinglePage, -- 落地页转化数据-卡券页领取
-        sum(a.play_over) as playOver, -- 完播数
+        else 0 end as installFinishRate,
+        sum(a.coupon) as coupon,
+        sum(a.coupon_single_page) as couponSinglePage,
+        sum(a.play_over) as playOver,
 
         case
         when sum(a.download_start) != 0
         then sum(a.cost)/sum(a.download_start)
-        else 0 end as downloadStartCost, -- 应用下载广告数据-安卓下载开始成本  计算方法:总花费/安卓下载开始数。
-        sum(a.message) as message, -- 落地页转化数据-短信咨询  用户点击短信咨询的次数
-        <!-- sum(a.play_duration) as playDuration, --> --
-
+        else 0 end as downloadStartCost,
+        sum(a.message) as message,
         case
         when sum(a.show_material) != 0
         then sum(a.valid_play)/sum(a.show_material)
-        else 0 end as validPlayRate, -- 视频数据-有效播放率  有效播放数/展示数
+        else 0 end as validPlayRate,
 
         case
         when sum(a.valid_play) != 0
         then sum(a.average_play_time_per_play*a.valid_play)/sum(a.valid_play)
-        else 0 end as averagePlayTimePerPlay,         -- 视频数据-平均单次播放时长
-
+        else 0 end as averagePlayTimePerPlay,
         case
         when sum(a.convert_material) != 0
         then sum(a.cost)/sum(a.convert_material)
-        else 0 end as convertCost, --  转化数据-转化成本=总花费/转化数
-        <!--  sum(a.convert_show_rate) as convert_show_rate, --> --
+        else 0 end as convertCost,
 
         case
         when sum(a.install_finish) != 0
         then sum(a.cost)/sum(a.install_finish)
-        else 0 end as installFinishCost, --  应用下载广告数据-安卓安装完成成本  计算方式:总花费/安卓安装完成数
+        else 0 end as installFinishCost,
 
         case
         when sum(a.click) != 0
         then sum(a.download_start)/sum(a.click)
-        else 0 end as downloadStartRate, --  应用下载广告数据-安卓下载开始率  计算方法:安卓下载开始数/点击数
+        else 0 end as downloadStartRate,
     </sql>
 
     <select id="videoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">

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

@@ -3,19 +3,15 @@
 <mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceVideoReportMapper">
 
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        SELECT * from (SELECT
         t1.signature,
         t2.url,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.clip_id=u.id where t3.material_id=t1.signature limit 1) AS clip,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where t3.material_id=t1.signature limit 1) AS shot,
+        (SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where t3.material_id=t1.signature limit 1) AS plan,
         t2.cover_url as converUrl,
         t2.material_name AS materialName,
-        (
-        SELECT
-        project_name
-        FROM
-        ctop_project t4
-        WHERE
-        t4.id = t3.project_id
-        ) AS projectName,
+        (SELECT project_name FROM ctop_project t4 WHERE t4.id = t3.project_id) AS projectName,
         t2.create_time as createTime,
         ${filed}
         FROM
@@ -34,6 +30,53 @@
         </if>
         AND t2.url!=""
         GROUP BY t1.signature
+        ) t
+        WHERE t.clip like '%${clip}%'
+        AND (t.shot LIKE '%%' or t.shot is null)
+        AND t.plan like '%${plan}%'
         ORDER BY ${target} ${order}
     </select>
+
+    <select id="queryVideoDetailBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.stat_datetime as statDate,
+        t1.signature,
+        t2.url,
+        t2.cover_url as converUrl,
+        t2.material_name AS materialName,
+        (
+        SELECT
+        project_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id
+        ) AS projectName,
+        (
+        SELECT
+        advertiser_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id limit 1
+        ) AS advertiserName,
+        t2.create_time as createTime,
+        ${filed}
+        FROM
+        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 t1.signature=#{signature}
+        AND 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>
+        </if>
+        AND t2.url!=""
+        GROUP BY t1.signature,t1.stat_datetime
+    </select>
 </mapper>

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

@@ -8,7 +8,9 @@ import java.util.List;
 
 public interface IBytedanceVideoReportService {
 
-    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo);
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo);
 
-    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
+    List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature);
+
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
 }

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

@@ -187,7 +187,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
         JSONObject jsonObject = new JSONObject();
         after.forEach((k, v) -> {
             //去除没法计算的字段
-            if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")) {
+            if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")||before.getString(k).contains("%")) {
                 jsonObject.put(k, "-");
             } else {
                 jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k)==null?zero:after.getBigDecimal(k), before.getBigDecimal(k)==null?zero:before.getBigDecimal(k)));
@@ -228,7 +228,6 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
         if(projectList==null || projectList.size()==0){
             LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             String userId = sysUser.getId();
-            //String userId = "388e787edd294ecfb9243fe176a3ae56";
             String roleCode = bytedanceAccountReportMapper.getRoleCodeByUserId(userId);
 
             List<Long> mediaIds = new ArrayList<>();

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

@@ -18,15 +18,20 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
     BytedanceVideoReportMapper bytedanceVideoReportMapper;
 
     @Override
-    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo) {
         PageHelper.startPage(pageNo,pageSize);
-        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
         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);
+    public List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature) {
+        return bytedanceVideoReportMapper.queryVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan) {
+        return bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
     }
 
 }