Explorar o código

Merge remote-tracking branch 'origin/master'

syh %!s(int64=4) %!d(string=hai) anos
pai
achega
7aeb4ee050
Modificáronse 39 ficheiros con 1425 adicións e 430 borrados
  1. 22 13
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  2. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 10 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  4. 261 240
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  5. 33 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  6. 3 3
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  7. 121 68
      module-common/src/main/java/cn/com/ctop/common/module/entity/SysDepart.java
  8. 18 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/SysUser.java
  9. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java
  10. 42 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  11. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/model/DepartIdModel.java
  12. 24 1
      module-common/src/main/java/cn/com/ctop/common/module/model/SysDepartTreeModel.java
  13. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysBaseApi.java
  14. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java
  15. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysBaseApiImpl.java
  16. 31 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysDepartServiceImpl.java
  17. 7 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java
  18. 2 12
      module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  19. 17 11
      module-common/src/main/java/cn/com/ctop/common/module/utils/FindsDepartsChildrenUtil.java
  20. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAudienceReportJob.java
  21. 1 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java
  22. 13 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java
  23. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCreativePreviewController.java
  24. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchGroupPreviewController.java
  25. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCampaignPreview.java
  26. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCreativePreview.java
  27. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java
  28. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouStrategyMapper.java
  29. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouStrategyMapper.xml
  30. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouStrategyService.java
  31. 21 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java
  32. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouStrategyServiceImpl.java
  33. 227 46
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  34. 6 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java
  35. 77 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  36. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java
  37. 25 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java
  38. 188 0
      module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_dict.json
  39. 214 0
      module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json

+ 22 - 13
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -6,18 +6,20 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- *  Created by JQ.bi on 2020.5.30
+ * Created by JQ.bi on 2020.5.30
  */
 public class AccountReportConstants {
 
     /**
      * 私有构造器
      */
-    private AccountReportConstants(){
+    private AccountReportConstants() {
 
     }
 
-    /** 单体实例 */
+    /**
+     * 单体实例
+     */
     private static AccountReportConstants instance;
 
     /**
@@ -34,22 +36,29 @@ public class AccountReportConstants {
      * 字典数据
      */
     //头条字段映射
-    public static Map<String, Map<String,Object>> dicMapBy = new HashMap<>();
+    public static Map<String, Map<String, Object>> dicMapBy = new HashMap<>();
     //快手字段映射
-    public static Map<String, Map<String,Object>> dicMapKs = new HashMap<>();
+    public static Map<String, Map<String, Object>> dicMapKs = new HashMap<>();
     //头条视频报表字段映射
-    public static Map<String, Map<String,Object>> dicMapByVideo= new HashMap<>();
+    public static Map<String, Map<String, Object>> dicMapByVideo = new HashMap<>();
+    public static Map<String, Map<String, Object>> kuaishouVideoReportMap = new HashMap<>();
+    public static Map<String, Map<String, Object>> kuaishouVideoReportDict = new HashMap<>();
+
     /**
      * 初始化字典
      */
-    public void init(){
+    public void init() {
         //加载json文件
-        Object jsonBy=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
-        Object jsonKs=JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
-        Object jsonByVideo=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
+        Object jsonBy = JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        Object jsonKs = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
+        Object KuaiShouVideoJson = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_video_report_filed_mapping.json");
+        Object KuaiShouVideoDictJson = JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_video_report_filed_dict.json");
+        Object jsonByVideo = JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
         //json 转为map存为静态常量
-        dicMapBy=JsonResourceUtil.jsonToMap(jsonBy);
-        dicMapKs=JsonResourceUtil.jsonToMap(jsonKs);
-        dicMapByVideo=JsonResourceUtil.jsonToMap(jsonByVideo);
+        dicMapBy = JsonResourceUtil.jsonToMap(jsonBy);
+        dicMapKs = JsonResourceUtil.jsonToMap(jsonKs);
+        dicMapByVideo = JsonResourceUtil.jsonToMap(jsonByVideo);
+        kuaishouVideoReportMap = JsonResourceUtil.jsonToMap(KuaiShouVideoJson);
+        kuaishouVideoReportDict = JsonResourceUtil.jsonToMap(KuaiShouVideoDictJson);
     }
 }

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -190,6 +190,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ai/aiKuaiShouAppInfo/*", "anon");
         filterChainDefinitionMap.put("/explore/*", "anon");
         filterChainDefinitionMap.put("/ai/batchUpdate/*", "anon");
+        filterChainDefinitionMap.put("/ctop/kuaishou/videoReport/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -264,11 +264,18 @@ public class ProjectMemberController {
                 Project project = projectService.getById(member.getProjectId());
                 if (!Check.isNull(project)) {
                     SysUser responsible = sysUserService.getById(project.getResponsibleId());
-                    member.setResponsibleName(responsible.getRealname());
+                    if (!Check.isNull(responsible)) {
+                        member.setResponsibleName(responsible.getRealname());
+                    }
                     SysUser designResponsible = sysUserService.getById(project.getDesignResponsibleId());
-                    member.setDesignResponsibleName(designResponsible.getRealname());
+                    if (!Check.isNull(designResponsible)) {
+                        member.setDesignResponsibleName(designResponsible.getRealname());
+                    }
                     Advertiser advertiser = advertiserService.getById(project.getAdvertiserId());
-                    member.setProjectName(project.getProjectName());
+                    if (!Check.isNull(advertiser)) {
+                        member.setProjectName(project.getProjectName());
+                    }
+
                     Product product = productService.getById(project.getProductId());
                     if (!Check.isNull(product)) {
                         member.setProductId(product.getId());

+ 261 - 240
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -3,9 +3,11 @@ package org.jeecg.modules.system.controller;
 import cn.com.ctop.common.module.entity.SysDepart;
 import cn.com.ctop.common.module.model.DepartIdModel;
 import cn.com.ctop.common.module.model.SysDepartTreeModel;
+import cn.com.ctop.common.module.service.ISysBaseApi;
 import cn.com.ctop.common.module.service.ISysDepartService;
 import cn.com.ctop.common.module.service.ISysUserDepartService;
 import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -26,7 +28,12 @@ import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+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;
@@ -34,7 +41,13 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.*;
+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;
 
 /**
  * <p>
@@ -47,205 +60,212 @@ import java.util.*;
 @RequestMapping("/sys/sysDepart")
 @Slf4j
 public class SysDepartController {
+    @Autowired
+    private ISysBaseApi sysBaseAPI;
+    @Autowired
+    private ISysDepartService sysDepartService;
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private ISysUserDepartService sysUserDepartService;
+    public RedisTemplate<String, Object> redisTemplate;
 
-	@Autowired
-	private ISysDepartService sysDepartService;
-	@Autowired
-	private ISysUserService sysUserService;
-	@Autowired
-	private ISysUserDepartService sysUserDepartService;
-	public RedisTemplate<String, Object> redisTemplate;
-	/**
-	 * 查询数据 查出我的部门,并以树结构数据格式响应给前端
-	 *
-	 * @return
-	 */
-	@RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET)
-	public Result<List<SysDepartTreeModel>> queryMyDeptTreeList() {
-		Result<List<SysDepartTreeModel>> result = new Result<>();
-		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-		try {
-			if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
-				List<SysDepartTreeModel> list = sysDepartService.queryMyDeptTreeList(user.getDepartIds());
-				result.setResult(list);
-				result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
-				result.setSuccess(true);
-			}else{
-				result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
-				result.setSuccess(true);
-			}
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-		}
-		return result;
-	}
+    /**
+     * 查询数据 查出我的部门,并以树结构数据格式响应给前端
+     *
+     * @return
+     */
+    @RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET)
+    public Result<List<SysDepartTreeModel>> queryMyDeptTreeList() {
+        Result<List<SysDepartTreeModel>> result = new Result<>();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        try {
+            if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) {
+                List<SysDepartTreeModel> list = sysDepartService.queryMyDeptTreeList(user.getDepartIds());
+                result.setResult(list);
+                result.setMessage(CommonConstant.USER_IDENTITY_2.toString());
+                result.setSuccess(true);
+            } else {
+                result.setMessage(CommonConstant.USER_IDENTITY_1.toString());
+                result.setSuccess(true);
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return result;
+    }
 
-	/**
-	 * 查询数据 查出所有部门,并以树结构数据格式响应给前端
-	 *
-	 * @return
-	 */
-	@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
-	public Result<List<SysDepartTreeModel>> queryTreeList() {
-		Result<List<SysDepartTreeModel>> result = new Result<>();
-		try {
-			List<SysDepartTreeModel> list = sysDepartService.queryTreeList();
-			result.setResult(list);
-			result.setSuccess(true);
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-		}
-		return result;
-	}
+    /**
+     * 查询数据 查出所有部门,并以树结构数据格式响应给前端
+     *
+     * @return
+     */
+    @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
+    public Result<List<SysDepartTreeModel>> queryTreeList() {
+        Result<List<SysDepartTreeModel>> result = new Result<>();
+        try {
+            List<SysDepartTreeModel> list = sysDepartService.queryTreeList();
+            result.setResult(list);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return result;
+    }
 
-	/**
-	 * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
-	 *
-	 * @param sysDepart
-	 * @return
-	 */
-	//@RequiresRoles({"admin"})
-	@RequestMapping(value = "/add", method = RequestMethod.POST)
-	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
-	public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
-		Result<SysDepart> result = new Result<SysDepart>();
-		String username = JwtUtil.getUserNameByToken(request);
-		try {
-			sysDepart.setCreateBy(username);
-			sysDepartService.saveDepartData(sysDepart, username);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
+    /**
+     * 添加新数据 添加用户新建的部门对象数据,并保存到数据库
+     *
+     * @param sysDepart
+     * @return
+     */
+    //@RequiresRoles({"admin"})
+    @RequestMapping(value = "/add", method = RequestMethod.POST)
+    @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
+    public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
+        Result<SysDepart> result = new Result<SysDepart>();
+        String username = JwtUtil.getUserNameByToken(request);
+        try {
+            sysDepart.setCreateBy(username);
+            sysDepartService.saveDepartData(sysDepart, username);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-	/**
-	 * 编辑数据 编辑部门的部分数据,并保存到数据库
-	 *
-	 * @param sysDepart
-	 * @return
-	 */
-	//@RequiresRoles({"admin"})
-	@RequestMapping(value = "/edit", method = RequestMethod.PUT)
-	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
-	public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
-		String username = JwtUtil.getUserNameByToken(request);
-		sysDepart.setUpdateBy(username);
-		Result<SysDepart> result = new Result<SysDepart>();
-		SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
-		if (sysDepartEntity == null) {
-			result.error500("未找到对应实体");
-		} else {
-			boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
-			// TODO 返回false说明什么?
-			if (ok) {
-				result.success("修改成功!");
-			}
-		}
-		return result;
-	}
+    /**
+     * 编辑数据 编辑部门的部分数据,并保存到数据库
+     *
+     * @param sysDepart
+     * @return
+     */
+    //@RequiresRoles({"admin"})
+    @RequestMapping(value = "/edit", method = RequestMethod.PUT)
+    @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
+    public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
+        sysBaseAPI.addLog("编辑部门,id: " + sysDepart.getId(), CommonConstant.LOG_TYPE_2, 2);
+        String username = JwtUtil.getUserNameByToken(request);
+        sysDepart.setUpdateBy(username);
+        Result<SysDepart> result = new Result<SysDepart>();
+        if (!Check.isNull(sysDepart.getLeaderName())) {
+            sysDepart.setLeaderName(sysDepart.getLeaderName().trim());
+        }
+        SysDepart sysDepartEntity = sysDepartService.getById(sysDepart.getId());
+        if (sysDepartEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = sysDepartService.updateDepartDataById(sysDepart, username);
+            // TODO 返回false说明什么?
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+        return result;
+    }
 
-	 /**
-     *   通过id删除
-    * @param id
-    * @return
-    */
-	//@RequiresRoles({"admin"})
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    //@RequiresRoles({"admin"})
     @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
-	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
-   public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {
-
-       Result<SysDepart> result = new Result<SysDepart>();
-       SysDepart sysDepart = sysDepartService.getById(id);
-       if(sysDepart==null) {
-           result.error500("未找到对应实体");
-       }else {
-           boolean ok = sysDepartService.delete(id);
-           if(ok) {
-               result.success("删除成功!");
-           }
-       }
-       return result;
-   }
-
+    @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
+    public Result<SysDepart> delete(@RequestParam(name = "id", required = true) String id) {
+        sysBaseAPI.addLog("删除部门,id: " + id, CommonConstant.LOG_TYPE_2, 3);
+        Result<SysDepart> result = new Result<SysDepart>();
+        SysDepart sysDepart = sysDepartService.getById(id);
+        if (sysDepart == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = sysDepartService.delete(id);
+            if (ok) {
+                result.success("删除成功!");
+            }
+        }
+        return result;
+    }
 
-	/**
-	 * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
-	 *
-	 * @param ids
-	 * @return
-	 */
-	//@RequiresRoles({"admin"})
-	@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
-	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
-	public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
 
-		Result<SysDepart> result = new Result<SysDepart>();
-		if (ids == null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		} else {
-			this.sysDepartService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
+    /**
+     * 批量删除 根据前端请求的多个ID,对数据库执行删除相关部门数据的操作
+     *
+     * @param ids
+     * @return
+     */
+    //@RequiresRoles({"admin"})
+    @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
+    @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
+    public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        sysBaseAPI.addLog("批量删除部门, ids: " + ids, CommonConstant.LOG_TYPE_2, 3);
+        Result<SysDepart> result = new Result<SysDepart>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.sysDepartService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
 
-	/**
-	 * 查询数据 添加或编辑页面对该方法发起请求,以树结构形式加载所有部门的名称,方便用户的操作
-	 *
-	 * @return
-	 */
-	@RequestMapping(value = "/queryIdTree", method = RequestMethod.GET)
-	public Result<List<DepartIdModel>> queryIdTree() {
-		Result<List<DepartIdModel>> result = new Result<>();
-		try {
-			List<DepartIdModel> list = sysDepartService.queryDepartIdTreeList();
-			result.setResult(list);
-			result.setSuccess(true);
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-		}
-		return result;
-	}
+    /**
+     * 查询数据 添加或编辑页面对该方法发起请求,以树结构形式加载所有部门的名称,方便用户的操作
+     *
+     * @return
+     */
+    @RequestMapping(value = "/queryIdTree", method = RequestMethod.GET)
+    public Result<List<DepartIdModel>> queryIdTree() {
+        Result<List<DepartIdModel>> result = new Result<>();
+        try {
+            List<DepartIdModel> list = sysDepartService.queryDepartIdTreeList();
+            result.setResult(list);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return result;
+    }
 
-	/**
-	 * <p>
-	 * 部门搜索功能方法,根据关键字模糊搜索相关部门
-	 * </p>
-	 *
-	 * @param keyWord
-	 * @return
-	 */
-	@RequestMapping(value = "/searchBy", method = RequestMethod.GET)
-	public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
-		Result<List<SysDepartTreeModel>> result = new Result<List<SysDepartTreeModel>>();
-		//部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据
-		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-		String departIds = null;
-		if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals( CommonConstant.USER_IDENTITY_2 )){
-			departIds = user.getDepartIds();
-		}
-		List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord,myDeptSearch,departIds);
-		if (treeList == null || treeList.size() == 0) {
-			result.setSuccess(false);
-			result.setMessage("未查询匹配数据!");
-			return result;
-		}
-		result.setResult(treeList);
-		return result;
-	}
+    /**
+     * <p>
+     * 部门搜索功能方法,根据关键字模糊搜索相关部门
+     * </p>
+     *
+     * @param keyWord
+     * @return
+     */
+    @RequestMapping(value = "/searchBy", method = RequestMethod.GET)
+    public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord, @RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
+        Result<List<SysDepartTreeModel>> result = new Result<List<SysDepartTreeModel>>();
+        //部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String departIds = null;
+        if (oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2)) {
+            departIds = user.getDepartIds();
+        }
+        List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord, myDeptSearch, departIds);
+        if (treeList == null || treeList.size() == 0) {
+            result.setSuccess(false);
+            result.setMessage("未查询匹配数据!");
+            return result;
+        }
+        result.setResult(treeList);
+        return result;
+    }
 
 
-	/**
+    /**
      * 导出excel
      *
      * @param request
      * @param sysDepart
      */
     @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
