Procházet zdrojové kódy

Merge branch 'test'

zhaoxian před 2 roky
rodič
revize
1090b458a9
32 změnil soubory, kde provedl 5162 přidání a 724 odebrání
  1. 0 1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 261 79
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/controller/DesignerAchievementsController.java
  3. 41 33
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/mapper/DesignerMapper.java
  4. 480 205
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/mapper/xml/DesignerMapper.xml
  5. 4 17
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/service/IDesignerService.java
  6. 339 380
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/service/impl/DesignerServiceImpl.java
  7. 14 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  8. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java
  9. 15 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java
  10. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java
  11. 125 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouOperationReportController.java
  12. 3 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouOperationReportService.java
  13. 22 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouOperationReportServiceImpl.java
  14. 119 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoDoController.java
  15. 284 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoStrategyController.java
  16. 181 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoTargetController.java
  17. 556 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/entity/V3KuaishouAccountAutoStrategy.java
  18. 271 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/entity/V3KuaishouAccountAutoTarget.java
  19. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/V3KuaishouAccountAutoStrategyMapper.java
  20. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/V3KuaishouAccountAutoTargetMapper.java
  21. 43 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/xml/V3KuaishouAccountAutoStrategyMapper.xml
  22. 25 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/xml/V3KuaishouAccountAutoTargetMapper.xml
  23. 23 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoDoService.java
  24. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoStrategyService.java
  25. 27 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoTargetService.java
  26. 13 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountDetailsService.java
  27. 1997 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoDoServiceImpl.java
  28. 24 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoStrategyServiceImpl.java
  29. 84 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoTargetServiceImpl.java
  30. 105 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountDetailsServiceImpl.java
  31. 9 1
      jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  32. 6 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java

+ 0 - 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -3,7 +3,6 @@ package org.jeecg.common.util;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import io.swagger.models.auth.In;
-import jdk.nashorn.internal.ir.LiteralNode;
 import net.sf.saxon.type.StringConverter;
 import org.hibernate.annotations.Check;
 import org.slf4j.Logger;

+ 261 - 79
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/controller/DesignerAchievementsController.java

@@ -1,16 +1,31 @@
 package cn.com.ctop.common.module.achievements.controller;
 
 import cn.com.ctop.common.module.achievements.service.IDesignerService;
