Browse Source

Merge branch 'test' into test_v2

yumeng 5 năm trước cách đây
mục cha
commit
908d71f141
33 tập tin đã thay đổi với 1874 bổ sung151 xóa
  1. 5 6
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  3. 46 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java
  5. 38 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  6. 0 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoPartController.java
  7. 25 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/EffiVideoJob.java
  8. 10 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MergeVideoJob.java
  9. 32 26
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  10. 39 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java
  11. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  12. 107 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  13. 25 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/EffiRateComparator.java
  14. 25 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/UserDto.java
  15. 12 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysRoleMapper.java
  16. 40 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysRoleMapper.xml
  17. 31 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
  18. 721 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  19. 6 0
      jeecg-boot-module-system/src/main/resources/quartz.properties
  20. 0 2
      module-common/pom.xml
  21. 98 53
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  22. 16 18
      module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java
  23. 5 2
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/mapper/xml/PerformanceMapper.xml
  24. 4 3
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceOptimizerServiceImpl.java
  25. 15 11
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceServiceImpl.java
  26. 1 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/vo/OptimizerCostDetailVO.java
  27. 32 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/DesignMaterialInfo.java
  28. 22 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/EffiVideoDTO.java
  29. 13 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/ProjectDTO.java
  30. 79 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysRole.java
  31. 142 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysUser.java
  32. 38 3
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java
  33. 235 1
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

+ 5 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -76,11 +76,11 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/appium/crawler/startJob", "anon");
 
 		//优化师相关
-		filterChainDefinitionMap.put("/ctop/performanceOptimizer/detail", "anon");
-		filterChainDefinitionMap.put("/ctop/performanceOptimizer/ranking/list", "anon");
-		filterChainDefinitionMap.put("/ctop/performance/project/list", "anon");
-		filterChainDefinitionMap.put("/ctop/performance/account/list", "anon");
-		filterChainDefinitionMap.put("/ctop/optimizerRoleInfo/manager/detail", "anon");
+		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/detail", "anon");
+		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/ranking/list", "anon");
+		//filterChainDefinitionMap.put("/ctop/performance/project/list", "anon");
+		//filterChainDefinitionMap.put("/ctop/performance/account/list", "anon");
+		//filterChainDefinitionMap.put("/ctop/optimizerRoleInfo/manager/detail", "anon");
 
 
         filterChainDefinitionMap.put("/generic/**", "anon");
@@ -129,7 +129,6 @@ public class ShiroConfig {
         //文件上传接口
 		filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
-		filterChainDefinitionMap.put("/ctop/materialpart/merge","anon");
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
         filterChainDefinitionMap.put("/qywexin", "anon");

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -85,7 +85,7 @@ public class AdvertiserController {
         Result<IPage<Advertiser>> result = new Result<IPage<Advertiser>>();
         String roleCode = materialReportMapper.getRoleCodeByUserId(advertiser.getUserId());
         String userId = advertiser.getUserId();
-        if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode)) {
+        if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode)|| "touTiaoOperationManager".equals(roleCode)) {
             advertiser.setUserId(null);
         }
         QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,9 +13,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -67,6 +70,16 @@ public class MaterialInfoController {
 
     }
 
+    @PostMapping("watermark")
+    public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Integer watermarkTemplateId) {
+        Result<Object> result = new Result<>();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId());
+        result.setCode(200);
+        result.setSuccess(true);
+        result.setMessage("水印合成任务执行成功,请稍后查看");
+        return result;
+    }
 
     /**
      * 分页列表查询
@@ -77,8 +90,6 @@ public class MaterialInfoController {
      * @param req
      * @return
      */
-
-
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")
@@ -134,6 +145,39 @@ public class MaterialInfoController {
         return result;
     }
 
+
+    /**
+     * 批量修改项目
+     *
+     * @param jsonObject
+     * @return
+     */
+    @PostMapping(value = "/batchEdit")
+    public Result<MaterialInfo> batchEdit(@RequestBody JSONObject jsonObject) {
+        Result<MaterialInfo> result = new Result<>();
+        try {
+            Long projectId = jsonObject.getLong("projectId");
+            JSONArray materialIds = jsonObject.getJSONArray("materialIds");
+            for (int i = 0; i < materialIds.size(); i++) {
+                String materialId = materialIds.getString(i);
+                MaterialInfo updateMaterial = new MaterialInfo();
+                updateMaterial.setId(materialId);
+                updateMaterial.setProjectId(projectId);
+                materialInfoService.updateById(updateMaterial);
+
+            }
+            result.setSuccess(true);
+            result.success("修改成功!");
+        } catch (Exception e) {
+            result.setSuccess(false);
+        }
+
+
+        return result;
+
+    }
+
+
     /**
      * 编辑
      *

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialPartController.java

@@ -5,6 +5,9 @@ import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IVideoMergeTaskService;
 import cn.com.ctop.common.module.service.IVideoPartService;
 import cn.com.ctop.common.module.utils.MpsUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
 import com.google.gson.Gson;
 import io.swagger.annotations.Api;
@@ -17,6 +20,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,12 +35,14 @@ public class MaterialPartController {
     private IVideoPartService videoPartService;
     @Autowired
     private IMaterialInfoService materialInfoService;
+
     @AutoLog(value = "片段合成")
     @ApiOperation(value = "片段合成", notes = "片段合成")
     @PostMapping(value = "/merge")
-    public Result<Object> add(@RequestBody List<VideoMerge> videoMergeList) {
+    public Result<Object> merge(@RequestBody JSONArray jsonArray, HttpServletRequest req) {
         Result<Object> result = new Result<Object>();
         List<String> jobIdList = new ArrayList<>();
+        List<VideoMerge> videoMergeList = jsonArray.toJavaList(VideoMerge.class);
         try {
             MpsUtils mpsUtils = new MpsUtils();
             for (VideoMerge videoMerge:videoMergeList){

+ 38 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -20,6 +20,7 @@ import org.jeecg.modules.ctop.entity.Advertiser;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMapper;
+import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
@@ -41,10 +42,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 项目
@@ -64,6 +62,9 @@ public class ProjectController {
     @Autowired
     private IProjectMemberService projectMemberService;
 
+    @Autowired
+    private ProjectMemberMapper projectMemberMapper;
+
 
     @Autowired
     private IAdvertiserService advertiserService;
@@ -89,15 +90,43 @@ public class ProjectController {
         Map<String, Object> map = new HashMap<>();
         String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
         QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+        List<Project> projects = new ArrayList<>();
         if (!"admin".equals(roleCode)) {
-            if ("designTeamLeader".equals(roleCode)) {
-                queryWrapper.eq("design_responsible_id", userId);
+            if ("designTeamLeader".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "kuaishouOperationManager".equals(roleCode)) {
+                QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
+                memberQueryWrapper.eq("user_id", userId);
+                memberQueryWrapper.groupBy("project_id");
+                memberQueryWrapper.orderByDesc("create_time");
+                List<ProjectMember> projectMemberList = projectMemberMapper.selectList(memberQueryWrapper);
+                if (!Check.isNull(projectMemberList)) {
+                    for (ProjectMember member : projectMemberList) {
+                        Long projectId = member.getProjectId();
+                        Project project = projectService.getById(projectId);
+                        projects.add(project);
+                    }
+                }
             } else {
-                queryWrapper.eq("responsible_id", userId);
+                QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
+                projectQueryWrapper.eq("responsible_id", userId);
+                projectQueryWrapper.orderByDesc("create_time");
+                List<Project> responsibles = projectMapper.selectList(projectQueryWrapper);
+                if (!Check.isNull(responsibles)) {
+                    projects = responsibles;
+                } else {
+                    QueryWrapper<Project> designResponsibleQueryWrapper = new QueryWrapper<>();
+                    designResponsibleQueryWrapper.eq("design_responsible_id", userId);
+                    designResponsibleQueryWrapper.orderByDesc("create_time");
+                    List<Project> designResponsibles = projectMapper.selectList(projectQueryWrapper);
+                    projects = designResponsibles;
+                }
+
+
             }
+        } else {
+            queryWrapper.orderByDesc("create_time");
+            projects = projectMapper.selectList(queryWrapper);
         }
-        queryWrapper.orderByDesc("create_time");
-        List<Project> projects = projectMapper.selectList(queryWrapper);
+
         map.put("success", true);
         map.put("code", 0);
         map.put("result", projects);

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

@@ -8,7 +8,6 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import cn.com.ctop.common.module.entity.VideoPart;
 import cn.com.ctop.common.module.service.IVideoPartService;
 import org.jeecg.common.api.vo.Result;
@@ -20,13 +19,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
-
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;

+ 25 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/EffiVideoJob.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.ctop.job;
+
+
+import org.jeecg.modules.system.service.IPerformanceService2;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class EffiVideoJob implements Job {
+    @Autowired
+    private IPerformanceService2 performanceService;
+
+    /**
+     * 获取有效视频以及对应人的定时任务
+     *
+     * @param jobExecutionContext
+     * @throws JobExecutionException
+     */
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        performanceService.efficientVideoTask(2);
+        performanceService.efficientVideoTask(1);
+    }
+}

+ 10 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MergeVideoJob.java

@@ -15,26 +15,25 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.io.IOException;
 import java.util.List;