+    public ModelAndView exportXls(SysDepart sysDepart, HttpServletRequest request) {
         // Step.1 组装查询条件
         QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
         //Step.2 AutoPoi 导出Excel
@@ -254,15 +274,15 @@ public class SysDepartController {
         //按字典排序
         Collections.sort(pageList, new Comparator<SysDepart>() {
             @Override
-			public int compare(SysDepart arg0, SysDepart arg1) {
-            	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
+            public int compare(SysDepart arg0, SysDepart arg1) {
+                return arg0.getOrgCode().compareTo(arg1.getOrgCode());
             }
         });
         //导出文件名称
         mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
         mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:" + user.getRealname(), "导出信息"));
         mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
         return mv;
     }
@@ -276,11 +296,11 @@ public class SysDepartController {
      */
     //@RequiresRoles({"admin"})
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-	@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
+    @CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-		List<String> errorMessageList = new ArrayList<>();
-		List<SysDepart> listSysDeparts = null;
+        List<String> errorMessageList = new ArrayList<>();
+        List<SysDepart> listSysDeparts = null;
         Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
         for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
             MultipartFile file = entity.getValue();// 获取上传文件对象
@@ -289,50 +309,50 @@ public class SysDepartController {
             params.setHeadRows(1);
             params.setNeedSave(true);
             try {
-            	// orgCode编码长度
-            	int codeLength = 3;
+                // orgCode编码长度
+                int codeLength = 3;
                 listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params);
                 //按长度排序
                 Collections.sort(listSysDeparts, new Comparator<SysDepart>() {
                     @Override
-					public int compare(SysDepart arg0, SysDepart arg1) {
-                    	return arg0.getOrgCode().length() - arg1.getOrgCode().length();
+                    public int compare(SysDepart arg0, SysDepart arg1) {
+                        return arg0.getOrgCode().length() - arg1.getOrgCode().length();
                     }
                 });
 
                 int num = 0;
                 for (SysDepart sysDepart : listSysDeparts) {
-                	String orgCode = sysDepart.getOrgCode();
-                	if(orgCode.length() > codeLength) {
-                		String parentCode = orgCode.substring(0, orgCode.length()-codeLength);
-                		QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>();
-                		queryWrapper.eq("org_code", parentCode);
-                		try {
-                		SysDepart parentDept = sysDepartService.getOne(queryWrapper);
-                		if(!parentDept.equals(null)) {
-							sysDepart.setParentId(parentDept.getId());
-						} else {
-							sysDepart.setParentId("");
-						}
-                		}catch (Exception e) {
-                			//没有查找到parentDept
-                		}
-                	}else{
-                		sysDepart.setParentId("");
-					}
-					sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
-					ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE);
-					num++;
+                    String orgCode = sysDepart.getOrgCode();
+                    if (orgCode.length() > codeLength) {
+                        String parentCode = orgCode.substring(0, orgCode.length() - codeLength);
+                        QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>();
+                        queryWrapper.eq("org_code", parentCode);
+                        try {
+                            SysDepart parentDept = sysDepartService.getOne(queryWrapper);
+                            if (!parentDept.equals(null)) {
+                                sysDepart.setParentId(parentDept.getId());
+                            } else {
+                                sysDepart.setParentId("");
+                            }
+                        } catch (Exception e) {
+                            //没有查找到parentDept
+                        }
+                    } else {
+                        sysDepart.setParentId("");
+                    }
+                    sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
+                    ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE);
+                    num++;
                 }
-				//清空部门缓存
-				Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*");
-				Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
-				redisTemplate.delete(keys3);
-				redisTemplate.delete(keys4);
-				return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList);
+                //清空部门缓存
+                Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*");
+                Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
+                redisTemplate.delete(keys3);
+                redisTemplate.delete(keys4);
+                return ImportExcelUtil.imporReturnRes(errorMessageList.size(), listSysDeparts.size() - errorMessageList.size(), errorMessageList);
             } catch (Exception e) {
-                log.error(e.getMessage(),e);
-                return Result.error("文件导入失败:"+e.getMessage());
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
             } finally {
                 try {
                     file.getInputStream().close();
@@ -345,22 +365,23 @@ public class SysDepartController {
     }
 
 
-	/**
-	 * 查询所有部门信息
-	 * @return
-	 */
-	@GetMapping("listAll")
-	public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) {
-		Result<List<SysDepart>> result = new Result<>();
-		LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
-		query.orderByAsc(SysDepart::getOrgCode);
-		if(oConvertUtils.isNotEmpty(id)){
-			String arr[] = id.split(",");
-			query.in(SysDepart::getId,arr);
-		}
-		List<SysDepart> ls = this.sysDepartService.list(query);
-		result.setSuccess(true);
-		result.setResult(ls);
-		return result;
-	}
+    /**
+     * 查询所有部门信息
+     *
+     * @return
+     */
+    @GetMapping("listAll")
+    public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) {
+        Result<List<SysDepart>> result = new Result<>();
+        LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
+        query.orderByAsc(SysDepart::getOrgCode);
+        if (oConvertUtils.isNotEmpty(id)) {
+            String arr[] = id.split(",");
+            query.in(SysDepart::getId, arr);
+        }
+        List<SysDepart> ls = this.sysDepartService.list(query);
+        result.setSuccess(true);
+        result.setResult(ls);
+        return result;
+    }
 }

