Browse Source

快手 视频报表 权限 调整

zhaoxian 3 years ago
parent
commit
e26a180db2

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoStrategy.java

@@ -277,6 +277,11 @@ public class AiKuaishouAccountAutoStrategy {
     private String stickerTitle;
 
     /**
+     * 是否使用优质定向,0关闭,1开启
+     */
+    private Integer systemOptimization;
+
+    /**
      * 行为意向-系统优选,0关闭,1开启
      */
     private Integer intentionTarget;

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -347,7 +347,7 @@ public class AccountReportConstants {
             "    \"comment\": \"按钮点击率\"\n" +
             "  },\n" +
             "  \"play3sRate\": {\n" +
-            "    \"filed\": \"(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(aclick) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.aclick),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate\",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
@@ -550,7 +550,7 @@ public class AccountReportConstants {
             "    \"comment\": \"按钮点击率\"\n" +
             "  },\n" +
             "  \"play3sRate\": {\n" +
-            "    \"filed\": \"(CASE WHEN  sum(t1.aclick) != 0 THEN round( sum(t1.play_3s_ratio * t1.aclick) / sum(t1.aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(aclick) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.aclick),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate\",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
             "  \"keyAction\": {\n" +

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

@@ -1,10 +1,37 @@
 package org.jeecg.modules.ctop.controller;
 
 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.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.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
-import cn.com.ctop.common.module.service.*;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+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.IProductService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+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.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
@@ -25,13 +52,25 @@ 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.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -79,6 +118,8 @@ public class MaterialInfoController {
     private IProjectService projectService;
     @Autowired
     private IProjectMemberService projectMemberService;
+    @Resource
+    IUserCompanyService userCompanyService;
     @Autowired
     private IByteDanceCreativeWordPackageService byteDanceGeneralCopywriterService;
 
@@ -351,15 +392,20 @@ public class MaterialInfoController {
             if (!Check.isNull(projectId)) {
                 projectIds.add(projectId);
             } else if (!Check.isNull(productId)) {
-                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
                 List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
                 projectIds.addAll(partakeProjectIds);
                 projectIds.addAll(productProjectIds);
             } else {
-                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(null, userId);
-                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(null, partakeProjectIds);
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(null, userId, null, null);
+//                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(null, partakeProjectIds);
                 projectIds.addAll(partakeProjectIds);
-                projectIds.addAll(productProjectIds);
+//                projectIds.addAll(productProjectIds);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
             }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
 
@@ -368,26 +414,86 @@ public class MaterialInfoController {
             if (!Check.isNull(projectId)) {
                 projectIds.add(projectId);
             } else if (!Check.isNull(productId)) {
-                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
             } else {
-                projectIds = projectMemberService.getProjectIdsByProductId(null, userId);
+                projectIds = projectMemberService.getProjectIdsByProductId(null, userId, null, null);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
             }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
         } else if ("CompanyManager".equals(roleCode)) {
-            projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (Check.isNull(userCompany)) {
+                return null;
+            }
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, null, userCompany.getCompanyId(), null);
+                projectIds.addAll(partakeProjectIds);
+            } else {
+                projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
+            }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
         } else if ("bytedanceDirector".equals(roleCode)) {
-            projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (Check.isNull(userCompany)) {
+                return null;
+            }
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, null, userCompany.getCompanyId(), "1");
+                projectIds.addAll(partakeProjectIds);
+            } else {
+                projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
+            }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
         } else if ("kuaishouDirector".equals(roleCode)) {
-            projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (Check.isNull(userCompany)) {
+                return null;
+            }
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId, userCompany.getCompanyId(), "2");
+                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
+                projectIds.addAll(partakeProjectIds);
+                projectIds.addAll(productProjectIds);
+            } else {
+                projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
+            }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
         } else {
             //查询自己上传的视频
             if (!Check.isNull(projectId)) {
                 projectIds.add(projectId);
             } else if (!Check.isNull(productId)) {
-                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId);
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
+            }
+            if (Check.isNull(projectIds) || projectIds.isEmpty()) {
+                Map<String, Object> result = new HashMap<>();
+                ResultMapUtils.setResultMap(result, StatusCode.CTOP_PROJECT_NOT_EXIST);
+                return result;
             }
             return materialInfoService.getListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, userId, clipId, shotId, planId, leaderName, offlineFlag, pageNo, pageSize, syncKuaishou, syncBytedance, materialInnovate);
         }

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java

@@ -51,7 +51,7 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<ProjectMember> getProductIds(@Param("userId") String userId, @Param("mediaList") List<Integer> mediaList, @Param("productId") Long productId);
 
-    List<Long> getProjectIdsByProductId(@Param("productId") Long productId, @Param("userId") String userId);
+    List<Long> getProjectIdsByProductId(@Param("productId") Long productId, @Param("userId") String userId, @Param("companyId") String companyId,@Param("mediaId") String mediaId);
 
-    List<ProjectMember> getlistByUserId(@Param("userId")String userId);
+    List<ProjectMember> getlistByUserId(@Param("userId") String userId);
 }

+ 11 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml

@@ -273,11 +273,20 @@
         FROM
         ctop_project t1
         LEFT JOIN ctop_project_member t2 ON t1.id = t2.project_id
-        WHERE
-        t2.user_id = #{userId}
+        <where>
+        <if test="userId != null and userId != ''">
+             AND t2.user_id = #{userId}
+        </if>
+        <if test="mediaId != null and mediaId != ''">
+             AND t1.media_id = #{mediaId}
+        </if>
+        <if test="companyId != null and companyId != ''">
+            AND t1.company_id = #{companyId}
+        </if>
         <if test="productId != null and productId != ''">
             AND t1.product_id = #{productId}
         </if>
+        </where>
         GROUP BY
         t1.id
     </select>

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

@@ -52,7 +52,7 @@ public interface IProjectMemberService extends IService<ProjectMember> {
 
     List<ProjectMember> getOwnProducts(List<Integer> mediaList, Long productId);
 
-    List<Long> getProjectIdsByProductId(Long productId, String userId);
+    List<Long> getProjectIdsByProductId(Long productId, String userId,String companyId,String mediaId);
 
 
 }

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

@@ -459,8 +459,8 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
     }
 
     @Override
-    public List<Long> getProjectIdsByProductId(Long productId, String userId) {
-        return memberMapper.getProjectIdsByProductId(productId, userId);
+    public List<Long> getProjectIdsByProductId(Long productId, String userId,String companyId,String mediaId) {
+        return memberMapper.getProjectIdsByProductId(productId, userId, companyId,mediaId);
     }
 
 }