-import java.util.UUID;
 
 public class MergeVideoJob implements Job {
     @Autowired
     private IVideoMergeTaskService videoMergeTaskService;
     @Autowired
     private IMaterialInfoService materialInfoService;
+
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         QueryWrapper<VideoMergeTask> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("status","Submitted","Transcoding");
+        queryWrapper.in("status", "Submitted", "Transcoding");
         List<VideoMergeTask> list = videoMergeTaskService.list(queryWrapper);
-        if(list != null && list.size() > 0){
-            for (VideoMergeTask videoMergeTask : list){
+        if (list != null && list.size() > 0) {
+            for (VideoMergeTask videoMergeTask : list) {
                 MpsUtils mpsUtils = new MpsUtils();
                 QueryJobListResponse.Job job = mpsUtils.getJobStatus(videoMergeTask.getJobId());
-                if (job.getState().equals("TranscodeSuccess")){
-                    String url = "https://ctop-part.oss-cn-beijing.aliyuncs.com/"+job.getOutput().getOutputFile().getObject();
+                if (job.getState().equals("TranscodeSuccess")) {
+                    String url = "https://ctop-part.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
 
                     try {
                         String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
@@ -48,13 +47,15 @@ public class MergeVideoJob implements Job {
                         materialInfo.setUserId(videoMergeTask.getUserId());
                         materialInfo.setStatus(0);
                         materialInfo.setType("VIDEO");
-                        materialInfo.setMaterialName("合成"+ DateUtils.getMillis());
+                        materialInfo.setMaterialName("合成" + DateUtils.getMillis());
                         materialInfoService.saveOrUpdate(materialInfo);
+                        Thread.sleep(3 * 1000);
+                        materialInfoService.getFile(materialInfo);
                         videoMergeTask.setVideoUrl(url);
                         videoMergeTask.setStatus(job.getState());
                         videoMergeTask.setVideoId(materialInfo.getId());
                         videoMergeTaskService.updateById(videoMergeTask);
-                    } catch (IOException e) {
+                    } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }

+ 32 - 26
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java

@@ -27,35 +27,41 @@ public class WatermarkVideoJob implements Job {
     private IMaterialInfoService materialInfoService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        QueryWrapper<VideoWatermarkTask> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("status","Submitted","Transcoding");
-        List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
-        if(list != null && list.size() > 0){
-            for (VideoWatermarkTask videoWatermarkTask : list){
-                MpsUtils mpsUtils = new MpsUtils();
-                QueryJobListResponse.Job job = mpsUtils.getJobStatus(videoWatermarkTask.getJobId());
-                if (job.getState().equals("TranscodeSuccess")){
-                    String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/watermark/"+DateUtils.getNowDate("yyyy-MM-dd")+"/"+job.getOutput().getOutputFile().getObject();
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                QueryWrapper<VideoWatermarkTask> queryWrapper = new QueryWrapper<>();
+                queryWrapper.in("status", "Submitted", "Transcoding");
+                List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
+                if (list != null && list.size() > 0) {
+                    for (VideoWatermarkTask videoWatermarkTask : list) {
+                        MpsUtils mpsUtils = new MpsUtils();
+                        QueryJobListResponse.Job job = mpsUtils.getJobStatus(videoWatermarkTask.getJobId());
+                        if (job.getState().equals("TranscodeSuccess")) {
+                            String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
 
-                    try {
-                        String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-//                        String localPath = LoadFileUtil.downLoadFromUrl(url,"D:/video/");
-                        String md5 = LoadFileUtil.getMD5(localPath);
-                        LoadFileUtil.delFile(localPath);
-                        QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
-                        materialInfoQueryWrapper.eq("watermark_code",job.getJobId());
-                        MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
-                        materialInfo.setWatermarkUrl(url);
-                        materialInfoService.saveOrUpdate(materialInfo);
-                        videoWatermarkTask.setVideoUrl(url);
-                        videoWatermarkTask.setStatus(job.getState());
-                        videoWatermarkTask.setVideoId(materialInfo.getId());
-                        videoWaterMarkService.updateById(videoWatermarkTask);
-                    } catch (IOException e) {
-                        e.printStackTrace();
+                            try {
+                                String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                                //                        String localPath = LoadFileUtil.downLoadFromUrl(url,"D:/video/");
+                                String md5 = LoadFileUtil.getMD5(localPath);
+                                LoadFileUtil.delFile(localPath);
+                                QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
+                                materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
+                                MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
+                                materialInfo.setWatermarkUrl(url);
+                                materialInfoService.saveOrUpdate(materialInfo);
+                                videoWatermarkTask.setVideoUrl(url);
+                                videoWatermarkTask.setStatus(job.getState());
+                                videoWatermarkTask.setVideoId(materialInfo.getId());
+                                videoWaterMarkService.updateById(videoWatermarkTask);
+                            } catch (IOException e) {
+                                e.printStackTrace();
+                            }
+                        }
                     }
                 }
             }
-        }
+        };
+        thread.start();
     }
 }

+ 39 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java

@@ -1,6 +1,10 @@
 package org.jeecg.modules.fileupload.controller;
 
 import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.utils.Check;
+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 org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
@@ -10,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -35,4 +40,38 @@ public class FileController {
         json.put("userId", user.getId());
         return materialInfoService.insert(json);
     }
+
+
+    @PostMapping("file/batchInsert")
+    public Map<String, Object> batchInsert(@RequestBody JSONObject json) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject()
+                    .getPrincipal();
+            json.put("userId", user.getId());
+            JSONArray videoArr = json.getJSONArray("videoArr");
+            if (!Check.isNull(videoArr)) {
+                json.remove("videoArr");
+
+                for (int i = 0; i < videoArr.size(); i++) {
+                    JSONObject video = videoArr.getJSONObject(i);
+                    json.put("code", video.getString("code"));
+                    json.put("url", video.getString("url"));
+                    materialInfoService.insert(json);
+
+                }
+            }
+
+            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+
+        } catch (Exception e) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
+            e.printStackTrace();
+        }
+
+
+        return resultMap;
+    }
+
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -91,6 +91,10 @@ public class LoginController {
                     result.error500("该用户未注册系统账户,请联系管理员");
                     return result;
                 }
+                if(sysUser.getStatus() != 1){
+                    result.error500("该用户已冻结,请联系管理员");
+                    return result;
+                }
                 String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
                 sysUser.setDepartId(departId);
                 result = sysUserService.checkUserIsEffective(sysUser);

+ 107 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -0,0 +1,107 @@
+package org.jeecg.modules.system.controller;
+
+import cn.com.ctop.crawler.modules.account.entity.KuaishouAppAccount;
+import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.modules.system.service.IPerformanceService2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设计师季度绩效表2
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-10
+ */
+@Slf4j
+@Api(tags = "设计师季度绩效表2")
+@RestController
+@RequestMapping("/ctop/performance2")
+public class PerformanceController2 {
+    @Autowired
+    private IPerformanceService2 performanceService;
+
+    //平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效
+    @AutoLog(value = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效")
+    @ApiOperation(value = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效", notes = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效")
+    @PostMapping(value = "/getPerformanceInfo")
+    public Result<Map<String,Object>> getPerformanceInfo() {
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Map<String,Object> resultMap = new HashMap<>();
+        try {
+            resultMap = performanceService.getPerformanceInfo();
+            result.setSuccess(true);
+            result.setResult(resultMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("/getPerformanceInfo出错啦");
+        }
+        return result;
+    }
+
+    //有效率排行榜
+    @AutoLog(value = "有效率排行榜")
+    @ApiOperation(value = "有效率排行榜", notes = "有效率排行榜")
+    @PostMapping(value = "/effiRateRank")
+    public Result<Map<String,Object>> effiRateRank(@RequestParam(name = "pageSize")Integer pageSize) {
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Map<String,Object> resultMap = new HashMap<>();
+        try {
+            resultMap = performanceService.effiRateRank(pageSize);
+            result.setSuccess(true);
+            result.setResult(resultMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("/ctop/performance2/effiRateRank出错啦");
+        }
+        return result;
+    }
+
+    //素材、素材跑量、封面点击数、封面曝光数、行为数
+    @AutoLog(value = "素材、素材跑量、封面点击数、封面曝光数、行为数")
+    @ApiOperation(value = "素材、素材跑量、封面点击数、封面曝光数、行为数", notes = "素材、素材跑量、封面点击数、封面曝光数、行为数")
+    @PostMapping(value = "/materialInfoList")
+    public Result<Map<String,Object>> materialInfoList() {
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Map<String,Object> resultMap = new HashMap<>();
+        try {
+            List<DesignMaterialInfo> designMaterialInfoList= performanceService.materialInfoList();
+            resultMap.put("designMaterialInfoList",designMaterialInfoList);
+            result.setSuccess(true);
+            result.setResult(resultMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("/ctop/performance2/materialInfoList出错啦");
+        }
+        return result;
+    }
+
+    //点击+符号 投放账户、投放账户、跑量
+    @AutoLog(value = "点击账户增加_投放账户、投放账户、跑量")
+    @ApiOperation(value = "点击账户增加_投放账户、投放账户、跑量", notes = "点击账户增加_投放账户、投放账户、跑量")
+    @PostMapping(value = "/materialAccountInfo")
+    public Result<Map<String,Object>> materialAccountInfo(@RequestParam(name = "materialId")String materialId) {
+        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
+        Map<String,Object> resultMap = new HashMap<>();
+        try {
+            List<DesignMaterialInfo> designMaterialInfoList= performanceService.materialAccountInfo(materialId);
+            resultMap.put("designMaterialInfoList",designMaterialInfoList);
+            result.setSuccess(true);
+            result.setResult(resultMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("/ctop/performance2/materialAccountInfo出错啦");
+        }
+        return result;
+    }
+
+}

+ 25 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/EffiRateComparator.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.system.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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.io.Serializable;
+import java.util.Comparator;
+import java.util.Date;
+
+public class EffiRateComparator implements Comparator<Object> {
+
+
+    @Override
+    public int compare(Object o1, Object o2) {
+        UserDto p1 = (UserDto) o1; // 强制转换
+        UserDto p2 = (UserDto) o2;
+        return (p2.getEffiRate()).compareTo(p1.getEffiRate());
+    }
+}

+ 25 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/UserDto.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.system.entity;
+
+import lombok.Data;
+
+import java.awt.print.Book;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Comparator;
+
+@Data
+public class UserDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String userId;
+
+    private String realname;
+
+    private String roleId;
+
+    private String roleName;
+
+    private BigDecimal effiRate;
+
+}

+ 12 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysRoleMapper.java

@@ -1,8 +1,13 @@
 package org.jeecg.modules.system.mapper;
 
-import org.jeecg.modules.system.entity.SysRole;
+
+import io.lettuce.core.dynamic.annotation.Param;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.system.entity.SysRole;
+import org.jeecg.modules.system.entity.UserDto;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,5 +18,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2018-12-19
  */
 public interface SysRoleMapper extends BaseMapper<SysRole> {
+    //根据roleCode获取相对应的用户信息
+    List<UserDto> getUserByRoleCode(@Param("roleCode")String roleCode);
+
+    String getRoleIdByRoleCode(@Param("roleCode")String roleCode);
+
+    String getRoleCodeByUserId(@Param("userId")String userId);
 
 }

+ 40 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysRoleMapper.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.system.mapper.SysRoleMapper">
+
+	<!-- 根据rolecode获取相对应角色所有的人 -->
+	<select id="getUserByRoleCode" resultType="org.jeecg.modules.system.entity.UserDto">
+			select
+			a.id as userId,
+			a.realname,
+			c.id as roleId,
+			c.role_name
+		from
+		sys_user a
+		left join sys_user_role b on a.id = b.user_id
+		left join sys_role c on b.role_id = c.id
+        where
+        c.role_code = #{roleCode}
+	</select>
+
+	<!-- 根据roleCode获取roleId -->
+	<select id="getRoleIdByRoleCode" resultType="java.lang.String">
+		select
+		id
+		from sys_role
+		where role_code = #{roleCode}
+	</select>
+
+	<!-- 根据userId获取角色code -->
+	<select id="getRoleCodeByUserId" resultType="java.lang.String">
+		select
+		c.role_code
+		from
+		sys_user a
+		left join sys_user_role b on a.id = b.user_id
+		left join sys_role c on b.role_id = c.id
+        where
+        a.id = #{userId}
+	</select>
+
+</mapper>

+ 31 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java

@@ -0,0 +1,31 @@
+package org.jeecg.modules.system.service;
+
+import cn.com.ctop.performanceappraisal.entity.Performance;
+import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设计师季度绩效表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-10
+ */
+public interface IPerformanceService2 extends IService<Performance> {
+    void efficientVideoTask(int days);
+
+    //平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效
+    public Map<String,Object> getPerformanceInfo();
+
+    //有效率排行榜
+    public Map<String,Object> effiRateRank(Integer size);
+
+    //素材、素材跑量、封面点击数、封面曝光数、行为数
+    public List<DesignMaterialInfo> materialInfoList();
+
+    //点击+符号 投放账户、投放账户、跑量
+    public List<DesignMaterialInfo> materialAccountInfo(String materialInfoId);
+}

+ 721 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -0,0 +1,721 @@
+package org.jeecg.modules.system.service.impl;
+
+import cn.com.ctop.performanceappraisal.entity.OptimizerConfig;
+import cn.com.ctop.performanceappraisal.entity.Performance;
+import cn.com.ctop.performanceappraisal.mapper.PerformanceMapper;
+import cn.com.ctop.performanceappraisal.service.IOptimizerConfigService;
+import cn.com.ctop.performanceappraisal.vo.OptimizerCostDetailVO;
+import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
+import cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO;
+import cn.com.ctop.userefficientvideomap.entity.ProjectDTO;
+import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
+import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.system.entity.EffiRateComparator;
+import org.jeecg.modules.system.entity.UserDto;
+import org.jeecg.modules.system.mapper.SysRoleMapper;
+import org.jeecg.modules.system.service.IPerformanceService2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.*;
+
+/**
+ * 设计师季度绩效表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-10
+ */
+@Slf4j
+@Service
+public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Performance> implements IPerformanceService2 {
+
+    @Autowired
+    private PerformanceMapper performanceMapper;
+    @Autowired
+    private UserEfficientVideoMapMapper userEfficientVideoMapMapper;
+    @Autowired
+    private SysRoleMapper sysRoleMapper;
+    @Autowired
+    private IOptimizerConfigService optimizerConfigService;
+
+    //获取季度有效视频和角色对应关系的定时任务
+    //每天定时任务:角色对应本季度有效视频计算--需要工具类有效视频计算工具类
+    public void efficientVideoTask(int days){
+        //有效视频定义:两周内视频消耗>=5000的视频称为
+        //季度有效视频定义:在本季度成为有效视频的视频成为季度有效视频
+        //每月1号计算上个月最后一天的有效视频,然后可以跑每个季度的计算绩效的定时任务
+        //如果按照时间
+        //计算逻辑 1.查找出来所有的剪辑、编导、拍摄,循环查找出对应当天产生的有效视频---不太好,同一个视频会被查出好多次,舍去
+        //2.查出当天的有效视频,再和表中有效视频做对比,然后插入;采用
+        //如何查询出前一天的有效视频。
+        //方案:从两周前开始到昨天的所有上传的视频都扫描一遍,如果成为了有效视频而且没有再数据库中,则插入数据库当中
+
+        //addDay(Date date, int day) 返回之前几天的时间
+        //需要增加 1.获取传入参数获取年份的接口  2.传入参数获取月份的参数 3.根据月份计算出季度的时间方法
+        //1和2用Dateutis.formatAddDate获取calendar即可,不行用getYear也可以  3.getQuarter(Date date)获取根据月份计算时间的方法
+
+        //传入时间,获取对应的年份
+        try {
+            Date thisDate = DateUtils.addDay(new Date(), days);
+            String thisDateStr = DateUtils.formatDate(thisDate,"yyyy-MM-dd");
+            String thisYear = DateUtils.getYear( "yyyy-MM-dd", thisDateStr);
+            //String thisMonth = DateUtils.getMonth("yyyy-MM-dd", thisYear);
+            int thisQuarter = DateUtils.getQuarter(thisDate);
+
+            //以传入的时间为节点,向前获取14天(包括当天)的时间
+            String startDate = DateUtils.formatDate(DateUtils.addDay(thisDate, 13),"yyyy-MM-dd");
+            //获取时间段内所有<快手>的有效视频
+            List<EffiVideoDTO> EffiVideoDTOList = userEfficientVideoMapMapper.getUserVideoMap(thisDateStr, startDate);
+
+            for(EffiVideoDTO effiVideoDTO : EffiVideoDTOList){
+                //判断此视频是否已经在关系表中存在,如果已经存在则说明此视频已经存在,跳过即可
+                //有效视频的逻辑是无论是快手还是头条
+                int signatureCount = userEfficientVideoMapMapper.getEffiVideoCountBySignature(effiVideoDTO.getSignature());
+                if(signatureCount != 0){
+                    continue;
+                }
+
+                UserEfficientVideoMap shot = new UserEfficientVideoMap();
+                UserEfficientVideoMap plane = new UserEfficientVideoMap();
+                UserEfficientVideoMap plan = new UserEfficientVideoMap();
+                UserEfficientVideoMap clip = new UserEfficientVideoMap();
+
+                //拍摄
+                shot.setUserId(effiVideoDTO.getShotId());
+                shot.setEfficientVideoSignature(effiVideoDTO.getSignature());
+                shot.setQuarter(thisQuarter);
+                shot.setAppType(1); //1快手 2头条
+                shot.setYear(Integer.parseInt(thisYear));
+                shot.setRoleId("7bff9afed625aeeabca6bffe3c189183");
+                userEfficientVideoMapMapper.insert(shot);
+
+                //平面
+                plane.setUserId(effiVideoDTO.getPlaneId());
+                plane.setEfficientVideoSignature(effiVideoDTO.getSignature());
+                plane.setQuarter(thisQuarter);
+                plane.setAppType(1); //1快手 2头条
+                plane.setYear(Integer.parseInt(thisYear));
+                plane.setRoleId("8dc30cb9810bde89bdc3fa8a85b830b0");
+                userEfficientVideoMapMapper.insert(plane);
+
+                //策划
+                plan.setUserId(effiVideoDTO.getPlanId());
+                plan.setEfficientVideoSignature(effiVideoDTO.getSignature());
+                plan.setQuarter(thisQuarter);
+                plan.setAppType(1); //1快手 2头条
+                plan.setYear(Integer.parseInt(thisYear));
+                plan.setRoleId("0214283aa16f943efbb149ea4bb18f18");
+                userEfficientVideoMapMapper.insert(plan);
+
+                //剪辑
+                clip.setUserId(effiVideoDTO.getClipId());
+                clip.setEfficientVideoSignature(effiVideoDTO.getSignature());
+                clip.setQuarter(thisQuarter);
+                clip.setAppType(1); //1快手 2头条
+                clip.setYear(Integer.parseInt(thisYear));
+                clip.setRoleId("f38d8d70cf7ec50d5357a749e4dbf8ee");
+                userEfficientVideoMapMapper.insert(clip);
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 分平台:快手、抖音
+     *
+     * 编导、剪辑、拍摄:
+     * 1.根据角色(编导、剪辑、拍摄)查询出相对应角色所有的人
+     * 2.根据查询出来的所属角色的人,从定时任务跑出来的视频人对应的表中查询出来每个人对应的季度视频总数和季度有效视频数量
+     * 3.循环所有人并计算出相对应的视频有效率,并排序
+     * 4.根据有效率和对应的绩效梯度进行绩效计算,前百分之30,给予千分之5的提点绩效;中间百分之50%,给予千分之3的提点绩效
+     * 即角色人的本季度绩效=本季度视频总消耗*提点*角色提成点(需要考虑到小数点问题和绩效节点上下有效率相同的问题)
+     *
+     *平面设计:
+     * 1.根据角色查询出相对应的平面设计所有的人
+     * 2.循环所有人并计算出相对应的素材总消耗
+     * 3.判断媒体总任务是否完成,如果完成则按照千分之5来进行提点绩效;如果未完成,则给予千分之3的提点绩效
+     *
+     * 设计师leader:
+     * 1.如果媒体总任务未达成,则没有绩效;如果已达成,则按照千分之5给予提点绩效
+     * 2.查询出所有设计部门的代码,并找出每部门的leader,和部门下所有人员
+     * 3.根据编导(或剪辑、拍摄)算出素材的总消耗
+     * 4.根据部门当中是否有平面设计师来判断提成绩效。有平面,按照15%计算;没有按照20%计算
+     */
+    //季度定时任务(在有效视频绑定人定时任务之后跑):设计师绩效计算-----包括快手和头条的计算逻辑
+    public void designerPerformanceTask(){
+        kuaishouDesigner();//快手
+        toutiaoDesigner();//头条
+    }
+
+
+    //快手设计师逻辑
+    private void kuaishouDesigner(){
+        Date thisDate = DateUtils.addDay(new Date(), -1);
+        String thisDateStr = DateUtils.formatDate(thisDate,"yyyy-MM-dd");
+        String thisYear = null;
+        try {
+            thisYear = DateUtils.getYear( "yyyy-MM-dd", thisDateStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        //String thisMonth = DateUtils.getMonth("yyyy-MM-dd", thisYear);
+        int thisQuarter = DateUtils.getQuarter(thisDate);
+        String startTime = null;  //季度开始时间
+        String endTime = null;  //季度结束时间
+        if(thisQuarter == 1){
+            startTime = thisYear + "-01-01";
+            endTime = thisYear + "-03-31";
+        }else if(thisQuarter == 2){
+            startTime = thisYear + "-04-01";
+            endTime = thisYear + "-06-30";
+        }else if(thisQuarter == 3){
+            startTime = thisYear + "-07-01";
+            endTime = thisYear + "-09-30";
+        }else if(thisQuarter == 4){
+            startTime = thisYear + "-10-01";
+            endTime = thisYear + "-12-31";
+        }
+
+        //1.根据角色(编导、剪辑、拍摄)查询出相对应角色所有的人
+        List<UserDto> planList = sysRoleMapper.getUserByRoleCode("plan"); //编导
+        List<UserDto> shotList = sysRoleMapper.getUserByRoleCode("shot"); //拍摄
+        List<UserDto> clipList = sysRoleMapper.getUserByRoleCode("clip"); //剪辑
+        List<UserDto> planeList = sysRoleMapper.getUserByRoleCode("plane"); //平面
+
+        //2.1 编导 start
+        //循环编导列表计算视频有效率并排序
+        for(UserDto userDto:planList){
+            //有效视频数量
+            int effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByUserId(Integer.parseInt(thisYear),thisQuarter,userDto.getUserId());
+            //总视频数量
+            int videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId("plan",startTime, endTime, userDto.getUserId());
+            //视频有效率
+            BigDecimal effiRate = new BigDecimal( String.valueOf(effiVideoCount) ).divide( new BigDecimal(String.valueOf(videoCount)) );
+            userDto.setEffiRate(effiRate);
+        }
+        Collections.sort(planList, new EffiRateComparator());
+
+        //获取编导人数并按照提点比例计算每个梯度的人数
+        int planLength = planList.size();
+        //获取前30%和中间50%的人数(视频有效率四舍五入)
+        int top30 = new BigDecimal(String.valueOf(planLength)).multiply(new BigDecimal("0.3")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+        int middle50 = new BigDecimal(String.valueOf(planLength)).multiply(new BigDecimal("0.5")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+
+        //循环前30%有绩效的人数并计算其绩效,并入库
+        for(int i=0; i<=top30 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(planList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(5‰)*提成比例(编导40%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.4"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(planList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.005"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(planList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(planList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+
+        //去掉list中前30的数据
+        planList.subList(0,top30-1).clear();
+
+        //循环中间50%有绩效的人,计算绩效并入库
+        for(int i=0; i<=middle50 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(planList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(3‰)*提成比例(编导40%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.4"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(planList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.003"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(planList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(planList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+        /////////////////////////////////////////编导end
+
+        //2.2 拍摄 start
+        for(UserDto userDto:shotList){
+            //有效视频数量
+            int effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByUserId(Integer.parseInt(thisYear),thisQuarter,userDto.getUserId());
+            //总视频数量
+            int videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId("shot",startTime, endTime, userDto.getUserId());
+            //视频有效率
+            BigDecimal effiRate = new BigDecimal( String.valueOf(effiVideoCount) ).divide( new BigDecimal(String.valueOf(videoCount)) );
+            userDto.setEffiRate(effiRate);
+        }
+        Collections.sort(shotList, new EffiRateComparator());
+
+        //获取编导人数并按照提点比例计算每个梯度的人数
+        int shotLength = shotList.size();
+        //获取前30%和中间50%的人数(视频有效率四舍五入)
+        int shotTop30 = new BigDecimal(String.valueOf(shotLength)).multiply(new BigDecimal("0.3")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+        int shotMiddle50 = new BigDecimal(String.valueOf(shotLength)).multiply(new BigDecimal("0.5")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+
+        //循环前30%有绩效的人数并计算其绩效,并入库
+        for(int i=0; i<=shotTop30 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(shotList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(5‰)*提成比例(拍摄10%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.1"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(shotList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.005"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(shotList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(shotList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+
+        //去掉list中前30的数据
+        shotList.subList(0,shotTop30-1).clear();
+
+        //循环中间50%有绩效的人,计算绩效并入库
+        for(int i=0; i<=shotMiddle50 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(shotList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(3‰)*提成比例(拍摄10%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.1"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(shotList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.003"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(shotList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(shotList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+        ///////////////////////////////////////////////////拍摄 end
+
+        //剪辑 start
+        for(UserDto userDto:clipList){
+            //有效视频数量
+            int effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByUserId(Integer.parseInt(thisYear),thisQuarter,userDto.getUserId());
+            //总视频数量
+            int videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId("clip",startTime, endTime, userDto.getUserId());
+            //视频有效率
+            BigDecimal effiRate = new BigDecimal( String.valueOf(effiVideoCount) ).divide( new BigDecimal(String.valueOf(videoCount)) );
+            userDto.setEffiRate(effiRate);
+        }
+        Collections.sort(clipList, new EffiRateComparator());
+
+        //获取剪辑人数并按照提点比例计算每个梯度的人数
+        int clipLength = clipList.size();
+        //获取前30%和中间50%的人数(视频有效率四舍五入)
+        int clipTop30 = new BigDecimal(String.valueOf(clipLength)).multiply(new BigDecimal("0.3")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+        int clipMiddle50 = new BigDecimal(String.valueOf(clipLength)).multiply(new BigDecimal("0.5")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+
+        //循环前30%有绩效的人数并计算其绩效,并入库
+        for(int i=0; i<=clipTop30 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(clipList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(5‰)*提成比例(剪辑30%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.3"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(clipList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.005"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(clipList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(clipList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+
+        //去掉list中前30的数据
+        clipList.subList(0,clipTop30-1).clear();
+
+        //循环中间50%有绩效的人,计算绩效并入库
+        for(int i=0; i<=clipMiddle50 - 1; i++){
+            //总消耗--获取这个人所在项目的总消耗
+            BigDecimal totalCost = userEfficientVideoMapMapper.getProjectTotalCostByUserId(clipList.get(i).getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例(3‰)*提成比例(剪辑30%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.3"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(clipList.get(i).getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(new BigDecimal("0.003"));
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(clipList.get(i).getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(clipList.get(i).getUserId());
+            performanceMapper.insert(performance);
+        }
+        //////////////////////////////////////////////////////剪辑 end
+
+        //平面设计的总消耗 start
+        // *平面设计:
+        // * 1.根据媒体的任务
+        // * 1.根据角色查询出相对应的平面设计所有的人
+        // * 2.循环所有人并计算出相对应的素材总消耗
+        // * 3.判断媒体总任务是否完成,如果完成则按照千分之5来进行提点绩效;如果未完成,则给予千分之3的提点绩效
+        planeList = sysRoleMapper.getUserByRoleCode("plane");
+
+        //判断媒体任务是否完成
+        String raiseRate = null;
+        if(mediaMission()){
+            raiseRate = "0.005";
+        }else{
+            raiseRate = "0.003";
+        }
+
+        for(UserDto userDto:planeList){
+            //总消耗--获取这个人所在项目的总消耗2
+            BigDecimal totalCost = userEfficientVideoMapMapper.getTotalCostByPlaneId(userDto.getUserId(), startTime, endTime);
+            //总绩效=总消耗*提点比例*提成比例(平面5%)
+            BigDecimal totalPerformance = totalCost.multiply(new BigDecimal(raiseRate)).multiply(new BigDecimal("0.05"));
+
+            Performance performance = new Performance();
+            performance.setAppType(1); //1快手 2抖音
+            performance.setRoleId(userDto.getRoleId());
+            performance.setQuarter(thisQuarter);
+            performance.setYear(Integer.parseInt(thisYear));
+            performance.setCommissionRate(null);
+            performance.setTotalCost(totalCost);
+            performance.setTotalPerformance(totalPerformance);
+            performance.setStartTime(startTime);
+            performance.setEndTime(endTime);
+            performance.setVideoEfficiency(userDto.getEffiRate().setScale(4,BigDecimal.ROUND_HALF_UP));
+            performance.setUserId(userDto.getUserId());
+            performanceMapper.insert(performance);
+        }
+        ///////////////////////////////////////////////////////////////////平面end
+
+        //TODO 设计师leader start
+        //* 1.如果媒体总任务未达成,则没有绩效;如果已达成,则按照千分之5给予提点绩效
+        //* 2.查询出所有设计部门的代码,并找出每部门的leader,和部门下所有人员
+        //* 3.根据编导(或剪辑、拍摄)算出素材的总消耗
+        //* 4.根据部门当中是否有平面设计师来判断提成绩效。有平面,按照15%计算;没有按照20%计算
+
+        //判断媒体任务是否达成,如果未达成,则没有绩效
+        if(mediaMission()){
+        }else{
+            return;
+        }
+        //设计师leader end
+    }
+
+    //头条设计师逻辑
+    private void toutiaoDesigner(){
+        //TODO 头条目前还没有开发基础部件,等待开发完
+    }
+
+
+    //根据userId查询出所属的所有项目
+    private List<ProjectDTO> getProjects(String userId){
+        List<ProjectDTO> projectDTOList = userEfficientVideoMapMapper.getProjectsByUserId(userId);
+        return projectDTOList;
+    }
+
+    //根据projectId判断此项目是否存在plane平面设计师
+    private boolean planeExistsInProject(Long projectId){
+        int planeCount = userEfficientVideoMapMapper.getPlaneCountByProjectId(projectId);
+        if(planeCount == 0){
+            return true;
+        }
+        return false;
+    }
+
+    //根据角色id判断所在team是否存在平面设计师
+    private boolean planeExistsInTeam(String userId){
+        int planeCount = userEfficientVideoMapMapper.getPlaneCountByUserId(userId);
+        if(planeCount == 0){
+            return true;
+        }
+        return true;
+    }
+
+    //判断媒体季度任务是否完成
+    private boolean mediaMission(){
+        //查询优化师系统设置数据
+        OptimizerConfig config = optimizerConfigService.getEnabledConfigByMediaType(String.valueOf(2));
+
+        //2: 查询媒体季度任务完成情况
+        OptimizerCostDetailVO totalCostVo = getOptimizerTotalCost();
+        //result.put("totalCost", totalCostVo.getTotalCost().toString());
+        if (totalCostVo.getTotalCost().compareTo(config.getMediaTask()) < 0) {
+            //当前消耗季度任务未完成
+            return false;
+        }
+        return true;
+    }
+
+    public OptimizerCostDetailVO getOptimizerTotalCost() {
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String endNowDate = DateUtils.formatDate(getDate);
+        String year = DateUtils.getYear(getDate) + "";
+        String quarter = DateUtils.getQuarter(getDate) + "";
+        return performanceMapper.getOptimizerTotalCost(startDate, endNowDate, year, quarter);
+    }
+
+    //1
+    //季度到前一天为止个人的有效数量、素材总数、素材有效率、总跑量
+    //{"effiVideoCount有效数":70,"videoCount素材总数":200,"effiRate":40,"cost":2019;performance绩效":20000}
+    public Map<String,Object> getPerformanceInfo(){
+        Map<String,Object> performanceInfoMap = new HashMap<>();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        //LoginUser sysUser = new LoginUser();
+        //sysUser.setId("9712328fddd1443faf566ddb87693658");
+
+        //获取前一天的时间
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String endNowDate = DateUtils.formatDate(getDate);
+
+        String roleCode = sysRoleMapper.getRoleCodeByUserId(sysUser.getId());
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "getPerformanceInfo接口开始");
+
+        Map<String,String> lastDateMap = getLastDateInfo();
+        //获取本人的视频总有效数量
+        int effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByUserId(Integer.parseInt(lastDateMap.get("year")), Integer.parseInt(lastDateMap.get("quarter")),sysUser.getId());
+        //获取本人的视频总数
+        int videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(roleCode, startDate,endNowDate,sysUser.getId());
+        //获取本人目前的视频有效率
+        BigDecimal videoEffiRate = BigDecimal.ZERO;
+        if(effiVideoCount != 0 && videoCount != 0){
+            videoEffiRate = new BigDecimal(String.valueOf(effiVideoCount)).divide(new BigDecimal(String.valueOf(videoCount))).multiply(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);
+        }
+        //获取本人的总跑量
+        BigDecimal cost = BigDecimal.ZERO;
+
+        if(roleCode.equals("plan") ){
+            cost = userEfficientVideoMapMapper.getTotalCostByPlanId(sysUser.getId(), startDate, endDate);
+        }else if(roleCode.equals("shot") ){
+            cost = userEfficientVideoMapMapper.getTotalCostByShotId(sysUser.getId(), startDate, endDate);
+        }else if(roleCode.equals("clip") ){
+            cost = userEfficientVideoMapMapper.getTotalCostByClipId(sysUser.getId(), startDate, endDate);
+        }
+
+        performanceInfoMap.put("effiVideoCount",effiVideoCount);
+        performanceInfoMap.put("videoCount",videoCount);
+        performanceInfoMap.put("effiRate",videoEffiRate);
+        performanceInfoMap.put("cost",cost);
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "getPerformanceInfo接口开始");
+        return performanceInfoMap;
+    }
+
+    //2
+    //有效率排行榜
+    //{"list":[{"name":"pipi","effiRate":50},{"name":"pipixia","effiRate":40},{"name":"pipiqiu","effiRate":30}],"performance":performance}
+    public Map<String,Object> effiRateRank(Integer size){
+        Map<String,Object> resultMap = new HashMap<>();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        //LoginUser sysUser = new LoginUser();
+        //sysUser.setId("9712328fddd1443faf566ddb87693658");
+
+        //获取前一天的时间
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String endNowDate = DateUtils.formatDate(getDate);
+        Map<String,String> lastDateMap = getLastDateInfo();
+        String roleCode = sysRoleMapper.getRoleCodeByUserId(sysUser.getId());
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "有效率排行榜接口开始");
+
+        List<UserDto> userRoleList = new ArrayList<>();
+        BigDecimal rate = BigDecimal.ZERO; //提成比例
+        if(roleCode.equals("plan")){
+            userRoleList = sysRoleMapper.getUserByRoleCode("plan"); //编导
+            rate = new BigDecimal("0.4");
+        }else if(roleCode.equals("shot")){
+            userRoleList = sysRoleMapper.getUserByRoleCode("shot"); //拍摄
+            rate = new BigDecimal("0.1");
+        }else if(roleCode.equals("clip")){
+            userRoleList = sysRoleMapper.getUserByRoleCode("clip"); //剪辑
+            rate = new BigDecimal("0.3");
+        }
+
+        if (userRoleList != null) {
+            for (UserDto userDto : userRoleList) {
+                //有效视频数量
+                int effiVideoCount = userEfficientVideoMapMapper.getEffiVideoCountByUserId(Integer.parseInt(lastDateMap.get("year")), Integer.parseInt(lastDateMap.get("quarter")), userDto.getUserId());
+                //总视频数量
+                int videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(roleCode, startDate, endNowDate, userDto.getUserId());
+                //视频有效率
+                BigDecimal effiRate = BigDecimal.ZERO;
+                if(effiVideoCount!=0 && videoCount!=0){
+                    effiRate = new BigDecimal(String.valueOf(effiVideoCount)).divide(new BigDecimal(String.valueOf(videoCount))).multiply(new BigDecimal("100")).setScale(2,BigDecimal.ROUND_HALF_UP);
+                }
+                userDto.setEffiRate(effiRate);
+            }
+            Collections.sort(userRoleList, new EffiRateComparator());
+
+            //获取剪辑人数并按照提点比例计算每个梯度的人数
+            int userRoleLength = userRoleList.size();
+            //获取前30%和中间50%的人数(视频有效率四舍五入)
+            int userTopSize = new BigDecimal(String.valueOf(userRoleLength)).multiply(new BigDecimal("0.3")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+            int userMiddleSize = new BigDecimal(String.valueOf(userRoleLength)).multiply(new BigDecimal("0.5")).setScale(0,BigDecimal.ROUND_HALF_UP).intValue();
+            log.info(roleCode + "的总人数为:" + userRoleLength + ";前30%人数为:"+ userTopSize + ";中间50%的人数为:" + userMiddleSize);
+
+            int index = 0;
+            for(int i=0; i<= userRoleLength; i++){
+                index = index+1;
+                if(userRoleList.get(i).getUserId() .equals( sysUser.getId() )){
+                    log.info("当前登陆人userId:" + sysUser.getId() + ";姓名:" +sysUser.getRealname() + ";排名:" + index);
+                    break;
+                }
+            }
+
+            //总消耗--获取这个人素材总消耗
+            //总绩效=总消耗*提点比例(5‰)*提成比例(剪辑30%)
+            BigDecimal performance = BigDecimal.ZERO; //绩效
+            BigDecimal totalCost = BigDecimal.ZERO;  //总消耗
+            if(roleCode.equals("plan")){
+                totalCost = userEfficientVideoMapMapper.getTotalCostByPlanId(sysUser.getId(), startDate, endNowDate);
+                if(index <= userTopSize){
+                    performance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.4"));
+                }else if( index >userTopSize && index <= (userTopSize + userMiddleSize) ){
+                    performance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.4"));
+                }else{
+                    performance = BigDecimal.ZERO;
+                }
+            }else if(roleCode.equals("shot")){
+                totalCost = userEfficientVideoMapMapper.getTotalCostByShotId(sysUser.getId(), startDate, endNowDate);
+                if(index <= userTopSize){
+                    performance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.1"));
+                }else if( index >userTopSize && index <= (userTopSize + userMiddleSize) ){
+                    performance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.1"));
+                }else{
+                    performance = BigDecimal.ZERO;
+                }
+            }else{
+                totalCost = userEfficientVideoMapMapper.getTotalCostByClipId(sysUser.getId(), startDate, endNowDate);
+                if(index <= userTopSize){
+                    performance = totalCost.multiply(new BigDecimal("0.005")).multiply(new BigDecimal("0.3"));
+                }else if( index >userTopSize && index <= (userTopSize + userMiddleSize) ){
+                    performance = totalCost.multiply(new BigDecimal("0.003")).multiply(new BigDecimal("0.3"));
+                }else{
+                    performance = BigDecimal.ZERO;
+                }
+            }
+
+            //去掉list中前30的数据
+            if(size != null){
+                userRoleList.subList(size,userRoleList.size()).clear();
+            }
+
+            resultMap.put("userRoleList",userRoleList);
+            resultMap.put("performance",performance);
+        }else{
+            resultMap.put("userRoleList",null);
+            resultMap.put("performance",0);
+        }
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "有效率排行榜接口结束");
+        return resultMap;
+    }
+
+    //3
+    //素材、素材跑量、封面点击数、封面曝光数、行为数
+    //{"videoUrl":"http://dadfadfadf.mp4","videoCost":34.56,"pageClickCount":1200,"pageExposureCount":3939,"behaviorCount":5000}
+    public List<DesignMaterialInfo> materialInfoList(){
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        //LoginUser sysUser = new LoginUser();
+        //sysUser.setId("9712328fddd1443faf566ddb87693658");
+        String roleCode = sysRoleMapper.getRoleCodeByUserId(sysUser.getId());
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "materialInfoList接口开始");
+
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String endNowDate = DateUtils.formatDate(getDate);
+
+        List<DesignMaterialInfo> materialInfoList = userEfficientVideoMapMapper.designMaterialInfoList(roleCode, sysUser.getId(), startDate, endNowDate);
+
+        log.info(roleCode + ":" + sysUser.getRealname() + "materialInfoList接口结束");
+        return materialInfoList;
+    }
+
+    //4
+    //点击+符号 投放账户、投放账户、跑量
+    //{"videoAccount":"aabbcc","servingAccount":"ttyyhh","cost":34234.43}
+    public List<DesignMaterialInfo> materialAccountInfo(String materialInfoId){
+        log.info("materialAccountInfo接口开始");
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String endNowDate = DateUtils.formatDate(getDate);
+
+        List<DesignMaterialInfo> materialInfoList = userEfficientVideoMapMapper.getMaterialAccountInfoByMaterialId(materialInfoId, startDate, endNowDate);
+        log.info("materialAccountInfo接口结束");
+        return materialInfoList;
+    }
+
+    //获取前一天的年、季度信息
+    private Map<String,String> getLastDateInfo() {
+        Map<String, String> timeMap = new HashMap<String,String>();
+        Date date = new Date();
+        Date getDate = DateUtils.addDay(date, -1);
+        String startDate = DateUtils.getQuarterStartDate(getDate);
+        String endDate = DateUtils.getQuarterEndDate(getDate);
+        String year = DateUtils.getYear(getDate) + "";
+        String quarter = DateUtils.getQuarter(getDate) + "";
+
+        timeMap.put("startDate",startDate);
+        timeMap.put("endDate",endDate);
+        timeMap.put("year",year);
+        timeMap.put("quarter",quarter);
+        return timeMap;
+    }
+
+
+}

+ 6 - 0
jeecg-boot-module-system/src/main/resources/quartz.properties

@@ -0,0 +1,6 @@
+org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
+org.quartz.threadPool.threadCount=20
+org.quartz.threadPool.threadPriority=5
+org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
+org.quartz.jobStore.misfireThreshold=60000
+org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore

+ 0 - 2
module-common/pom.xml

@@ -23,13 +23,11 @@
     </properties>
 
     <dependencies>
-
         <dependency>
             <groupId>thirtpart</groupId>
             <artifactId>jave</artifactId>
             <version>1.0</version>
         </dependency>
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

+ 98 - 53
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -54,7 +54,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
-        String jobId = mpsUtils.videoWaterMark(materialInfo.getUrl(), videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
+        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length());
+        System.out.println(path);
+        String jobId = mpsUtils.videoWaterMark(path, videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
         videoWatermarkTask.setJobId(jobId);
@@ -110,62 +112,43 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         Map<String, Object> resultMap = new HashMap<>();
         try {
             String type = jsonObject.getString("type");
-            MaterialInfo info = new MaterialInfo();
-            info.setId(jsonObject.getString("code"));
-            info.setCode(jsonObject.getString("code"));
+            if ("IMAGE".equals(type)) {
+                JSONArray imageArr = jsonObject.getJSONArray("imageArr");
+                if (!Check.isNull(imageArr)) {
+                    jsonObject.remove("imageArr");
+                    for (int i = 0; i < imageArr.size(); i++) {
+                        String url = imageArr.getString(i);
+                        if (!Check.isNull(url)) {
+                            jsonObject.remove("code");
+                            jsonObject.remove("materialName");
+                            url = "https:" + url;
+                            String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                            //  String localPath = LoadFileUtil.downLoadFromUrl(url, "D:\\tets1\\image");
+                            String md5 = LoadFileUtil.getMD5(localPath);
+                            jsonObject.put("code", md5);
+                            LoadFileUtil.delFile(localPath);
+                            String fileName = url.substring(url.lastIndexOf("/") + 1);
+                            String fileNameStr = null;
+                            if (!Check.isNull(fileName)) {
+                                String[] split = fileName.split("-");
+                                fileNameStr = split[0];
+                            }
+                            jsonObject.put("materialName", AesEncryptUtil.getUrlDecoderString(fileNameStr));
+
+                            insertMaterialInfo(url, type, jsonObject);
+                        }
 
-            if (!Check.isNull(jsonObject.getString("watermarkUrl"))) {
-                info.setWatermarkUrl("https:" + jsonObject.getString("watermarkUrl"));
-            }
-            if (!Check.isNull(jsonObject.getString("url"))) {
-                info.setUrl("https:" + jsonObject.getString("url"));
-            }
-            info.setUserId(jsonObject.getString("userId"));
-            info.setProjectId(jsonObject.getLong("projectId"));
-            info.setWatermarkCode(jsonObject.getString("watermarkCode"));
-            info.setStatus(0);
-            info.setMaterialName(jsonObject.getString("materialName"));
-            info.setWatermarkMaterialName(jsonObject.getString("watermarkMaterialName"));
-            info.setMaterialDescribe(jsonObject.getString("materialDescribe"));
-            info.setCreateTime(new Date());
-            info.setUpdateTime(new Date());
-            info.setType(type);
-            this.save(info);
-            Map<String, Object> deleteMap = new HashMap<>();
-            deleteMap.put("material_id", info.getId());
-
-            JSONObject ascription = jsonObject.getJSONObject("ascription");
-            if (!Check.isNull(ascription)) {
-                MaterialAscription materialAscription = new MaterialAscription();
-                materialAscription.setMaterialId(info.getId());
-                // 剪辑人
-                materialAscription.setClipId(ascription.getString("clipId"));
-                // 拍摄人id
-                materialAscription.setShotId(ascription.getString("shotId"));
-                // 策划id
-                materialAscription.setPlanId(ascription.getString("planId"));
-                //平面id
-                materialAscription.setPlaneId(ascription.getString("planeId"));
-                materialAscriptionMapper.deleteByMap(deleteMap);
-                int i = materialAscriptionMapper.insert(materialAscription);
-                if (i > 0) {
-                    log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
-                }
-            }
-            JSONArray tag = jsonObject.getJSONArray("tag");
-            if (!Check.isNull(tag)) {
-                materialTagMapper.deleteByMap(deleteMap);
-                for (int i = 0; i < tag.size(); i++) {
-                    String tagStr = tag.getString(i);
-                    if (!Check.isNull(tagStr)) {
-                        MaterialTag materialTag = new MaterialTag();
-                        materialTag.setMaterialId(info.getId());
-                        materialTag.setTag(tagStr);
-                        materialTagMapper.insert(materialTag);
                     }
                 }
+
+            } else {
+                String url = "";
+                if (!Check.isNull(jsonObject.getString("url"))) {
+                    url = "https:" + jsonObject.getString("url");
+                }
+                insertMaterialInfo(url, type, jsonObject);
             }
-            getFile(info);
+
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
@@ -178,6 +161,68 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
 
+    private void insertMaterialInfo(String url, String type, JSONObject jsonObject) {
+        MaterialInfo info = new MaterialInfo();
+        info.setId(jsonObject.getString("code"));
+        info.setCode(jsonObject.getString("code"));
+
+        if (!Check.isNull(jsonObject.getString("watermarkUrl"))) {
+            info.setWatermarkUrl(jsonObject.getString("watermarkUrl"));
+        }
+        info.setUrl(url);
+        info.setUserId(jsonObject.getString("userId"));
+        info.setProjectId(jsonObject.getLong("projectId"));
+        info.setWatermarkCode(jsonObject.getString("watermarkCode"));
+        info.setStatus(0);
+        info.setMaterialName(jsonObject.getString("materialName"));
+        info.setWatermarkMaterialName(jsonObject.getString("watermarkMaterialName"));
+        info.setMaterialDescribe(jsonObject.getString("materialDescribe"));
+        info.setCreateTime(new Date());
+        info.setUpdateTime(new Date());
+        info.setType(type);
+        this.save(info);
+
+        Map<String, Object> deleteMap = new HashMap<>();
+        deleteMap.put("material_id", info.getId());
+
+        JSONObject ascription = jsonObject.getJSONObject("ascription");
+        if (!Check.isNull(ascription)) {
+            MaterialAscription materialAscription = new MaterialAscription();
+            materialAscription.setMaterialId(info.getId());
+            // 剪辑人
+            materialAscription.setClipId(ascription.getString("clipId"));
+            // 拍摄人id
+            materialAscription.setShotId(ascription.getString("shotId"));
+            // 策划id
+            materialAscription.setPlanId(ascription.getString("planId"));
+            //平面id
+            materialAscription.setPlaneId(ascription.getString("planeId"));
+            materialAscriptionMapper.deleteByMap(deleteMap);
+            int i = materialAscriptionMapper.insert(materialAscription);
+            if (i > 0) {
+                log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
+            }
+        }
+
+        JSONArray tag = jsonObject.getJSONArray("tag");
+        if (!Check.isNull(tag)) {
+            materialTagMapper.deleteByMap(deleteMap);
+            for (int i = 0; i < tag.size(); i++) {
+                String tagStr = tag.getString(i);
+                if (!Check.isNull(tagStr)) {
+                    MaterialTag materialTag = new MaterialTag();
+                    materialTag.setMaterialId(info.getId());
+                    materialTag.setTag(tagStr);
+                    materialTagMapper.insert(materialTag);
+                }
+            }
+        }
+
+        getFile(info);
+
+    }
+
+
     /**
      * 获取素材详细信息
      *

+ 16 - 18
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -26,11 +26,12 @@ public class MpsUtils {
 //        String[] a = {"1","2","3","4","5"};
 //        combinationSelect(a,3);
 //        arrangementSelect(a,3);
-        String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
-        int i = t.indexOf("/",10);
-        System.out.println(t.substring(i+1,t.length()-1));
+//        String t = "https://ctop-part.oss-cn-beijing.aliyuncs.com/input/VIDEO_HEAD/2019-12-11/25-1576044510677.mp4";
+//        int i = t.indexOf("/",10);
+//        System.out.println(t.substring(i+1,t.length()-1));
 
-//        MpsUtils mpsUtils = new MpsUtils();
+        MpsUtils mpsUtils = new MpsUtils();
+        mpsUtils.videoWaterMark("video/2019-12-20/20%E7%BD%91%E6%9C%8D-1576822566069.mp4","watermark/water1080-1920.png","8bcf0c98021c40fc96a95d60f55b1f10",720);
 //        List<String> list = new ArrayList<>();
 //        list.add("v1.mp4");
 //        String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
@@ -271,17 +272,20 @@ public class MpsUtils {
 
     public String videoWaterMark(String videoPath,String waterMarkPath,String watermarkTemplateId,Integer height){
         String jobId = "";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String outputFilename = "watermark/"+sdf.format(new Date())+"/"+ UUID.randomUUID()+".mp4";
         IAcsClient client = getClient();
         String pipelineId = getPipelineId(client);
         SubmitJobsRequest request = new SubmitJobsRequest();
+        JSONObject input = new JSONObject();
+        input.put("Location", ossLocation);
+        input.put("Bucket", "ctop-media");
+        input.put("Object", videoPath);
+        request.setInput(input.toJSONString());
         JSONObject videoWatermarkInput = new JSONObject();
         videoWatermarkInput.put("Location", ossLocation);
-        videoWatermarkInput.put("Bucket", ossBucket);
-        try {
-            videoWatermarkInput.put("Object", URLEncoder.encode(videoPath, "utf-8"));
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("videoWatetmark Input URL encode failed");
-        }
+        videoWatermarkInput.put("Bucket", "ctop-media");
+        videoWatermarkInput.put("Object", waterMarkPath);
         JSONObject videoWatermark = new JSONObject();
         videoWatermark.put("WaterMarkTemplateId", watermarkTemplateId);
         videoWatermark.put("Type", "Image");
@@ -290,14 +294,8 @@ public class MpsUtils {
         videoWatermark.put("Height", height);
         videoWatermark.put("Dx", "0");
         videoWatermark.put("Dy", "0");
-        String outputOSSObject;
-        try {
-            outputOSSObject = URLEncoder.encode(waterMarkPath, "utf-8");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("output URL encode failed");
-        }
         JSONObject output = new JSONObject();
-        output.put("OutputObject", outputOSSObject);
+        output.put("OutputObject", outputFilename);
         JSONArray watermarks = new JSONArray();
         watermarks.add(videoWatermark);
         output.put("WaterMarks", watermarks.toJSONString());
@@ -305,7 +303,7 @@ public class MpsUtils {
         JSONArray outputs = new JSONArray();
         outputs.add(output);
         request.setOutputs(outputs.toJSONString());
-        request.setOutputBucket(ossBucket);
+        request.setOutputBucket("ctop-media");
         request.setOutputLocation(ossLocation);
         // PipelineId
         request.setPipelineId(pipelineId);

+ 5 - 2
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/mapper/xml/PerformanceMapper.xml

@@ -10,6 +10,7 @@
         <result column="appType" property="appType"/>
         <result column="projectId" property="projectId"/>
         <result column="projectName" property="projectName"/>
+        <result column="accountName" property="accountName"/>
     </resultMap>
     <select id="getOptimizerTotalCostDetailGroupByUserId" resultMap="OptimizerTotalCostDetail">
         SELECT
@@ -69,7 +70,8 @@
 
     <select id="getUserOptimizerTotalCostGroupByProjectId" resultMap="OptimizerTotalCostDetail">
         SELECT
-        allocation.project_id as projectId,allocation.project_name as projectName,dailiAccount.account_id,sysUser.id as
+        allocation.project_id as projectId,allocation.project_name as projectName,allocation.auth_name as
+        accountName,sysUser.id as
         userId,sysUser.realname as realName,SUM(charge) as totalCost,#{year} AS year,#{quarter} as quarter,2 as appType
         FROM
         ctop_kuaishou_report_daily_account dailiAccount
@@ -99,7 +101,8 @@
     </select>
     <select id="getUserOptimizerTotalCostGroupByAccountId" resultMap="OptimizerTotalCostDetail">
         SELECT
-        allocation.project_id as projectId,allocation.project_name as projectName,dailiAccount.account_id,sysUser.id as
+        allocation.project_id as projectId,allocation.project_name as projectName,allocation.auth_name as accountName
+        ,sysUser.id as
         userId,sysUser.realname as realName,SUM(charge) as totalCost,#{year} AS year,#{quarter} as quarter,2 as appType
         FROM
         ctop_kuaishou_report_daily_account dailiAccount

+ 4 - 3
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceOptimizerServiceImpl.java

@@ -11,6 +11,7 @@ import cn.com.ctop.performanceappraisal.service.IPerformanceService;
 import cn.com.ctop.performanceappraisal.vo.OptimizerCostDetailVO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -41,9 +42,9 @@ public class PerformanceOptimizerServiceImpl extends ServiceImpl<PerformanceOpti
         Map<String, Object> result = new HashMap<>();
         Integer startIndex = (pageNo - 1) * pageSize;
         //查询当前登录人信息
-//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        LoginUser sysUser = new LoginUser();
-        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        LoginUser sysUser = new LoginUser();
+//        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
         //查询当前媒体配置信息
         OptimizerConfig config = optimizerConfigService.getEnabledConfigByMediaType(mediaType);
         if (null == config) {

+ 15 - 11
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/service/impl/PerformanceServiceImpl.java

@@ -12,6 +12,7 @@ import cn.com.ctop.performanceappraisal.service.IPerformanceService;
 import cn.com.ctop.performanceappraisal.vo.DesignerCostDetailVO;
 import cn.com.ctop.performanceappraisal.vo.OptimizerCostDetailVO;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -98,9 +99,9 @@ public class PerformanceServiceImpl extends ServiceImpl<PerformanceMapper, Perfo
     @Override
     public Map<String, Object> getUserOptimizerProjectList(Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
-        //        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        LoginUser sysUser = new LoginUser();
-        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        LoginUser sysUser = new LoginUser();
+//        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
         Integer startIndex = (pageNo - 1) * pageSize;
         Date date = new Date();
         Date getDate = DateUtils.addDay(date, -1);
@@ -117,9 +118,9 @@ public class PerformanceServiceImpl extends ServiceImpl<PerformanceMapper, Perfo
     @Override
     public Map<String, Object> getUserOptimizerAccountList(Long projectId, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
-        //        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        LoginUser sysUser = new LoginUser();
-        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        LoginUser sysUser = new LoginUser();
+//        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
         Integer startIndex = (pageNo - 1) * pageSize;
         Date date = new Date();
         Date getDate = DateUtils.addDay(date, -1);
@@ -137,10 +138,10 @@ public class PerformanceServiceImpl extends ServiceImpl<PerformanceMapper, Perfo
     public Map<String, Object> getMemberPerformanceByUserId(OptimizerConfig config, OptimizerCostDetailVO totalCostVo) {
         Map<String, Object> result = new HashMap<>();
         //查询此机构下其他运营专员跑量数据
-        //        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        LoginUser sysUser = new LoginUser();
-        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
-        sysUser.setOrgCode("A01A07A01");
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        LoginUser sysUser = new LoginUser();
+//        sysUser.setId("fcb3fbf6192640adaadb2a7df9c02dae");
+//        sysUser.setOrgCode("A01A07A01");
         Date date = new Date();
         Date getDate = DateUtils.addDay(date, -1);
         String startDate = DateUtils.getQuarterStartDate(getDate);
@@ -151,15 +152,18 @@ public class PerformanceServiceImpl extends ServiceImpl<PerformanceMapper, Perfo
         List<OptimizerCostDetailVO> detailVOS = performanceMapper.getMemberPerformanceByOrgCode(startDate, endDate, year, quarter, sysUser.getOrgCode());
         List<OptimizerCostDetailVO> getDetails = new ArrayList<>();
         BigDecimal memberTotaRoyalty = BigDecimal.ZERO;
-        result.put("totalCost", totalCostVo.getTotalCost());
+        BigDecimal memberTotaCost = BigDecimal.ZERO;
+        result.put("mediaTotalCost", totalCostVo.getTotalCost());
         result.put("mediaTask", config.getMediaTask());
         for (OptimizerCostDetailVO vo : detailVOS) {
             BigDecimal royalty = getTotalRoyalty(config, vo, totalCostVo);
             vo.setTotalRoyalty(royalty);
             memberTotaRoyalty = memberTotaRoyalty.add(royalty);
+            memberTotaCost = memberTotaCost.add(vo.getTotalCost());
             getDetails.add(vo);
         }
         result.put("memberDetails", getDetails);
+        result.put("memberTotalCost", memberTotaCost.setScale(2, RoundingMode.HALF_UP).toString());
         if (totalCostVo.getTotalCost().compareTo(config.getMediaTask()) < 0) {
             result.put("totalRoyalty", "0");
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());

+ 1 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/vo/OptimizerCostDetailVO.java

@@ -44,4 +44,5 @@ public class OptimizerCostDetailVO implements Serializable {
 
     private String projectName;
 
+    private String accountName;
 }

+ 32 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/DesignMaterialInfo.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class DesignMaterialInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	private String id;
+
+	private String videoUrl;
+
+	private Integer pageExposureCount;
+
+	private Integer pageClickCount;
+
+	private Integer materialExposureCount;
+
+	private Integer behaviorCount;
+
+	private BigDecimal totalCost;
+
+	private String accountId;
+
+	private String accountName;
+
+	private String platform;
+
+}

+ 22 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/EffiVideoDTO.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+@Data
+public class EffiVideoDTO {
+	private String signature;
+	private BigDecimal charge;
+	private String clipId;
+	private String clipName;
+	private String shotId;
+	private String shotName;
+	private String planId;
+	private String planName;
+	private String planeId;
+	private String planeName;
+
+
+}

+ 13 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/ProjectDTO.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+
+@Data
+public class ProjectDTO implements Serializable {
+    private Long projectId;
+    private BigDecimal projectName;
+}

+ 79 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysRole.java

@@ -0,0 +1,79 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 角色表
+ * </p>
+ *
+ * @Author scott
+ * @since 2018-12-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SysRole implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+
+    /**
+     * 角色名称
+     */
+    @Excel(name="角色名",width=15)
+    private String roleName;
+
+    /**
+     * 角色编码
+     */
+    @Excel(name="角色编码",width=15)
+    private String roleCode;
+
+    /**
+          * 描述
+     */
+    @Excel(name="描述",width=60)
+    private String description;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+
+}

+ 142 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/SysUser.java

@@ -0,0 +1,142 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 用户表
+ * </p>
+ *
+ * @Author scott
+ * @since 2018-12-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SysUser implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    private String id;
+
+    /**
+     * 登录账号
+     */
+    @Excel(name = "登录账号", width = 15)
+    private String username;
+
+    /**
+     * 真实姓名
+     */
+    @Excel(name = "真实姓名", width = 15)
+    private String realname;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * md5密码盐
+     */
+    private String salt;
+
+    /**
+     * 头像
+     */
+    @Excel(name = "头像", width = 15)
+    private String avatar;
+
+    /**
+     * 生日
+     */
+    @Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date birthday;
+
+    /**
+     * 性别(1:男 2:女)
+     */
+    @Excel(name = "性别", width = 15, dicCode = "sex")
+    @Dict(dicCode = "sex")
+    private Integer sex;
+
+    /**
+     * 电子邮件
+     */
+    @Excel(name = "电子邮件", width = 15)
+    private String email;
+
+    /**
+     * 电话
+     */
+    @Excel(name = "电话", width = 15)
+    private String phone;
+
+    /**
+     * 部门code
+     */
+    private String orgCode;
+
+    /**
+     * 状态(1:正常  2:冻结 )
+     */
+    @Excel(name = "状态", width = 15, dicCode = "user_status")
+    @Dict(dicCode = "user_status")
+    private Integer status;
+
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    @Excel(name = "删除状态", width = 15, dicCode = "del_flag")
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新人
+     */
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+    /**
+     * 同步工作流引擎1同步0不同步
+     */
+    private String activitiSync;
+
+
+    @TableField(exist = false)
+    private String departId;
+
+
+}

+ 38 - 3
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/UserEfficientVideoMapMapper.java

@@ -1,10 +1,15 @@
 package cn.com.ctop.userefficientvideomap.mapper;
 
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
+import cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO;
+import cn.com.ctop.userefficientvideomap.entity.ProjectDTO;
 import cn.com.ctop.userefficientvideomap.entity.UserEfficientVideoMap;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * 有效视频与角色对应表
@@ -12,6 +17,36 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @date:   2019-12-16
  * @cersion: V1.0
  */
+@Component
 public interface UserEfficientVideoMapMapper extends BaseMapper<UserEfficientVideoMap> {
 
+    List<EffiVideoDTO> getUserVideoMap(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    int getEffiVideoCountBySignature(@Param("signature")String signature);
+
+    int getEffiVideoCountByUserId(@Param("year")int year, @Param("quarter")int quarter, @Param("userId")String userId);
+
+    int getQuarterMaterialCountByUserId(@Param("roleCode")String roleCode, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("userId")String userId);
+
+    BigDecimal getTotalCostByClipId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal getTotalCostByShotId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal getTotalCostByPlanId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal getTotalCostByPlaneId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    BigDecimal getProjectTotalCostByUserId(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<ProjectDTO> getProjectsByUserId(@Param("userId")String userId);
+
+    int getPlaneCountByProjectId(@Param("projectId")Long projectId);
+
+    int getPlaneCountByUserId(@Param("userId")String userId);
+
+    List<DesignMaterialInfo> designMaterialInfoList(@Param("roleCode")String roleCode, @Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<DesignMaterialInfo> getMaterialAccountInfoByMaterialId(@Param("materialId")String materialId, @Param("startDate")String startDate, @Param("endDate")String endDate);
+
+
 }

+ 235 - 1
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -2,4 +2,238 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper">
 
-</mapper>
+    <!-- 获取有效视频以及视频和人的对应关系 -->
+    <select id="getUserVideoMap" resultType="cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO">
+            select
+            a.signature,
+            sum(a.charge) as charge,
+            d1.id as clip_id,
+            d1.realname as clip_name,
+            d2.id as shot_id,
+            d2.realname as shot_name,
+            d3.id as plan_id,
+            d3.realname as plan_name,
+            d4.id as plane_id,
+            d4.realname as plane_name
+        from ctop_kuaishou_report_daily_creative_statistic a
+        left join ctop_material_info b on a.signature = b.code
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join sys_user d1 on c.clip_id = d1.id
+        left join sys_user d2 on c.shot_id = d2.id
+        left join sys_user d3 on c.plan_id = d3.id
+        left join sys_user d4 on c.plane_id = d4.id
+        where a.signature is not null and b.id is not null
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        group by a.signature
+        having sum(a.charge) >= 5000
+    </select>
+
+    <!-- 根据md5获取有效视频是否存在 -->
+    <select id="getEffiVideoCountBySignature" resultType="java.lang.Integer">
+            select
+            count(1)
+        from ctop_user_efficient_video_map
+        where efficient_video_signature = #{signature}
+    </select>
+
+    <!-- 根据年、季度、userId获取有效视频数量 -->
+    <select id="getEffiVideoCountByUserId" resultType="java.lang.Integer">
+        select
+        count(1)
+        from
+        ctop_user_efficient_video_map
+        where year = #{year}
+        and quarter = #{quarter}
+        and user_id = #{userId}
+    </select>
+
+    <!-- 按人获取季度总视频数量 -->
+    <select id="getQuarterMaterialCountByUserId" resultType="java.lang.Integer">
+            select
+            count(1)
+        from ctop_material_info a
+        left join ctop_material_ascription b on a.id = b.material_id
+        where date_format(a.create_time,'%Y-%m-%d') &gt;= #{startTime}
+        and date_format(a.create_time,'%Y-%m-%d') &lt;= #{endTime}
+        and
+        <choose>
+            <when test=" roleCode == 'plan' ">
+                b.plan_id = #{userId}
+            </when>
+            <when test=" roleCode == 'clip' ">
+                b.clip_id = #{userId}
+            </when>
+            <otherwise>
+                b.shot_id = #{userId}
+            </otherwise>
+        </choose>
+
+    </select>
+
+    <!-- 根据clip_id获取视频总消耗 -->
+    <select id="getTotalCostByClipId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+        from ctop_kuaishou_report_daily_creative_statistic a
+        left join ctop_material_info b on a.signature = b.code
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join sys_user d1 on c.clip_id = d1.id
+        left join sys_user d2 on c.shot_id = d2.id
+        left join sys_user d3 on c.plan_id = d3.id
+        left join sys_user d4 on c.plane_id = d4.id
+        where a.signature is not null and b.id is not null
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        and c.clip_id = #{userId}
+    </select>
+
+    <!-- 根据clip_id获取视频总消耗 -->
+    <select id="getTotalCostByShotId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+        from ctop_kuaishou_report_daily_creative_statistic a
+        left join ctop_material_info b on a.signature = b.code
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join sys_user d1 on c.clip_id = d1.id
+        left join sys_user d2 on c.shot_id = d2.id
+        left join sys_user d3 on c.plan_id = d3.id
+        left join sys_user d4 on c.plane_id = d4.id
+        where a.signature is not null and b.id is not null
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        and c.shot_id = #{userId}
+    </select>
+
+    <!-- 根据clip_id获取视频总消耗 -->
+    <select id="getTotalCostByPlanId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+        from ctop_kuaishou_report_daily_creative_statistic a
+        left join ctop_material_info b on a.signature = b.code
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join sys_user d1 on c.clip_id = d1.id
+        left join sys_user d2 on c.shot_id = d2.id
+        left join sys_user d3 on c.plan_id = d3.id
+        left join sys_user d4 on c.plane_id = d4.id
+        where a.signature is not null and b.id is not null
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        and c.plan_id = #{userId}
+    </select>
+
+    <!-- 根据plane_id获取视频总消耗 -->
+    <select id="getTotalCostByPlaneId" resultType="java.math.BigDecimal">
+            select
+            sum(a.charge) as charge
+        from ctop_kuaishou_report_daily_creative_statistic a
+        left join ctop_material_info b on a.signature = b.code
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join sys_user d1 on c.clip_id = d1.id
+        left join sys_user d2 on c.shot_id = d2.id
+        left join sys_user d3 on c.plan_id = d3.id
+        left join sys_user d4 on c.plane_id = d4.id
+        where a.signature is not null and b.id is not null
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        where c.plane_id = #{userId}
+    </select>
+
+    <select id="getProjectTotalCostByUserId" resultType="java.math.BigDecimal">
+        select
+        sum(dailiAccount.charge) as charge
+        from
+        ctop_kuaishou_report_daily_account dailiAccount
+        left join
+        ctop_user_allocation allocation on dailiAccount.account_id = allocation.account_id
+        left join
+        ctop_project_member projectMember on projectMember.project_id = allocation.project_id
+        where
+        projectMember.user_id = #{userId}
+        AND
+        dailiAccount.stat_date &gt;= #{startDate}
+        AND
+        dailiAccount.stat_date &lt; #{endDate}
+    </select>
+
+    <!-- 获取这个人所在的所有项目 -->
+    <select id="getProjectsByUserId" resultType="cn.com.ctop.userefficientvideomap.entity.ProjectDTO">
+        select
+        project_id as projectId,
+        project_name as projectName
+        from
+        ctop_project_member
+        where
+        user_id = #{userId}
+    </select>
+
+
+    <!-- 根据项目id获取平面设计师的数量 -->
+    <select id="getPlaneCountByProjectId" resultType="java.lang.Integer">
+        select
+        count(1)
+        from ctop_project_member
+        where project_id = #{projectId}
+        and role_code = 'plane';
+    </select>
+
+    <!-- 根据获取的id -->
+    <select id="getPlaneCountByUserId" resultType="java.lang.Integer">
+        select
+        count(1)
+        from sys_user as u
+        left join sys_user_role ur where u.user_id = ur.user_id
+        left join sys_role r on ur.role_id = r.id
+        where u.org_code = (select org_code from sys_user u2 where id = #{userId})
+        and role_code = 'plane'
+    </select>
+
+    <select id="designMaterialInfoList" resultType="cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo">    <!-- 素材、素材跑量、封面点击数、封面曝光数、行为数 -->
+        select
+        b.id as id,
+        b.url as videoUrl, <!-- 素材url -->
+        sum(a.photo_show) as pageExposureCount, <!-- 封面曝光数 -->
+        sum(a.photo_click) as pageClickCount, <!-- 封面点击数 -->
+        sum(a.aclick) as materialExposureCount, <!-- 素材曝光数 -->
+        sum(a.bclick) as behaviorCount,<!-- 行为数 -->
+        sum(a.charge) as totalCost <!-- 素材跑量 -->
+        from
+        ctop_material_info b
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join ctop_kuaishou_report_daily_creative_statistic a on b.code = a.signature
+        where
+        <choose>
+            <when test=" roleCode == 'plan' ">
+                c.plan_id = #{userId}
+            </when>
+            <when test=" roleCode == 'clip' ">
+                c.clip_id = #{userId}
+            </when>
+            <otherwise>
+                c.shot_id = #{userId}
+            </otherwise>
+        </choose>
+         and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+         and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+        group by b.id
+    </select>
+
+    <!-- 根据material_info的id查询出素材账户、投放账户、跑量 -->
+    <select id="getMaterialAccountInfoByMaterialId" resultType="cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo">
+        select
+        a.account_id as accountId,
+        a.account_name as accountName,
+        '快手' as platform,
+        sum(charge) as totalCost
+        from
+        ctop_material_info b
+        left join ctop_material_ascription c on b.id = c.material_id
+        left join ctop_kuaishou_report_daily_creative_statistic a on b.code = a.signature
+        where
+        b.id = #{materialId}
+        and DATE_FORMAT(b.create_time,'%Y-%m-%d') &gt;= #{startDate}
+         and DATE_FORMAT(b.create_time,'%Y-%m-%d') &lt;= #{endDate}
+    </select>
+
+
+</mapper>