-import com.alibaba.fastjson.JSON;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -28,150 +43,317 @@ import java.util.Map;
 public class DesignerAchievementsController {
     @Autowired
     private IDesignerService designerService;
+    @Autowired
+    private RedisUtil redisUtil;
 
     /**
-     * 查询设计人员基础信息
-     *
-     * @param userId
-     * @return
-     */
-    @GetMapping(value = "/getDesignBasicsInfoList")
-    public PageInfo<JSONObject> getDesignBasicsInfoList(@RequestParam(name = "userId") String userId,
-                                                        @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
-                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-
-        return designerService.getDesignBasicsInfoList(userId,pageNum,pageSize);
-
-    }
-
-    /**
-     * 爆款视频数据
+     * 修改绩效中的用户部分信息
      *
-     * @param userId
+     * @param jsonObject
      * @param
      * @return
      */
-    @GetMapping(value = "/getHotVideoData")
-    public List<Map<String,Object>> getHotVideoData(@RequestParam(name = "userId") String userId,
-                                                    @RequestParam(name = "yearTime")String yearTime,
-                                                    @RequestParam(name = "monthTime")String monthTime) {
+    @PostMapping(value = "/updateUserHappyProbability")
+    public Result updateUserHappyProbability(@RequestBody JSONObject jsonObject) {
 
-        return designerService.getHotVideoData(userId,yearTime,monthTime);
+        return designerService.updateUserHappyProbability(jsonObject);
 
     }
 
+
     /**
-     * 设计绩效
+     * 基础信息+爆款 --
      *
      * @param userId
-     * @param
+     * @param pageNum
+     * @param pageSize
      * @return
      */
-    @GetMapping(value = "/getDesignerAchievements")
-    public Map<String,Object> getDesignerAchievements(@RequestParam(name = "userId") String userId,
-                                                      @RequestParam(name = "yearTime")String yearTime,
-                                                      @RequestParam(name = "monthTime")String monthTime) {
-        return designerService.getDesignerAchievements(userId,yearTime,monthTime);
+    @GetMapping(value = "/getDesignerBasicsAndHotVideoInfo")
+    public Result getDesignerCommission(@RequestParam(name = "userId") String userId,
+                                        @RequestParam(name = "yearTime") String yearTime,
+                                        @RequestParam(name = "monthTime") String monthTime,
+                                        @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        return designerService.getDesignerBasicsAndHotVideoInfo(userId, yearTime, monthTime, pageNum, pageSize);
 
     }
 
+
     /**
-     * 设计提成
+     * 基础信息+绩效 --
      *
      * @param userId
-     * @param
+     * @param pageNum
+     * @param pageSize
      * @return
      */
-    @GetMapping(value = "/getDesignerCommission")
-    public JSONObject getDesignerCommission(@RequestParam(name = "userId") String userId,
-                                            @RequestParam(name = "yearTime")String yearTime,
-                                            @RequestParam(name = "monthTime")String monthTime) {
-        return designerService.getDesignerCommission(userId,yearTime,monthTime);
+    @GetMapping(value = "/getDesignerBasicsAndAch")
+    public Result getDesignerBasicsAndAch(@RequestParam(name = "userId") String userId,
+                                          @RequestParam(name = "yearTime") String yearTime,
+                                          @RequestParam(name = "monthTime") String monthTime,
+                                          @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        return designerService.getDesignerBasicsAndAch(userId, yearTime, monthTime, pageNum, pageSize);
 
     }
 
 
     /**
-     * 修改绩效中的用户部分信息
+     * 基础信息+提成
      *
-     * @param jsonObject
-     * @param
+     * @param userId
+     * @param pageNum
+     * @param pageSize
      * @return
      */
-    @PostMapping(value = "/updateUserHappyProbability")
-    public Result updateUserHappyProbability(@RequestBody JSONObject jsonObject) {
-
-        return designerService.updateUserHappyProbability(jsonObject);
+    @GetMapping(value = "/getDesignerBasicsAndAchAndComInfo")
+    public Result getDesignerBasicsAndAchAndComInfo(@RequestParam(name = "userId") String userId,
+                                                    @RequestParam(name = "yearTime") String yearTime,
+                                                    @RequestParam(name = "monthTime") String monthTime,
+                                                    @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        return designerService.getDesignerBasicsAndAchAndComInfo(userId, yearTime, monthTime, pageNum, pageSize);
 
     }
 
 
     /**
-     * 基础信息+爆款
+     * 基础信息+爆款 --
+     *
      * @param userId
-     * @param pageNum
-     * @param pageSize
      * @return
      */
-    @GetMapping(value = "/getDesignerBasicsAndHotVideoInfo")
-    public Result getDesignerCommission(@RequestParam(name = "userId") String userId,
-                                        @RequestParam(name = "yearTime") String yearTime,
-                                        @RequestParam(name = "monthTime") String monthTime,
-                                        @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
-                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-       return designerService.getDesignerBasicsAndHotVideoInfo(userId,yearTime,monthTime,pageNum,pageSize);
-
+    @GetMapping(value = "/getDesignerBasicsAndHotVideoInfoExcel")
+    public void getDesignerBasicsAndHotVideoInfoExcel(HttpServletResponse response,
+                                                      @RequestParam(name = "userId") String userId,
+                                                      @RequestParam(name = "yearTime") String yearTime,
+                                                      @RequestParam(name = "monthTime") String monthTime) {
+        try {
+            Result<PageInfo<JSONObject>> result = designerService.getDesignerBasicsAndHotVideoInfo(userId, yearTime, monthTime, 1, 99999);
+            PageInfo<JSONObject> pageInfo = result.getResult();
+            List<List<Object>> excelList = new ArrayList<>();
+            Integer month = 0;
+            if (!Check.isNull(pageInfo)) {
+                List<JSONObject> list = pageInfo.getList();
+                if (!list.isEmpty()) {
+                    month = list.get(0).getJSONObject("bytedance").getInteger("monthTime1");
+                    list.forEach(data -> {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(data.getString("userName"));
+                        temp.add(data.getString("roleName"));
+                        temp.add("1".equals(data.getString("status")) ? "正常" : "冻结");
+                        temp.add(data.getString("departName"));
+                        JSONObject bytedance = data.getJSONObject("bytedance");
+                        JSONObject kuaishou = data.getJSONObject("kuaishou");
+                        temp.add(kuaishou.getString("hotNum1"));
+                        temp.add(kuaishou.getString("hotNum2"));
+                        temp.add(kuaishou.getString("hotNum3"));
+                        temp.add(bytedance.getString("hotNum1"));
+                        temp.add(bytedance.getString("hotNum2"));
+                        temp.add(bytedance.getString("hotNum3"));
+                        excelList.add(temp);
+                    });
+                }
+                List<Integer> monthInt = null;
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"姓名", "岗位", "状态", "组别",
+                        "快手" + month + "月爆款", "快手" + (month + 1) + "月爆款", "快手" + (month + 2) + "月爆款",
+                        "头条" + month + "月爆款", "头条" + (month + 1) + "月爆款", "头条" + (month + 2) + "月爆款"};
+                eeu.exportExcelForAttendance(workbook, 0, "设计爆款数据", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 
-
     /**
-     * 基础信息+绩效
+     * 基础信息+绩效 --
+     *
      * @param userId
-     * @param pageNum
-     * @param pageSize
      * @return
      */
-    @GetMapping(value = "/getDesignerBasicsAndAch")
-    public Result getDesignerBasicsAndAch(@RequestParam(name = "userId") String userId,
-                                                    @RequestParam(name = "yearTime") String yearTime,
-                                                    @RequestParam(name = "monthTime") String monthTime,
-                                        @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
-                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-       return designerService.getDesignerBasicsAndAch(userId,yearTime,monthTime,pageNum,pageSize);
-
+    @GetMapping(value = "/getDesignerBasicsAndAchExcel")
+    public void getDesignerBasicsAndAchExcel(HttpServletResponse response,
+                                             @RequestParam(name = "userId") String userId,
+                                             @RequestParam(name = "yearTime") String yearTime,
+                                             @RequestParam(name = "monthTime") String monthTime) {
+        try {
+            Result<PageInfo<JSONObject>> result = null;
+            String statDate = DateUtils.formatDate(new Date());
+            String key = statDate + "-ACHINFO-" + userId.substring(0, 8).toUpperCase();
+            Object hget = redisUtil.hget(key, monthTime);
+            if (!Check.isNull(hget)) {
+                result = (Result<PageInfo<JSONObject>>) hget;
+            } else {
+                result = designerService.getDesignerBasicsAndAch(userId, yearTime, monthTime, 1, 9999);
+                Map<Object, Object> hmget = redisUtil.hmget(key);
+                if (Check.isNull(hmget) || hmget.isEmpty()) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put(monthTime, result);
+                    redisUtil.hmset(key, map, 80000L);
+                } else {
+                    redisUtil.hset(key, monthTime, result);
+                }
+            }
+            PageInfo<JSONObject> pageInfo = result.getResult();
+            List<List<Object>> excelList = new ArrayList<>();
+            Integer month = 0;
+            if (!Check.isNull(pageInfo)) {
+                List<JSONObject> list = pageInfo.getList();
+                if (!list.isEmpty()) {
+                    month = list.get(0).getJSONArray("byteDanceData").getJSONObject(0).getInteger("monthTime");
+                    list.forEach(data -> {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(data.getString("userName"));
+                        temp.add(data.getString("roleName"));
+                        temp.add("1".equals(data.getString("status")) ? "正常" : "冻结");
+                        temp.add(data.getString("departName"));
+                        JSONArray bytedance = data.getJSONArray("byteDanceData");
+                        JSONArray kuaishou = data.getJSONArray("kuaiShouData");
+                        for (int i = 0; i < kuaishou.size(); i++) {//clip剪辑id>plan 编导id>shot 拍摄id
+                            JSONObject obj = kuaishou.getJSONObject(i);
+                            temp.add(obj.getDouble("cost"));
+                            temp.add(obj.getDouble("commission"));
+                        }
+                        for (int i = 0; i < bytedance.size(); i++) {//clip剪辑id>plan 编导id>shot 拍摄id
+                            JSONObject obj = bytedance.getJSONObject(i);
+                            temp.add(obj.getDouble("cost"));
+                            temp.add(obj.getDouble("commission"));
+                        }
+                        excelList.add(temp);
+                    });
+                }
+                List<Integer> monthInt = null;
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"姓名", "岗位", "状态", "组别",
+                        month + "月快手剪辑消耗", month + "月快手剪辑提成", month + "月快手编导消耗", month + "月快手编导提成", month + "月快手拍摄消耗", month + "月快手拍摄提成",
+                        (month + 1) + "月快手剪辑消耗", (month + 1) + "月快手剪辑提成", (month + 1) + "月快手编导消耗", (month + 1) + "月快手编导提成", (month + 1) + "月快手拍摄消耗", (month + 1) + "月快手拍摄提成",
+                        (month + 2) + "月快手剪辑消耗", (month + 2) + "月快手剪辑提成", (month + 2) + "月快手编导消耗", (month + 2) + "月快手编导提成", (month + 2) + "月快手拍摄消耗", (month + 2) + "月快手拍摄提成",
+                        month + "月头条剪辑消耗", month + "月头条剪辑提成", month + "月头条编导消耗", month + "月头条编导提成", month + "月头条拍摄消耗", month + "月头条拍摄提成",
+                        (month + 1) + "月头条剪辑消耗", (month + 1) + "月头条剪辑提成", (month + 1) + "月头条编导消耗", (month + 1) + "月头条编导提成", (month + 1) + "月头条拍摄消耗", (month + 1) + "月头条拍摄提成",
+                        (month + 2) + "月头条剪辑消耗", (month + 2) + "月头条剪辑提成", (month + 2) + "月头条编导消耗", (month + 2) + "月头条编导提成", (month + 2) + "月头条拍摄消耗", (month + 2) + "月头条拍摄提成"};
+                eeu.exportExcelForAttendance(workbook, 0, "设计基础数据", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 
     /**
      * 基础信息+提成
+     *
      * @param userId
      * @param pageNum
      * @param pageSize
      * @return
      */
-    @GetMapping(value = "/getDesignerBasicsAndAchAndComInfo")
-    public Result getDesignerBasicsAndAchAndComInfo(@RequestParam(name = "userId") String userId,
-                                                    @RequestParam(name = "yearTime") String yearTime,
-                                                    @RequestParam(name = "monthTime") String monthTime,
-                                        @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
-                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
-       return designerService.getDesignerBasicsAndAchAndComInfo(userId,yearTime,monthTime,pageNum,pageSize);
-
+    @GetMapping(value = "/getDesignerBasicsAndAchAndComInfoExcel")
+    public void getDesignerBasicsAndAchAndComInfoExcel(HttpServletResponse response,
+                                                       @RequestParam(name = "userId") String userId,
+                                                       @RequestParam(name = "yearTime") String yearTime,
+                                                       @RequestParam(name = "monthTime") String monthTime) {
+
+        try {
+            Result<PageInfo<JSONObject>> result = null;
+            String statDate = DateUtils.formatDate(new Date());
+            String key = statDate + "-COMINFO-" + userId.substring(0, 8).toUpperCase();
+            Object hget = redisUtil.hget(key, monthTime);
+            if (!Check.isNull(hget)) {
+                result = (Result<PageInfo<JSONObject>>) hget;
+            } else {
+                result = designerService.getDesignerBasicsAndAchAndComInfo(userId, yearTime, monthTime, 1, 9999);
+                Map<Object, Object> hmget = redisUtil.hmget(key);
+                if (Check.isNull(hmget) || hmget.isEmpty()) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put(monthTime, result);
+                    redisUtil.hmset(key, map, 80000L);
+                } else {
+                    redisUtil.hset(key, monthTime, result);
+                }
+            }
+            PageInfo<JSONObject> pageInfo = result.getResult();
+            List<List<Object>> excelList = new ArrayList<>();
+            Integer month = 0;
+            if (!Check.isNull(pageInfo)) {
+                List<JSONObject> list = pageInfo.getList();
+                if (!list.isEmpty()) {
+                    month = list.get(0).getJSONObject("userFrozen").getJSONArray("commissionList").getJSONObject(0).getInteger("monthTime");
+                    list.forEach(data -> {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(data.getString("userName"));
+                        temp.add(data.getString("roleName"));
+                        temp.add("1".equals(data.getString("status")) ? "正常" : "冻结");
+                        temp.add(data.getString("departName"));
+                        JSONObject userFrozen = data.getJSONObject("userFrozen");
+                        JSONArray quarterCostList = userFrozen.getJSONArray("quarterCostList");
+                        temp.add(quarterCostList.getJSONObject(0).getString("cost"));
+                        temp.add(quarterCostList.getJSONObject(1).getString("cost"));
+                        temp.add(userFrozen.getString("tatolQuarterCost"));
+                        temp.add(userFrozen.getString("leaderCost"));
+                        temp.add(userFrozen.getString("materialCostQualifiedFlag"));
+                        temp.add(userFrozen.getString("hotVideoNum"));
+                        temp.add(userFrozen.getString("openHotVideoNum"));
+                        temp.add(userFrozen.getString("hotVideoTotalNum"));
+                        temp.add(userFrozen.getString("coefficient"));
+                        JSONArray commissionList = userFrozen.getJSONArray("commissionList");
+                        temp.add(commissionList.getJSONObject(0).getString("commission"));
+                        temp.add(commissionList.getJSONObject(1).getString("commission"));
+                        temp.add(commissionList.getJSONObject(2).getString("commission"));
+                        temp.add(userFrozen.getString("totalCommission"));
+                        temp.add(userFrozen.getString("userHappyGetMoney"));
+                        temp.add(userFrozen.getString("remarks"));
+                        temp.add("1".equals(userFrozen.getString("paySalary")) ? "是" : "否");
+                        temp.add("1".equals(userFrozen.getString("paySalary")) ? userFrozen.getString("userHappyGetMoney") : 0);
+                        temp.add("1".equals(data.getString("status")) ? userFrozen.getString("userHappyProbability") : "-");
+                        excelList.add(temp);
+                    });
+                }
+                List<Integer> monthInt = null;
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"姓名", "岗位", "状态", "组别",
+                        "头条素材消耗", "快手素材消耗", "素材总消耗", "管理消耗", "是否达标", "爆款素材数量", "开屏爆款数量", "爆款总量", "爆款达标"
+                        , month + "月提成", (month + 1) + "月提成", (month + 2) + "月提成", "季度提成汇总", "负责人提成", "提成发放金额", "备注", "是否发放", "最终发放金额", "离职发放比例"
+                };
+                eeu.exportExcelForAttendance(workbook, 0, "设计基础数据", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 
     /**
      * 根据角色查询人员
+     *
      * @param roleName
      * @return
      */
     @GetMapping(value = "/getUserByRoleName")
     public Result getUserByRoleName(@RequestParam(name = "roleName") String roleName) {
-       return designerService.getUserByRoleName(roleName);
+        return designerService.getUserByRoleName(roleName);
 
     }
 
 
-
 }

+ 41 - 33
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/mapper/DesignerMapper.java

@@ -1,10 +1,10 @@
 package cn.com.ctop.common.module.achievements.mapper;
 
 import com.alibaba.fastjson.JSONObject;
-import io.swagger.models.auth.In;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -14,108 +14,116 @@ import java.util.Set;
  * @date: 2022-09-28
  * @cersion: V1.0
  */
-public interface DesignerMapper{
+public interface DesignerMapper {
 
     /**
      * 查询设计人员基础信息
+     *
      * @param userIdList 用户id
      * @param departName 部门名称
      * @return
      */
-    List<JSONObject> getDesignerUserInfo(@Param("departName")String departName,@Param("userIdList") Set<String> userIdList);
+    List<JSONObject> getDesignerUserInfo(@Param("roleCodes") List<String> roleCodes, @Param("userIdList") Set<String> userIdList, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime);
 
 
     /**
      * 获取爆款视频数量
+     *
      * @param userId
      * @param roleName  角色名称
      * @param mediaType 1-头条 2-快手
      * @param startTime 当前年份
-     * @param endTime 当前月份
+     * @param endTime   当前月份
      * @return
      */
-    JSONObject  getHotVideoData(@Param("userId")String userId,
-                                     @Param("roleName") String roleName,
-                                     @Param("mediaType") Integer mediaType,
-                                @Param("startTime") Integer startTime,
-                                @Param("endTime") Integer endTime);
+    JSONObject getHotVideoData(@Param("userId") String userId,  @Param("roleName") String roleName,@Param("mediaType") Integer mediaType, @Param("month1") Map<String, Integer> month1, @Param("month2") Map<String, Integer> month2, @Param("month3") Map<String, Integer> month3);
 
 
     /**
-     *  设计人员绩效-头条
+     * 设计人员绩效-头条
+     *
      * @param userId
      * @param startTime
      * @param endTime
      * @return
      */
-    List<JSONObject>  getDesignerAchievementsBytedance(@Param("userId")String userId,
-                                     @Param("startTime") Integer startTime,
-                                     @Param("endTime") Integer endTime);
-
-
-     List<JSONObject>  getDesignerAchievementsKuaishou(@Param("userId")String userId,
-                                     @Param("startTime") Integer startTime,
-                                     @Param("endTime") Integer endTime);
+    List<JSONObject> getDesignerAchievementsBytedance(@Param("userId") String userId,
+                                                      @Param("startTime") Integer startTime,
+                                                      @Param("endTime") Integer endTime);
 
 
+    List<JSONObject> getDesignerAchievementsKuaishou(@Param("userId") String userId,
+                                                     @Param("startTime") Integer startTime,
+                                                     @Param("endTime") Integer endTime);
 
 
     /**
      * 查询设计 本季度 头条  季度消耗汇总
+     *
      * @param userId
      * @return
      */
-    List<JSONObject>  getDesignerBytedanceQuaterCost(@Param("userId")String userId,@Param("startTime") Integer startTime,
-                                                                @Param("endTime") Integer endTime);
-/**
+    List<JSONObject> getDesignerBytedanceQuaterCost(@Param("userId") String userId, @Param("startTime") Integer startTime,
+                                                    @Param("endTime") Integer endTime);
+
+    /**
      * 查询设计 本季度 快手季度消耗汇总
+     *
      * @param userId
      * @return
      */
-    List<JSONObject>  getDesignerKuaishouQuaterCost(@Param("userId")String userId,@Param("startTime") Integer startTime,
-                                                                @Param("endTime") Integer endTime);
+    List<JSONObject> getDesignerKuaishouQuaterCost(@Param("userId") String userId, @Param("startTime") Integer startTime,
+                                                   @Param("endTime") Integer endTime);
 
     /**
      * 管理消耗
+     *
      * @param userId
      * @param startTime
      * @param endTime
      * @return
      */
-    List<JSONObject>  getDesignerManagerLeaderCost(@Param("userId")String userId,@Param("startTime") Integer startTime,
-                                             @Param("endTime") Integer endTime);
+    List<JSONObject> getDesignerManagerLeaderCost(@Param("userId") String userId, @Param("startTime") Integer startTime,
+                                                  @Param("endTime") Integer endTime);
 
     /**
      * 查询人员离职时间
+     *
      * @param userId
      * @return
      */
-    JSONObject  getUserFrozenInfo(@Param("userId")String userId);
+    JSONObject getUserFrozenInfo(@Param("userId") String userId);
 
     /**
      * 查询人员 当前季度爆款素材数量
+     *
      * @param userId
      * @return
      */
-    JSONObject  getUserHotMaterialQuarter(@Param("userId")String userId,@Param("startTime") Integer startTime,
-                                          @Param("endTime") Integer endTime);
+    JSONObject getUserHotMaterialQuarter(@Param("userId") String userId, @Param("startTime") Integer startTime,
+                                         @Param("endTime") Integer endTime);
 
     /**
      * 绩效- 用户信息修改
+     *
      * @return
      */
-    void  updateUserHappyProbability(@Param("userId")String userId,
-                                           @Param("openScreenNum")String openScreenNum,
-                                           @Param("paySalary")String paySalary,
-                                           @Param("remarks")String remarks);
+    void updateUserHappyProbability(@Param("userId") String userId,
+                                    @Param("openScreenNum") String openScreenNum,
+                                    @Param("paySalary") String paySalary,
+                                    @Param("remarks") String remarks);
 
 
     /**
      * 根据角色查询人员
+     *
      * @param roleName
      * @return
      */
-    List<JSONObject> getUserByRoleName(@Param("roleName")String roleName);
+    List<JSONObject> getUserByRoleName(@Param("roleName") String roleName);
+
 
+    List<JSONObject> getQuarterDesignerAchievementsByTedance(@Param("userId") String userId, @Param("month1") Map<String, Integer> month1, @Param("month2") Map<String, Integer> month2, @Param("month3") Map<String, Integer> month3);
 
+    List<JSONObject> getQuarterDesignerAchievementsByKuaishou(@Param("userId") String userId, @Param("month1") Map<String, Integer> month1, @Param("month2") Map<String, Integer> month2, @Param("month3") Map<String, Integer> month3);
 }

+ 480 - 205
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/mapper/xml/DesignerMapper.xml

@@ -6,275 +6,326 @@
     <!-- 查询设计人员基础信息 -->
     <select id="getDesignerUserInfo" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            u.id AS userId,
-            u.realname AS userName,
-            u.sex AS userSex,
-            u.frozen_time AS frozenTime,
-            d.depart_name AS departName,
-            r.role_name AS roleName,
-            u.`status`
+        u.id AS userId,
+        u.realname AS userName,
+        u.sex AS userSex,
+        IFNULL(u.frozen_time,'-') AS frozenTime,
+        d.depart_name AS departName,
+        r.role_name AS roleName,
+        u.`status`
         FROM
-            `jeecg-boot`.sys_user u
-                LEFT JOIN `jeecg-boot`.sys_depart d ON u.org_code = d.org_code
-                LEFT JOIN `jeecg-boot`.sys_user_role ur ON ur.user_id = u.id
-                LEFT JOIN `jeecg-boot`.sys_role r ON r.id = ur.role_id
-        <where>
-            <if test="departName != null and departName != ''">
-                and d.depart_name LIKE concat('%',#{departName},'%')
-            </if>
-            <if test="userIdList != null and userIdList.size() > 0">
-                and u.id in
-                    <foreach collection="userIdList" item="userId" separator="," open="(" close=")">
-                        #{userId}
-                    </foreach>
-            </if>
-        </where>
-        ORDER BY u.id
+        `jeecg-boot`.sys_user u
+        LEFT JOIN `jeecg-boot`.sys_depart d ON u.org_code = d.org_code
+        LEFT JOIN `jeecg-boot`.sys_user_role ur ON ur.user_id = u.id
+        LEFT JOIN `jeecg-boot`.sys_role r ON r.id = ur.role_id
+        where u.STATUS = 1 AND u.del_flag = 0
+        <if test="roleCodes != null and roleCodes.size() > 0">
+            and
+            <foreach collection="roleCodes" item="roleCode" separator=" OR " open="(" close=")">
+                r.role_name LIKE concat(#{roleCode},'%')
+            </foreach>
+        </if>
+        <if test="userIdList != null and userIdList.size() > 0">
+            and u.id in
+            <foreach collection="userIdList" item="userId" separator="," open="(" close=")">
+                #{userId}
+            </foreach>
+        </if>
+        UNION
+        SELECT
+        u.id AS userId,
+        u.realname AS userName,
+        u.sex AS userSex,
+        u.frozen_time AS frozenTime,
+        d.depart_name AS departName,
+        r.role_name AS roleName,
+        u.`status`
+        FROM
+        `jeecg-boot`.sys_user u
+        LEFT JOIN `jeecg-boot`.sys_depart d ON u.org_code = d.org_code
+        LEFT JOIN `jeecg-boot`.sys_user_role ur ON ur.user_id = u.id
+        LEFT JOIN `jeecg-boot`.sys_role r ON r.id = ur.role_id
+        where (u.STATUS != 1 OR u.del_flag != 0)
+        <if test="roleCodes != null and roleCodes.size() > 0">
+            and
+            <foreach collection="roleCodes" item="roleCode" separator=" OR " open="(" close=")">
+                r.role_name LIKE concat(#{roleCode},'%')
+            </foreach>
+        </if>
+        <if test="userIdList != null and userIdList.size() > 0">
+            and u.id in
+            <foreach collection="userIdList" item="userId" separator="," open="(" close=")">
+                #{userId}
+            </foreach>
+        </if>
+        AND (DATE_FORMAT(u.update_time,'%Y%m%d') BETWEEN #{startTime} AND #{endTime} OR
+        DATE_FORMAT(u.frozen_time,'%Y%m%d') BETWEEN #{startTime} AND #{endTime})
+        ORDER BY userId
     </select>
 
 
-
     <!-- 查询设计人员基础信息 -->
     <select id="getHotVideoData" resultType="com.alibaba.fastjson.JSONObject">
+        select * FROM (
         SELECT
-        QUARTER	( h.hot_date ) quaterTime,
-        DATE_FORMAT( h.hot_date, '%Y' ) yearTime,
-        DATE_FORMAT( h.hot_date, '%m' ) monthTime,
-        IFNULL( COUNT( h.signature ), 0 ) AS hotNum
+        DATE_FORMAT( #{month1.startTime}, '%m' ) as 'monthTime1',
+        IFNULL( COUNT( h.signature ), 0 ) AS 'hotNum1'
         FROM
         application.hot_material h
         LEFT JOIN `jeecg-boot`.ctop_material_ascription v ON v.material_id = h.signature
-        where
-         h.media_id = #{mediaType}
-        AND h.hot_date &gt;= #{startTime}
-        AND  h.hot_date &lt;= #{endTime}
+        WHERE
+        h.media_id = #{mediaType}
+        AND h.hot_date &gt;= #{month1.startTime}
+        AND h.hot_date &lt;= #{month1.endTime}
+        <if test="roleName == 'clip'.toString()">
+            AND clip_id = #{userId}
+        </if>
+        <if test="roleName == 'shot'.toString()">
+            AND shot_id = #{userId}
+        </if>
+        <if test="roleName == 'plan'.toString()">
+            AND plan_id = #{userId}
+        </if>
+        <if test="roleName == 'all'.toString()">
+            AND (plan_id = #{userId} or clip_id = #{userId} or shot_id = #{userId} or leader_id = #{userId})
+        </if>
+        ) t1
+        LEFT JOIN (
+        SELECT
+        DATE_FORMAT( #{month2.startTime}, '%m' ) as 'monthTime2',
+        IFNULL( COUNT( h.signature ), 0 ) AS 'hotNum2'
+        FROM
+        application.hot_material h
+        LEFT JOIN `jeecg-boot`.ctop_material_ascription v ON v.material_id = h.signature
+        WHERE
+        h.media_id = #{mediaType}
+        AND h.hot_date &gt;= #{month2.startTime}
+        AND h.hot_date &lt;= #{month2.endTime}
         <if test="roleName == 'clip'.toString()">
             AND clip_id = #{userId}
         </if>
-
         <if test="roleName == 'shot'.toString()">
             AND shot_id = #{userId}
         </if>
-
         <if test="roleName == 'plan'.toString()">
             AND plan_id = #{userId}
         </if>
-
         <if test="roleName == 'all'.toString()">
             AND (plan_id = #{userId} or clip_id = #{userId} or shot_id = #{userId} or leader_id = #{userId})
         </if>
+        )t2 ON 1=1
+        LEFT JOIN (
+        SELECT
+        DATE_FORMAT( #{month3.startTime}, '%m' ) as 'monthTime3',
+        IFNULL( COUNT( h.signature ), 0 ) AS 'hotNum3'
+        FROM
+        application.hot_material h
+        LEFT JOIN `jeecg-boot`.ctop_material_ascription v ON v.material_id = h.signature
+        WHERE
+        h.media_id = #{mediaType}
+        AND h.hot_date &gt;= #{month3.startTime}
+        AND h.hot_date &lt;= #{month3.endTime}
+        <if test="roleName == 'clip'.toString()">
+            AND clip_id = #{userId}
+        </if>
+        <if test="roleName == 'shot'.toString()">
+            AND shot_id = #{userId}
+        </if>
+        <if test="roleName == 'plan'.toString()">
+            AND plan_id = #{userId}
+        </if>
+        <if test="roleName == 'all'.toString()">
+            AND (plan_id = #{userId} or clip_id = #{userId} or shot_id = #{userId} or leader_id = #{userId})
+        </if>
+        )t3 ON 1=1
 
     </select>
 
 
-
-
     <!-- 查询设计人员 头条绩效-->
     <select id="getDesignerAchievementsBytedance" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            QUARTER	( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.cost ), 0 ) AS cost,
-            '0.3' AS coefficient,
-            IFNULL( round(( sum( d.cost ) * 0.002 * 0.3 ), 3 ), 0 ) AS commission,
-            'clip' AS type
-        FROM
-            application.bytedance_material_cost_daily d
-        WHERE
-            clip_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                           quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                 yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                 monthTime,
+               IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+               '0.3'                                            AS coefficient,
+               IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
+               'clip'                                           AS type
+        FROM application.bytedance_material_cost_daily d
+        WHERE clip_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
         UNION ALL
-        SELECT
-            QUARTER	( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.cost ), 0 ) AS cost,
-            '0.1' AS coefficient,
-            IFNULL( round(( sum( d.cost ) * 0.002 * 0.1 ), 3 ), 0 ) AS commission,
-            'shot' AS type
-        FROM
-            application.bytedance_material_cost_daily d
-        WHERE
-            shot_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                           quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                 yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                 monthTime,
+               IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+               '0.1'                                            AS coefficient,
+               IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
+               'shot'                                           AS type
+        FROM application.bytedance_material_cost_daily d
+        WHERE shot_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
         UNION ALL
-        SELECT
-            QUARTER	( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.cost ), 0 ) AS cost,
-            '0.4' AS coefficient,
-            IFNULL( round(( sum( d.cost ) * 0.002 * 0.4 ), 3 ), 0 ) AS commission,
-            'plan' AS type
-        FROM
-            application.bytedance_material_cost_daily d
-        WHERE
-            plan_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                           quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                 yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                 monthTime,
+               IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+               '0.4'                                            AS coefficient,
+               IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
+               'plan'                                           AS type
+        FROM application.bytedance_material_cost_daily d
+        WHERE plan_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
     </select>
 
 
     <!-- 查询设计人员 快手绩效-->
     <select id="getDesignerAchievementsKuaishou" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            QUARTER	( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.charge ), 0 ) AS cost,
-            '0.3' AS coefficient,
-            IFNULL( round(( sum( d.charge ) * 0.003 * 0.3 ), 3 ), 0 ) AS commission,
-            'clip' AS type
-        FROM
-            application.kuaishou_material_cost_daily d
-        WHERE
-            clip_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                             quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                   yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                   monthTime,
+               IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+               '0.3'                                              AS coefficient,
+               IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
+               'clip'                                             AS type
+        FROM application.kuaishou_material_cost_daily d
+        WHERE clip_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
         UNION ALL
-        SELECT
-            QUARTER	( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.charge ), 0 ) AS cost,
-            '0.1' AS coefficient,
-            IFNULL( round(( sum( d.charge ) * 0.003 * 0.1 ), 3 ), 0 ) AS commission,
-            'shot' AS type
-        FROM
-            application.kuaishou_material_cost_daily d
-        WHERE
-            shot_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                             quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                   yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                   monthTime,
+               IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+               '0.1'                                              AS coefficient,
+               IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
+               'shot'                                             AS type
+        FROM application.kuaishou_material_cost_daily d
+        WHERE shot_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
         UNION ALL
-        SELECT
-            QUARTER( d.first_cost_day ) quaterTime,
-            DATE_FORMAT( d.first_cost_day, '%Y' ) yearTime,
-            DATE_FORMAT( d.first_cost_day, '%m' ) monthTime,
-            IFNULL( sum( d.charge ), 0 ) AS cost,
-            '0.4' AS coefficient,
-            IFNULL( round(( sum( d.charge ) * 0.003 * 0.4 ), 3 ), 0 ) AS commission,
-            'plan' AS type
-        FROM
-            application.kuaishou_material_cost_daily d
-        WHERE
-            plan_id = #{userId}
+        SELECT QUARTER(d.first_cost_day)                             quaterTime,
+               DATE_FORMAT(d.first_cost_day, '%Y')                   yearTime,
+               DATE_FORMAT(d.first_cost_day, '%m')                   monthTime,
+               IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+               '0.4'                                              AS coefficient,
+               IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
+               'plan'                                             AS type
+        FROM application.kuaishou_material_cost_daily d
+        WHERE plan_id = #{userId}
           AND d.stat_date &gt;= #{startTime}
           AND d.stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
     </select>
 
     <!-- 查询设计 本季度 头条季度消耗汇总-->
     <select id="getDesignerBytedanceQuaterCost" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            QUARTER( d.first_cost_day ) quaterTime,
-            YEAR ( d.first_cost_day ) yearTime,
-            IFNULL( sum( d.cost ), 0 ) AS cost,
-            'byteDance' AS type
+        SELECT QUARTER(#{startTime}) AS 'quaterTime',
+            YEAR (
+               #{startTime}) AS 'yearTime',
+            IFNULL(ROUND(SUM(d.cost), 2), 0) AS 'cost',
+            'byteDance' AS 'type'
         FROM
             application.bytedance_material_cost_daily d
         WHERE
             (
-            d.clip_id = #{userId} OR d.shot_id = #{userId} OR d.plan_id = #{userId}
+            d.clip_id = #{userId}
+           OR d.shot_id = #{userId}
+           OR d.plan_id = #{userId}
             )
           AND stat_date &gt;= #{startTime}
-          AND  stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND stat_date &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
     </select>
-<!-- 查询设计 本季度 快手季度消耗汇总-->
+    <!-- 查询设计 本季度 快手季度消耗汇总-->
     <select id="getDesignerKuaishouQuaterCost" resultType="com.alibaba.fastjson.JSONObject">
-               SELECT
-            QUARTER( d.first_cost_day ) quaterTime,
-            YEAR ( d.first_cost_day ) yearTime,
-            IFNULL( sum( d.charge ), 0 ) AS cost,
-            'kuaiShou' AS type
+        SELECT QUARTER(#{startTime}) AS 'quaterTime',
+            YEAR (
+               #{startTime}) AS 'yearTime',
+            IFNULL(ROUND(SUM(d.charge), 2), 0) AS 'cost',
+            'kuaiShou' AS 'type'
         FROM
             application.kuaishou_material_cost_daily d
-
         WHERE
             (
-            d.clip_id = #{userId} OR d.shot_id = #{userId} OR d.plan_id = #{userId}
+            d.clip_id = #{userId}
+           OR d.shot_id = #{userId}
+           OR d.plan_id = #{userId}
             )
           AND stat_date &gt;= #{startTime}
-          AND  stat_date &lt;= #{endTime}
-          AND  d.first_cost_day &gt;= #{startTime}
-          AND  d.first_cost_day &lt;= #{endTime}
+          AND stat_date &lt;= #{endTime}
+          AND d.first_cost_day &gt;= #{startTime}
+          AND d.first_cost_day &lt;= #{endTime}
     </select>
 
-   <!-- 管理消耗-->
+    <!-- 管理消耗-->
     <select id="getDesignerManagerLeaderCost" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT * FROM
-            (
-                SELECT IFNULL(SUM(cost),0) cost,leader_id,'bytedance' as type ,1 as sort FROM
-                    application.bytedance_material_cost_daily
-                WHERE leader_id = #{userId}
-                  AND  stat_date &gt;= #{startTime}
-                  AND stat_date &lt;= #{endTime}
-                  AND first_cost_day &gt;= #{startTime}
-                  AND first_cost_day &lt;= #{endTime}
-                UNION
-                SELECT IFNULL(SUM(charge),0) cost,leader_id,'kuaishou' as type,2 as sort FROM
-                    application.kuaishou_material_cost_daily
-                WHERE leader_id = #{userId}
-                  AND  stat_date &gt;= #{startTime}
-                  AND stat_date &lt;= #{endTime}
-                  AND first_cost_day &gt;= #{startTime}
-                  AND first_cost_day &lt;= #{endTime}
-            )  t
+        SELECT *
+        FROM (
+                 SELECT IFNULL(SUM(cost), 0) cost, leader_id, 'bytedance' as type, 1 as sort
+                 FROM application.bytedance_material_cost_daily
+                 WHERE leader_id = #{userId}
+                   AND stat_date &gt;= #{startTime}
+                   AND stat_date &lt;= #{endTime}
+                   AND first_cost_day &gt;= #{startTime}
+                   AND first_cost_day &lt;= #{endTime}
+                 UNION
+                 SELECT IFNULL(SUM(charge), 0) cost, leader_id, 'kuaishou' as type, 2 as sort
+                 FROM application.kuaishou_material_cost_daily
+                 WHERE leader_id = #{userId}
+                   AND stat_date &gt;= #{startTime}
+                   AND stat_date &lt;= #{endTime}
+                   AND first_cost_day &gt;= #{startTime}
+                   AND first_cost_day &lt;= #{endTime}
+             ) t
         ORDER BY t.sort
     </select>
 
 
     <!-- 查询人员离职时间-->
     <select id="getUserFrozenInfo" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            u.id userId,
-            u.username userName,
-            u.realname realName,
-            u.create_time createTime,
-            u.frozen_time frozenTime,
-            IFNULL(u.open_screen_num,0) openHotVideoNum,
-            IFNULL(u.pay_salary,0) paySalary,
-            u.remarks,
-            u.status
-        FROM
-            `jeecg-boot`.sys_user u
-        WHERE u.id = #{userId}
-            limit 1
+        SELECT u.id                         userId,
+               u.username                   userName,
+               u.realname                   realName,
+               u.create_time                createTime,
+               u.frozen_time                frozenTime,
+               IFNULL(u.open_screen_num, 0) openHotVideoNum,
+               IFNULL(u.pay_salary, 0)      paySalary,
+               u.remarks,
+               u.status
+        FROM `jeecg-boot`.sys_user u
+        WHERE u.id = #{userId} limit 1
     </select>
 
 
     <!-- 查询人员 当前季度爆款素材数量 -->
     <select id="getUserHotMaterialQuarter" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-            COUNT(h.signature) hotVideoNum
-        FROM
-            application.hot_material h
-                LEFT JOIN `jeecg-boot`.ctop_material_ascription v ON v.material_id = h.signature
-        WHERE
-
-                (v.plan_id = #{userId}
-                    OR v.clip_id = #{userId}
-                    or v.shot_id =#{userId}
-                    or v.leader_id = #{userId}
-                    )
-          AND  h.hot_date &gt;= #{startTime}
-          AND  h.hot_date &lt;= #{endTime}
+        SELECT COUNT(h.signature) hotVideoNum
+        FROM application.hot_material h
+                 LEFT JOIN `jeecg-boot`.ctop_material_ascription v ON v.material_id = h.signature
+        WHERE (v.plan_id = #{userId}
+            OR v.clip_id = #{userId}
+            or v.shot_id = #{userId}
+            or v.leader_id = #{userId}
+            )
+          AND h.hot_date &gt;= #{startTime}
+          AND h.hot_date &lt;= #{endTime}
 
     </select>
 
@@ -297,8 +348,6 @@
     </update>
 
 
-
-
     <!-- 根据角色查询人员 -->
     <select id="getUserByRoleName" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
@@ -315,26 +364,252 @@
         LEFT JOIN `jeecg-boot`.sys_user_role ur ON ur.user_id = u.id
         LEFT JOIN `jeecg-boot`.sys_role r ON r.id = ur.role_id
         <where>
-             <choose>
-                    <when test="roleName != null and roleName != ''">
-                        and r.role_name LIKE concat('%',#{roleName},'%') or r.role_code LIKE concat('%',#{roleName},'%')
-                    </when>
-                    <otherwise>
-                        and (r.role_name LIKE '%平面组长%'
-                        or r.role_name LIKE '%设计组长%'
-                        or r.role_name LIKE '%制片%'
-                        or r.role_name LIKE '%平面%'
-                        or r.role_name LIKE '%策划%'
-                        or r.role_name LIKE '%拍摄%'
-                        or r.role_name LIKE '%剪辑%' )
-                    </otherwise>
-             </choose>
+            <choose>
+                <when test="roleName != null and roleName != ''">
+                    and r.role_name LIKE concat('%',#{roleName},'%') or r.role_code LIKE concat('%',#{roleName},'%')
+                </when>
+                <otherwise>
+                    and (r.role_name LIKE '%平面组长%'
+                    or r.role_name LIKE '%设计组长%'
+                    or r.role_name LIKE '%制片%'
+                    or r.role_name LIKE '%平面%'
+                    or r.role_name LIKE '%策划%'
+                    or r.role_name LIKE '%拍摄%'
+                    or r.role_name LIKE '%剪辑%' )
+                </otherwise>
+            </choose>
         </where>
     </select>
 
 
+    <select id="getQuarterDesignerAchievementsByTedance" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        FROM (
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.3'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
+                        'clip'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.1'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
+                        'shot'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.4'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
+                        'plan'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.3'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
+                        'clip'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.1'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
+                        'shot'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.4'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
+                        'plan'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.3'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
+                        'clip'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.1'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
+                        'shot'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')              monthTime,
+                        IFNULL(ROUND(SUM(d.cost), 2), 0)                 AS cost,
+                        '0.4'                                            AS coefficient,
+                        IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
+                        'plan'                                           AS type
+                 FROM application.bytedance_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+             ) t
+        order by monthTime, type
+    </select>
 
 
-
+    <!-- 查询设计人员 季度快手绩效-->
+    <select id="getQuarterDesignerAchievementsByKuaishou" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        FROM (
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.3'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
+                        'clip'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.1'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
+                        'shot'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month1.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.4'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
+                        'plan'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month1.startTime}
+                   AND d.stat_date &lt;= #{month1.endTime}
+                   AND d.first_cost_day &gt;= #{month1.startTime}
+                   AND d.first_cost_day &lt;= #{month1.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.3'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
+                        'clip'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.1'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
+                        'shot'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month2.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.4'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
+                        'plan'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month2.startTime}
+                   AND d.stat_date &lt;= #{month2.endTime}
+                   AND d.first_cost_day &gt;= #{month2.startTime}
+                   AND d.first_cost_day &lt;= #{month2.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.3'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
+                        'clip'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE clip_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.1'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
+                        'shot'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE shot_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+                 UNION
+                 SELECT DATE_FORMAT(#{month3.startTime}, '%m')                monthTime,
+                        IFNULL(ROUND(SUM(d.charge), 2), 0)                 AS cost,
+                        '0.4'                                              AS coefficient,
+                        IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
+                        'plan'                                             AS type
+                 FROM application.kuaishou_material_cost_daily d
+                 WHERE plan_id = #{userId}
+                   AND d.stat_date &gt;= #{month3.startTime}
+                   AND d.stat_date &lt;= #{month3.endTime}
+                   AND d.first_cost_day &gt;= #{month3.startTime}
+                   AND d.first_cost_day &lt;= #{month3.endTime}
+             ) t
+        order by monthTime, type
+    </select>
 
 </mapper>

+ 4 - 17
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/service/IDesignerService.java

@@ -1,12 +1,8 @@
 package cn.com.ctop.common.module.achievements.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.github.pagehelper.PageInfo;
 import org.jeecg.common.api.vo.Result;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * 设计人员绩效
  *
@@ -14,24 +10,15 @@ import java.util.Map;
  * @date: 2022-09-28
  * @cersion: V1.0
  */
-public interface IDesignerService{
-
-
-    PageInfo<JSONObject> getDesignBasicsInfoList(String userId, int pageNum, int pageSize);
-
-    List<Map<String,Object>> getHotVideoData(String userId,String yearTime,String monthTime);
-
-    Map<String,Object> getDesignerAchievements(String userId,String yearTime,String monthTime);
-
-    JSONObject getDesignerCommission(String userId,String yearTime,String monthTime);
+public interface IDesignerService {
 
     Result updateUserHappyProbability(JSONObject jsonObject);
 
-    Result getDesignerBasicsAndHotVideoInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize);
-    Result getDesignerBasicsAndAch(String userId,String yearTime,String monthTime,int pageNum,int pageSize);
-    Result getDesignerBasicsAndAchAndComInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize);
+    Result getDesignerBasicsAndHotVideoInfo(String userId, String yearTime, String monthTime, int pageNum, int pageSize);
 
+    Result getDesignerBasicsAndAch(String userId, String yearTime, String monthTime, int pageNum, int pageSize);
 
+    Result getDesignerBasicsAndAchAndComInfo(String userId, String yearTime, String monthTime, int pageNum, int pageSize);
 
     Result getUserByRoleName(String roleName);
 

+ 339 - 380
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/achievements/service/impl/DesignerServiceImpl.java

@@ -3,12 +3,10 @@ package cn.com.ctop.common.module.achievements.service.impl;
 import cn.com.ctop.common.module.achievements.mapper.DesignerMapper;
 import cn.com.ctop.common.module.achievements.service.IDesignerService;
 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.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.itextpdf.text.pdf.parser.clipper.ClipperOffset;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
@@ -20,7 +18,15 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.function.ToDoubleFunction;
 
 /**
@@ -44,112 +50,6 @@ public class DesignerServiceImpl implements IDesignerService {
     private IMaterialReportOverViewService materialReportOverViewService;
     private ToDoubleFunction<JSONObject> getJSONObject;
 
-    @Override
-    public PageInfo<JSONObject> getDesignBasicsInfoList(String userId,int pageNum,int pageSize) {
-        String departName = null;
-        Set<String> userIdList = new HashSet<>();
-        //查询用户角色
-        String roleCode = roleService.getRoleCodeByUserId(userId);
-        if (roleCode.contains("admin")){
-            //查询设计部门所有人
-            departName = "设计";
-        }else if (roleCode.contains("Leader")){
-            //查询所有包含自己的下级
-            userIdList = materialReportOverViewService.recursiveQuerySubordinate(userId);
-        }else {
-            userIdList.add(userId);
-        }
-        PageHelper.startPage(pageNum,pageSize);
-        List<JSONObject> list = designerMapper.getDesignerUserInfo(departName,userIdList);
-        PageInfo<JSONObject> pageInfo = new PageInfo<>(list);
-
-        return pageInfo;
-    }
-
-
-    /**
-     *
-     * @description:爆款视频数据
-     *
-     * @param userId
-     * @return: org.jeecg.common.api.vo.Result
-     * @author: zianY
-     */
-    @Override
-    public List<Map<String,Object>> getHotVideoData(String userId,String yearTime,String monthTime) {
-        String roleName = null;
-        //查询用户角色
-        String roleCode = roleService.getRoleCodeByUserId(userId);
-        if (roleCode.contains("clip")){
-            roleName = "clip";
-        }else if (roleCode.contains("shot")){
-            roleName = "shot";
-        }else if (roleCode.contains("plan")){
-            roleName = "plan";
-        }else {
-            roleName = "all";
-        }
-
-
-        //取当前时间的季度的月份
-        List<Map<String,Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
-
-
-        List<Map<String,Object>> resultList = new ArrayList<>();
-        List<Map<String,Object>> byteDanceList = new ArrayList<>();
-        Map<String,Object> bytedanceMap = new HashMap<>();
-        List<Map<String,Object>> kuaishouList = new ArrayList<>();
-        Map<String,Object> kuaishouMap = new HashMap<>();
-        for (Map<String,Integer> month : timeMap ){
-            //头条
-            JSONObject bytedanceJson = designerMapper.getHotVideoData(userId,roleName,1,month.get("startTime"),month.get("endTime"));
-            bytedanceJson.put("monthTime",month);
-            byteDanceList.add(bytedanceJson);
-            bytedanceMap.put("byteDance",byteDanceList);
-            //快手
-            JSONObject kuaishouJson = designerMapper.getHotVideoData(userId,roleName,2,month.get("startTime"),month.get("endTime"));
-            kuaishouJson.put("monthTime",month);
-            kuaishouList.add(kuaishouJson);
-            kuaishouMap.put("kuaishou",kuaishouList);
-        }
-        resultList.add(bytedanceMap);
-        resultList.add(kuaishouMap);
-        return resultList;
-    }
-
-
-   @Override
-    public Map<String,Object> getDesignerAchievements(String userId,String yearTime,String monthTime) {
-
-       //取当前时间的季度的月份
-       List<Map<String,Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
-
-       Map<String,Object> resultMap = new HashMap<>();
-       List<Map<String,Object>> byteDanceList = new ArrayList<>();
-       List<Map<String,Object>> kuaishouList = new ArrayList<>();
-
-        for (Map<String,Integer> month : timeMap ){
-            Map<String,Object> bytedanceMap = new HashMap<>();
-            Map<String,Object> kuaishouMap = new HashMap<>();
-            //头条
-            List<JSONObject> bytedanceJson = designerMapper.getDesignerAchievementsBytedance(userId,month.get("startTime"),month.get("endTime"));
-            bytedanceMap.put("monthTime",month );
-            bytedanceMap.put("yearTime",yearTime);
-            bytedanceMap.put("byteDance",bytedanceJson);
-            byteDanceList.add(bytedanceMap);
-            //快手
-            List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsKuaishou(userId,month.get("startTime"),month.get("endTime"));
-            kuaishouMap.put("monthTime",month );
-            bytedanceMap.put("yearTime",yearTime);
-            kuaishouMap.put("kuaiShou",kuaishouJson);
-            kuaishouList.add(kuaishouMap);
-        }
-       resultMap.put("byteDanceData",byteDanceList);
-       resultMap.put("kuaiShouData",kuaishouList);
-        return resultMap;
-    }
-
-
     /**
      * 判断 人员 季度消耗 是否达标
      * 一季度3个月 平均每个月80w消耗
@@ -157,9 +57,10 @@ public class DesignerServiceImpl implements IDesignerService {
      * 此外需要考虑人员的入离职日期,如果5月入职,则只计算5、6月是否达标即可,则为每个月80w的消耗目标;
      * frozenTime 离职时间
      * createTime 员工入职时间
+     *
      * @return
      */
-    public Double getMaterialCost(String frozenTime, String createTime,int yearTime,int monthTime){
+    public Double getMaterialCost(String frozenTime, String createTime, int yearTime, int monthTime) {
 
 //String frozenTime = "";
         //String createTime = "2022-11-02 12:23:23";
@@ -171,79 +72,80 @@ public class DesignerServiceImpl implements IDesignerService {
         /**
          * 人员离职
          */
-        if (frozenTime != null){
+        if (frozenTime != null) {
             String yearF = DateUtils.getYear("yyyy-MM-dd", frozenTime);
-            if (!yearF.equals(String.valueOf(yearTime))){
-                log.info("离职-----离职时间是:{},查询季度{} 绩效按照0计算。",frozenTime,monthTime);
+            if (!yearF.equals(String.valueOf(yearTime))) {
+                log.info("离职-----离职时间是:{},查询季度{} 绩效按照0计算。", frozenTime, monthTime);
                 return 0 * cost;
             }
 
 
-            Date  date = DateUtils.str2Date(frozenTime,new SimpleDateFormat("yyyy-MM-dd"));
+            Date date = DateUtils.str2Date(frozenTime, new SimpleDateFormat("yyyy-MM-dd"));
             // 判断时间所在的季度
             int quarterTime = DateUtils.getQuarter(date);
 
             //季度查询时间 超过 离职时间 则比例为0 绩效 无
-            if (quarterTime < monthTime){
+            if (quarterTime < monthTime) {
                 i = 0;
-                log.info("离职-----离职时间是:{},查询季度{} 绩效按照0计算。当前时间是:{},",frozenTime,monthTime,new Date());
+                log.info("离职-----离职时间是:{},查询季度{} 绩效按照0计算。当前时间是:{},", frozenTime, monthTime, new Date());
 
             }
 
-            if (quarterTime > monthTime){
-                log.info("离职-----离职时间是:{},查询季度{},绩效按照240计算。当前时间是:{},",frozenTime,monthTime,new Date());
+            if (quarterTime > monthTime) {
+                log.info("离职-----离职时间是:{},查询季度{},绩效按照240计算。当前时间是:{},", frozenTime, monthTime, new Date());
 
             }
 
             //离职时间 是否是当前季度
-            if (quarterTime == monthTime){
-                Map<String,Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
+            if (quarterTime == monthTime) {
+                Map<String, Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
                 //离职时间所在 月份
-                String month = DateUtils.getMonth("yyyy-MM-dd",frozenTime);
+                String month = DateUtils.getMonth("yyyy-MM-dd", frozenTime);
                 //离职时间所在的季度 的全部 月份
-                String[]  quarter =(String[]) map.get("quarter");
+                String[] quarter = (String[]) map.get("quarter");
                 //判断当前离职所在的月份 与当前季度中的月份集合 并获取下标  下标+1 则是 在职月份i
-                int j = Collections.indexOfSubList(Arrays.asList(quarter),Arrays.asList(month));
+                int j = Collections.indexOfSubList(Arrays.asList(quarter), Arrays.asList(month));
                 i = j + 1;
-                log.info("离职-----离职时间是:{}在查询季度{}范围内!系数为{}个月的绩效数据--->{}",frozenTime,monthTime,i,i*cost);
+                log.info("离职-----离职时间是:{}在查询季度{}范围内!系数为{}个月的绩效数据--->{}", frozenTime, monthTime, i, i * cost);
 
             }
             //return i * cost;
 
-        }else {
+        } else {
             String yearC = DateUtils.getYear("yyyy-MM-dd", createTime);
-            if (!yearC.equals(String.valueOf(yearTime))){
-                log.info("在职-----入职时间是:{},查询季度{} 绩效按照240计算。",createTime,monthTime);
+            if (!yearC.equals(String.valueOf(yearTime))) {
+                log.info("在职-----入职时间是:{},查询季度{} 绩效按照240计算。", createTime, monthTime);
                 return i * cost;
             }
-            Date  date = DateUtils.str2Date(createTime,new SimpleDateFormat("yyyy-MM-dd"));
+            Date date = DateUtils.str2Date(createTime, new SimpleDateFormat("yyyy-MM-dd"));
             // 判断时间所在的季度
             int quarterTime = DateUtils.getQuarter(date);
             //查询入职前的 比例
             //季度查询时间 超过 入职时间  绩效0
-            if (quarterTime < monthTime){
-                log.info("在职-----入职时间是:{},查询季度{} 绩效按照240计算。当前时间是:{},",createTime,monthTime,new Date());
+            if (quarterTime < monthTime) {
+                log.info("在职-----入职时间是:{},查询季度{} 绩效按照240计算。当前时间是:{},", createTime, monthTime, new Date());
             }
             //查询入职后的 比例
-            if (quarterTime > monthTime){
+            if (quarterTime > monthTime) {
                 i = 0;
-                log.info("在职-----入职时间是:{},查询季度{},绩效按照0计算。当前时间是:{},",createTime,monthTime,new Date());
+                log.info("在职-----入职时间是:{},查询季度{},绩效按照0计算。当前时间是:{},", createTime, monthTime, new Date());
             }
 
             //入职时间 在当前季度
-            if (quarterTime == monthTime){
-                Map<String,Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
+            if (quarterTime == monthTime) {
+                Map<String, Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
                 //月份
                 //入职时间所在 月份
-                String month = DateUtils.getMonth("yyyy-MM-dd",createTime);
+                String month = DateUtils.getMonth("yyyy-MM-dd", createTime);
                 //季度
-                String[]  quarter =(String[]) map.get("quarter");
+                String[] quarter = (String[]) map.get("quarter");
                 //判断当前离职所在的月份 与当前季度中的月份集合 并获取下标  下标+1 则是 在职月份i
-                int j = Collections.indexOfSubList(Arrays.asList(quarter),Arrays.asList(month));
+                int j = Collections.indexOfSubList(Arrays.asList(quarter), Arrays.asList(month));
                 i = j + 1;
-                log.info("在职-----入职时间是:{}在查询季度{}内!系数为{}个月的绩效数据--->{}",createTime,monthTime,i,i*cost);
+                log.info("在职-----入职时间是:{}在查询季度{}内!系数为{}个月的绩效数据--->{}", createTime, monthTime, i, i * cost);
                 return i * cost;
-            };
+            }
+            ;
         }
         return i * cost;
     }
@@ -252,36 +154,37 @@ public class DesignerServiceImpl implements IDesignerService {
     /**
      * 离职发放比例
      * frozenTime 离职时间
+     *
      * @return
      */
-    public Double userHappyProbability(String frozenTime,int monthTime){
+    public Double userHappyProbability(String frozenTime, int monthTime) {
 
         //离职发放比例
         Double userHappyProbability = new Double("1");
-        if (!Check.isNull(frozenTime)){
+        if (!Check.isNull(frozenTime)) {
             //根据时间获取季度
             //离职时间所在的季度 是否和 查询季度相同 相同则判断 不同 则比例为1
 
             //当前季度的 月份
-            Map<String,Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
+            Map<String, Object> map = DateUtils.getCurrentQuarterMonths(monthTime);
             //季度
-            String[]  quarter =(String[]) map.get("quarter");
-            String month = DateUtils.getMonth("yyyy-MM-dd",frozenTime);
-            if (Arrays.binarySearch(quarter,month) < 0){
+            String[] quarter = (String[]) map.get("quarter");
+            String month = DateUtils.getMonth("yyyy-MM-dd", frozenTime);
+            if (Arrays.binarySearch(quarter, month) < 0) {
                 return userHappyProbability;
             }
 
 
             //离职  获取 天
-            String day = DateUtils.getDay("yyyy-MM-dd",frozenTime);
+            String day = DateUtils.getDay("yyyy-MM-dd", frozenTime);
 
             //15日之前离职 不发
-            if (Integer.valueOf(day) < 15){
+            if (Integer.valueOf(day) < 15) {
                 userHappyProbability = new Double("0");
             }
 
             // 15号之后离职,发50%
-            if (Integer.valueOf(day) >= 15){
+            if (Integer.valueOf(day) >= 15) {
                 userHappyProbability = new Double("0.5");
             }
 
@@ -289,8 +192,8 @@ public class DesignerServiceImpl implements IDesignerService {
             String endDay = DateUtils.getQuarterEndDay(frozenTime);
             //最后一天离职 发放比例为1
             // 离职时间 > = 最后一天
-            if (DateUtils.str2Date(frozenTime,new SimpleDateFormat("yyyy-MM-dd")).getTime() >=
-                    DateUtils.str2Date(endDay,new SimpleDateFormat("yyyy-MM-dd")).getTime()){
+            if (DateUtils.str2Date(frozenTime, new SimpleDateFormat("yyyy-MM-dd")).getTime() >=
+                    DateUtils.str2Date(endDay, new SimpleDateFormat("yyyy-MM-dd")).getTime()) {
                 userHappyProbability = new Double("1");
             }
 
@@ -300,292 +203,348 @@ public class DesignerServiceImpl implements IDesignerService {
         return userHappyProbability;
     }
 
+    /**
+     * @param userId
+     * @description:爆款视频数据
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public void getHotVideoData(JSONObject jsonObject, String yearTime, List<Map<String, Integer>> timeMap) {
+        String userId = jsonObject.getString("userId");
+        String roleName = null;
+        //查询用户角色
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        if (roleCode.contains("clip")) {
+            roleName = "clip";
+        } else if (roleCode.contains("shot")) {
+            roleName = "shot";
+        } else if (roleCode.contains("plan")) {
+            roleName = "plan";
+        } else {
+            roleName = "all";
+        }
+        Map<String, Integer> month1 = timeMap.get(0);
+        Map<String, Integer> month2 = timeMap.get(1);
+        Map<String, Integer> month3 = timeMap.get(2);
+        JSONObject bytedanceJson = designerMapper.getHotVideoData(userId, roleName, 1, month1, month2, month3);
+        JSONObject kuaishouJson = designerMapper.getHotVideoData(userId, roleName, 2, month1, month2, month3);
+        jsonObject.put("bytedance", bytedanceJson);
+        jsonObject.put("kuaishou", kuaishouJson);
+    }
 
 
+    public void getDesignerAchievements(JSONObject jsonObject, String yearTime, List<Map<String, Integer>> timeMap) {
+        String userId = jsonObject.getString("userId");
+        Map<String, Object> resultMap = new HashMap<>();
+        Map<String, Integer> month1 = timeMap.get(0);
+        Map<String, Integer> month2 = timeMap.get(1);
+        Map<String, Integer> month3 = timeMap.get(2);
+        List<JSONObject> bytedanceJson = designerMapper.getQuarterDesignerAchievementsByTedance(userId, month1, month2, month3);
+        List<JSONObject> kuaishouJson = designerMapper.getQuarterDesignerAchievementsByKuaishou(userId, month1, month2, month3);
+        jsonObject.put("byteDanceData", bytedanceJson);
+        jsonObject.put("kuaiShouData", kuaishouJson);
 
+    }
 
+    public JSONObject getDesignerCommission(String userId, String yearTime, String monthTime, List<Map<String, Integer>> timeMap) {
+        String roleCode = roleService.getRoleCodeByUserId(userId);
 
+        //人员离职信息
+        JSONObject userFrozen = designerMapper.getUserFrozenInfo(userId);
+
+        //离职时间
+        String frozenTime = userFrozen.getString("frozenTime");
+        //入职时间
+        String createTime = userFrozen.getString("createTime");
+
+
+        List<Map<String, Object>> quarterCostList = new ArrayList<>();
+        List<Map<String, Object>> leaderCostList = new ArrayList<>();
+        List<JSONObject> listBytedanceCost = new ArrayList<>();
+        List<JSONObject> listKuaishouCost = new ArrayList<>();
+        for (Map<String, Integer> month : timeMap) {
+            //季度 分媒体 素材消耗 分月查询
+            List<JSONObject> bytedanceQuarterCost = designerMapper.getDesignerBytedanceQuaterCost(userId, month.get("startTime"), month.get("endTime"));
+            List<JSONObject> kuaishouQuarterCost = designerMapper.getDesignerKuaishouQuaterCost(userId, month.get("startTime"), month.get("endTime"));
+            listBytedanceCost.addAll(bytedanceQuarterCost);
+            listKuaishouCost.addAll(kuaishouQuarterCost);
+
+
+            //管理消耗 分月查询
+            List<JSONObject> leaderCost = designerMapper.getDesignerManagerLeaderCost(userId, month.get("startTime"), month.get("endTime"));
+
+            //离职 提成系数
+            //Double a = userHappyProbability(frozenTime,Integer.valueOf(monthTime));
+            Double userHappyProbability = new Double(1);
+            if (!Check.isNull(frozenTime)) {
+                //离职时间
+                int frozenT = DateUtils.getDateInteger(frozenTime);
+
+                //设计组长 看月份  如果6月离职的,则只计算4、5月份的,与日期无关
+                if (roleCode.equalsIgnoreCase("designTeamLeader")) {
+                    if (frozenT > month.get("endTime")) {
+                        userHappyProbability = new Double(1);
+                    } else {
+                        userHappyProbability = new Double(0);
+                    }
+                }
+            }
 
-   @Override
-    public JSONObject getDesignerCommission(String userId,String yearTime,String monthTime) {
-
-       String roleCode = roleService.getRoleCodeByUserId(userId);
-
-       //取当前时间的季度的月份
-       List<Map<String,Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
-       //人员离职信息
-       JSONObject userFrozen = designerMapper.getUserFrozenInfo(userId);
-
-       //离职时间
-       String frozenTime = userFrozen.getString("frozenTime");
-       //入职时间
-       String createTime = userFrozen.getString("createTime");
-
-
-
-       List<Map<String,Object>> quarterCostList = new ArrayList<>();
-       List<Map<String,Object>> leaderCostList = new ArrayList<>();
-       List<JSONObject> listBytedanceCost = new ArrayList<>();
-       List<JSONObject> listKuaishouCost  = new ArrayList<>();
-       for (Map<String,Integer> month : timeMap ) {
-           //季度 分媒体 素材消耗 分月查询
-           List<JSONObject> bytedanceQuarterCost = designerMapper.getDesignerBytedanceQuaterCost(userId,month.get("startTime"),month.get("endTime"));
-           List<JSONObject> kuaishouQuarterCost = designerMapper.getDesignerKuaishouQuaterCost(userId,month.get("startTime"),month.get("endTime"));
-           listBytedanceCost.addAll(bytedanceQuarterCost);
-           listKuaishouCost.addAll(kuaishouQuarterCost);
-
-
-           //管理消耗 分月查询
-           List<JSONObject> leaderCost = designerMapper.getDesignerManagerLeaderCost(userId,month.get("startTime"),month.get("endTime"));
-
-           //离职 提成系数
-           //Double a = userHappyProbability(frozenTime,Integer.valueOf(monthTime));
-           Double userHappyProbability = new Double(1);
-           if (!Check.isNull(frozenTime)){
-               //离职时间
-               int frozenT = DateUtils.getDateInteger(frozenTime);
-
-               //设计组长 看月份  如果6月离职的,则只计算4、5月份的,与日期无关
-               if (roleCode.equalsIgnoreCase("designTeamLeader")){
-                   if (frozenT > month.get("endTime")){
-                       userHappyProbability = new Double(1);
-                   }else {
-                       userHappyProbability = new Double(0);
-                   }
-               }
-           }
-
-           Map<String,Object> leaderCostMap = new HashMap<>();
-           leaderCostMap.put("xishu", userHappyProbability);
-           leaderCostMap.put("bytedanceCost",new Double(leaderCost.get(0).getString("cost")) * userHappyProbability);
-           leaderCostMap.put("kuaishouCost",new Double(leaderCost.get(1).getString("cost")) * userHappyProbability);
-           leaderCostList.add(leaderCostMap);
-
-       }
-       Double bytedanceCost = listBytedanceCost.stream().mapToDouble(json -> json.getDouble("cost")).reduce(Double::sum).orElse(new Double("0"));
-       Double kuaishouCost = listKuaishouCost.stream().mapToDouble(json -> json.getDouble("cost")).reduce(Double::sum).orElse(new Double("0"));
-       Map<String,Object> bytedanceMap = new HashMap<>();
-       Map<String,Object> kuaishouMap = new HashMap<>();
-       bytedanceMap.put("type","byteDance");
-       bytedanceMap.put("cost",bytedanceCost);
-       kuaishouMap.put("type","kuaiShou");
-       kuaishouMap.put("cost",kuaishouCost);
-       quarterCostList.add(bytedanceMap);
-       quarterCostList.add(kuaishouMap);
-
-       //季度 分媒体 素材消耗
-       userFrozen.put("quarterCostList",quarterCostList);
-
-       //季度素材 总消耗
-       Double tatolCost = quarterCostList.stream().mapToDouble(json -> new Double(json.get("cost")+"")).reduce(Double::sum).orElse(new Double("0"));
-       userFrozen.put("tatolQuarterCost",tatolCost);
-
-       //季度 管理消耗汇总
-       Double bytedanceLeaderCost = leaderCostList.stream().mapToDouble(json -> new Double(json.get("bytedanceCost")+"")).reduce(Double::sum).orElse(new Double("0"));
-       Double kuaishouLeaderCost = leaderCostList.stream().mapToDouble(json -> new Double(json.get("kuaishouCost")+"")).reduce(Double::sum).orElse(new Double("0"));
-       userFrozen.put("leaderCost",bytedanceLeaderCost + kuaishouLeaderCost);
-
-
-       //判断素材消耗是否达标
-       Double i = getMaterialCost(frozenTime,createTime,Integer.valueOf(yearTime),Integer.valueOf(monthTime));
-       String materialCostQualifiedFlag = tatolCost >= i ? "是" : "否";
-       userFrozen.put("materialCostQualifiedFlag",materialCostQualifiedFlag);
-
-       //爆款素材数量 分月查询
-       JSONObject hotVideoNum = designerMapper.getUserHotMaterialQuarter(userId,timeMap.get(0).get("startTime"),timeMap.get(2).get("endTime"));
-       int hotVideoN = Check.isNull(hotVideoNum) ? 0 : hotVideoNum.getInteger("hotVideoNum");
-       userFrozen.put("hotVideoNum",hotVideoN);
-
-
-       //爆款总量 开屏爆款数量 + 爆款数量
-       int hotVideoTotalNum = userFrozen.getInteger("openHotVideoNum") + hotVideoN;
-       userFrozen.put("hotVideoTotalNum",hotVideoTotalNum);
-
-
-
-       //提成 分月份
-       List<JSONObject> commissionList = new ArrayList<>();
-       for (Map<String,Integer> month : timeMap ) {
-           JSONObject commissionJson = new JSONObject();
-           //头条消耗 提成
-           List<JSONObject> bytedanceJson = designerMapper.getDesignerAchievementsBytedance(userId, month.get("startTime"),month.get("endTime"));
-           Double bytedanceCommission = bytedanceJson.stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
-
-           //快手消耗 提成
-           List<JSONObject> kuaishouJson = designerMapper.getDesignerAchievementsKuaishou(userId, month.get("startTime"),month.get("endTime"));
-           Double kuaishouCommission = kuaishouJson.stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
-
-           commissionJson.put("monthTime", month.get("startTime"));
-           commissionJson.put("yearTime", yearTime);
-
-
-           //离职 提成系数
-           //Double a = userHappyProbability(frozenTime,Integer.valueOf(monthTime));
-           Double userHappyProbability = new Double(1);
-           if (!Check.isNull(frozenTime)){
-
-               //离职时间
-               int frozenT = DateUtils.getDateInteger(frozenTime);
-
-               // 日期转换 20221021 ===>>> 2022-10-21
-               String day = DateUtils.getStrDateToInt(month.get("startTime"));
-               //获取月份的 中间的日期 20221015
-               int middleDay = DateUtils.subMonthMiddleDay(day);
-
-               //个人看日期
-               // 如果当月15日之前离职,当月不发;
-               // 15号之后离职,发50%;
-               // 若月底最后一天离职,则发放100
-               if (!roleCode.equalsIgnoreCase("designTeamLeader")){
-                   if (frozenT < middleDay){
-                       userHappyProbability = new Double(0);
-                   }
-                   if (frozenT > middleDay && frozenT < month.get("endTime")){
-                       userHappyProbability = new Double(0.5);
-                   }
-                   if (frozenT == month.get("endTime")){
-                       userHappyProbability = new Double(1);
-                   }
-               }
-           }
-
-           commissionJson.put("xishu", userHappyProbability);
-           commissionJson.put("commission", (bytedanceCommission + kuaishouCommission) * userHappyProbability);
-           commissionList.add(commissionJson);
-
-       }
-       userFrozen.put("commissionList",commissionList);
-
-
-       //季度提成汇总
-       BigDecimal totalCommissionBd = commissionList.stream().map(json -> json.getBigDecimal("commission")).reduce(BigDecimal.ZERO,BigDecimal::add);
-       Double totalCommission = totalCommissionBd.doubleValue();
-
-       //负责人提成 如果是负责人 (设计组长) 管理消耗 千三的20%
-       Double designerLeaderCommission = new Double("0");
-
-       if (roleCode.equalsIgnoreCase("designTeamLeader")){
-           Double designerLeaderCommissionBytedance = bytedanceLeaderCost * 0.002 * 0.2;
-           Double designerLeaderCommissionKuaishou = kuaishouLeaderCost * 0.003 * 0.2;
-           designerLeaderCommission = designerLeaderCommissionBytedance + designerLeaderCommissionKuaishou;
-       }
-       userFrozen.put("designerLeaderCommission",designerLeaderCommission);
-
-       //提成汇总 = 季度汇总 + 负责人提成
-       totalCommission+=designerLeaderCommission;
-       userFrozen.put("totalCommission",totalCommission);
+            Map<String, Object> leaderCostMap = new HashMap<>();
+            leaderCostMap.put("xishu", userHappyProbability);
+            leaderCostMap.put("bytedanceCost", new Double(leaderCost.get(0).getString("cost")) * userHappyProbability);
+            leaderCostMap.put("kuaishouCost", new Double(leaderCost.get(1).getString("cost")) * userHappyProbability);
+            leaderCostList.add(leaderCostMap);
 
-       //离职发放比例
-       Double userHappyProbability = userHappyProbability(frozenTime,Integer.valueOf(monthTime));
-       userFrozen.put("userHappyProbability",userHappyProbability);
+        }
+        Double bytedanceCost = listBytedanceCost.stream().mapToDouble(json -> json.getDouble("cost")).reduce(Double::sum).orElse(new Double("0"));
+        Double kuaishouCost = listKuaishouCost.stream().mapToDouble(json -> json.getDouble("cost")).reduce(Double::sum).orElse(new Double("0"));
+        Map<String, Object> bytedanceMap = new HashMap<>();
+        Map<String, Object> kuaishouMap = new HashMap<>();
+        bytedanceMap.put("type", "byteDance");
+        bytedanceMap.put("cost", String.format("%.3f", bytedanceCost));
+        kuaishouMap.put("type", "kuaiShou");
+        kuaishouMap.put("cost", String.format("%.3f", kuaishouCost));
+        quarterCostList.add(bytedanceMap);
+        quarterCostList.add(kuaishouMap);
+
+        //季度 分媒体 素材消耗
+        userFrozen.put("quarterCostList", quarterCostList);
+
+        //季度素材 总消耗
+        Double tatolCost = quarterCostList.stream().mapToDouble(json -> new Double(json.get("cost") + "")).reduce(Double::sum).orElse(new Double("0"));
+        userFrozen.put("tatolQuarterCost", String.format("%.3f", tatolCost));
+
+        //季度 管理消耗汇总
+        Double bytedanceLeaderCost = leaderCostList.stream().mapToDouble(json -> new Double(json.get("bytedanceCost") + "")).reduce(Double::sum).orElse(new Double("0"));
+        Double kuaishouLeaderCost = leaderCostList.stream().mapToDouble(json -> new Double(json.get("kuaishouCost") + "")).reduce(Double::sum).orElse(new Double("0"));
+        userFrozen.put("leaderCost", String.format("%.3f", bytedanceLeaderCost + kuaishouLeaderCost));
+
+
+        //判断素材消耗是否达标
+        Double flag = getMaterialCost(frozenTime, createTime, Integer.valueOf(yearTime), Integer.valueOf(monthTime));
+        String materialCostQualifiedFlag = tatolCost >= flag ? "是" : "否";
+        userFrozen.put("materialCostQualifiedFlag", materialCostQualifiedFlag);
+
+        //爆款素材数量 分月查询
+        JSONObject hotVideoNum = designerMapper.getUserHotMaterialQuarter(userId, timeMap.get(0).get("startTime"), timeMap.get(2).get("endTime"));
+        int hotVideoN = Check.isNull(hotVideoNum) ? 0 : hotVideoNum.getInteger("hotVideoNum");
+        userFrozen.put("hotVideoNum", hotVideoN);
+
+
+        //爆款总量 开屏爆款数量 + 爆款数量
+        int hotVideoTotalNum = userFrozen.getInteger("openHotVideoNum") + hotVideoN;
+        userFrozen.put("hotVideoTotalNum", hotVideoTotalNum);
+
+
+        Map<String, Integer> month1 = timeMap.get(0);
+        Map<String, Integer> month2 = timeMap.get(1);
+        Map<String, Integer> month3 = timeMap.get(2);
+        List<JSONObject> bytedanceJson = designerMapper.getQuarterDesignerAchievementsByTedance(userId, month1, month2, month3);
+        List<JSONObject> kuaishouJson = designerMapper.getQuarterDesignerAchievementsByKuaishou(userId, month1, month2, month3);
+        List<List<JSONObject>> bytedance = Lists.partition(bytedanceJson, 3);
+        List<List<JSONObject>> kuaishou = Lists.partition(kuaishouJson, 3);
+        //提成 分月份
+        List<JSONObject> commissionList = new ArrayList<>();
+        for (int i = 0; i < bytedance.size(); i++) {
+            JSONObject commissionJson = new JSONObject();
+            Double bytedanceCommission = bytedance.get(i).stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
+            Double kuaishouCommission = kuaishou.get(i).stream().mapToDouble(json -> json.getDouble("commission")).reduce(Double::sum).orElse(new Double("0"));
+            Double userHappyProbability = new Double(1);
+            if (!Check.isNull(frozenTime)) {
+                //离职时间
+                int frozenT = DateUtils.getDateInteger(frozenTime);
+                int startTime = 0;
+                int endTime = 0;
+                if (i == 0) {
+                    startTime = month1.get("startTime");
+                    endTime = month1.get("endTime");
+                } else if (i == 1) {
+                    startTime = month2.get("startTime");
+                    endTime = month2.get("endTime");
+                } else {
+                    startTime = month3.get("startTime");
+                    endTime = month3.get("endTime");
+                }
+                // 日期转换 20221021 ===>>> 2022-10-21
+                String day = DateUtils.getStrDateToInt(startTime);
+                //获取月份的 中间的日期 20221015
+                int middleDay = DateUtils.subMonthMiddleDay(day);
+
+                //个人看日期
+                // 如果当月15日之前离职,当月不发;
+                // 15号之后离职,发50%;
+                // 若月底最后一天离职,则发放100
+                if (!roleCode.equalsIgnoreCase("designTeamLeader")) {
+                    if (frozenT < middleDay) {
+                        userHappyProbability = new Double(0);
+                    }
+                    if (frozenT > middleDay && frozenT < endTime) {
+                        userHappyProbability = new Double(0.5);
+                    }
+                    if (frozenT == endTime) {
+                        userHappyProbability = new Double(1);
+                    }
+                }
+            }
+            commissionJson.put("monthTime", bytedance.get(i).get(0).getBigInteger("monthTime"));
+            commissionJson.put("xishu", userHappyProbability);
+            commissionJson.put("commission", String.format("%.3f", (bytedanceCommission + kuaishouCommission) * userHappyProbability));
+            commissionList.add(commissionJson);
+        }
+        bytedanceJson.get(0);
+        userFrozen.put("commissionList", commissionList);
 
 
-       /**
-        * 爆款达标 提成发放系数
-        * 在季度中
-        * 爆款 >= 10个 消耗>=240w 绩效 100%
-        * 爆款 < 10 消耗 >= 240w 绩效50%
-        * 爆款<=0 绩效 >= 240w 不发
-        * 爆款>=10 绩效<=240w 不发
-        * 其中的绩效240 根据入职或离职时间按月计算 使用字段materialCostQualifiedFlag
-        *
-        */
-       Double coefficient = new Double("0");
-       if (materialCostQualifiedFlag.equals("是")){
-           if (hotVideoTotalNum >= 10){
-               coefficient = new Double("1");
-           }
-           if (hotVideoTotalNum > 0 && hotVideoTotalNum < 10){
-               coefficient = new Double("0.5");
-           }
-       }
-       userFrozen.put("coefficient",coefficient);
+        //季度提成汇总
+        BigDecimal totalCommissionBd = commissionList.stream().map(json -> json.getBigDecimal("commission")).reduce(BigDecimal.ZERO, BigDecimal::add);
+        Double totalCommission = totalCommissionBd.doubleValue();
 
-       //提成发放金额 = 总提成 * 爆款达标发放系数
-       Double userHappyGetMoney = totalCommission * coefficient;
-       userFrozen.put("userHappyGetMoney",userHappyGetMoney);
-
-       return userFrozen;
+        //负责人提成 如果是负责人 (设计组长) 管理消耗 千三的20%
+        Double designerLeaderCommission = new Double("0");
 
+        if (roleCode.equalsIgnoreCase("designTeamLeader")) {
+            Double designerLeaderCommissionBytedance = bytedanceLeaderCost * 0.002 * 0.2;
+            Double designerLeaderCommissionKuaishou = kuaishouLeaderCost * 0.003 * 0.2;
+            designerLeaderCommission = designerLeaderCommissionBytedance + designerLeaderCommissionKuaishou;
+        }
+        userFrozen.put("designerLeaderCommission", String.format("%.3f", designerLeaderCommission));
 
-   }
+        //提成汇总 = 季度汇总 + 负责人提成
+        totalCommission += designerLeaderCommission;
+        userFrozen.put("totalCommission", totalCommission);
 
+        //离职发放比例
+        Double userHappyProbability = userHappyProbability(frozenTime, Integer.valueOf(monthTime));
+        userFrozen.put("userHappyProbability", userHappyProbability);
 
+        /**
+         * 爆款达标 提成发放系数
+         * 在季度中
+         * 爆款 >= 10个 消耗>=240w 绩效 100%
+         * 爆款 < 10 消耗 >= 240w 绩效50%
+         * 爆款<=0 绩效 >= 240w 不发
+         * 爆款>=10 绩效<=240w 不发
+         * 其中的绩效240 根据入职或离职时间按月计算 使用字段materialCostQualifiedFlag
+         *
+         */
+        Double coefficient = new Double("0");
+        if (materialCostQualifiedFlag.equals("是")) {
+            if (hotVideoTotalNum >= 10) {
+                coefficient = new Double("1");
+            }
+            if (hotVideoTotalNum > 0 && hotVideoTotalNum < 10) {
+                coefficient = new Double("0.5");
+            }
+        }
+        userFrozen.put("coefficient", coefficient);
 
+        //提成发放金额 = 总提成 * 爆款达标发放系数
+        Double userHappyGetMoney = totalCommission * coefficient;
+        userFrozen.put("userHappyGetMoney", String.format("%.3f", userHappyGetMoney));
 
+        return userFrozen;
+    }
 
 
-   @Override
+    @Override
     public Result updateUserHappyProbability(JSONObject jsonObject) {
         designerMapper.updateUserHappyProbability(jsonObject.getString("userId"),
                 jsonObject.getString("openScreenNum"),
                 jsonObject.getString("paySalary"),
                 jsonObject.getString("remarks"));
-       return Result.successMsg("修改成功",null);
+        return Result.successMsg("修改成功", null);
 
 
-   }
-
+    }
 
 
     @Override
-    public Result getDesignerBasicsAndHotVideoInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
+    public Result getDesignerBasicsAndHotVideoInfo(String userId, String yearTime, String monthTime, int pageNum, int pageSize) {
+        //取当前时间的季度的月份
+        List<Map<String, Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
         //基础信息 + 爆款信息
-        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
+        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId, pageNum, pageSize, timeMap);
         for (JSONObject jsonObject : baseics.getList()) {
-            List<Map<String,Object>> hotVideo = getHotVideoData(jsonObject.getString("userId"),yearTime,monthTime);
-            jsonObject.put("hotVideoInfo",hotVideo);
+            getHotVideoData(jsonObject, yearTime, timeMap);
         }
-        return Result.successMsg("基础+爆款查询成功。",baseics);
+        return Result.successMsg("基础+爆款查询成功。", baseics);
 
 
     }
 
 
     @Override
-    public Result getDesignerBasicsAndAch(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
+    public Result getDesignerBasicsAndAch(String userId, String yearTime, String monthTime, int pageNum, int pageSize) {
+        long startTime = System.currentTimeMillis() / 1000;
+        //取当前时间的季度的月份
+        List<Map<String, Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
         //基础信息 + 绩效
-        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
+        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId, pageNum, pageSize, timeMap);
+        long endTime1 = System.currentTimeMillis() / 1000;
+        System.out.println("------------------查询人员用时---------->" + (endTime1 - startTime) + "S");
         for (JSONObject jsonObject : baseics.getList()) {
             //绩效
-            Map<String,Object> achievementsMap = getDesignerAchievements(jsonObject.getString("userId"),yearTime,monthTime);
-            jsonObject.put("achievementsMap",achievementsMap);
+            getDesignerAchievements(jsonObject, yearTime, timeMap);
         }
-        return Result.successMsg("基础+绩效查询成功。",baseics);
+        long endTime = System.currentTimeMillis() / 1000;
+        System.out.println("------------------总共用时---------->" + (endTime - startTime) + "S");
+        return Result.successMsg("基础+绩效查询成功。", baseics);
     }
 
 
     @Override
-    public Result getDesignerBasicsAndAchAndComInfo(String userId,String yearTime,String monthTime,int pageNum,int pageSize){
+    public Result getDesignerBasicsAndAchAndComInfo(String userId, String yearTime, String monthTime, int pageNum, int pageSize) {
+        //取当前时间的季度的月份
+        List<Map<String, Integer>> timeMap = DateUtils.getQuarStartAndEndTime(Integer.valueOf(monthTime));
         //基础信息 +提成
-        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId,pageNum,pageSize);
+        PageInfo<JSONObject> baseics = getDesignBasicsInfoList(userId, pageNum, pageSize, timeMap);
         for (JSONObject jsonObject : baseics.getList()) {
             //提成
-            JSONObject userFrozen = getDesignerCommission(jsonObject.getString("userId"),yearTime,monthTime);
-            jsonObject.put("userFrozen",userFrozen);
+            JSONObject userFrozen = getDesignerCommission(jsonObject.getString("userId"), yearTime, monthTime, timeMap);
+            jsonObject.put("userFrozen", userFrozen);
         }
-        return Result.successMsg("基础+提成查询成功。",baseics);
+        return Result.successMsg("基础+提成查询成功。", baseics);
     }
 
+    /**
+     * 获取人员信息
+     */
+    private PageInfo<JSONObject> getDesignBasicsInfoList(String userId, int pageNum, int pageSize, List<Map<String, Integer>> timeMap) {
+        List<String> roleCodes = new ArrayList<>();
+        Set<String> userIdList = new HashSet<>();
+        //查询用户角色
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        if (roleCode.contains("admin")) {
+            //查询设计部门所有人
+            roleCodes.add("设计");
+            roleCodes.add("平面");
+            roleCodes.add("制片");
+            roleCodes.add("策划");
+            roleCodes.add("拍摄");
+            roleCodes.add("剪辑");
+
+        } else if (roleCode.contains("Leader")) {
+            //查询所有包含自己的下级
+            userIdList = materialReportOverViewService.recursiveQuerySubordinate(userId);
+        } else {
+            userIdList.add(userId);
+        }
+        Integer startTime = timeMap.get(0).get("startTime");
+        Integer endTime = timeMap.get(2).get("endTime");
 
-
-
-
+        PageHelper.startPage(pageNum, pageSize);
+        List<JSONObject> list = designerMapper.getDesignerUserInfo(roleCodes, userIdList, startTime, endTime);
+        PageInfo<JSONObject> pageInfo = new PageInfo<>(list);
+        return pageInfo;
+    }
 
 
     @Override
-    public Result getUserByRoleName(String roleName){
+    public Result getUserByRoleName(String roleName) {
         List<JSONObject> list = designerMapper.getUserByRoleName(roleName);
-        return Result.successMsg("查询成功。",list);
+        return Result.successMsg("查询成功。", list);
     }
 
 
-
-
-
-
-
-
-
-
 }

+ 14 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -367,14 +367,26 @@ public class KuaishouInterfaceConstant {
      * 查询广告组的加速探索报表接口
      */
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
-  /**
+    /**
      * 辅助探索
      */
     public static final String AD_UNIT_EXPLORE_SUPPORT = "/rest/openapi/v1/ad_unit/explore/support";
 
-     /**
+    /**
      * 获取试玩列表
      */
     public static final String PLAYABLE_LIST = "/rest/openapi/gw/dsp/v1/playable/list";
 
+
+    /**
+     * 广告创建接口(包括广告计划、广告组、创意(自定义创意、程序化创意)的三层广告创编接口)
+     */
+    public static final String V3_CREATE_CASCADE_ALL = "/rest/openapi/gw/dsp/v3/ad/createCascadeAll";
+
+    /**
+     * 广告创建接口(广告组和广告创意)
+     */
+    public static final String V3_CREATE_UNIT_AND_CREATIVE = "/rest/openapi/gw/dsp/v3/ad/createUnitAndCreative";
+
+
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -106,6 +107,20 @@ public class AiKuaishouCampaignLevelOperationRecord {
         this.aiStrategyUuid = campaignUuid;
         this.createType = 3;
     }
+    public AiKuaishouCampaignLevelOperationRecord(V3KuaishouAccountAutoStrategy strategy, Long campaignId, Integer code, String message, String campaignName, String campaignUuid) {
+        this.accountId = strategy.getAccountId();
+        this.dayBudget = strategy.getCampaignDayBudget().longValue();
+        this.dayBudgetSchedule = strategy.getCampaignDayBudgetSchedule();
+        this.campaignType = strategy.getCampaignType();
+        this.campaignId = campaignId;
+        this.status = code;
+        this.message = message;
+        this.operationType = 1;
+        this.createTime = new Date();
+        this.campaignName = campaignName;
+        this.aiStrategyUuid = campaignUuid;
+        this.createType = 3;
+    }
 
     public AiKuaishouCampaignLevelOperationRecord(KuaishouProjectStrategy strategy, Long campaignId, Integer code, String message) {
         this.accountId = strategy.getAccountId();

+ 15 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -162,7 +163,20 @@ public class AiKuaishouCreativeLevelOperationRecord {
 
     }
 
-    public AiKuaishouCreativeLevelOperationRecord(AiKuaishouAccountAutoStrategy strategy, Integer creativeCode, JSONObject creativeParams, String creativeMessage,Long newCampaignId, Long unitId, String uuid) {
+    public AiKuaishouCreativeLevelOperationRecord(AiKuaishouAccountAutoStrategy strategy, Integer creativeCode, JSONObject creativeParams, String creativeMessage, Long newCampaignId, Long unitId, String uuid) {
+        BeanUtils.copyProperties(strategy, this);
+        this.status = creativeCode;
+        this.description = creativeParams.getString("description");
+        this.photoId = creativeParams.getString("photo_id");
+        this.message = creativeMessage;
+        this.campaignId = newCampaignId;
+        this.unitId = unitId;
+        this.aiStrategyUuid = uuid;
+        this.createTime = new Date();
+        this.createType = 3;
+    }
+
+    public AiKuaishouCreativeLevelOperationRecord(V3KuaishouAccountAutoStrategy strategy, Integer creativeCode, JSONObject creativeParams, String creativeMessage, Long newCampaignId, Long unitId, String uuid) {
         BeanUtils.copyProperties(strategy, this);
         this.status = creativeCode;
         this.description = creativeParams.getString("description");

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -349,4 +350,20 @@ public class AiKuaishouUnitLevelOperationRecord {
         this.channelId = channelId;
         this.autoTargetId = autoTargetId;
     }
+
+    public AiKuaishouUnitLevelOperationRecord(V3KuaishouAccountAutoStrategy strategy, JSONObject unitParams, Integer unitCode, String unitMessage, String strategyUuid, Long autoTargetId, Long channelId) {
+        BeanUtils.copyProperties(strategy, this);
+        this.groupName = unitParams.getString("unit_name");
+        this.campaignId = unitParams.getLong("campaign_id");
+        this.cpaBid = unitParams.getInteger("cpa_bid");
+        this.bid = unitParams.getInteger("bid");
+        this.deepConversionBid = unitParams.getInteger("deep_conversion_bid");
+        this.createTime = new Date();
+        this.status = unitCode;
+        this.message = unitMessage;
+        this.aiStrategyUuid = strategyUuid;
+        this.createType = 3;
+        this.channelId = channelId;
+        this.autoTargetId = autoTargetId;
+    }
 }

+ 125 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouOperationReportController.java

@@ -4,6 +4,8 @@ import cn.com.ctop.common.module.entity.AccountCompensation;
 import cn.com.ctop.common.module.service.IAccountCompensationService;
 import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouOperationReport;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouOperationReportService;
 import com.alibaba.fastjson.JSONObject;
@@ -12,6 +14,7 @@ import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysRoleService;
@@ -24,6 +27,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -254,4 +259,124 @@ public class KuaishouOperationReportController {
         return Result.error("修改失败");
     }
 
+    /**
+     * 导出应季月度消耗
+     */
+    @GetMapping("/queryMonthlyDataExcel")
+    public void queryMonthlyDataExcel(HttpServletResponse response, String mediaId, Integer time, String role, String userId) {
+        try {
+            Result<Object> result = null;
+            if (mediaId.equals("1")) {
+                result = kuaishouOperationReportService.queryToutiaoMonthlyData(time, role, userId, 1, 99999);
+            } else {
+                result = kuaishouOperationReportService.queryKuaishouMonthlyData(time, role, userId, 1, 99999);
+            }
+            List<List<Object>> excelList = new ArrayList<>();
+            PageInfo pageInfo = (PageInfo) result.getResult();
+            if (!Check.isNull(pageInfo)) {
+                List<JSONObject> list = pageInfo.getList();
+                if (!list.isEmpty()) {
+                    list.forEach(data -> {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(data.getString("userName"));
+                        temp.add(data.getString("roleName"));
+                        temp.add(data.getString("upTime"));
+                        temp.add(data.getString("1totalCharge"));
+                        temp.add(data.getString("2totalCharge"));
+                        temp.add(data.getString("3totalCharge"));
+                        temp.add(data.getString("1KFCharge"));
+                        temp.add(data.getString("2KFCharge"));
+                        temp.add(data.getString("3KFCharge"));
+                        temp.add(data.getString("1FWCharge"));
+                        temp.add(data.getString("2FWCharge"));
+                        temp.add(data.getString("3FWCharge"));
+                        temp.add(data.getString("quitTime"));
+                        excelList.add(temp);
+                    });
+                }
+                List<Integer> monthInt = kuaishouOperationReportService.getMonthInt(time);
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"运营", "岗位", "晋升时间",
+                        monthInt.get(0) + "月总消耗", monthInt.get(1) + "月总消耗", monthInt.get(2) + "月总消耗",
+                        monthInt.get(0) + "月框返消耗", monthInt.get(1) + "月框返消耗", monthInt.get(2) + "月框返消耗",
+                        monthInt.get(0) + "月服务消耗", monthInt.get(1) + "月服务消耗", monthInt.get(2) + "月服务消耗", "离职时间"};
+                eeu.exportExcelForAttendance(workbook, 0, "运营数据", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 查询季度消耗 导出
+     * 条件:日期,岗位,人员
+     */
+    @ApiOperation(value = "运营绩效-分页列表查询", notes = "运营绩效-分页列表查询")
+    @GetMapping(value = "/queryQuarterlyDataExcel")
+    public void queryQuarterlyDataExcel(HttpServletResponse response, String mediaId, Integer time, String role, String userId) {
+        try {
+            Result<Object> result = null;
+            if ("1".equals(mediaId)) {
+                result = kuaishouOperationReportService.queryToutiaoQuarterlyCharge(time, role, userId, 1, 99999);
+            } else {
+                result = kuaishouOperationReportService.queryKuaishouQuarterlyCharge(time, role, userId, 1, 99999);
+            }
+
+            List<List<Object>> excelList = new ArrayList<>();
+            List<JSONObject> list = (List<JSONObject>) result.getResult();
+            if (!Check.isNull(list)) {
+                if (!list.isEmpty()) {
+                    list.forEach(data -> {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(data.getString("userName"));
+                        temp.add(data.getString("roleName"));
+                        temp.add(data.getString("upTime"));
+                        temp.add(data.getString("quitTime"));
+                        temp.add(data.getString("totalCharge"));
+                        temp.add(data.getString("KFCharge"));
+                        temp.add(data.getString("FWCharge"));
+                        temp.add(data.getString("KFChargeIsOk"));
+                        temp.add(data.getString("manageCharge"));
+                        temp.add(data.getString("assistantCharge"));
+                        temp.add(data.getString("FWChargeCommission"));
+                        temp.add(data.getString("KFChargeCommission"));
+                        temp.add(data.getString("manageChargeCommission"));
+                        temp.add(data.getString("operateCompensation"));
+                        temp.add(data.getString("manageCompensation"));
+                        temp.add(data.getString("FWChargeIsOk"));
+                        temp.add(data.getString("compMoney"));
+                        temp.add(data.getString("paySalary"));
+                        temp.add(data.getString("putMoney"));
+                        temp.add(data.getString("paySalaryRatio"));
+                        temp.add(data.getString("finalPutMoney"));
+                        excelList.add(temp);
+                    });
+                }
+                List<Integer> monthInt = kuaishouOperationReportService.getMonthInt(time);
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"运营", "岗位", "晋升时间", "离职时间",
+                        "Q" + time + "总消耗", "Q" + time + "框返消耗", "Q" + time + "服务消耗", "框返消耗是否满足30W",
+                        "管理消耗", "助理消耗", "服务消耗提成", "框返消耗提成",
+                        "管理消耗提成", "运营赔付扣罚比例", "经理/总监赔付扣罚比例", "是否达标",
+                        "扣减金额", "是否符合发放", "发放金额", "发放系数", "最终发放金额"
+                };
+                eeu.exportExcelForAttendance(workbook, 0, "运营绩效", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 }

+ 3 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouOperationReportService.java

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouOperationReport;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 
+import java.util.List;
+
 /**
  * 运营绩效
  *
@@ -24,5 +26,5 @@ public interface IKuaishouOperationReportService extends IService<KuaishouOperat
 
     Result<Object> queryKuaishouQuarterlyCharge(Integer time, String role, String userId, Integer pageNo, Integer pageSize) throws Exception;
 
-
+    List<Integer> getMonthInt(Integer time);
 }

+ 22 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouOperationReportServiceImpl.java

@@ -24,6 +24,8 @@ import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -133,6 +135,15 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         if (!Check.isNull(onJobUserIds)) {
             dataList.addAll(getTtOnJobUserData(onJobUserIds, time, quarterMap));
         }
+        //后端代码排序
+        if (!Check.isNull(dataList)) {
+            Collections.sort(dataList, new Comparator<JSONObject>() {
+                @Override
+                public int compare(JSONObject o1, JSONObject o2) {
+                    return o2.getDouble("totalCharge").compareTo(o1.getDouble("totalCharge"));
+                }
+            });
+        }
         return Result.ok(dataList);
     }
 
@@ -707,6 +718,15 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         if (!Check.isNull(onJobUserIds)) {
             dataList.addAll(getOnJobUserData(onJobUserIds, time, quarterMap));
         }
+        //后端代码排序
+        if (!Check.isNull(dataList)) {
+            Collections.sort(dataList, new Comparator<JSONObject>() {
+                @Override
+                public int compare(JSONObject o1, JSONObject o2) {
+                    return o2.getDouble("totalCharge").compareTo(o1.getDouble("totalCharge"));
+                }
+            });
+        }
         return Result.ok(dataList);
     }
 
@@ -1232,7 +1252,8 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
     /**
      * 获取每季度月份1~12
      */
-    private static List<Integer> getMonthInt(Integer time) {
+    @Override
+    public List<Integer> getMonthInt(Integer time) {
         List<Integer> list = new ArrayList<>();
         if (1 == time) {
             for (int i = 1; i <= 3; i++) {

+ 119 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoDoController.java

@@ -0,0 +1,119 @@
+package cn.com.ctop.kuaishou.modules.v3.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoDoService;
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoDoService;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoStrategyService;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Api(tags = "快手-自动投放——重构")
+@RestController
+@RequestMapping("/auto/v3create")
+public class V3KuaishouAccountAutoDoController {
+    @Autowired
+    private V3KuaishouAccountAutoDoService autoDoService;
+    @Autowired
+    private V3KuaishouAccountAutoStrategyService strategyService;
+    static ExecutorService customService = Executors.newFixedThreadPool(8);
+    static ExecutorService programService = Executors.newFixedThreadPool(8);
+
+    /**
+     * 每日补充创建创意 、频率 每天22点05分钟执行1次
+     */
+    @GetMapping(value = "/supplementTodayCreatives")
+    public JSONObject supplementTodayCreatives(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            V3KuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("****** 广告组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日广告组创建已超限");
+            }
+            customService.submit(() -> autoDoService.supplementTodayCreatives(strategy));
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+    /**
+     * 创建自定义非上新广告创意 、频率 60分钟/次
+     */
+    @GetMapping(value = "/createCustomCreative")
+    public JSONObject createCustomCreative(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            V3KuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("****** 广告组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日广告组创建已超限");
+            }
+            customService.submit(() -> autoDoService.createCustomCreative(strategy));
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 创建程序化广告创意 频率 60分钟/次
+     */
+    @GetMapping(value = "/createProgramCreative")
+    public JSONObject createProgramCreative(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            V3KuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+            programService.submit(() -> autoDoService.createProgramCreative(strategy));
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+}

+ 284 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoStrategyController.java

@@ -0,0 +1,284 @@
+package cn.com.ctop.kuaishou.modules.v3.controller;
+
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
+import cn.com.ctop.kuaishou.modules.document.service.DocumentLibraryService;
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoStrategyService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+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.system.query.QueryGenerator;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.system.service.ISysRoleService;
+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.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自动投放v3-账户策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-10-24
+ */
+@Slf4j
+@Api(tags = "自动投放v3-账户策略表")
+@RestController
+@RequestMapping("/auto/v3KuaishouAccountAutoStrategy")
+public class V3KuaishouAccountAutoStrategyController {
+    @Autowired
+    private V3KuaishouAccountAutoStrategyService v3KuaishouAccountAutoStrategyService;
+
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+    @Autowired
+    private IUserAllocationService allocationService;
+
+    @Autowired
+    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
+
+    @Autowired
+    private DocumentLibraryService documentLibraryService;
+
+    @Autowired
+    private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
+
+    @Autowired
+    private RedisUtil redisUtil;
+
+    /**
+     * 分页列表查询
+     *
+     * @param V3KuaishouAccountAutoStrategy
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/list")
+    public Result<PageInfo<V3KuaishouAccountAutoStrategy>> queryPageList(V3KuaishouAccountAutoStrategy strategy,
+                                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                         HttpServletRequest req) {
+        Result<PageInfo<V3KuaishouAccountAutoStrategy>> result = new Result<>();
+        if (Check.isNull(strategy.getUserId())) {
+            result.setSuccess(false);
+            result.setMessage("请选择用户");
+            return result;
+        }
+        String userId = strategy.getUserId();
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        List<String> userIds = new ArrayList<>();
+        if ("CompanyManager".equals(roleCode)) {
+            userIds = sysRoleService.getCompanyUsers(roleCode, userId);
+            strategy.setUserIds(userIds);
+        } else if ("bytedanceDirector".equals(roleCode)) {
+            userIds = sysRoleService.getCompanyUsers(roleCode, userId);
+            strategy.setUserIds(userIds);
+        } else if ("kuaishouDirector".equals(roleCode)) {
+            userIds = sysRoleService.getCompanyUsers(roleCode, userId);
+            strategy.setUserIds(userIds);
+        } else if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+            strategy.setUserIds(null);
+        } else {
+            userIds.add(userId);
+            strategy.setUserIds(userIds);
+        }
+        PageHelper.startPage(pageNo, pageSize);
+        PageInfo<V3KuaishouAccountAutoStrategy> pageInfo = v3KuaishouAccountAutoStrategyService.queryList(strategy);
+        List<V3KuaishouAccountAutoStrategy> list = pageInfo.getList();
+        List<V3KuaishouAccountAutoStrategy> setData = new ArrayList<>();
+        String date = DateUtils.formatDate(new Date());
+        if (null != list && !list.isEmpty()) {
+            list.forEach(record -> {
+                Long accountId = record.getAccountId();
+                UserAllocation allocation = allocationService.getByAccountId(accountId);
+                if (null != allocation) {
+                    record.setAuthName(allocation.getAuthName());
+                }
+                String customkey = date + "_v3_custom_cnt_" + accountId;
+                Integer customUnitCnt = (Integer) redisUtil.get(customkey);
+                customUnitCnt = Check.isNull(customUnitCnt) ? 0 : customUnitCnt;
+                record.setCustomCreatedUnitCnt(customUnitCnt);
+                String programkey = date + "_v3_program_cnt_" + accountId;
+                Integer programUnitCnt = (Integer) redisUtil.get(programkey);
+                programUnitCnt = Check.isNull(programUnitCnt) ? 0 : programUnitCnt;
+                record.setProgramCreatedUnitCnt(programUnitCnt);
+            });
+        }
+        pageInfo.setList(list);
+        result.setSuccess(true);
+        result.setResult(pageInfo);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param V3KuaishouAccountAutoStrategy
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-添加", notes = "自动投放重构-账户策略表-添加")
+    @PostMapping(value = "/add")
+    public Result<V3KuaishouAccountAutoStrategy> add(@RequestBody V3KuaishouAccountAutoStrategy autoStrategy) {
+        Result<V3KuaishouAccountAutoStrategy> result = new Result<>();
+        try {
+            Long accountId = autoStrategy.getAccountId();
+            QueryWrapper<V3KuaishouAccountAutoStrategy> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("account_id", accountId).last("limit 1");
+            V3KuaishouAccountAutoStrategy one = v3KuaishouAccountAutoStrategyService.getOne(queryWrapper);
+            if (null != one) {
+                result.error500("该账户配置信息已经被创建");
+                return result;
+            }
+            UserAllocation allocation = allocationService.getByAccountId(accountId);
+            if (null != allocation) {
+                autoStrategy.setUserId(allocation.getUserId());
+            }
+            Integer singleAppId = autoStrategy.getSingleAppid();
+            if (null != singleAppId && singleAppId == 1) {
+                if (autoStrategy.getCampaignType() == 2 || autoStrategy.getCampaignType() == 7) {
+                    Long appId = Long.valueOf(JSONArray.parseArray(autoStrategy.getAppIdArray()).getString(0));
+                    autoStrategy.setAppId(appId);
+                }
+            }
+            v3KuaishouAccountAutoStrategyService.save(autoStrategy);
+            //添加广告语到文案库
+            documentLibraryService.insertBatch(autoStrategy.getDescription(), accountId);
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    kuaishouVideoRelateCreativesService.videoRelateCreatives(autoStrategy.getAccountId());
+                }
+            };
+            thread.start();
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 编辑
+     *
+     * @param v3KuaishouAccountAutoStrategy
+     * @return
+     */
+    @ApiOperation(value = "自动投放v3-账户策略表-编辑", notes = "自动投放v3-账户策略表-编辑")
+    @PostMapping(value = "/edit")
+    public Result<V3KuaishouAccountAutoStrategy> edit(@RequestBody V3KuaishouAccountAutoStrategy v3KuaishouAccountAutoStrategy) {
+        Result<V3KuaishouAccountAutoStrategy> result = new Result<V3KuaishouAccountAutoStrategy>();
+        V3KuaishouAccountAutoStrategy v3KuaishouAccountAutoStrategyEntity = v3KuaishouAccountAutoStrategyService.getById(v3KuaishouAccountAutoStrategy.getId());
+        if (v3KuaishouAccountAutoStrategyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = v3KuaishouAccountAutoStrategyService.updateById(v3KuaishouAccountAutoStrategy);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放v3-账户策略表-通过id删除", notes = "自动投放v3-账户策略表-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            v3KuaishouAccountAutoStrategyService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "自动投放v3-账户策略表-批量删除", notes = "自动投放v3-账户策略表-批量删除")
+    @GetMapping(value = "/deleteBatch")
+    public Result<V3KuaishouAccountAutoStrategy> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<V3KuaishouAccountAutoStrategy> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.v3KuaishouAccountAutoStrategyService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放v3-账户策略表-通过id查询", notes = "自动投放v3-账户策略表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<V3KuaishouAccountAutoStrategy> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<V3KuaishouAccountAutoStrategy> result = new Result<>();
+        V3KuaishouAccountAutoStrategy v3KuaishouAccountAutoStrategy = v3KuaishouAccountAutoStrategyService.getById(id);
+        if (v3KuaishouAccountAutoStrategy == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(v3KuaishouAccountAutoStrategy);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+}

+ 181 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/controller/V3KuaishouAccountAutoTargetController.java

@@ -0,0 +1,181 @@
+package cn.com.ctop.kuaishou.modules.v3.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoTargetService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 自动投放-v3-本地定向表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-10-31
+ */
+@Slf4j
+@Api(tags = "自动投放-v3-本地定向表")
+@RestController
+@RequestMapping("/auto/v3KuaishouAccountAutoTarget")
+public class V3KuaishouAccountAutoTargetController {
+    @Autowired
+    private V3KuaishouAccountAutoTargetService v3KuaishouAccountAutoTargetService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param v3KuaishouAccountAutoTarget
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "自动投放-v3-本地定向表-分页列表查询", notes = "自动投放-v3-本地定向表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<Object> queryPageList(Long accountId, String targetName,Integer platform, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+																	@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+		try {
+			if (Check.isNull(accountId)||Check.isNull(platform)) {
+				return Result.error("缺少参数");
+			}
+			return v3KuaishouAccountAutoTargetService.queryPageList(accountId, targetName,platform, pageNo, pageSize);
+		} catch (Exception e) {
+			log.error("查询异常,", e.getMessage());
+			e.printStackTrace();
+		}
+		return Result.error("查询失败");
+    }
+	/**
+	 * 创建定向包
+	 *
+	 * @param
+	 * @return
+	 */
+	@PostMapping(value = "/add")
+	public Result<Object> add(@RequestBody JSONObject requestJson) {
+		try {
+			if (Check.isNull(requestJson.getString("targetName"))) {
+				return Result.error("定向包名称为必传项");
+			}
+			Long accountId = requestJson.getLong("accountId");
+			if (Check.isNull(accountId)) {
+				return Result.error("请选择账户id");
+			}
+			return v3KuaishouAccountAutoTargetService.addV3LocalTarget(requestJson);
+		} catch (Exception e) {
+			log.error("创建定向包失败", e);
+			return Result.error("创建失败" + e.getMessage());
+		}
+	}
+
+	/**
+	 * 修改定向包
+	 *
+	 * @param
+	 * @return
+	 */
+	@PostMapping(value = "/edit")
+	public Result<Object> edit(@RequestBody JSONObject requestJson) {
+		try {
+			if (Check.isNull(requestJson.getString("id"))) {
+				return Result.error("请选择定向包");
+			}
+			V3KuaishouAccountAutoTarget target = v3KuaishouAccountAutoTargetService.getById(requestJson.getString("id"));
+			if (target == null) {
+				return Result.ok("修改失败,未查到对应定向包");
+			}
+			return v3KuaishouAccountAutoTargetService.updateV3LocalTarget(requestJson);
+		} catch (Exception e) {
+			return Result.error("修改异常");
+		}
+	}
+
+	@PostMapping(value = "/getV3AutoTargetByIds")
+	public Result<Object> getAutoTargetByIds(@RequestBody JSONObject data) {
+		try {
+			JSONArray ids = data.getJSONArray("ids");
+			if (Check.isNull(ids)) {
+				return Result.error("缺少参数");
+			}
+			List<String> list = JSONObject.parseObject(JSONObject.toJSONString(ids), List.class);
+			if (Check.isNull(list)) {
+				return Result.error("缺少参数");
+			}
+			List<V3KuaishouAccountAutoTarget> targets = v3KuaishouAccountAutoTargetService.getAutoTargetByIds(list);
+			return Result.ok(targets);
+		} catch (Exception e) {
+			log.error("查询异常,", e);
+			return Result.error("查询失败," + e.getMessage());
+		}
+	}
+
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放-v3-本地定向表-通过id删除", notes = "自动投放-v3-本地定向表-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            v3KuaishouAccountAutoTargetService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放-v3-本地定向表-通过id查询", notes = "自动投放-v3-本地定向表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<V3KuaishouAccountAutoTarget> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<V3KuaishouAccountAutoTarget> result = new Result<>();
+        V3KuaishouAccountAutoTarget v3KuaishouAccountAutoTarget = v3KuaishouAccountAutoTargetService.getById(id);
+        if (v3KuaishouAccountAutoTarget == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(v3KuaishouAccountAutoTarget);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+}

+ 556 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/entity/V3KuaishouAccountAutoStrategy.java

@@ -0,0 +1,556 @@
+package cn.com.ctop.kuaishou.modules.v3.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 自动投放v3-账户策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2022-10-24
+ */
+@Data
+@TableName("ctop_v3_kuaishou_account_auto_strategy")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_v3_kuaishou_account_auto_strategy对象", description = "自动投放v3-账户策略表")
+public class V3KuaishouAccountAutoStrategy {
+
+    /**
+     * 客户策略ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "客户策略ID")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 策略状态 1-使用 0-停用
+     */
+    @Excel(name = "策略状态 1-使用 0-停用", width = 15)
+    @ApiModelProperty(value = "策略状态 1-使用 0-停用")
+    private Integer status;
+    /**
+     * 客户要求的计划名称规范
+     */
+    @Excel(name = "客户要求的计划名称规范", width = 15)
+    @ApiModelProperty(value = "客户要求的计划名称规范")
+    private String campaignName;
+    /**
+     * 计划状态: 1:投放 2:暂停
+     */
+    @Excel(name = "计划状态: 1:投放 2:暂停 ", width = 15)
+    @ApiModelProperty(value = "计划状态: 1:投放 2:暂停 ")
+    private Integer campaignStatus;
+    /**
+     * 计划类型2-应用下载;3-获取电商下单;4-推广品牌活动;5-收集营销线索;7-应用拉活;16-粉丝直播推广
+     */
+    @Excel(name = "计划类型2-应用下载;3-获取电商下单;4-推广品牌活动;5-收集营销线索;7-应用拉活;16-粉丝直播推广", width = 15)
+    @ApiModelProperty(value = "计划类型2-应用下载;3-获取电商下单;4-推广品牌活动;5-收集营销线索;7-应用拉活;16-粉丝直播推广")
+    private Integer campaignType;
+    /**
+     * 客户要求的广告组名称规范
+     */
+    @Excel(name = "客户要求的广告组名称规范", width = 15)
+    @ApiModelProperty(value = "客户要求的广告组名称规范")
+    private String groupName;
+
+    /**
+     * 定向模板id
+     */
+    @Excel(name = "定向模板id", width = 15)
+    @ApiModelProperty(value = "定向模板id")
+    private String templateId;
+    /**
+     * 广告类型		0:信息流广告;1:搜索广告
+     */
+    @Excel(name = "广告类型	0:信息流广告;1:搜索广告", width = 15)
+    @ApiModelProperty(value = "广告类型	0:信息流广告;1:搜索广告")
+    private Integer adType;
+    /**
+     * 投放策略 0:投放策略(默认);1:最大转化
+     */
+    @Excel(name = "投放策略 0:投放策略(默认);1:最大转化", width = 15)
+    @ApiModelProperty(value = "投放策略 0:投放策略(默认);1:最大转化")
+    private Integer campaignBidType;
+    /**
+     * 出价类型 2:CPC;10:OCPM;12:最大转化
+     */
+    @Excel(name = "出价类型 2:CPC;10:OCPM;12:最大转化", width = 15)
+    @ApiModelProperty(value = "出价类型 2:CPC;10:OCPM;12:最大转化")
+    private Integer unitBidType;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @Excel(name = "优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 应用商店列表
+     */
+    @Excel(name = "应用商店列表", width = 15)
+    @ApiModelProperty(value = "应用商店列表")
+    private String appStore;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private String bid;
+    /**
+     * cpaBid出价
+     */
+    @Excel(name = "cpaBid出价", width = 15)
+    @ApiModelProperty(value = "cpaBid出价")
+    private String cpaBid;
+    /**
+     * 优化目标
+     */
+    @Excel(name = "优化目标", width = 15)
+    @ApiModelProperty(value = "优化目标")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标
+     */
+    @Excel(name = "深度转化目标", width = 15)
+    @ApiModelProperty(value = "深度转化目标")
+    private Integer deepConversionType;
+    /**
+     * 付费ROI系数
+     */
+    @Excel(name = "付费ROI系数", width = 15)
+    @ApiModelProperty(value = "付费ROI系数")
+    private Float roiRatio;
+    /**
+     * 资源位置
+     */
+    @Excel(name = "资源位置", width = 15)
+    @ApiModelProperty(value = "资源位置")
+    private String sceneIds;
+    /**
+     * 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0
+     */
+    @Excel(name = " 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0", width = 15)
+    @ApiModelProperty(value = " 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0")
+    private Integer unitType;
+    /**
+     * 投放开始时间
+     */
+    @Excel(name = "投放开始时间", width = 15)
+    @ApiModelProperty(value = "投放开始时间")
+    private String beginTime;
+    /**
+     * 投放结束时间
+     */
+    @Excel(name = "投放结束时间", width = 15)
+    @ApiModelProperty(value = "投放结束时间")
+    private String endTime;
+    /**
+     * 投放排期
+     * [[0,2],[],[5, 9],[],[],[],[]]
+     * 表示只在周一的0点和2点,周三的5点和9点进行投放。 注意如果传参为[],[],[],[],[],[],[]会被当成[]处理
+     */
+    @Excel(name = "投放时间段", width = 15)
+    @ApiModelProperty(value = "投放时间段")
+    private String scheduleTime;
+    /**
+     * 转化目标ID
+     */
+    @Excel(name = "转化目标ID", width = 15)
+    @ApiModelProperty(value = "转化目标ID")
+    private Integer convertId;
+    /**
+     * url类型
+     */
+    @Excel(name = "url类型", width = 15)
+    @ApiModelProperty(value = "url类型")
+    private Integer urlType;
+    /**
+     * url类型
+     */
+    @Excel(name = "url类型", width = 15)
+    @ApiModelProperty(value = "url类型")
+    private Integer webUriType;
+    /**
+     * 投放链接
+     */
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
+    private String url;
+    /**
+     * 调起链接
+     */
+    @Excel(name = "调起链接", width = 15)
+    @ApiModelProperty(value = "调起链接")
+    private String schemaUri;
+    /**
+     * 应用ID
+     */
+    @Excel(name = "应用ID", width = 15)
+    @ApiModelProperty(value = "应用ID")
+    private Long appId;
+    /**
+     * 创意展现方式 1-轮播  2-优选
+     */
+    @Excel(name = "创意展现方式 1-轮播  2-优选", width = 15)
+    @ApiModelProperty(value = "创意展现方式 1-轮播  2-优选")
+    private Integer showMode;
+    /**
+     * 投放方式 1-加速投放  2-平滑投放 3-优先低成本
+     */
+    @Excel(name = "投放方式 1-加速投放  2-平滑投放 3-优先低成本", width = 15)
+    @ApiModelProperty(value = "投放方式 1-加速投放  2-平滑投放 3-优先低成本")
+    private Integer speed;
+    /**
+     * 预约广告
+     */
+    @Excel(name = "预约广告", width = 15)
+    @ApiModelProperty(value = "预约广告")
+    private Integer siteType;
+    /**
+     * 游戏礼包码
+     */
+    @Excel(name = "游戏礼包码", width = 15)
+    @ApiModelProperty(value = "游戏礼包码")
+    private String giftData;
+    /**
+     * 是否使用落地页前置功能
+     */
+    @Excel(name = "是否使用落地页前置功能", width = 15)
+    @ApiModelProperty(value = "是否使用落地页前置功能")
+    private Integer videoLandingPage;
+    /**
+     * 定向类型 0:不限;1:智能定向
+     */
+    @Excel(name = "定向类型 0:不限;1:智能定向", width = 15)
+    @ApiModelProperty(value = "定向类型 0:不限;1:智能定向")
+    private Integer targetType;
+    /**
+     * 是否开启自动生成视频
+     */
+    @Excel(name = "是否开启自动生成视频", width = 15)
+    @ApiModelProperty(value = "是否开启自动生成视频")
+    private Integer autoCreatePhoto;
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称", width = 15)
+    @ApiModelProperty(value = "创意名称")
+    private String creativeName;
+    /**
+     * 行动号召按钮文案
+     */
+    @Excel(name = "行动号召按钮文案", width = 15)
+    @ApiModelProperty(value = "行动号召按钮文案")
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+    /**
+     * 便利贴创意短广告语
+     */
+    @Excel(name = "便利贴创意短广告语", width = 15)
+    @ApiModelProperty(value = "便利贴创意短广告语")
+    private String shortSlogan;
+    /**
+     * 封面广告语标题
+     */
+    @Excel(name = "封面广告语标题", width = 15)
+    @ApiModelProperty(value = "封面广告语标题")
+    private String stickerTitle;
+    /**
+     * 贴纸样式类型
+     */
+    @Excel(name = "贴纸样式类型", width = 15)
+    @ApiModelProperty(value = "贴纸样式类型")
+    private String overlayType;
+    /**
+     * 广告标签
+     */
+    @Excel(name = "广告标签", width = 15)
+    @ApiModelProperty(value = "广告标签")
+    private String exposeTag;
+    /**
+     * 广告标签2期
+     */
+    @Excel(name = "广告标签2期", width = 15)
+    @ApiModelProperty(value = "广告标签2期")
+    private String newExposeTag;
+    /**
+     * 安卓下载中间页ID
+     */
+    @Excel(name = "安卓下载中间页ID", width = 15)
+    @ApiModelProperty(value = "安卓下载中间页ID")
+    private String siteId;
+    /**
+     * 程序化落地页
+     */
+    @Excel(name = "程序化落地页", width = 15)
+    @ApiModelProperty(value = "程序化落地页")
+    private String groupId;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方开始播放监测链接
+     */
+    @Excel(name = "第三方开始播放监测链接", width = 15)
+    @ApiModelProperty(value = "第三方开始播放监测链接")
+    private String impressionUrl;
+    /**
+     * 第三方有效播放监测链接
+     */
+    @Excel(name = "第三方有效播放监测链接", width = 15)
+    @ApiModelProperty(value = "第三方有效播放监测链接")
+    private String adPhotoPlayedT3sUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+    /**
+     * 物料关联的封面个数
+     */
+    private Integer imageCnt;
+    /**
+     * 组素材数
+     */
+    @Excel(name = "组素材数", width = 15)
+    @ApiModelProperty(value = "组素材数")
+    private Integer customCreativeCnt;
+    /**
+     * 程序化创意2.0-是否开启智能抽帧
+     */
+    @Excel(name = "程序化创意2.0-是否开启智能抽帧", width = 15)
+    @ApiModelProperty(value = "程序化创意2.0-是否开启智能抽帧")
+    private Integer smartCover;
+    /**
+     * 程序化创意2.0-是否开启素材挖掘
+     */
+    @Excel(name = "程序化创意2.0-是否开启素材挖掘", width = 15)
+    @ApiModelProperty(value = "程序化创意2.0-是否开启素材挖掘")
+    private Integer assetMining;
+    /**
+     * 单/多应用,1单应用,2多应用
+     */
+    @Excel(name = "单/多应用,1单应用,2多应用", width = 15)
+    @ApiModelProperty(value = "单/多应用,1单应用,2多应用")
+    private Integer singleAppid;
+    /**
+     * 应用ID列表
+     */
+    @Excel(name = "应用ID列表", width = 15)
+    @ApiModelProperty(value = "应用ID列表")
+    private String appIdArray;
+    /**
+     * 是否通用监测链接
+     */
+    @Excel(name = "是否通用监测链接", width = 15)
+    @ApiModelProperty(value = "是否通用监测链接")
+    private Integer generalTrack;
+    /**
+     * 深度转化出价
+     */
+    @Excel(name = "深度转化出价", width = 15)
+    @ApiModelProperty(value = "深度转化出价")
+    private String deepConversionBid;
+    /**
+     * 是否创建程序化创意
+     */
+    @Excel(name = "是否创建程序化创意", width = 15)
+    @ApiModelProperty(value = "是否创建程序化创意")
+    private Integer openProgramCreate;
+    /**
+     * 行为意向-系统优选,0关闭,1开启
+     */
+    @Excel(name = "行为意向-系统优选,0关闭,1开启", width = 15)
+    @ApiModelProperty(value = "行为意向-系统优选,0关闭,1开启")
+    private Integer intentionTarget;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * 素材来源 0:自产 1:素造
+     */
+    @Excel(name = "素材来源 0:自产 1:素造", width = 15)
+    @ApiModelProperty(value = "素材来源 0:自产 1:素造")
+    private Integer channelType;
+    /**
+     * 计划日预算
+     */
+    @Excel(name = "计划日预算", width = 15)
+    @ApiModelProperty(value = "计划日预算")
+    private Long campaignDayBudget;
+    /**
+     * 组日预算
+     */
+    @Excel(name = "组日预算", width = 15)
+    @ApiModelProperty(value = "组日预算")
+    private Long unitDayBudget;
+    /**
+     * 分日预算
+     */
+    @Excel(name = "分日预算", width = 15)
+    @ApiModelProperty(value = "分日预算")
+    private String campaignDayBudgetSchedule;
+    /**
+     * 自定义计划数量
+     */
+    @Excel(name = "自定义计划数量", width = 15)
+    @ApiModelProperty(value = "自定义计划数量")
+    private Integer customPlanCnt;
+    /**
+     * 自定义组数量
+     */
+    @Excel(name = "自定义组数量", width = 15)
+    @ApiModelProperty(value = "自定义组数量")
+    private Integer customUnitCnt;
+    /**
+     * 程序化计划数量
+     */
+    @Excel(name = "程序化计划数量", width = 15)
+    @ApiModelProperty(value = "程序化计划数量")
+    private Integer programPlanCnt;
+    /**
+     * 程序化组数量
+     */
+    @Excel(name = "程序化组数量", width = 15)
+    @ApiModelProperty(value = "程序化组数量")
+    private Integer programUnitCnt;
+    /**
+     * 素材名称关键字
+     */
+    @Excel(name = "素材名称关键字", width = 15)
+    @ApiModelProperty(value = "素材名称关键字")
+    private String materialKeyword;
+    /**
+     * 是否多应用多出价 0 否 1 是
+     */
+    @Excel(name = "是否多应用多出价 0 否 1 是", width = 15)
+    @ApiModelProperty(value = "是否多应用多出价 0 否 1 是")
+    private Integer multipleBids;
+    /**
+     * 渠道号使用层级
+     */
+    @Excel(name = "渠道号使用层级", width = 15)
+    @ApiModelProperty(value = "渠道号使用层级")
+    private String usageLevel;
+    /**
+     * 是否使用渠道号0不使用,1使用
+     */
+    @Excel(name = "是否使用渠道号0不使用,1使用", width = 15)
+    @ApiModelProperty(value = "是否使用渠道号0不使用,1使用")
+    private Integer useChannel;
+    /**
+     * 1 定向匹配。2素材匹配
+     */
+    @Excel(name = "1 定向匹配。2素材匹配", width = 15)
+    @ApiModelProperty(value = "1 定向匹配。2素材匹配")
+    private Integer matchType;
+    /**
+     * 本地定向集
+     */
+    @Excel(name = "本地定向集", width = 15)
+    @ApiModelProperty(value = "本地定向集")
+    private String autoTargetArray;
+    /**
+     * 素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
+     */
+    @Excel(name = "素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞", width = 15)
+    @ApiModelProperty(value = "素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞")
+    private String sourceMaterial;
+    /**
+     * 是否使用优质定向  0 否 1 是
+     */
+    @Excel(name = "是否使用优质定向  0 否 1 是 ", width = 15)
+    @ApiModelProperty(value = "是否使用优质定向  0 否 1 是 ")
+    private Integer systemOptimization;
+    /**
+     * 应用中间页的类型 0=不使用;1=建站落地页
+     */
+    @Excel(name = "应用中间页的类型 0=不使用;1=建站落地页", width = 15)
+    @ApiModelProperty(value = "应用中间页的类型 0=不使用;1=建站落地页")
+    private Integer downloadPageType;
+    /**
+     * 应用中间页链接
+     */
+    @Excel(name = "应用中间页链接", width = 15)
+    @ApiModelProperty(value = "应用中间页链接")
+    private String downloadPageUrl;
+    /**
+     * 试玩 ID集
+     */
+    @Excel(name = "试玩 ID集", width = 15)
+    @ApiModelProperty(value = "试玩 ID集")
+    private String playableIds;
+    /**
+     * 1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩”
+     */
+    @Excel(name = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩”", width = 15)
+    @ApiModelProperty(value = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩”")
+    private String playButton;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private List<String> userIds;
+
+    @TableField(exist = false)
+    private String authName;
+
+    @TableField(exist = false)
+    private int customCreatedUnitCnt;
+
+    @TableField(exist = false)
+    private int programCreatedUnitCnt;
+    //待建广告组数
+    @TableField(exist = false)
+    private int toBeBuiltCnt;
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 271 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/entity/V3KuaishouAccountAutoTarget.java


+ 21 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/V3KuaishouAccountAutoStrategyMapper.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.v3.mapper;
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 自动投放v3-账户策略表
+ *
+ * @author jeecg-boot
+ * 2022-10-24
+ * @version V1.0
+ */
+public interface V3KuaishouAccountAutoStrategyMapper extends BaseMapper<V3KuaishouAccountAutoStrategy> {
+
+    List<V3KuaishouAccountAutoStrategy> queryList(V3KuaishouAccountAutoStrategy strategy);
+
+    void createRecord(JSONObject record);
+}

+ 21 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/V3KuaishouAccountAutoTargetMapper.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.v3.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 自动投放-v3-本地定向表
+ *
+ * @author jeecg-boot
+ * 2022-10-31
+ * @version V1.0
+ */
+public interface V3KuaishouAccountAutoTargetMapper extends BaseMapper<V3KuaishouAccountAutoTarget> {
+
+    List<V3KuaishouAccountAutoTarget> queryPageList(@Param("accountId") Long accountId, @Param("targetName") String targetName, @Param("platform") Integer platform);
+
+    List<V3KuaishouAccountAutoTarget> getAutoTargetByIds(@Param("ids")List<String> list);
+}

+ 43 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/xml/V3KuaishouAccountAutoStrategyMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.v3.mapper.V3KuaishouAccountAutoStrategyMapper">
+
+    <select id="queryList" resultType="cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy">
+        SELECT
+        id,
+        account_id,
+        status,
+        create_time,
+        convert_id,
+        ocpx_action_type,
+        cpa_bid,
+        bid,
+        unit_bid_type,
+        campaign_bid_type
+        FROM ctop_v3_kuaishou_account_auto_strategy
+        <where>
+            <if test="accountId != null">
+                and account_id = #{accountId}
+            </if>
+            <if test="userIds != null and userIds.size() > 0">
+                and user_id in
+                <foreach item="id" index="index" collection="userIds"
+                         open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <insert id="createRecord">
+        insert into ctop_v3_kuaishou_account_create_record
+            (account_id, params, message)
+        values (#{accountId}, #{params}, #{message})
+    </insert>
+
+
+</mapper>

+ 25 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/mapper/xml/V3KuaishouAccountAutoTargetMapper.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.v3.mapper.V3KuaishouAccountAutoTargetMapper">
+
+    <select id="queryPageList" resultType="cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget">
+        SELECT
+        *
+        FROM ctop_v3_kuaishou_account_auto_target
+        where account_id = #{accountId}
+        <if test="targetName != null">
+            and target_name LIKE CONCAT(CONCAT('%', #{targetName}), '%')
+        </if>
+        AND (platform =0 or platform = #{platform})
+        order by create_time desc
+    </select>
+
+    <select id="getAutoTargetByIds" resultType="cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget">
+        SELECT *
+        FROM ctop_v3_kuaishou_account_auto_target
+        WHERE id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+    </select>
+</mapper>

+ 23 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoDoService.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.kuaishou.modules.v3.service;
+
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+
+import java.text.ParseException;
+
+public interface V3KuaishouAccountAutoDoService {
+
+
+    //创建自定义广告创意
+    void createCustomCreative(V3KuaishouAccountAutoStrategy strategy) ;
+
+    //创建程序化广告创意
+    void createProgramCreative(V3KuaishouAccountAutoStrategy strategy);
+
+    // 组创建是否超限
+    Boolean getUnitOverrun(Long accountId);
+
+    //每日补齐创建
+    void supplementTodayCreatives(V3KuaishouAccountAutoStrategy strategy);
+
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoStrategyService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.v3.service;
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * 自动投放v3-账户策略表
+ *
+ * @author jeecg-boot
+ * 2022-10-24
+ * @version V1.0
+ */
+public interface V3KuaishouAccountAutoStrategyService extends IService<V3KuaishouAccountAutoStrategy> {
+
+    PageInfo<V3KuaishouAccountAutoStrategy> queryList(V3KuaishouAccountAutoStrategy strategy);
+}

+ 27 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountAutoTargetService.java

@@ -0,0 +1,27 @@
+package cn.com.ctop.kuaishou.modules.v3.service;
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+import java.util.List;
+
+/**
+ * 自动投放-v3-本地定向表
+ *
+ * @author jeecg-boot
+ * 2022-10-31
+ * @version V1.0
+ */
+public interface V3KuaishouAccountAutoTargetService extends IService<V3KuaishouAccountAutoTarget> {
+
+    Result<Object> queryPageList(Long accountId, String targetName, Integer platform, Integer pageNo, Integer pageSize);
+
+    Result<Object> addV3LocalTarget(JSONObject requestJson);
+
+    Result<Object> updateV3LocalTarget(JSONObject requestJson);
+
+    List<V3KuaishouAccountAutoTarget> getAutoTargetByIds(List<String> list);
+
+}

+ 13 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/V3KuaishouAccountDetailsService.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.v3.service;
+
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import com.alibaba.fastjson.JSONObject;
+
+public interface V3KuaishouAccountDetailsService {
+
+    JSONObject createCascadeAll(CtopOauthToken token, JSONObject newAdParams);
+
+    JSONObject createUnitAndCreative(CtopOauthToken token, JSONObject hadAdParams);
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1997 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoDoServiceImpl.java


+ 24 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoStrategyServiceImpl.java

@@ -0,0 +1,24 @@
+package cn.com.ctop.kuaishou.modules.v3.service.impl;
+
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.v3.mapper.V3KuaishouAccountAutoStrategyMapper;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoStrategyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageInfo;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自动投放v3-账户策略表
+ *
+ * @author jeecg-boot
+ * 2022-10-24
+ * @version V1.0
+ */
+@Service
+public class V3KuaishouAccountAutoStrategyServiceImpl extends ServiceImpl<V3KuaishouAccountAutoStrategyMapper, V3KuaishouAccountAutoStrategy> implements V3KuaishouAccountAutoStrategyService {
+
+    @Override
+    public PageInfo<V3KuaishouAccountAutoStrategy> queryList(V3KuaishouAccountAutoStrategy strategy) {
+        return new PageInfo<>(baseMapper.queryList(strategy));
+    }
+}

+ 84 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountAutoTargetServiceImpl.java

@@ -0,0 +1,84 @@
+package cn.com.ctop.kuaishou.modules.v3.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.v3.entity.V3KuaishouAccountAutoTarget;
+import cn.com.ctop.kuaishou.modules.v3.mapper.V3KuaishouAccountAutoTargetMapper;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountAutoTargetService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 自动投放-v3-本地定向表
+ *
+ * @author jeecg-boot
+ * 2022-10-31
+ * @version V1.0
+ */
+@Service
+public class V3KuaishouAccountAutoTargetServiceImpl extends ServiceImpl<V3KuaishouAccountAutoTargetMapper, V3KuaishouAccountAutoTarget> implements V3KuaishouAccountAutoTargetService {
+
+    @Override
+    public Result<Object> queryPageList(Long accountId, String targetName, Integer platform, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<V3KuaishouAccountAutoTarget> list = baseMapper.queryPageList(accountId, targetName, platform);
+        return Result.ok(new PageInfo<>(list));
+    }
+
+    @Override
+    public Result<Object> addV3LocalTarget(JSONObject requestJson) {
+        QueryWrapper<V3KuaishouAccountAutoTarget> wrapper = new QueryWrapper<>();
+        wrapper.eq("account_id", requestJson.getLong("accountId"));
+        wrapper.eq("target_name", requestJson.getString("targetName")).last("limit 1");
+        V3KuaishouAccountAutoTarget one = this.getOne(wrapper);
+        if (!Check.isNull(one)) {
+            return Result.error("该账户下定向包名已存在");
+        }
+        V3KuaishouAccountAutoTarget target = JSONObject.toJavaObject(requestJson, V3KuaishouAccountAutoTarget.class);
+        if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+            target.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
+        }
+        boolean save = this.save(target);
+        if (save) {
+            return Result.ok("创建成功");
+        }
+        return Result.error("创建失败,定向包新增失败");
+    }
+
+    @Override
+    public Result<Object> updateV3LocalTarget(JSONObject requestJson) {
+        QueryWrapper<V3KuaishouAccountAutoTarget> wrapper = new QueryWrapper<>();
+        wrapper.eq("account_id", requestJson.getLong("accountId"));
+        wrapper.eq("target_name", requestJson.getString("targetName")).last("limit 1");
+        V3KuaishouAccountAutoTarget one = this.getOne(wrapper);
+        if (!Check.isNull(one) && one.getId() - requestJson.getLong("id") != 0) {
+            return Result.error("账户下定向包名重复");
+        }
+        V3KuaishouAccountAutoTarget target = JSONObject.toJavaObject(requestJson, V3KuaishouAccountAutoTarget.class);
+        if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+            target.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
+        }
+        if (!Check.isNull(target.getMax()) && target.getMax() == -1) {
+            target.setMax(null);
+        }
+        if (!Check.isNull(target.getMin()) && target.getMin() == -1) {
+            target.setMin(null);
+        }
+        boolean update = this.saveOrUpdate(target);
+        if (update) {
+            return Result.ok("修改成功");
+        }
+        return Result.ok("修改失败");
+    }
+
+    @Override
+    public List<V3KuaishouAccountAutoTarget> getAutoTargetByIds(List<String> list) {
+        return baseMapper.getAutoTargetByIds(list);
+    }
+}

+ 105 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/v3/service/impl/V3KuaishouAccountDetailsServiceImpl.java

@@ -0,0 +1,105 @@
+package cn.com.ctop.kuaishou.modules.v3.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.v3.service.V3KuaishouAccountDetailsService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class V3KuaishouAccountDetailsServiceImpl implements V3KuaishouAccountDetailsService {
+
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouGroupService getKuaiShouGroupService;
+
+
+    @Override
+    public JSONObject createCascadeAll(CtopOauthToken token, JSONObject requestJson) {
+        Long accountId = requestJson.getLong("advertiser_id");
+        String accessToken = token.getAccessToken();
+        JSONObject resultJson = null;
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.V3_CREATE_CASCADE_ALL;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", " application/json");
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            resultJson = JSONObject.parseObject(result);
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject dataJson = resultJson.getJSONObject("data");
+                Long campaignId = dataJson.getLong("campaign_id");
+                Long unitId = dataJson.getLong("unit_id");
+                JSONArray creativeIds = dataJson.getJSONArray("creative_ids");
+                // 创建成功 拉取广告组信息
+                Thread.sleep(300);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        kuaishouInterfaceService.getCampaign(accessToken, accountId, campaignId);
+                        getKuaiShouGroupService.getGroupByUnitId(accessToken, accountId, unitId);
+                        kuaishouInterfaceService.getCreativeByCreativeIds(accessToken, accountId, creativeIds);
+                    }
+                };
+            } else {
+                log.error("创建V3广告失败,advertiser_id:{},返回信息:{}", accountId, resultJson);
+            }
+        } catch (Exception e) {
+            log.error("创建V3广告失败,advertiser_id:{}", accountId);
+            e.printStackTrace();
+        }
+        return resultJson;
+    }
+
+    @Override
+    public JSONObject createUnitAndCreative(CtopOauthToken token, JSONObject requestJson) {
+        Long accountId = requestJson.getLong("advertiser_id");
+        String accessToken = token.getAccessToken();
+        JSONObject resultJson = null;
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.V3_CREATE_UNIT_AND_CREATIVE;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", " application/json");
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+             resultJson = JSONObject.parseObject(result);
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject dataJson = resultJson.getJSONObject("data");
+                Long campaignId = dataJson.getLong("campaign_id");
+                Long unitId = dataJson.getLong("unit_id");
+                JSONArray creativeIds = dataJson.getJSONArray("creative_ids");
+                // 创建成功 拉取广告组信息
+                Thread.sleep(300);
+                Thread thread = new Thread() {
+                    @Override
+                    public void run() {
+                        kuaishouInterfaceService.getCampaign(accessToken, accountId, campaignId);
+                        getKuaiShouGroupService.getGroupByUnitId(accessToken, accountId, unitId);
+                        kuaishouInterfaceService.getCreativeByCreativeIds(accessToken, accountId, creativeIds);
+                    }
+                };
+            } else {
+                log.error("创建V3广告失败,advertiser_id:{},返回信息:{}", accountId, resultJson);
+            }
+        } catch (Exception e) {
+            log.error("创建V3广告失败,advertiser_id:{}", accountId);
+            e.printStackTrace();
+        }
+        return resultJson;
+    }
+}

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

@@ -796,8 +796,16 @@ public class AccountReportConstants {
             "    \"filed\": \"CASE WHEN sum(aclick) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.aclick),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate\",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
+            "  \"eventNewUserPay\": {\n" +
+            "    \"filed\": \"sum(t1.event_new_user_pay) as eventNewUserPay\",\n" +
+            "    \"comment\": \"新增付费人数\"\n" +
+            "  },\n" +
+            "  \"eventNewUserPayCost\": {\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.event_new_user_pay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_new_user_pay),3) end as eventNewUserPayCost \",\n" +
+            "    \"comment\": \"新增付费人数成本\"\n" +
+            "  },\n" +
             "  \"eventNewUserPayRatio\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(t1.activation) != 0 THEN concat(CAST(round(sum(t1.event_pay) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0.00%' end as eventNewUserPayRatio \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.activation)+sum(t1.event_app_invoked)+sum(t1.form_count) != 0 THEN concat(CAST(round(sum(t1.event_new_user_pay) / (sum(t1.activation)+sum(t1.event_app_invoked)+sum(t1.form_count))*100,2) AS CHAR) ,'%') else '0.00%' end as eventNewUserPayRatio \",\n" +
             "    \"comment\": \"新增付费人数率\"\n" +
             "  }\n" +
             "}";

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

@@ -287,14 +287,16 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             projects = getProjectsByCurrentUser(mediaId);
         }
         if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo());
+            String filedAll = null;
+//                    JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapByVideo());
             PageHelper.startPage(pageNo, pageSize, false);
             List<JSONObject> list = materialReportOverViewMapper.queryBytedanceMaterialReport(filedAll, startDate, endDate, projects, md5, target, order);
             Long count = materialReportOverViewMapper.queryBytedanceMaterialReportCount(startDate, endDate, projects, md5);
             result.setTotal(count);
             result.setList(list);
         } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
+            String filedAll =  null;
+//                    JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
             PageHelper.startPage(pageNo, pageSize, false);
             List<JSONObject> list = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, startDate, endDate, projects, channelType, md5, target, order);
             Long count = materialReportOverViewMapper.queryKuaishouMaterialReportCount(startDate, endDate, projects, channelType, md5);
@@ -373,7 +375,8 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
             columns2.add(columns2.size(), columns.getString(i));
         }
         List<String> titles = getfileIds(AccountReportConstants.getKuaishouVideoReportDict(), columns2);
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
+        String filedAll = "";
+//                JsonResourceUtil.joinAllFiled(AccountReportConstants.getKuaishouVideoReportMap());
         List<JSONObject> excelData = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, requestBody.getString("startDate"), requestBody.getString("endDate"),
                 projects, requestBody.getString("channelType"), requestBody.getString("md5"), requestBody.getString("target") == null ? "cost" : requestBody.getString("target")
                 , requestBody.getString("order") == null ? "desc" : requestBody.getString("order"));