+ 33 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -103,6 +103,8 @@ public class SysUserController {
     @Autowired
     private ISysRoleService roleService;
 
+    @Resource
+    private UserCompanyMapper userCompanyMapper;
     @Autowired
     private RedisUtil redisUtil;
     @Value("${jeecg.path.upload}")
@@ -118,14 +120,22 @@ public class SysUserController {
     public Map<String, Object> getAllDesigner() {
         Map<String, Object> map = new HashMap<>();
         List<SysUser> userList = sysUserService.getAllDesigner();
-        map.put("data",userList);
+        map.put("data", userList);
         ResultMapUtils.setResultMap(map, StatusCode.COMMON_SUCCESS);
         return map;
     }
 
+    @RequestMapping(value = "/getAllUser", method = RequestMethod.GET)
+    public Result<Object> getAllUser(String status) {
+        try {
+            List<SysUserVo> allUser = sysUserService.getAllUser(null, status);
+            return Result.ok(allUser);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
 
-    @Resource
-    private UserCompanyMapper userCompanyMapper;
 
     /**
      * 获取用户列表数据
@@ -138,6 +148,21 @@ public class SysUserController {
      */
     @PermissionData(pageComponent = "system/UserList")
     @RequestMapping(value = "/list", method = RequestMethod.GET)
+    public Result<Object> queryPageList(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            PageHelper.startPage(pageNo, pageSize);
+            List<SysUser> list = sysUserService.queryPageList(user);
+            PageInfo<SysUser> pageInfo = new PageInfo<>(list);
+            return Result.ok(pageInfo);
+        } catch (Exception e) {
+            log.error("获取用户列表数据-分页列表查询异常", e);
+        }
+        return Result.error("查询失败");
+    }
+
+   /* @PermissionData(pageComponent = "system/UserList")
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
     public Result<IPage<SysUser>> queryPageList(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
         Result<IPage<SysUser>> result = new Result<>();
@@ -161,7 +186,7 @@ public class SysUserController {
         result.setResult(pageList);
         log.info(pageList.toString());
         return result;
-    }
+    }*/
 
     @RequestMapping(value = "/getAllUserListByCompany", method = RequestMethod.GET)
     public Result<List<SysUserVo>> getAllUserListByCompany(String userName) {
@@ -176,7 +201,7 @@ public class SysUserController {
             String companyId = userCompany.getCompanyId();
             List<SysUserVo> userList;
             if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
-                userList = sysUserService.getAllUser(userName);
+                userList = sysUserService.getAllUser(userName, null);
             } else {
                 userList = sysUserService.getUserListByCompany(companyId, userName);
             }
@@ -209,7 +234,7 @@ public class SysUserController {
 
             PageHelper.startPage(pageNo, pageSize);
             if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
-                userList = sysUserService.getAllUser(userName);
+                userList = sysUserService.getAllUser(userName, null);
             } else {
                 userList = sysUserService.getUserListByCompany(companyId, userName);
             }
@@ -238,7 +263,7 @@ public class SysUserController {
             String companyId = userCompany.getCompanyId();
             List<SysUserVo> userList;
             if ("4b10089775c040119e139087517aed88".equals(companyId) || "6608ed13c0dd42de93c790dbdf124234".equals(companyId) || "d57fecdcf7a94d009736d9c850731582".equals(companyId)) {
-                userList = sysUserService.getAllUser(userName);
+                userList = sysUserService.getAllUser(userName, null);
             } else {
                 userList = sysUserService.getUserListByCompany(companyId, userName);
             }
@@ -307,6 +332,7 @@ public class SysUserController {
             sysUserService.addUserWithDepart(user, selectedDeparts);
             userCompanyService.addOrUpdateUserWithCompany(user);
             result.success("添加成功!");
+            sysBaseAPI.addLog("添加用户,id: " + user.getId(), CommonConstant.LOG_TYPE_2, 1);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             result.error500("操作失败");

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -135,9 +135,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
-          username: hcst
-          password: hcst@2020
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          username: data
+          password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

+ 121 - 68
module-common/src/main/java/cn/com/ctop/common/module/entity/SysDepart.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.entity;
 
 import cn.com.ctop.common.module.annotation.Dict;
 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 com.fasterxml.jackson.annotation.JsonFormat;
@@ -19,85 +20,137 @@ import java.util.Objects;
  * <p>
  *
  * @Author Steve
- * @Since  2019-01-22
+ * @Since 2019-01-22
  */
 @Data
 @TableName("sys_depart")
 public class SysDepart implements Serializable {
     private static final long serialVersionUID = 1L;
 
-	/**ID*/
-	@TableId(type = IdType.ID_WORKER_STR)
-	private String id;
-	/**父机构ID*/
-	private String parentId;
-	/**机构/部门名称*/
-	@Excel(name="机构/部门名称",width=15)
-	private String departName;
-	/**英文名*/
-	@Excel(name="英文名",width=15)
-	private String departNameEn;
-	/**缩写*/
-	private String departNameAbbr;
-	/**排序*/
-	@Excel(name="排序",width=15)
-	private Integer departOrder;
-	/**描述*/
-	@Excel(name="描述",width=15)
-	private String description;
-	/**机构类别 1组织机构,2岗位*/
-	@Excel(name="机构类别",width=15,dicCode="org_category")
-	private String orgCategory;
-	/**机构类型*/
-	private String orgType;
-	/**机构编码*/
-	@Excel(name="机构编码",width=15)
-	private String orgCode;
-	/**手机号*/
-	@Excel(name="手机号",width=15)
-	private String mobile;
-	/**传真*/
-	@Excel(name="传真",width=15)
-	private String fax;
-	/**地址*/
-	@Excel(name="地址",width=15)
-	private String address;
-	/**备注*/
-	@Excel(name="备注",width=15)
-	private String memo;
-	/**状态(1启用,0不启用)*/
-	@Dict(dicCode = "depart_status")
+    /**
+     * ID
+     */
+    @TableId(type = IdType.ID_WORKER_STR)
+    private String id;
+    /**
+     * 父机构ID
+     */
+    private String parentId;
+    /**
+     * 机构/部门名称
+     */
+    @Excel(name = "机构/部门名称", width = 15)
+    private String departName;
+    /**
+     * 英文名
+     */
+    @Excel(name = "英文名", width = 15)
+    private String departNameEn;
+    /**
+     * 缩写
+     */
+    private String departNameAbbr;
+    /**
+     * 排序
+     */
+    @Excel(name = "排序", width = 15)
+    private Integer departOrder;
+    /**
+     * 描述
+     */
+    @Excel(name = "描述", width = 15)
+    private String description;
+    /**
+     * 机构类别 1组织机构,2岗位
+     */
+    @Excel(name = "机构类别", width = 15, dicCode = "org_category")
+    private String orgCategory;
+    /**
+     * 机构类型
+     */
+    private String orgType;
+    /**
+     * 机构编码
+     */
+    @Excel(name = "机构编码", width = 15)
+    private String orgCode;
+    /**
+     * 手机号
+     */
+    @Excel(name = "手机号", width = 15)
+    private String mobile;
+    /**
+     * 传真
+     */
+    @Excel(name = "传真", width = 15)
+    private String fax;
+    /**
+     * 地址
+     */
+    @Excel(name = "地址", width = 15)
+    private String address;
+    /**
+     * 备注
+     */
+    @Excel(name = "备注", width = 15)
+    private String memo;
+    /**
+     * 状态(1启用,0不启用)
+     */
+    @Dict(dicCode = "depart_status")
     private String status;
-	/**删除状态(0,正常,1已删除)*/
-	@Dict(dicCode = "del_flag")
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    @Dict(dicCode = "del_flag")
     private String delFlag;
-	/**创建人*/
-	private String createBy;
-	/**创建日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	private Date createTime;
-	/**更新人*/
-	private String updateBy;
-	/**更新日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
-	private Date updateTime;
+    /**
+     * 创建人
+     */
+    private String createBy;
+    /**
+     * 创建日期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 更新人
+     */
+    private String updateBy;
+    /**
+     * 更新日期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+    /**
+     * 领导 ID
+     */
+    private String leaderId;
 
-	/**
-	 * 重写equals方法
-	 */
+    @TableField(exist = false)
+    private String title;
+
+    /**
+     * 领导姓名
+     */
+    private String leaderName;
+
+    /**
+     * 重写equals方法
+     */
     @Override
     public boolean equals(Object o) {
         if (this == o) {
-			return true;
-		}
+            return true;
+        }
         if (o == null || getClass() != o.getClass()) {
-			return false;
-		}
+            return false;
+        }
         if (!super.equals(o)) {
-			return false;
-		}
+            return false;
+        }
         SysDepart depart = (SysDepart) o;
         return Objects.equals(id, depart.id) &&
                 Objects.equals(parentId, depart.parentId) &&
@@ -126,8 +179,8 @@ public class SysDepart implements Serializable {
     @Override
     public int hashCode() {
         return Objects.hash(super.hashCode(), id, parentId, departName,
-        		departNameEn, departNameAbbr, departOrder, description,
-        		orgType, orgCode, mobile, fax, address, memo, status,
-        		delFlag, createBy, createTime, updateBy, updateTime);
+                departNameEn, departNameAbbr, departOrder, description,
+                orgType, orgCode, mobile, fax, address, memo, status,
+                delFlag, createBy, createTime, updateBy, updateTime);
     }
 }

+ 18 - 1
module-common/src/main/java/cn/com/ctop/common/module/entity/SysUser.java

@@ -199,8 +199,25 @@ public class SysUser implements Serializable {
     private String depart;
 
     /**
-     * 部门
+     * 角色
      */
     @TableField(exist = false)
     private String roleName;
+
+    /**
+     * 组织机构名称
+     */
+    @TableField(exist = false)
+    private String departName;
+
+    /**
+     * 领导 ID
+     */
+    private String leaderId;
+
+    /**
+     * 领导姓名
+     */
+    private String leaderName;
+
 }

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/SysUserMapper.java

@@ -161,7 +161,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 
     Map<String, Object> queryRoleCode(@Param("userId") String userId);
 
-    List<SysUserVo> getAllUser(@Param("userName") String userName);
+    List<SysUserVo> getAllUser(@Param("userName") String userName,@Param("status") String status);
 
     List<SysUserVo> getUserListByCompany(@Param("companyId") String companyId, @Param("userName") String userName);
 
@@ -172,4 +172,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     JSONObject selectUserByAccount(@Param("accountId") Long accountId);
 
     SysUser getDesignerTeamLeaderBy(@Param("orgCode")String orgCode);
+
+    List<SysUser> queryPageList(SysUser user);
 }

+ 42 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -100,6 +100,10 @@ SELECT
         <if test="userName != null and userName != ''">
             and t1.realname like concat(concat('%',#{userName}),'%')
         </if>
+          <if test="status != null and status != ''">
+            and t1.status =#{status}
+            AND t1.del_flag = 0
+        </if>
     </select>
     <!-- SQL片段:getUserByOrgCode 的 FROM 和 WHERE 部分 -->
     <sql id="getUserByOrgCodeFromSql">
@@ -271,4 +275,42 @@ SELECT
         AND
             role.role_code = 'designTeamLeader'
     </select>
+
+    <select id="queryPageList" resultType="cn.com.ctop.common.module.entity.SysUser">
+        SELECT t1.*,t3.depart_name ,role.role_name
+        FROM sys_user t1
+        LEFT JOIN sys_user_depart t2 ON t1.id = t2.user_id
+        LEFT JOIN sys_depart t3 ON t2.dep_id = t3.id
+        LEFT JOIN sys_user_role userRole ON t1.id = userRole.user_id
+        LEFT JOIN sys_role role ON userRole.role_id = role.id
+        where t1.del_flag = 0
+        <if test="realname != null and realname != ''">
+            AND t1.realname LIKE CONCAT(CONCAT('%',#{realname}),'%')
+        </if>
+        <if test="username != null and username != ''">
+            AND t1.username LIKE CONCAT(CONCAT('%',#{username}),'%')
+        </if>
+        <if test="email != null and email != ''">
+            AND t1.email LIKE CONCAT(CONCAT('%',#{email}),'%')
+        </if>
+        <if test="phone != null and phone != ''">
+            AND t1.phone LIKE CONCAT(CONCAT('%',#{phone}),'%')
+        </if>
+        <if test="status != null and status != ''">
+            AND t1.`status` = #{status}
+        </if>
+        <if test="leaderName != null and leaderName != ''">
+            AND t1.leader_name LIKE CONCAT(CONCAT('%',#{leaderName}),'%')
+        </if>
+        <if test="departId != null and departId != ''">
+            AND t3.id =#{departId}
+        </if>
+        <if test="roleName != null and roleName != ''">
+            AND role.role_name LIKE CONCAT(CONCAT('%',#{roleName}),'%')
+        </if>
+        <if test="sex != null and sex != ''">
+            AND t1.sex =#{sex}
+        </if>
+    </select>
+
 </mapper>

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/model/DepartIdModel.java

@@ -47,7 +47,7 @@ public class DepartIdModel implements Serializable {
     public DepartIdModel convert(SysDepartTreeModel treeModel) {
         this.key = treeModel.getId();
         this.value = treeModel.getId();
-        this.title = treeModel.getDepartName();
+        this.title = treeModel.getTitle();
         this.orgCode = treeModel.getOrgCode();
         return this;
     }

+ 24 - 1
module-common/src/main/java/cn/com/ctop/common/module/model/SysDepartTreeModel.java

@@ -73,6 +73,11 @@ public class SysDepartTreeModel implements Serializable{
 
     private Date updateTime;
 
+    private String leaderId;
+    /**
+     * 领导姓名
+     */
+    private String leaderName;
     private List<SysDepartTreeModel> children = new ArrayList<>();
 
 
@@ -83,7 +88,7 @@ public class SysDepartTreeModel implements Serializable{
 	public SysDepartTreeModel(SysDepart sysDepart) {
 		this.key = sysDepart.getId();
         this.value = sysDepart.getId();
-        this.title = sysDepart.getDepartName();
+        this.title = sysDepart.getTitle();
         this.id = sysDepart.getId();
         this.parentId = sysDepart.getParentId();
         this.departName = sysDepart.getDepartName();
@@ -104,12 +109,30 @@ public class SysDepartTreeModel implements Serializable{
         this.createTime = sysDepart.getCreateTime();
         this.updateBy = sysDepart.getUpdateBy();
         this.updateTime = sysDepart.getUpdateTime();
+        this.leaderName = sysDepart.getLeaderName();
+        this.leaderId = sysDepart.getLeaderId();
     }
 
     public boolean getIsLeaf() {
         return isLeaf;
     }
 
+    public String getLeaderId() {
+        return leaderId;
+    }
+
+    public void setLeaderId(String leaderId) {
+        this.leaderId = leaderId;
+    }
+
+    public String getLeaderName() {
+        return leaderName;
+    }
+
+    public void setLeaderName(String leaderName) {
+        this.leaderName = leaderName;
+    }
+
     public void setIsLeaf(boolean isleaf) {
          this.isLeaf = isleaf;
     }

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

@@ -21,7 +21,7 @@ public interface ISysBaseApi {
 	/**
 	 * 日志添加
 	 * @param LogContent 内容
-	 * @param logType 日志类型(0:操作日志;1:登录日志;2:定时任务)
+	 * @param logType 日志类型(0:定时任务;1:登录日志;2:操作日志)
 	 * @param operatetype 操作类型(1:添加;2:修改;3:删除;)
 	 */
 	void addLog(String LogContent, Integer logType, Integer operatetype);

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java

@@ -259,9 +259,11 @@ public interface ISysUserService extends IService<SysUser> {
      */
     List<SysUser> queryByDepIds(List<String> departIds, String username);
 
-    List<SysUserVo> getAllUser(String userName);
+    List<SysUserVo> getAllUser(String userName,String status);
 
     List<SysUser> getAllDesigner();
 
     SysUser getDesignerTeamLeaderBy(String orgCode);
+
+    List<SysUser> queryPageList(SysUser user);
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysBaseApiImpl.java

@@ -749,6 +749,7 @@ public class SysBaseApiImpl implements ISysBaseApi {
     }
 
     /**
+
      * 推送签到人员信息
      *
      * @param userId

+ 31 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysDepartServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.mapper.*;
 import cn.com.ctop.common.module.model.DepartIdModel;
 import cn.com.ctop.common.module.model.SysDepartTreeModel;
+import cn.com.ctop.common.module.service.ISysBaseApi;
 import cn.com.ctop.common.module.service.ISysDepartRoleService;
 import cn.com.ctop.common.module.service.ISysDepartService;
 import cn.com.ctop.common.module.utils.Check;
@@ -33,7 +34,8 @@ import java.util.*;
  */
 @Service
 public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart> implements ISysDepartService {
-
+    @Autowired
+    private ISysBaseApi sysBaseAPI;
     @Resource
     private SysUserDepartMapper userDepartMapper;
     @Autowired
@@ -61,6 +63,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
         List<SysDepart> listDepts = this.list(query);
         for (int i = 0; i < codeArr.length; i++) {
             for (SysDepart dept : listDepts) {
+                if (!Check.isNull(dept.getLeaderName())) {
+                    dept.setTitle(dept.getDepartName().concat("(").concat(dept.getLeaderName()).concat(")"));
+                } else {
+                    dept.setTitle(dept.getDepartName());
+                }
                 if (dept.getOrgCode().equals(codeArr[i])) {
                     dept.setParentId(null);
                 }
@@ -81,6 +88,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
         query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
         query.orderByAsc(SysDepart::getDepartOrder);
         List<SysDepart> list = this.list(query);
+        for (SysDepart sysDepart : list) {
+            if (!Check.isNull(sysDepart.getLeaderName())) {
+                sysDepart.setTitle(sysDepart.getDepartName().concat("(").concat(sysDepart.getLeaderName()).concat(")"));
+            } else {
+                sysDepart.setTitle(sysDepart.getDepartName());
+            }
+        }
+
         // 调用wrapTreeDataToTreeList方法生成树状数据
         List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
         return listResult;
@@ -93,6 +108,13 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
         query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
         query.orderByAsc(SysDepart::getDepartOrder);
         List<SysDepart> list = this.list(query);
+        for (SysDepart sysDepart : list) {
+            if (!Check.isNull(sysDepart.getLeaderName())) {
+                sysDepart.setTitle(sysDepart.getDepartName().concat("(").concat(sysDepart.getLeaderName()).concat(")"));
+            } else {
+                sysDepart.setTitle(sysDepart.getDepartName());
+            }
+        }
         // 调用wrapTreeDataToTreeList方法生成树状数据
         List<DepartIdModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list);
         return listResult;
@@ -127,6 +149,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
             sysDepart.setCreateTime(new Date());
             sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
             this.save(sysDepart);
+            sysBaseAPI.addLog("添加部门,id: " + sysDepart.getId(), CommonConstant.LOG_TYPE_2, 1);
         }
 
     }
@@ -284,6 +307,13 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
         //update-begin--Author:huangzhilin  Date:20140417 for:[bugfree号]组织机构搜索回显优化--------------------
         SysDepartTreeModel model = new SysDepartTreeModel();
         List<SysDepart> departList = this.list(query);
+        for (SysDepart sysDepart : departList) {
+            if (!Check.isNull(sysDepart.getLeaderName())) {
+                sysDepart.setTitle(sysDepart.getDepartName().concat("(").concat(sysDepart.getLeaderName()).concat(")"));
+            } else {
+                sysDepart.setTitle(sysDepart.getDepartName());
+            }
+        }
         if (departList.size() > 0) {
             for (SysDepart depart : departList) {
                 model = new SysDepartTreeModel(depart);

+ 7 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -268,8 +268,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
-    public List<SysUserVo> getAllUser(String userName) {
-        return userMapper.getAllUser(userName);
+    public List<SysUserVo> getAllUser(String userName,String status) {
+        return userMapper.getAllUser(userName,status);
     }
 
     @Override
@@ -283,6 +283,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
+    public List<SysUser> queryPageList(SysUser user) {
+        return userMapper.queryPageList(user);
+    }
+
+    @Override
     public Map<String, String> getDepNamesByUserIds(List<String> userIds) {
         List<SysUserDepVo> list = this.baseMapper.getDepNamesByUserIds(userIds);
         Map<String, String> res = new HashMap<String, String>();

+ 2 - 12
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -1,18 +1,8 @@
 package cn.com.ctop.common.module.utils;
 
 
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.ss.usermodel.VerticalAlignment;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFFont;
-import org.apache.poi.xssf.usermodel.XSSFRichTextString;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.*;
 
 import java.math.BigDecimal;
 import java.util.List;

+ 17 - 11
module-common/src/main/java/cn/com/ctop/common/module/utils/FindsDepartsChildrenUtil.java

@@ -9,19 +9,19 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * <P>
+ * <p>
  * 对应部门的表,处理并查找树级数据
- * <P>
+ * <p>
  *
  * @Author: Steve
  * @Date: 2019-01-22
  */
 public class FindsDepartsChildrenUtil {
 
-	//部门树信息-树结构
-	//private static List<SysDepartTreeModel> sysDepartTreeList = new ArrayList<SysDepartTreeModel>();
+    //部门树信息-树结构
+    //private static List<SysDepartTreeModel> sysDepartTreeList = new ArrayList<SysDepartTreeModel>();
 
-	//部门树id-树结构
+    //部门树id-树结构
     //private static List<DepartIdModel> idList = new ArrayList<>();
 
 
@@ -32,7 +32,7 @@ public class FindsDepartsChildrenUtil {
     public static List<SysDepartTreeModel> wrapTreeDataToTreeList(List<SysDepart> recordList) {
         // 在该方法每请求一次,都要对全局list集合进行一次清理
         //idList.clear();
-    	List<DepartIdModel> idList = new ArrayList<DepartIdModel>();
+        List<DepartIdModel> idList = new ArrayList<DepartIdModel>();
         List<SysDepartTreeModel> records = new ArrayList<>();
         for (int i = 0; i < recordList.size(); i++) {
             SysDepart depart = recordList.get(i);
@@ -45,6 +45,7 @@ public class FindsDepartsChildrenUtil {
 
     /**
      * 获取 DepartIdModel
+     *
      * @param recordList
      * @return
      */
@@ -55,6 +56,11 @@ public class FindsDepartsChildrenUtil {
         List<SysDepartTreeModel> records = new ArrayList<>();
         for (int i = 0; i < recordList.size(); i++) {
             SysDepart depart = recordList.get(i);
+            if (!Check.isNull(depart.getLeaderName())) {
+                depart.setTitle(depart.getDepartName().concat("(").concat(depart.getLeaderName()).concat(")"));
+            } else {
+                depart.setTitle(depart.getDepartName());
+            }
             records.add(new SysDepartTreeModel(depart));
         }
         findChildren(records, idList);
@@ -77,7 +83,7 @@ public class FindsDepartsChildrenUtil {
                 departIdList.add(departIdModel);
             }
         }
-        getGrandChildren(treeList,recordList,departIdList);
+        getGrandChildren(treeList, recordList, departIdList);
 
         //idList = departIdList;
         return treeList;
@@ -85,16 +91,16 @@ public class FindsDepartsChildrenUtil {
 
     /**
      * queryTreeList的子方法====3====
-     *该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合
+     * 该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合
      */
-    private static void getGrandChildren(List<SysDepartTreeModel> treeList,List<SysDepartTreeModel> recordList,List<DepartIdModel> idList) {
+    private static void getGrandChildren(List<SysDepartTreeModel> treeList, List<SysDepartTreeModel> recordList, List<DepartIdModel> idList) {
 
         for (int i = 0; i < treeList.size(); i++) {
             SysDepartTreeModel model = treeList.get(i);
             DepartIdModel idModel = idList.get(i);
             for (int i1 = 0; i1 < recordList.size(); i1++) {
                 SysDepartTreeModel m = recordList.get(i1);
-                if (m.getParentId()!=null && m.getParentId().equals(model.getId())) {
+                if (m.getParentId() != null && m.getParentId().equals(model.getId())) {
                     model.getChildren().add(m);
                     DepartIdModel dim = new DepartIdModel().convert(m);
                     idModel.getChildren().add(dim);
@@ -117,7 +123,7 @@ public class FindsDepartsChildrenUtil {
             if (model.getChildren().size() == 0) {
                 model.setChildren(null);
                 model.setIsLeaf(true);
-            }else{
+            } else {
                 setEmptyChildrenAsNull(model.getChildren());
                 model.setIsLeaf(false);
             }

+ 2 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAudienceReportJob.java

@@ -44,8 +44,8 @@ public class KuaishouDailyAudienceReportJob {
             XxlJobHelper.handleFail();
             return;
         }
-        //查询有效策略的账户ID
-        List<Long> accountIds = kuaishouStrategyService.queryActiveAccount();
+        //查询手淘有效账户数据
+        List<Long> accountIds = kuaishouStrategyService.queryShouTaoAccounts();
         if (Check.isNull(accountIds) || accountIds.size() == 0) {
             XxlJobHelper.log("定时获取人群分析报表数据异常:未获取到有效策略账户信息");
             XxlJobHelper.handleFail();

+ 1 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java

@@ -86,7 +86,7 @@ public class KuaishouVideoRelateCreativesJob {
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
-                if (count < 10) {
+                if (count < 20) {
                     photoIds.add(video.getPhotoId());
                     statdateMap.put(video.getPhotoId(), video.getStatDate());
                 } else {

+ 13 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java

@@ -24,7 +24,13 @@ 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.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.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;
@@ -76,7 +82,13 @@ public class KuaishouBatchCampaignPreviewController {
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                      HttpServletRequest req) {
         Result<IPage<KuaishouBatchCampaignPreview>> result = new Result<>();
+        String statDate = kuaishouBatchCampaignPreview.getStatDate();
+        kuaishouBatchCampaignPreview.setStatDate(null);
         QueryWrapper<KuaishouBatchCampaignPreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCampaignPreview, req.getParameterMap());
+        if (!Check.isNull(statDate)) {
+            queryWrapper.like("create_time", statDate);
+        }
+        queryWrapper.orderByDesc("create_time");
         Page<KuaishouBatchCampaignPreview> page = new Page<KuaishouBatchCampaignPreview>(pageNo, pageSize);
         IPage<KuaishouBatchCampaignPreview> pageList = kuaishouBatchCampaignPreviewService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.QueryGenerator;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCreativePreviewService;
@@ -66,7 +67,13 @@ public class KuaishouBatchCreativePreviewController {
                                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                      HttpServletRequest req) {
         Result<IPage<KuaishouBatchCreativePreview>> result = new Result<>();
+        String statDate = kuaishouBatchCreativePreview.getStatDate();
+        kuaishouBatchCreativePreview.setStatDate(null);
         QueryWrapper<KuaishouBatchCreativePreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCreativePreview, req.getParameterMap());
+        if (!Check.isNull(statDate)) {
+            queryWrapper.like("create_time", statDate);
+        }
+        queryWrapper.orderByDesc("create_time");
         Page<KuaishouBatchCreativePreview> page = new Page<KuaishouBatchCreativePreview>(pageNo, pageSize);
         IPage<KuaishouBatchCreativePreview> pageList = kuaishouBatchCreativePreviewService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -71,7 +71,13 @@ public class KuaishouBatchGroupPreviewController {
                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                   HttpServletRequest req) {
         Result<IPage<KuaishouBatchGroupPreview>> result = new Result<>();
+        String statDate = kuaishouBatchGroupPreview.getStatDate();
+        kuaishouBatchGroupPreview.setStatDate(null);
         QueryWrapper<KuaishouBatchGroupPreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchGroupPreview, req.getParameterMap());
+        if (!Check.isNull(statDate)) {
+            queryWrapper.like("create_time", statDate);
+        }
+        queryWrapper.orderByDesc("create_time");
         Page<KuaishouBatchGroupPreview> page = new Page<KuaishouBatchGroupPreview>(pageNo, pageSize);
         IPage<KuaishouBatchGroupPreview> pageList = kuaishouBatchGroupPreviewService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -115,6 +115,9 @@ public class KuaishouBatchCampaignPreview {
     private Long campaignId;
 
     @TableField(exist = false)
+    private String statDate;
+
+    @TableField(exist = false)
     private List<KuaishouBatchGroupPreview> kuaishouBatchGroupPreviews;
 
 }

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCreativePreview.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -197,5 +198,6 @@ public class KuaishouBatchCreativePreview {
      * 创建成功后的创意ID
      */
     private Long creativeId;
-
+    @TableField(exist = false)
+    private String statDate;
 }

+ 8 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java

@@ -259,4 +259,12 @@ public class KuaishouBatchGroupPreview {
     @TableField(exist = false)
     private Long siteId;
 
+    @TableField(exist = false)
+    private String statDate;
+
+    @TableField(exist = false)
+    private Integer bidMax;
+
+    @TableField(exist = false)
+    private Integer bidMin;
 }

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

@@ -18,4 +18,6 @@ public interface KuaishouStrategyMapper extends BaseMapper<KuaishouStrategy> {
     List<JSONObject> queryPlanIdsByStrategyId(Long id);
 
     List<Long> queryActiveAccount();
+
+    List<Long> queryShouTaoAccounts();
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouStrategyMapper.xml

@@ -16,4 +16,11 @@
         WHERE timer_task_status = 1
         GROUP BY account_id
     </select>
+
+    <select id="queryShouTaoAccounts" resultType="java.lang.Long">
+        select t1.account_id from ctop_ai_kuaishou_advertiser_strategy t1
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        where t2.project_id = 458
+        AND t1.status = 1
+    </select>
 </mapper>

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

@@ -46,4 +46,6 @@ public interface IKuaishouStrategyService extends IService<KuaishouStrategy> {
      * @author ZHAOXA
      */
     List<Long> queryActiveAccount();
+
+    List<Long> queryShouTaoAccounts();
 }

+ 21 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -208,7 +208,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         campaignPreview.setCampaignId(campaignId);
         campaignPreview.setCampaignType(kuaiShouCampaign.getCampaignType());
         campaignPreview.setPutStatus(kuaiShouCampaign.getPutStatus());
-        if (!Check.isNull(kuaiShouCampaign.getDayBudget())&&kuaiShouCampaign.getDayBudget() != 0) {
+        if (!Check.isNull(kuaiShouCampaign.getDayBudget()) && kuaiShouCampaign.getDayBudget() != 0) {
             campaignPreview.setDayBudget(kuaiShouCampaign.getDayBudget());
         }
         campaignPreview.setDayBudgetSchedule(kuaiShouCampaign.getDayBudgetSchedule());
@@ -345,6 +345,14 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     groupPreview.setTemplateId(targetIds.getLong(i));
                     groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(i), groupPreview.getSceneId(), appId, groupPreview.getUnitType()) + j);
                     groupPreview.setUrl(url);
+                    if (!Check.isNull(groupPreview.getBidMax()) && !Check.isNull(groupPreview.getBidMin())) {
+                        int bid = getRandom(groupPreview.getBidMax(), groupPreview.getBidMin());
+                        if (Check.isNull(groupPreview.getBid())) {
+                            groupPreview.setCpaBid(bid);
+                        } else {
+                            groupPreview.setBid(bid);
+                        }
+                    }
                     groupPreviewMapper.insert(groupPreview);
                     JSONObject material = materialList.getJSONObject(j);
                     JSONArray photoArr = material.getJSONArray("photoArr");
@@ -435,6 +443,14 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     groupPreview.setTemplateId(targetIds.getLong(j));
                     groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(j), groupPreview.getSceneId(), appId, groupPreview.getUnitType()) + j);
                     groupPreview.setUrl(url);
+                    if (!Check.isNull(groupPreview.getBidMax()) && !Check.isNull(groupPreview.getBidMin())) {
+                        int bid = getRandom(groupPreview.getBidMax(), groupPreview.getBidMin());
+                        if (Check.isNull(groupPreview.getBid())) {
+                            groupPreview.setCpaBid(bid);
+                        } else {
+                            groupPreview.setBid(bid);
+                        }
+                    }
                     groupPreviewMapper.insert(groupPreview);
                     for (int k = 0; k < photoArr.size(); k++) {
                         creativePreview.setId(null);
@@ -516,7 +532,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         campaignPreview.setCampaignName(campaignJson.getString("campaignName"));
         campaignPreview.setCampaignNameFormat(campaignJson.getString("campaignName"));
         campaignPreview.setCampaignType(campaignJson.getInteger("campaignType"));
-        if (!Check.isNull(campaignJson.getLong("dayBudget"))&&campaignJson.getLong("dayBudget") != 0) {
+        if (!Check.isNull(campaignJson.getLong("dayBudget")) && campaignJson.getLong("dayBudget") != 0) {
             campaignPreview.setDayBudget(campaignJson.getLong("dayBudget"));
         }
         campaignPreview.setDayBudgetSchedule(campaignJson.getString("dayBudgetSchedule"));
@@ -542,6 +558,8 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         groupPreview.setUnitNameFormat(groupJson.getString("unitName"));
         groupPreview.setPutStatus(Check.isNull(campaignJson.getInteger("unitStatus")) || campaignJson.getInteger("unitStatus") == 2 ? 2 : null);
         groupPreview.setBidType(groupJson.getInteger("bidType"));
+        groupPreview.setBidMax(groupJson.getInteger("bidMax"));
+        groupPreview.setBidMin(groupJson.getInteger("bidMin"));
         int bid = -1;
         if (!Check.isNull(groupJson.getInteger("bidMin")) && !Check.isNull(groupJson.getInteger("bidMax"))) {
             bid = getRandom(groupJson.getInteger("bidMax"), groupJson.getInteger("bidMin"));
@@ -562,7 +580,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         groupPreview.setOcpxActionType(groupJson.getInteger("ocpxActionType"));
         groupPreview.setDeepConversionType(groupJson.getInteger("deepConversionType"));
         groupPreview.setDeepConversionBid(groupJson.getInteger("deepConversionBid"));
-        if (!Check.isNull(groupJson.getInteger("dayBudget"))&&groupJson.getInteger("dayBudget") != 0) {
+        if (!Check.isNull(groupJson.getInteger("dayBudget")) && groupJson.getInteger("dayBudget") != 0) {
             groupPreview.setDayBudget(groupJson.getInteger("dayBudget"));
         }
         groupPreview.setSpeed(groupJson.getInteger("speed"));

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouStrategyServiceImpl.java

@@ -152,6 +152,11 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
         return kuaishouStrategyMapper.queryActiveAccount();
     }
 
+    @Override
+    public List<Long> queryShouTaoAccounts() {
+        return kuaishouStrategyMapper.queryShouTaoAccounts();
+    }
+
     public JSONArray createGroupLevelStrategy(CtopOauthToken oauthToken, JSONObject data) {
         JSONArray resultArr = new JSONArray();
         JSONArray groupInfo = data.getJSONArray("groupInfo");

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
+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.service.IKsVideoReportService;
@@ -22,7 +23,9 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by JQ.bi on 2020.09.27
@@ -35,38 +38,86 @@ public class KsVideoReportCtrl {
     @Autowired
     IKsVideoReportService ksVideoReportService;
 
+
+    @PostMapping("/getDesignList")
+    public Result<List<JSONObject>> getDesignList() {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> designList = ksVideoReportService.getDesignList();
+            result.setSuccess(true);
+            result.setResult(designList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
     @PostMapping("/list")
     public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
-
         Result<PageInfo<JSONObject>> result = new Result<>();
-        if (requestBody.isEmpty()) {
-            log.error("request body is empty");
-            result.setSuccess(false);
-        } else {
-            JSONArray accountIds = requestBody.getJSONArray("accountIds");
-            String startDate = requestBody.getString("startDate");
-            String endDate = requestBody.getString("endDate");
-            String clip = requestBody.getString("clip");
-            String shot = requestBody.getString("shot");
-            String plan = requestBody.getString("plan");
-            String target = requestBody.getString("target");
-            String order = requestBody.getString("order");
+        try {
+            if (Check.isNull(requestBody)) {
+                new Exception("入参不能为空");
+            }
             int pageSize = requestBody.getInteger("pageSize");
+            if (Check.isNull(pageSize)) {
+                throw new Exception("请输入查询每页条数");
+            }
             int pageNo = requestBody.getInteger("pageNo");
-
-            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
-
-            try {
-                if(accountIds.isEmpty()){
-                    accountIds=null;
-                }
-                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot,plan,pageSize, pageNo);
-                result.setResult(listData);
-                result.setSuccess(true);
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                result.setSuccess(false);
+            if (Check.isNull(pageNo)) {
+                throw new Exception("请输入查询页数");
+            }
+            String startDate = requestBody.getString("startDate");
+            if (Check.isNull(startDate)) {
+                throw new Exception("请输入查询开始时间");
+            }
+            String endDate = requestBody.getString("endDate");
+            if (Check.isNull(endDate)) {
+                throw new Exception("请输入查询结束时间");
             }
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+            //   System.err.println(filedAll);
+            if (Check.isNull(filedAll)) {
+                throw new Exception("初始化查询 字段返回为空");
+            }
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("filed", filedAll);
+            requestMap.put("startDate", startDate);
+            requestMap.put("endDate", endDate);
+            if (!Check.isNull(requestBody.getJSONArray("accountIds"))) {
+                requestMap.put("accountIds", requestBody.getJSONArray("accountIds"));
+            }
+            if (!Check.isNull(requestBody.getString("clipId"))) {
+                requestMap.put("clipId", requestBody.getString("clipId"));
+            }
+            if (!Check.isNull(requestBody.getString("shotId"))) {
+                requestMap.put("shotId", requestBody.getString("shotId"));
+            }
+            if (!Check.isNull(requestBody.getString("planId"))) {
+                requestMap.put("planId", requestBody.getString("planId"));
+            }
+            if (!Check.isNull(requestBody.getString("leaderId"))) {
+                requestMap.put("leaderId", requestBody.getString("leaderId"));
+            }
+            if (!Check.isNull(requestBody.getString("target"))) {
+                requestMap.put("target", requestBody.getString("target"));
+            }
+            if (!Check.isNull(requestBody.getString("order"))) {
+                requestMap.put("order", requestBody.getString("order"));
+            }
+            PageInfo<JSONObject> listData = ksVideoReportService.getKuaiShouVideoPageReportByMap(requestMap, pageSize, pageNo);
+            if (Check.isNull(listData)) {
+                throw new Exception("暂无素材相关信息,请检查账户");
+            }
+            result.setSuccess(true);
+            result.setResult(listData);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+            result.setMessage(e.toString());
         }
         return result;
     }
@@ -90,7 +141,7 @@ public class KsVideoReportCtrl {
                 if (accountIds.isEmpty()) {
                     accountIds = null;
                 }
-                List<JSONObject> listData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filedAll,signature);
+                List<JSONObject> listData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filedAll, signature);
                 result.setResult(listData);
                 result.setSuccess(true);
             } catch (Exception e) {
@@ -106,8 +157,8 @@ public class KsVideoReportCtrl {
                                HttpServletRequest request,
                                HttpServletResponse response) {
         //加一个参数区分是table页,还是详情页。
-        String exportType= requestBody.getString("exportType");
-        if(exportType.isEmpty()){
+        String exportType = requestBody.getString("exportType");
+        if (exportType.isEmpty()) {
             return;
         }
         JSONArray columns = requestBody.getJSONArray("columns");
@@ -118,20 +169,20 @@ public class KsVideoReportCtrl {
         String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs, columns);
         List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
         //此处增加两个元素是为了保证数据顺序
-        if("exportDetail".equals(exportType)){
-            titles.add(0,"客户");
-            titles.add(1,"项目名称");
-            titles.add(2,"时间");
-            titles.add(3,"消耗");
+        if ("exportDetail".equals(exportType)) {
+            titles.add(0, "客户");
+            titles.add(1, "项目名称");
+            titles.add(2, "时间");
+            titles.add(3, "消耗");
             columns.add(0, "advertiserName");
             columns.add(1, "projectName");
             columns.add(2, "statDate");
-        }else{
-            titles.add(0,"唯一标识");
-            titles.add(1,"视频");
-            titles.add(2,"视频名称");
-            titles.add(3,"项目名称");
-            titles.add(4,"上传时间");
+        } else {
+            titles.add(0, "唯一标识");
+            titles.add(1, "视频");
+            titles.add(2, "视频名称");
+            titles.add(3, "项目名称");
+            titles.add(4, "上传时间");
             titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
             columns.add(0, "signature");
             columns.add(1, "url");
@@ -152,13 +203,13 @@ public class KsVideoReportCtrl {
         String plan = requestBody.getString("plan");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
-        List<JSONObject> excelData=null;
-        if("exportTable".equals(exportType)){
-            excelData = ksVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order,clip,shot,plan);
-        }else if("exportDetail".equals(exportType)){
-            excelData = ksVideoReportService.getVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+        List<JSONObject> excelData = null;
+        if ("exportTable".equals(exportType)) {
+            excelData = ksVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
+        } else if ("exportDetail".equals(exportType)) {
+            excelData = ksVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filed, signature);
         }
-        if (null!=excelData&&excelData.isEmpty()) {
+        if (null != excelData && excelData.isEmpty()) {
             return;
         }
         List<List<Object>> excelList = new ArrayList<>();
@@ -183,4 +234,134 @@ public class KsVideoReportCtrl {
             log.error(e.getMessage());
         }
     }
+
+
+    @PostMapping("/excelV2")
+    public void excelV2(@RequestBody JSONObject requestBody,
+                        HttpServletRequest request,
+                        HttpServletResponse response) {
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        try {
+
+
+            if (Check.isNull(requestBody)) {
+                throw new Exception("入参不能为空");
+            }
+            JSONArray columns = requestBody.getJSONArray("columns");
+            if (Check.isNull(columns)) {
+                throw new Exception("请传入表头");
+            }
+
+            String startDate = requestBody.getString("startDate");
+            if (Check.isNull(startDate)) {
+                throw new Exception("请输入查询开始时间");
+            }
+            String endDate = requestBody.getString("endDate");
+            if (Check.isNull(endDate)) {
+                throw new Exception("请输入查询结束时间");
+            }
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+            //   System.err.println(filedAll);
+            if (Check.isNull(filedAll)) {
+                throw new Exception("初始化查询 字段返回为空");
+            }
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("filed", filedAll);
+            requestMap.put("startDate", startDate);
+            requestMap.put("endDate", endDate);
+            if (!Check.isNull(requestBody.getJSONArray("accountIds"))) {
+                requestMap.put("accountIds", requestBody.getJSONArray("accountIds"));
+            }
+            if (!Check.isNull(requestBody.getString("clipId"))) {
+                requestMap.put("clipId", requestBody.getString("clipId"));
+            }
+            if (!Check.isNull(requestBody.getString("shotId"))) {
+                requestMap.put("shotId", requestBody.getString("shotId"));
+            }
+            if (!Check.isNull(requestBody.getString("planId"))) {
+                requestMap.put("planId", requestBody.getString("planId"));
+            }
+            if (!Check.isNull(requestBody.getString("leaderId"))) {
+                requestMap.put("leaderId", requestBody.getString("leaderId"));
+            }
+            if (!Check.isNull(requestBody.getString("target"))) {
+                requestMap.put("target", requestBody.getString("target"));
+            }
+            if (!Check.isNull(requestBody.getString("order"))) {
+                requestMap.put("order", requestBody.getString("order"));
+            }
+
+            JSONArray columns2 = new JSONArray();
+            columns2.add(0, "materialName");
+            columns2.add(1, "signature");
+            columns2.add(2, "projectName");
+            columns2.add(3, "channel");
+            columns2.add(4, "designLeader");
+            columns2.add(5, "clip");
+            columns2.add(6, "plan");
+            columns2.add(7, "shot");
+            columns2.add(8, "createTime");
+            for (int i = 0; i < columns.size(); i++) {
+                columns2.add(columns2.size(), columns.getString(i));
+            }
+            columns2.add(columns2.size(), "url");
+            List<String> titles = getfileIds(AccountReportConstants.kuaishouVideoReportDict, columns2);
+            List<JSONObject> listData = ksVideoReportService.getKuaiShouVideoReportByMap(requestMap);
+            if (Check.isNull(listData)) {
+                throw new Exception("暂无素材相关信息,请检查账户");
+            }
+            List<List<Object>> excelList = new ArrayList<>();
+            for (int i = 0; i < listData.size(); i++) {
+                List<Object> temp = new ArrayList<>();
+                JSONObject jsonObject = listData.get(i);
+                for (int j = 0; j < columns2.size(); j++) {
+                    String key = columns2.getString(j);
+                    String value = jsonObject.getString(key);
+                    temp.add(value);
+                }
+                excelList.add(temp);
+            }
+
+            try {
+                String[] strings = titles.toArray(new String[]{});
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                eeu.exportExcel(workbook, 0, "快手素材报表", strings, excelList);
+                HttpUtils.setResponseHeader(response, "快手素材.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            } catch (IOException e) {
+                log.error(e.getMessage());
+            }
+
+
+            result.setSuccess(true);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+
+    }
+
+    private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
+        List<String> titles = new ArrayList<>();
+        for (int i = 0; i < columns.size(); i++) {
+            String string = columns.getString(i);
+            Map<String, Object> stringObjectMap = kuaishouVideoReportMap.get(string);
+            if (Check.isNull(stringObjectMap)) {
+                titles.add("-");
+                continue;
+            }
+            Object comment = stringObjectMap.get("comment");
+            titles.add(String.valueOf(comment));
+
+        }
+        return titles;
+    }
 }

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

@@ -5,11 +5,15 @@ import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface KsVideoReportMapper {
 
-    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("target") String target,@Param("order") String order,@Param("clip") String clip,@Param("shot") String shot,@Param("plan") String plan);
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("target") String target, @Param("order") String order, @Param("clip") String clip, @Param("shot") String shot, @Param("plan") String plan);
 
-    List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("signature") String signature);
+    List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("signature") String signature);
 
+    List<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getDesignList();
 }

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

@@ -2,13 +2,67 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper">
 
+    <select id="getKuaiShouVideoReportByMap" resultType="com.alibaba.fastjson.JSONObject" parameterType="map">
+        SELECT
+        t1.*,
+        t2.clip_name as clip,
+        t2.plan_name as plan,
+        t2.shot_name as shot,
+        t2.design_team_leader_name as designLeader,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        t2.channel_name AS channel,
+        t2.state_date as createTime
+        FROM
+        (select ${filed}
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where 1 = 1
+        <if test="accountIds !=null and accountIds != ''">
+            and t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate !=null and startDate != ''">
+            AND t1.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate !=null and endDate != ''">
+            AND t1.stat_date &lt;= #{endDate}
+        </if>
+        GROUP BY t1.signature
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        WHERE
+        1 = 1
+        <if test="leaderId !=null and leaderId != ''">
+            AND t2.design_team_leader_id = #{leaderId}
+        </if>
+        <if test="clipId !=null and clipId != ''">
+            AND t2.clip_id = #{clipId}
+        </if>
+        <if test="planId !=null and planId != ''">
+            AND t2.plan_id = #{planId}
+        </if>
+        <if test="shotId !=null and shotId != ''">
+            AND t2.shot_id = #{shotId}
+        </if>
+        ORDER BY ${target} ${order}
+    </select>
+
+
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT * from (SELECT
         t1.signature,
         t1.photo_url as url,
-        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.clip_id=u.id where t3.material_id=t1.signature limit 1),'') AS clip,
-        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where t3.material_id=t1.signature limit 1),'') AS shot,
-        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where t3.material_id=t1.signature limit 1),'') AS plan,
+        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.clip_id=u.id where
+        t3.material_id=t1.signature limit 1),'') AS clip,
+        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where
+        t3.material_id=t1.signature limit 1),'') AS shot,
+        IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where
+        t3.material_id=t1.signature limit 1),'') AS plan,
         t1.cover_url as converUrl,
         (select t2.material_name from ctop_material_info t2 where t2.code=t1.signature limit 1) AS materialName,
         (SELECT project_name FROM ctop_project t4 WHERE t4.id = t3.project_id) AS projectName,
@@ -76,4 +130,24 @@
         GROUP BY t1.signature,t1.stat_date
         order by t1.stat_date desc
     </select>
+
+    <select id="getDesignList" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	t1.user_id AS 'userId',
+	LEFT (t1.company_name, 2) AS 'companyName',
+	t3.role_name AS 'ruleName',
+	t1.user_name AS 'userName'
+    FROM
+	user_company t1
+    LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
+    LEFT JOIN sys_role t3 ON t2.role_id = t3.id
+    WHERE
+	t3.role_code IN (
+		'plan',
+		'shot',
+		'clip',
+		'designTeamLeader'
+	)
+    </select>
+
 </mapper>

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 
 import java.util.List;
+import java.util.Map;
 
 public interface IKsVideoReportService {
 
@@ -13,4 +14,10 @@ public interface IKsVideoReportService {
     List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature);
 
     List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
+
+    PageInfo<JSONObject> getKuaiShouVideoPageReportByMap(Map<String, Object> requestMap, int pageSize, int pageNo);
+
+    List<JSONObject> getDesignList();
+
+    List<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap);
 }

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

@@ -1,7 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
-import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
 import cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class KsVideoReportServiceImpl implements IKsVideoReportService {
@@ -19,19 +20,38 @@ public class KsVideoReportServiceImpl implements IKsVideoReportService {
 
     @Override
     public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo) {
-        PageHelper.startPage(pageNo,pageSize);
-        List<JSONObject> jsonObjectList=ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
+        PageHelper.startPage(pageNo, pageSize);
+        List<JSONObject> jsonObjectList = ksVideoReportMapper.queryVideoReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
         return new PageInfo<>(jsonObjectList);
     }
 
     @Override
     public List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature) {
-        return ksVideoReportMapper.queryVideoDetailBy(accountIds,startDate,endDate,filed,signature);
+        return ksVideoReportMapper.queryVideoDetailBy(accountIds, startDate, endDate, filed, signature);
     }
 
     @Override
     public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan) {
-        return ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
+        return ksVideoReportMapper.queryVideoReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
+    }
+
+    @Override
+    public PageInfo<JSONObject> getKuaiShouVideoPageReportByMap(Map<String, Object> requestMap, int pageSize, int pageNo) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<JSONObject> jsonObjectList = ksVideoReportMapper.getKuaiShouVideoReportByMap(requestMap);
+        return new PageInfo<>(jsonObjectList);
+
+    }
+
+    @Override
+    public List<JSONObject> getDesignList() {
+        return ksVideoReportMapper.getDesignList();
+    }
+
+    @Override
+    public List<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap) {
+        List<JSONObject> jsonObjectList = ksVideoReportMapper.getKuaiShouVideoReportByMap(requestMap);
+        return jsonObjectList;
     }
 
 }

+ 188 - 0
module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_dict.json

@@ -0,0 +1,188 @@
+{
+  "clip": {
+    "comment": "剪辑"
+  },
+  "channel": {
+    "comment": "来源"
+  },
+  "plan": {
+    "comment": "编导"
+  },
+  "shot": {
+    "comment": "拍摄"
+  },
+  "designLeader": {
+    "comment": "设计负责人"
+  },
+  "materialName": {
+    "comment": "素材名称"
+  },
+  "createTime": {
+    "comment": "上线时间"
+  },
+  "coverUrl": {
+    "comment": "封面链接"
+  },
+  "url": {
+    "comment": "素材链接"
+  },
+  "signature": {
+    "comment": "素材标识"
+  },
+  "projectName": {
+    "comment": "项目名称"
+  },
+  "cost": {
+    "comment": "消耗"
+  },
+  "photoShow": {
+    "comment": "封面曝光数"
+  },
+  "photoClick": {
+    "comment": "封面点击数"
+  },
+  "aClick": {
+    "comment": "素材曝光数"
+  },
+  "bClick": {
+    "comment": "行为数"
+  },
+  "clickRate": {
+    "comment": "封面点击率"
+  },
+  "bClickRate": {
+    "comment": "行为率"
+  },
+  "cpm": {
+    "comment": "平均千次封面曝光花费"
+  },
+  "cpc": {
+    "comment": "平均封面点击单价"
+  },
+  "cpb": {
+    "comment": "平均行为单价"
+  },
+  "downloadStart": {
+    "comment": "安卓开始下载数"
+  },
+  "downloadStartCost": {
+    "comment": "安卓开始下载单价"
+  },
+  "downloadStartRate": {
+    "comment": "安卓开始下载率"
+  },
+  "downloadFinish": {
+    "comment": "安卓下载完成数"
+  },
+  "downloadFinishCost": {
+    "comment": "安卓下载完成单价"
+  },
+  "downloadFinishRate": {
+    "comment": "安卓下载完成率"
+  },
+  "active": {
+    "comment": "激活数"
+  },
+  "activeCost": {
+    "comment": "激活单价"
+  },
+  "firstDayPay": {
+    "comment": "首日付费次数"
+  },
+  "firstDayPayAmount": {
+    "comment": "首日付费金额"
+  },
+  "firstDayPayCost": {
+    "comment": "首日付费成本"
+  },
+  "firstDayPayROI": {
+    "comment": "首日ROI"
+  },
+  "eventPay": {
+    "comment": "付费次数"
+  },
+  "eventPayPurchaseAmount": {
+    "comment": "付费金额"
+  },
+  "eventPayCost": {
+    "comment": "付费次数成本"
+  },
+  "ROI": {
+    "comment": "ROI"
+  },
+  "register": {
+    "comment": "注册数"
+  },
+  "activeRegisterCost": {
+    "comment": "注册成本"
+  },
+  "activeRegisterRate": {
+    "comment": "注册率"
+  },
+  "eventJinJianApp": {
+    "comment": "完件数"
+  },
+  "eventJinJianAppCost": {
+    "comment": "完件成本"
+  },
+  "eventCreditGrantApp": {
+    "comment": "授信数"
+  },
+  "eventCreditGrantAppCost": {
+    "comment": "授信成本"
+  },
+  "eventCreditGrantAppRate": {
+    "comment": "授信率"
+  },
+  "formCount": {
+    "comment": "表单提交数"
+  },
+  "formCountRate": {
+    "comment": "表单提交率"
+  },
+  "formCountCost": {
+    "comment": "表单提交成本"
+  },
+  "nextDayOpen": {
+    "comment": "次留数"
+  },
+  "nextDayOpenCost": {
+    "comment": "次留成本"
+  },
+  "nextDayOpenRate": {
+    "comment": "次留率"
+  },
+  "eventJinJianLandingPage": {
+    "comment": "落地页完件数"
+  },
+  "eventJinJianLandingPageCost": {
+    "comment": "落地页完件成本"
+  },
+  "eventCreditGrantLandingPage": {
+    "comment": "落地页授信数"
+  },
+  "eventCreditGrantLandingPageCost": {
+    "comment": "落地页授信成本"
+  },
+  "eventCreditGrantLandingPageRate": {
+    "comment": "落地页授信率"
+  },
+  "submit": {
+    "comment": "按钮点击数"
+  },
+  "submitCost": {
+    "comment": "按钮点击成本"
+  },
+  "submitRate": {
+    "comment": "按钮点击率"
+  },
+  "activeRate": {
+    "comment": "下载完成激活率"
+  },
+  "play3sCount": {
+    "comment": "3s播放数"
+  },
+  "play3sRate": {
+    "comment": "3s播放率"
+  }
+}

+ 214 - 0
module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json

@@ -0,0 +1,214 @@
+{
+  "signature": {
+    "filed": "t1.signature as signature ",
+    "comment": "素材标识"
+  },
+  "projectName": {
+    "filed": "t1.project_name as projectName ",
+    "comment": "项目名称"
+  },
+  "cost": {
+    "filed": "IFNULL(sum(t1.charge),0) as cost ",
+    "comment": "消耗"
+  },
+  "photoShow": {
+    "filed": "IFNULL(sum(t1.photo_show),0) as photoShow ",
+    "comment": "封面曝光数"
+  },
+  "photoClick": {
+    "filed": "IFNULL(sum(t1.photo_click),0) as photoClick ",
+    "comment": "封面点击数"
+  },
+  "aClick": {
+    "filed": "IFNULL(sum(t1.aclick),0) as aClick ",
+    "comment": "素材曝光数"
+  },
+  "bClick": {
+    "filed": "IFNULL(sum(t1.bclick),0) as bClick ",
+    "comment": "行为数"
+  },
+  "clickRate": {
+    "filed": "CASE WHEN sum(t1.photo_show) != 0    THEN CONCAT( CAST(ROUND((sum(t1.photo_click) / sum(t1.photo_show)) * 100,2) AS CHAR) ,'%') else '0%' END AS clickRate ",
+    "comment": "封面点击率"
+  },
+  "bClickRate": {
+    "filed": "CASE WHEN  sum(t1.aclick) != 0 THEN CONCAT( CAST(ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2) AS CHAR) ,'%') ELSE '0%' END AS bClickRate ",
+    "comment": "行为率"
+  },
+  "cpm": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.photo_show) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.photo_show)) * 1000, 2 ) END AS cpm ",
+    "comment": "平均千次封面曝光花费"
+  },
+  "cpc": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.photo_click) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.photo_click)), 2) END AS cpc ",
+    "comment": "平均封面点击单价"
+  },
+  "cpb": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.bclick) IS NULL THEN 0 ELSE ROUND((sum(t1.charge) / sum(t1.bclick)), 2) END AS cpb ",
+    "comment": "平均行为单价"
+  },
+  "downloadStart": {
+    "filed": "IFNULL(sum(download_started),0) as downloadStart ",
+    "comment": "安卓开始下载数"
+  },
+  "downloadStartCost": {
+    "filed": "CASE WHEN sum(t1.charge) / (t1.download_started) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.download_started) end AS downloadStartCost ",
+    "comment": "安卓开始下载单价"
+  },
+  "downloadStartRate": {
+    "filed": "CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.download_started) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0%' end AS downloadStartRate",
+    "comment": "安卓开始下载率"
+  },
+  "downloadFinish": {
+    "filed": "IFNULL(sum(download_completed),0) as downloadFinish ",
+    "comment": "安卓下载完成数"
+  },
+  "downloadFinishCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.download_completed) IS NULL THEN 0 ELSE  sum(t1.charge) / sum(t1.download_completed) end AS downloadFinishCost ",
+    "comment": "安卓下载完成单价"
+  },
+  "downloadFinishRate": {
+    "filed": "CASE WHEN  sum(t1.download_started) != 0 then  concat(CAST(round(sum(t1.download_completed) / sum(t1.download_started)*100,2) AS CHAR) ,'%') else '0%' end AS downloadFinishRate  ",
+    "comment": "安卓下载完成率"
+  },
+  "active": {
+    "filed": "IFNULL(sum(activation),0) as active ",
+    "comment": "激活数"
+  },
+  "activeCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.activation) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.activation) end AS activeCost ",
+    "comment": "激活单价"
+  },
+  "firstDayPay": {
+    "filed": "CASE WHEN sum(t1.event_pay_first_day) != 0 THEN sum(t1.event_pay_first_day) ELSE 0  end as firstDayPay ",
+    "comment": "首日付费次数"
+  },
+  "firstDayPayAmount": {
+    "filed": "IFNULL(sum(t1.event_pay_purchase_amount_first_day),0) as firstDayPayAmount  ",
+    "comment": "首日付费金额"
+  },
+  "firstDayPayCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_pay_first_day) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.event_pay_first_day) end AS firstDayPayCost ",
+    "comment": "首日付费成本"
+  },
+  "firstDayPayROI": {
+    "filed": "CASE WHEN sum(t1.event_pay_purchase_amount_first_day) / sum(t1.charge) IS NULL THEN 0 ELSE sum(t1.event_pay_purchase_amount_first_day) / sum(t1.charge) end AS firstDayPayROI ",
+    "comment": "首日ROI"
+  },
+  "eventPay": {
+    "filed": "IFNULL(sum(t1.event_pay),0) as eventPay  ",
+    "comment": "付费次数"
+  },
+  "eventPayPurchaseAmount": {
+    "filed": "IFNULL(sum(t1.event_pay_purchase_amount),0) as eventPayPurchaseAmount  ",
+    "comment": "付费金额"
+  },
+  "eventPayCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_pay) IS NULL THEN 0 ELSE sum(t1.charge) / sum(t1.event_pay) end AS eventPayCost ",
+    "comment": "付费次数成本"
+  },
+  "ROI": {
+    "filed": "CASE WHEN sum(t1.event_pay_purchase_amount) / sum(t1.charge) IS NULL THEN 0 ELSE sum(t1.event_pay_purchase_amount) / sum(t1.charge) end AS ROI ",
+    "comment": "ROI"
+  },
+  "register": {
+    "filed": "IFNULL(sum(t1.event_register),0) as register ",
+    "comment": "注册数"
+  },
+  "activeRegisterCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_register) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_register),3) end as activeRegisterCost ",
+    "comment": "注册成本"
+  },
+  "activeRegisterRate": {
+    "filed": "CASE WHEN  sum(t1.activation) !=0  THEN concat(CAST(round(sum(t1.event_register) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0%' end as activeRegisterRate ",
+    "comment": "注册率"
+  },
+  "eventJinJianApp": {
+    "filed": "IFNULL(sum(event_jin_jian_app),0) as eventJinJianApp ",
+    "comment": "完件数"
+  },
+  "eventJinJianAppCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_jin_jian_app) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_jin_jian_app),3) end as eventJinJianAppCost ",
+    "comment": "完件成本"
+  },
+  "eventCreditGrantApp": {
+    "filed": "IFNULL(sum(event_credit_grant_app),0) as eventCreditGrantApp ",
+    "comment": "授信数"
+  },
+  "eventCreditGrantAppCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_credit_grant_app) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_credit_grant_app),3) end as eventCreditGrantAppCost ",
+    "comment": "授信成本"
+  },
+  "eventCreditGrantAppRate": {
+    "filed": "CASE WHEN  sum(t1.event_jin_jian_app) !=0 THEN concat(CAST(round(sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app)*100,2) AS CHAR) ,'%') ELSE '0' end as eventCreditGrantAppRate",
+    "comment": "授信率"
+  },
+  "formCount": {
+    "filed": "IFNULL(sum(t1.form_count),0) as formCount ",
+    "comment": "表单提交数"
+  },
+  "formCountRate": {
+    "filed": "CASE WHEN sum(t1.activation) != 0  THEN  concat(CAST(round(sum(t1.form_count) / sum(t1.activation)*100,2) AS CHAR) ,'%') else '0%' end as formCountRate ",
+    "comment": "表单提交率"
+  },
+  "formCountCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as formCountCost ",
+    "comment": "表单提交成本"
+  },
+  "nextDayOpen": {
+    "filed": "IFNULL(sum(t1.event_next_day_stay),0) as nextDayOpen ",
+    "comment": "次留数"
+  },
+  "nextDayOpenCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_next_day_stay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_next_day_stay),3) end as nextDayOpenCost ",
+    "comment": "次留成本"
+  },
+  "nextDayOpenRate": {
+    "filed": "CASE WHEN  sum(t1.activation) != 0 THEN  concat(CAST(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2) AS CHAR) ,'%') ELSE '0%' end as nextDayOpenRate",
+    "comment": "次留率"
+  },
+  "eventJinJianLandingPage": {
+    "filed": "IFNULL(sum(t1.event_jin_jian_landing_page),0) as eventJinJianLandingPage ",
+    "comment": "落地页完件数"
+  },
+  "eventJinJianLandingPageCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_jin_jian_landing_page),3) end as eventJinJianLandingPageCost ",
+    "comment": "落地页完件成本"
+  },
+  "eventCreditGrantLandingPage": {
+    "filed": "IFNULL(sum(t1.event_credit_grant_landing_page),0) as eventCreditGrantLandingPage ",
+    "comment": "落地页授信数"
+  },
+  "eventCreditGrantLandingPageCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_credit_grant_landing_page) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_credit_grant_landing_page),3) end as eventCreditGrantLandingPageCost ",
+    "comment": "落地页授信成本"
+  },
+  "eventCreditGrantLandingPageRate": {
+    "filed": "CASE WHEN  sum(t1.event_jin_jian_landing_page)  != 0 THEN  concat( CAST(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2) AS CHAR),'%') ELSE '0%' end as eventCreditGrantLandingPageRate ",
+    "comment": "落地页授信率"
+  },
+  "submit": {
+    "filed": "IFNULL(sum(t1.submit),0) as submit ",
+    "comment": "按钮点击数"
+  },
+  "submitCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.submit) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.submit),3) end as submitCost ",
+    "comment": "按钮点击成本"
+  },
+  "submitRate": {
+    "filed": "CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.submit) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0%' end as submitRate ",
+    "comment": "按钮点击率"
+  },
+  "activeRate": {
+    "filed": "CASE WHEN  sum(t1.download_completed) != 0 THEN concat(CAST(round(sum(t1.activation) / sum(t1.download_completed)*100,2) AS CHAR) ,'%') else '0%' end as activeRate ",
+    "comment": "下载完成激活率"
+  },
+  "play3sCount": {
+    "filed": "sum(t1.play_3s_count) as play3sCount",
+    "comment": "3s播放数"
+  },
+  "play3sRate": {
+    "filed": "CASE WHEN sum(photo_show) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.photo_show),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate",
+    "comment": "3s播放率"
+  }
+}