hcst_sunzhen преди 5 години
родител
ревизия
81e401be76

+ 5 - 5
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");

+ 26 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -1,9 +1,11 @@
 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;
@@ -32,58 +34,74 @@ public class PerformanceController2 {
     @AutoLog(value = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效")
     @ApiOperation(value = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效", notes = "平台的总有效数量、素材总数、素材有效率、总跑量、当前可获得绩效")
     @PostMapping(value = "/getPerformanceInfo")
-    public Map<String,Object> 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 resultMap;
+        return result;
     }
 
     //有效率排行榜
     @AutoLog(value = "有效率排行榜")
     @ApiOperation(value = "有效率排行榜", notes = "有效率排行榜")
     @PostMapping(value = "/effiRateRank")
-    public Map<String,Object> effiRateRank(@RequestParam(name = "pageSize")Integer pageSize) {
+    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 resultMap;
+        return result;
     }
 
     //素材、素材跑量、封面点击数、封面曝光数、行为数
     @AutoLog(value = "素材、素材跑量、封面点击数、封面曝光数、行为数")
     @ApiOperation(value = "素材、素材跑量、封面点击数、封面曝光数、行为数", notes = "素材、素材跑量、封面点击数、封面曝光数、行为数")
     @PostMapping(value = "/materialInfoList")
-    public Map<String,Object> 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 resultMap;
+        return result;
     }
 
     //点击+符号 投放账户、投放账户、跑量
     @AutoLog(value = "点击账户增加_投放账户、投放账户、跑量")
     @ApiOperation(value = "点击账户增加_投放账户、投放账户、跑量", notes = "点击账户增加_投放账户、投放账户、跑量")
     @PostMapping(value = "/materialAccountInfo")
-    public Map<String,Object> materialAccountInfo(@RequestParam(name = "materialId")String materialId) {
+    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 resultMap;
+        return result;
     }
 
 }

+ 1 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/UserDto.java

@@ -14,7 +14,7 @@ public class UserDto implements Serializable {
 
     private String userId;
 
-    private String username;
+    private String realname;
 
     private String roleId;
 
@@ -22,15 +22,4 @@ public class UserDto implements Serializable {
 
     private BigDecimal effiRate;
 
-    //public int compareTo(Object obj) {// Comparable接口中的方法
-    //    UserDto b = (UserDto) obj;
-    //   return this.effiRate.compareTo(b.getEffiRate()); //比较大小,用于默认排序
-    //}
-
-    //@Override
-    //public int compare(Object o1, Object o2) {
-    //    UserDto p1 = (UserDto) o1; // 强制转换
-    //    UserDto p2 = (UserDto) o2;
-    //    return (p1.getEffiRate()).compareTo(p2.getEffiRate());
-    //}
 }

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

@@ -428,13 +428,13 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         }
         ///////////////////////////////////////////////////////////////////平面end
 
-        //设计师leader start
+        //TODO 设计师leader start
         //* 1.如果媒体总任务未达成,则没有绩效;如果已达成,则按照千分之5给予提点绩效
         //* 2.查询出所有设计部门的代码,并找出每部门的leader,和部门下所有人员
         //* 3.根据编导(或剪辑、拍摄)算出素材的总消耗
         //* 4.根据部门当中是否有平面设计师来判断提成绩效。有平面,按照15%计算;没有按照20%计算
 
-        //TODO 判断媒体任务是否达成,如果未达成,则没有绩效
+        //判断媒体任务是否达成,如果未达成,则没有绩效
         if(mediaMission()){
         }else{
             return;
@@ -498,7 +498,6 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return performanceMapper.getOptimizerTotalCost(startDate, endNowDate, year, quarter);
     }
 
-
     //1
     //季度到前一天为止个人的有效数量、素材总数、素材有效率、总跑量
     //{"effiVideoCount有效数":70,"videoCount素材总数":200,"effiRate":40,"cost":2019;performance绩效":20000}
@@ -517,6 +516,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
 
         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());
@@ -543,6 +544,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         performanceInfoMap.put("effiRate",videoEffiRate);
         performanceInfoMap.put("cost",cost);
 
+        log.info(roleCode + ":" + sysUser.getRealname() + "getPerformanceInfo接口开始");
         return performanceInfoMap;
     }
 
@@ -564,6 +566,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         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")){
@@ -597,12 +601,13 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             //获取前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() )){
-                    System.out.println("当前登陆人userId:" + sysUser.getId() + "排名:" + index);
+                    log.info("当前登陆人userId:" + sysUser.getId() + ";姓名:" +sysUser.getRealname() + ";排名:" + index);
                     break;
                 }
             }
@@ -611,7 +616,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             //总绩效=总消耗*提点比例(5‰)*提成比例(剪辑30%)
             BigDecimal performance = BigDecimal.ZERO; //绩效
             BigDecimal totalCost = BigDecimal.ZERO;  //总消耗
-            if(roleCode == "plan"){
+            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"));
@@ -620,7 +625,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
                 }else{
                     performance = BigDecimal.ZERO;
                 }
-            }else if(roleCode == "shot"){
+            }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"));
@@ -652,6 +657,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             resultMap.put("performance",0);
         }
 
+        log.info(roleCode + ":" + sysUser.getRealname() + "有效率排行榜接口结束");
         return resultMap;
     }
 
@@ -664,6 +670,8 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         //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);
@@ -672,6 +680,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
 
         List<DesignMaterialInfo> materialInfoList = userEfficientVideoMapMapper.designMaterialInfoList(roleCode, sysUser.getId(), startDate, endNowDate);
 
+        log.info(roleCode + ":" + sysUser.getRealname() + "materialInfoList接口结束");
         return materialInfoList;
     }
 
@@ -679,6 +688,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     //点击+符号 投放账户、投放账户、跑量
     //{"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);
@@ -686,6 +696,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         String endNowDate = DateUtils.formatDate(getDate);
 
         List<DesignMaterialInfo> materialInfoList = userEfficientVideoMapMapper.getMaterialAccountInfoByMaterialId(materialInfoId, startDate, endNowDate);
+        log.info("materialAccountInfo接口结束");
         return materialInfoList;
     }