Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

yumeng 4 rokov pred
rodič
commit
81bf36436d
75 zmenil súbory, kde vykonal 3356 pridanie a 80 odobranie
  1. 10 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  2. 1 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CacheConstant.java
  3. 9 13
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java
  4. 234 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActCustomFormController.java
  5. 234 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActFormDataController.java
  6. 234 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActFormFieldController.java
  7. 234 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActFormPorcessController.java
  8. 55 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTopCtrl.java
  9. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  10. 159 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java
  11. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileController.java
  12. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UReportFile.java
  13. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UReportFileBindUser.java
  14. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialTopMapper.java
  15. 30 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialTopMapper.xml
  16. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMaterialTopService.java
  17. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  18. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialTopServiceImpl.java
  19. 9 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  20. 2 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  21. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  22. 2 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  23. 2 0
      jeecg-boot-module-system/src/main/resources/application-test.yml
  24. 2 0
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  25. 23 11
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  26. 1 1
      module-check/src/main/java/cn/com/ctop/check/TestGroovy.groovy
  27. 1 1
      module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskExecuteLogController.java
  28. 1 1
      module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskListController.java
  29. 25 1
      module-check/src/main/java/cn/com/ctop/check/script/TestGroovyScript.java
  30. 21 1
      module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java
  31. 34 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/ActCustomForm.java
  32. 35 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormData.java
  33. 34 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormField.java
  34. 33 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormPorcess.java
  35. 40 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java
  36. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ActCustomFormMapper.java
  37. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormDataMapper.java
  38. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormFieldMapper.java
  39. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormPorcessMapper.java
  40. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CustomDataByAccountMapper.java
  41. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/TagInfoMapper.java
  42. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActCustomFormMapper.xml
  43. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormDataMapper.xml
  44. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormFieldMapper.xml
  45. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormPorcessMapper.xml
  46. 63 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CustomDataByAccountMapper.xml
  47. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/TagInfoMapper.xml
  48. 56 0
      module-common/src/main/java/cn/com/ctop/common/module/model/TagIdModel.java
  49. 192 0
      module-common/src/main/java/cn/com/ctop/common/module/model/TagInfoTreeModel.java
  50. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IActCustomFormService.java
  51. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IActFormDataService.java
  52. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IActFormFieldService.java
  53. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IActFormPorcessService.java
  54. 25 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICustomDataByAccountService.java
  55. 19 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java
  56. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActCustomFormServiceImpl.java
  57. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormDataServiceImpl.java
  58. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormFieldServiceImpl.java
  59. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormPorcessServiceImpl.java
  60. 44 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CustomDataByAccountImpl.java
  61. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  62. 40 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java
  63. 118 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/FindstagInfosChildrenUtil.java
  64. 68 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  65. 150 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java
  66. 47 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouAccountReportMapper.java
  67. 216 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouAccountReportMapper.xml
  68. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouAccountReportService.java
  69. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentService.java
  70. 206 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java
  71. 100 30
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java
  72. 49 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/utils/LinkUtils.java
  73. 186 0
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  74. 3 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java
  75. 3 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

+ 10 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -31,17 +31,24 @@ public class AccountReportConstants {
         return instance;
     }
 
-    /** 字典数据 */
+    /**
+     * 字典数据
+     */
+    //头条字段映射
     public static Map<String, Map<String,Object>> dicMap = new HashMap<>();
+    //快手字段映射
+    public static Map<String, Map<String,Object>> dicMapKs = new HashMap<>();
 
     /**
      * 初始化字典
      */
     public void init(){
         //加载json文件
-        Object json=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        Object jsonBy=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
+        Object jsonKs=JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
         //json 转为map存为静态常量
-        dicMap=JsonResourceUtil.jsonToMap(json);
+        dicMap=JsonResourceUtil.jsonToMap(jsonBy);
+        dicMapKs=JsonResourceUtil.jsonToMap(jsonKs);
     }
 
 }

+ 1 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/CacheConstant.java

@@ -31,6 +31,7 @@ public interface CacheConstant {
 	 */
 	public static final String SYS_DEPARTS_CACHE = "sys:cache:depart:alldata";
 
+	public static final String SYS_TAGINFOS_CACHE = "sys:cache:taginfo:alldata";
 
 	/**
 	 * 全部部门ids缓存

+ 9 - 13
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/JsonResourceUtil.java

@@ -52,22 +52,20 @@ public class JsonResourceUtil {
     public static Map<String, Map<String, Object>> jsonToMap(Object jsonObj) {
         JSONObject jsonObject = JSONObject.parseObject(jsonObj.toString());
         Map<String, Map<String, Object>> mapMap = new HashMap<>();
-        jsonObject.forEach((key, value) -> {
-            mapMap.put(key, JSONObject.parseObject(value.toString()));
-        });
+        jsonObject.forEach((key, value) -> mapMap.put(key, JSONObject.parseObject(value.toString())));
         return mapMap;
     }
 
     /**
      * 拼接字段
      */
-    public static String joinFiled(JSONArray array) {
+    public static String joinFiled(Map<String, Map<String,Object>> mapMap,JSONArray array) {
         StringBuilder sb = new StringBuilder();
         array.forEach(it -> {
-            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+            if (mapMap.get(it.toString()).isEmpty()) {
                 sb.append(it).append(",");
             } else {
-                sb.append(AccountReportConstants.dicMap.get(it.toString()).get("filed")).append(",");
+                sb.append(mapMap.get(it.toString()).get("filed")).append(",");
             }
         });
         return sb.deleteCharAt(sb.length() - 1).toString();
@@ -76,13 +74,13 @@ public class JsonResourceUtil {
     /**
      * 拼接title
      */
-    public static List<String> joinTitle(JSONArray array) {
+    public static List<String> joinTitle(Map<String, Map<String,Object>> mapMap,JSONArray array) {
         List<String> titles = new ArrayList<>(20);
         array.forEach(it -> {
-            if (AccountReportConstants.dicMap.get(it.toString()).isEmpty()) {
+            if (mapMap.get(it.toString()).isEmpty()) {
                 titles.add(it.toString());
             } else {
-                titles.add(AccountReportConstants.dicMap.get(it.toString()).get("comment").toString());
+                titles.add(mapMap.get(it.toString()).get("comment").toString());
             }
         });
         return titles;
@@ -91,11 +89,9 @@ public class JsonResourceUtil {
     /**
      * 拼接字段
      */
-    public static String joinAllFiled() {
+    public static String joinAllFiled(Map<String, Map<String,Object>> mapMap) {
         StringBuilder sb = new StringBuilder();
-        AccountReportConstants.dicMap.forEach((k, v) -> {
-            sb.append(v.get("filed")).append(",");
-        });
+        mapMap.forEach((k, v) -> sb.append(v.get("filed")).append(","));
         return sb.deleteCharAt(sb.length() - 1).toString();
     }
 }

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

@@ -0,0 +1,234 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.ActCustomForm;
+import cn.com.ctop.common.module.service.IActCustomFormService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 自定义表单信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="自定义表单信息")
+@RestController
+@RequestMapping("/ctop/actCustomForm")
+public class ActCustomFormController {
+	@Autowired
+	private IActCustomFormService actCustomFormService;
+
+	/**
+	  * 分页列表查询
+	 * @param actCustomForm
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-分页列表查询", notes="自定义表单信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ActCustomForm>> queryPageList(ActCustomForm actCustomForm,
+													  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													  HttpServletRequest req) {
+		Result<IPage<ActCustomForm>> result = new Result<>();
+		QueryWrapper<ActCustomForm> queryWrapper = QueryGenerator.initQueryWrapper(actCustomForm, req.getParameterMap());
+		Page<ActCustomForm> page = new Page<ActCustomForm>(pageNo, pageSize);
+		IPage<ActCustomForm> pageList = actCustomFormService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param actCustomForm
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-添加", notes="自定义表单信息-添加")
+	@PostMapping(value = "/add")
+	public Result<ActCustomForm> add(@RequestBody ActCustomForm actCustomForm) {
+		Result<ActCustomForm> result = new Result<>();
+		try {
+			actCustomFormService.save(actCustomForm);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param actCustomForm
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-编辑", notes="自定义表单信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ActCustomForm> edit(@RequestBody ActCustomForm actCustomForm) {
+		Result<ActCustomForm> result = new Result<ActCustomForm>();
+		ActCustomForm actCustomFormEntity = actCustomFormService.getById(actCustomForm.getId());
+		if(actCustomFormEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = actCustomFormService.updateById(actCustomForm);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-通过id删除", notes="自定义表单信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			actCustomFormService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-批量删除", notes="自定义表单信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ActCustomForm> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ActCustomForm> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.actCustomFormService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单信息-通过id查询", notes="自定义表单信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ActCustomForm> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ActCustomForm> result = new Result<>();
+		ActCustomForm actCustomForm = actCustomFormService.getById(id);
+		if(actCustomForm==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(actCustomForm);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<ActCustomForm> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              ActCustomForm actCustomForm = JSON.parseObject(deString, ActCustomForm.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(actCustomForm, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<ActCustomForm> pageList = actCustomFormService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "自定义表单信息列表");
+      mv.addObject(NormalExcelConstants.CLASS, ActCustomForm.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("自定义表单信息列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<ActCustomForm> listActCustomForms = ExcelImportUtil.importExcel(file.getInputStream(), ActCustomForm.class, params);
+              actCustomFormService.saveBatch(listActCustomForms);
+              return Result.ok("文件导入成功!数据行数:" + listActCustomForms.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,234 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.ActFormData;
+import cn.com.ctop.common.module.service.IActFormDataService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 自定义表单存储数据
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="自定义表单存储数据")
+@RestController
+@RequestMapping("/ctop/actFormData")
+public class ActFormDataController {
+	@Autowired
+	private IActFormDataService actFormDataService;
+
+	/**
+	  * 分页列表查询
+	 * @param actFormData
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-分页列表查询", notes="自定义表单存储数据-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ActFormData>> queryPageList(ActFormData actFormData,
+													@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													HttpServletRequest req) {
+		Result<IPage<ActFormData>> result = new Result<>();
+		QueryWrapper<ActFormData> queryWrapper = QueryGenerator.initQueryWrapper(actFormData, req.getParameterMap());
+		Page<ActFormData> page = new Page<ActFormData>(pageNo, pageSize);
+		IPage<ActFormData> pageList = actFormDataService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param actFormData
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-添加", notes="自定义表单存储数据-添加")
+	@PostMapping(value = "/add")
+	public Result<ActFormData> add(@RequestBody ActFormData actFormData) {
+		Result<ActFormData> result = new Result<>();
+		try {
+			actFormDataService.save(actFormData);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param actFormData
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-编辑", notes="自定义表单存储数据-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ActFormData> edit(@RequestBody ActFormData actFormData) {
+		Result<ActFormData> result = new Result<ActFormData>();
+		ActFormData actFormDataEntity = actFormDataService.getById(actFormData.getId());
+		if(actFormDataEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = actFormDataService.updateById(actFormData);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-通过id删除", notes="自定义表单存储数据-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			actFormDataService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-批量删除", notes="自定义表单存储数据-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ActFormData> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ActFormData> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.actFormDataService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单存储数据-通过id查询", notes="自定义表单存储数据-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ActFormData> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ActFormData> result = new Result<>();
+		ActFormData actFormData = actFormDataService.getById(id);
+		if(actFormData==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(actFormData);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<ActFormData> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              ActFormData actFormData = JSON.parseObject(deString, ActFormData.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(actFormData, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<ActFormData> pageList = actFormDataService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "自定义表单存储数据列表");
+      mv.addObject(NormalExcelConstants.CLASS, ActFormData.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("自定义表单存储数据列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<ActFormData> listActFormDatas = ExcelImportUtil.importExcel(file.getInputStream(), ActFormData.class, params);
+              actFormDataService.saveBatch(listActFormDatas);
+              return Result.ok("文件导入成功!数据行数:" + listActFormDatas.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,234 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.ActFormField;
+import cn.com.ctop.common.module.service.IActFormFieldService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 自定义表单字段信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="自定义表单字段信息")
+@RestController
+@RequestMapping("/ctop/actFormField")
+public class ActFormFieldController {
+	@Autowired
+	private IActFormFieldService actFormFieldService;
+
+	/**
+	  * 分页列表查询
+	 * @param actFormField
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-分页列表查询", notes="自定义表单字段信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ActFormField>> queryPageList(ActFormField actFormField,
+													 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													 HttpServletRequest req) {
+		Result<IPage<ActFormField>> result = new Result<>();
+		QueryWrapper<ActFormField> queryWrapper = QueryGenerator.initQueryWrapper(actFormField, req.getParameterMap());
+		Page<ActFormField> page = new Page<>(pageNo, pageSize);
+		IPage<ActFormField> pageList = actFormFieldService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param actFormField
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-添加", notes="自定义表单字段信息-添加")
+	@PostMapping(value = "/add")
+	public Result<ActFormField> add(@RequestBody ActFormField actFormField) {
+		Result<ActFormField> result = new Result<>();
+		try {
+			actFormFieldService.save(actFormField);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param actFormField
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-编辑", notes="自定义表单字段信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ActFormField> edit(@RequestBody ActFormField actFormField) {
+		Result<ActFormField> result = new Result<ActFormField>();
+		ActFormField actFormFieldEntity = actFormFieldService.getById(actFormField.getId());
+		if(actFormFieldEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = actFormFieldService.updateById(actFormField);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-通过id删除", notes="自定义表单字段信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			actFormFieldService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-批量删除", notes="自定义表单字段信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ActFormField> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ActFormField> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.actFormFieldService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单字段信息-通过id查询", notes="自定义表单字段信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ActFormField> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ActFormField> result = new Result<>();
+		ActFormField actFormField = actFormFieldService.getById(id);
+		if(actFormField==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(actFormField);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<ActFormField> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              ActFormField actFormField = JSON.parseObject(deString, ActFormField.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(actFormField, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<ActFormField> pageList = actFormFieldService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "自定义表单字段信息列表");
+      mv.addObject(NormalExcelConstants.CLASS, ActFormField.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("自定义表单字段信息列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<ActFormField> listActFormFields = ExcelImportUtil.importExcel(file.getInputStream(), ActFormField.class, params);
+              actFormFieldService.saveBatch(listActFormFields);
+              return Result.ok("文件导入成功!数据行数:" + listActFormFields.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -0,0 +1,234 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.ActFormPorcess;
+import cn.com.ctop.common.module.service.IActFormPorcessService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+ /**
+ * 自定义表单关联流程信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="自定义表单关联流程信息")
+@RestController
+@RequestMapping("/ctop/actFormPorcess")
+public class ActFormPorcessController {
+	@Autowired
+	private IActFormPorcessService actFormPorcessService;
+
+	/**
+	  * 分页列表查询
+	 * @param actFormPorcess
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-分页列表查询", notes="自定义表单关联流程信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<ActFormPorcess>> queryPageList(ActFormPorcess actFormPorcess,
+													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													   HttpServletRequest req) {
+		Result<IPage<ActFormPorcess>> result = new Result<>();
+		QueryWrapper<ActFormPorcess> queryWrapper = QueryGenerator.initQueryWrapper(actFormPorcess, req.getParameterMap());
+		Page<ActFormPorcess> page = new Page<>(pageNo, pageSize);
+		IPage<ActFormPorcess> pageList = actFormPorcessService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param actFormPorcess
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-添加", notes="自定义表单关联流程信息-添加")
+	@PostMapping(value = "/add")
+	public Result<ActFormPorcess> add(@RequestBody ActFormPorcess actFormPorcess) {
+		Result<ActFormPorcess> result = new Result<>();
+		try {
+			actFormPorcessService.save(actFormPorcess);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param actFormPorcess
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-编辑", notes="自定义表单关联流程信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<ActFormPorcess> edit(@RequestBody ActFormPorcess actFormPorcess) {
+		Result<ActFormPorcess> result = new Result<ActFormPorcess>();
+		ActFormPorcess actFormPorcessEntity = actFormPorcessService.getById(actFormPorcess.getId());
+		if(actFormPorcessEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = actFormPorcessService.updateById(actFormPorcess);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-通过id删除", notes="自定义表单关联流程信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			actFormPorcessService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-批量删除", notes="自定义表单关联流程信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<ActFormPorcess> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<ActFormPorcess> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.actFormPorcessService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="自定义表单关联流程信息-通过id查询", notes="自定义表单关联流程信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<ActFormPorcess> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<ActFormPorcess> result = new Result<>();
+		ActFormPorcess actFormPorcess = actFormPorcessService.getById(id);
+		if(actFormPorcess==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(actFormPorcess);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<ActFormPorcess> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              ActFormPorcess actFormPorcess = JSON.parseObject(deString, ActFormPorcess.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(actFormPorcess, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<ActFormPorcess> pageList = actFormPorcessService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "自定义表单关联流程信息列表");
+      mv.addObject(NormalExcelConstants.CLASS, ActFormPorcess.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("自定义表单关联流程信息列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+      return mv;
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<ActFormPorcess> listActFormPorcesss = ExcelImportUtil.importExcel(file.getInputStream(), ActFormPorcess.class, params);
+              actFormPorcessService.saveBatch(listActFormPorcesss);
+              return Result.ok("文件导入成功!数据行数:" + listActFormPorcesss.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

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

@@ -1,14 +1,27 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
 import org.jeecg.modules.ctop.service.IMaterialTopService;
 import org.jeecg.modules.ctop.vo.MaterialTopVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  *  Created by JQ.bi on 2020.5.21
  */
@@ -47,4 +60,46 @@ public class MaterialTopCtrl {
         }
         return result;
     }
+
+    @PostMapping("/top/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               @RequestParam(defaultValue = "cost") String target,
+                               @RequestParam(defaultValue = "desc") String order,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+
+        String startDate= requestBody.getString("startDate");
+        String endDate= requestBody.getString("endDate");
+        List<MaterialTopVO> excelData= materialTopService.selectList(endDate,startDate, target, order);
+
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            temp.add(data.getUrl());
+            temp.add(data.getName());
+            temp.add(data.getCost());
+            temp.add(data.getClick());
+            temp.add(data.getShowNum());
+            temp.add(data.getPlay3s());
+            temp.add(data.getPlay10s());
+            temp.add(data.getActive());
+            temp.add(data.getPay());
+            temp.add(data.getResidue());
+            temp.add(data.getRegister());
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = {"视频","素材名","消耗","点击数","展示数","3s播放数","10s播放数","行为数","支付数","次留数","注册数"};
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "top素材", headers, excelList);
+            HttpUtils.setResponseHeader(response, "top素材.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
+        }
+    }
 }

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

@@ -380,16 +380,16 @@ public class ProjectMemberController {
     }
 
     /**
-     * 查询当前账户下的
+     * 查询当前账户下的快手头条传不同的mediaType
      *
      * @return
      */
     @GetMapping("/getProjectAccountByUserId")
-    public Result<List<Map<String, Object>>> getProjectAccountBy() {
+    public Result<List<Map<String, Object>>> getProjectAccountBy(String mediaType) {
         Result<List<Map<String, Object>>> resultBody = new Result<>();
         try {
             String userId = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
-            List<Map<String, Object>> result = projectMemberService.getProjectAccountByUserId(userId);
+            List<Map<String, Object>> result = projectMemberService.getProjectAccountByUserId(userId,mediaType);
             resultBody.setSuccess(true);
             resultBody.setResult(result);
         } catch (Exception e) {

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

@@ -0,0 +1,159 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.system.service.ISysDepartService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.List;
+
+ /**
+ * 标签信息
+ * @author jeecg-boot
+ * @date   2020-08-26
+ * @version V1.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/tagInfo")
+public class TagInfoController {
+	@Autowired
+	private ITagInfoService tagInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param tagInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<TagInfo>> queryPageList(TagInfo tagInfo,
+												@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+												@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+												HttpServletRequest req) {
+		Result<IPage<TagInfo>> result = new Result<>();
+		QueryWrapper<TagInfo> queryWrapper = QueryGenerator.initQueryWrapper(tagInfo, req.getParameterMap());
+		Page<TagInfo> page = new Page<>(pageNo, pageSize);
+		IPage<TagInfo> pageList = tagInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param tagInfo
+	 * @return
+	 */
+	@PostMapping(value = "/add")
+	public Result<TagInfo> add(@RequestBody TagInfo tagInfo) {
+		Result<TagInfo> result = new Result<>();
+		try {
+			tagInfoService.save(tagInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param tagInfo
+	 * @return
+	 */
+	@PutMapping(value = "/edit")
+	public Result<TagInfo> edit(@RequestBody TagInfo tagInfo) {
+		Result<TagInfo> result = new Result<TagInfo>();
+		TagInfo tagInfoEntity = tagInfoService.getById(tagInfo.getId());
+		if(tagInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = tagInfoService.updateById(tagInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			tagInfoService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<TagInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<TagInfo> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.tagInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<TagInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<TagInfo> result = new Result<>();
+		TagInfo tagInfo = tagInfoService.getById(id);
+		if(tagInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(tagInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+	@Autowired
+    private ISysDepartService sysDepartService;
+	@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
+    public Result<List<TagInfoTreeModel>> queryTreeList() {
+	    Result<List<TagInfoTreeModel>> result = new Result<>();
+	    try {
+            List<TagInfoTreeModel> list = tagInfoService.queryTreeList();
+	        result.setResult(list);
+	        result.setSuccess(true);
+	    } catch (Exception e) {
+	        log.error(e.getMessage(),e);
+	    }
+	    return result;
+	}
+}

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

@@ -5,18 +5,21 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bstek.ureport.export.ExportManager;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.ctop.entity.UReportFile;
+import org.jeecg.modules.ctop.entity.UReportFileBindUser;
 import org.jeecg.modules.ctop.service.IUReportFileService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 
 /**

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UReportFile.java

@@ -32,6 +32,7 @@ public class UReportFile {
     @TableId(type = IdType.UUID)
     @ApiModelProperty(value = "id")
     private String id;
+
     /**
      * 报表名称
      */
@@ -46,6 +47,10 @@ public class UReportFile {
     private String content;
 
     /**
+     *  报表类型 时报、日报
+     */
+    private Integer reportType;
+    /**
      * 创建时间
      */
     @ApiModelProperty(value = "创建时间")

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/UReportFileBindUser.java

@@ -57,6 +57,10 @@ public class UReportFileBindUser {
     @ApiModelProperty(value = "fileName")
     private String fileName;
     /**
+     * isSubscribe
+     */
+    private Boolean isSubscribe;
+    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialTopMapper.java

@@ -7,10 +7,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.ctop.vo.MaterialTopVO;
 
+import java.util.List;
+
 public interface MaterialTopMapper {
 
     IPage<MaterialTopVO> selectMapsPage(Page<MaterialTopVO> page, @Param(Constants.WRAPPER)QueryWrapper<MaterialTopVO> wrapper);
 
+    List<MaterialTopVO> selectList(@Param("endDate") String endDate,@Param("startDate") String startDate,@Param("target") String target,@Param("order") String order);
+
     int insertByteDanceMaterialReportAccountByDate(@Param("statDate") String statDate);
 
     int insertKuaiShouMaterialReportAccountByDate(@Param("statDate") String statDate);

+ 30 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialTopMapper.xml

@@ -26,6 +26,36 @@
             ${ew.sqlSegment}
     </select>
 
+    <select id="selectList" resultType="org.jeecg.modules.ctop.vo.MaterialTopVO">
+        SELECT
+            code,
+            url,
+            cover_url,
+            name,
+            stat_date ,
+            sum(cost) as cost,
+            sum(click) as click,
+            sum(show_num) as show_num,
+            sum(active) as active,
+            sum(register) as register,
+            sum(pay) as pay,
+            sum(phone_convert) as phone_convert,
+            sum(form_convert) as form_convert,
+            convert_rate,
+            sum(residue) as residue,
+            sum(play3s) as play3s,
+            sum(play10s) as play10s
+        FROM
+            ctop_material_report_total_result
+        where
+            stat_date&lt;=#{endDate}
+        and stat_date&gt;=#{startDate}
+        and url is not null
+        and url!=''
+        group by code
+        order by ${target} ${order}
+    </select>
+
     <insert id="insertByteDanceMaterialReportAccountByDate">
         INSERT INTO ctop_material_report_total_result (
             CODE,

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

@@ -3,7 +3,10 @@ package org.jeecg.modules.ctop.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.jeecg.modules.ctop.vo.MaterialTopVO;
 
+import java.util.List;
+
 public interface IMaterialTopService {
     IPage<MaterialTopVO> selectByPage(String endDate, String startDate, String target, String order, int pageNo, int pageSize);
+    List<MaterialTopVO> selectList(String endDate, String startDate, String target, String order);
     boolean insertMaterialReportAccount(String statDate);
 }

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

@@ -22,7 +22,7 @@ public interface IProjectMemberService extends IService<ProjectMember> {
 
     List<ProjectMember> getProjects(List<Integer> mediaIds);
 
-    List<Map<String, Object>> getProjectAccountByUserId(String userId);
+    List<Map<String, Object>> getProjectAccountByUserId(String userId,String mediaType);
 
     ProjectMember getProjectByParams(Long targetProject, String userId);
 

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

@@ -12,6 +12,8 @@ import org.jeecg.modules.ctop.vo.MaterialTopVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  *  Created by JQ.bi on 2020.05.22
  */
@@ -38,6 +40,11 @@ public class MaterialTopServiceImpl  implements IMaterialTopService {
     }
 
     @Override
+    public List<MaterialTopVO> selectList(String endDate, String startDate, String target, String order) {
+        return materialTopMapper.selectList(endDate,startDate,target,order);
+    }
+
+    @Override
     public boolean insertMaterialReportAccount(String statDate) {
 
         int resultByteDance=materialTopMapper.insertByteDanceMaterialReportAccountByDate(statDate);
@@ -49,7 +56,6 @@ public class MaterialTopServiceImpl  implements IMaterialTopService {
             materialTopMapper.deletedMaterialReportAccountByDate(statDate);
             log.info("delete dirty data is success");
         }
-
         return resultByteDance != 0 && resultKuaishou != 0;
     }
 

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

@@ -103,11 +103,17 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
     }
 
     @Override
-    public List<Map<String, Object>> getProjectAccountByUserId(String userId) {
+    public List<Map<String, Object>> getProjectAccountByUserId(String userId,String mediaType) {
         List<Map<String, Object>> result = new ArrayList<>();
         List<Integer> mediaList = new ArrayList<>();
-        mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT);
-        mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INSIDE_INT);
+        if(mediaType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE)){
+            mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT);
+            mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INSIDE_INT);
+        }else if(mediaType.equals(CtopAdConstant.PLATFORM_TYPE_KUAISHOU)){
+            mediaList.add(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
+            mediaList.add(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INSIDE_INT);
+        }
+
         //查询登录账号下的项目
         List<ProjectMember> projectMemberList = this.queryProjectMemberBy(userId, mediaList);
         if (projectMemberList.isEmpty()) {

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

@@ -197,6 +197,8 @@ jeecg:
     webapp: D://webapp
     video-upload: D://upFiles//video//
     image-upload: D://upFiles//image//
+    kuaishou-agent-image: D://temp.png
+    kuaishou-account-captcha-image: D://captcha.png
     chrome-driver: D://chromedriver.exe
     csv-upload: D://upFiles//csv//
     report-history: D://report//history//

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -170,6 +170,8 @@ jeecg:
     webapp: /data/webapp
     video-upload: /data/upload/video/
     image-upload: /data/upload/image/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
     chrome-driver: /usr/bin/chromedriver
     csv-upload: /data/upload/csv/
     bak-database-file: /data/data/bak/

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -162,6 +162,8 @@ jeecg:
     webapp: /data/webapp
     video-upload: /data/upload/video/
     image-upload: /data/upload/image/
+    kuaishou-agent-image: /data/upload/image/temp.png
+    kuaishou-account-captcha-image: /data/upload/image/captcha.png
     chrome-driver: /usr/bin/chromedriver
     csv-upload: /data/upload/csv/
     bak-database-file: /data/data/bak/

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -158,6 +158,8 @@ jeecg:
     webapp: /data/webapp
     video-upload: /data/upload/video/
     image-upload: /data/upload/image/
+    kuaishou-agent-image: D://temp.png
+    kuaishou-account-captcha-image: D://captcha.png
     chrome-driver: D://chromedriver.exe
     csv-upload: /data/upload/csv/
     report-history: /data/report/history/

+ 2 - 0
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -157,6 +157,8 @@ jeecg:
     webapp: /mnt/webapp
     video-upload: /mnt/upload/video/
     image-upload: /mnt/upload/image/
+    kuaishou-agent-image: D://temp.png
+    kuaishou-account-captcha-image: D://captcha.png
     chrome-driver: D://chromedriver.exe
     csv-upload: /mnt/upload/csv/
     bak-database-file: /mnt/data/bak/

+ 23 - 11
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,15 +2,15 @@ package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IRefreshTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
+import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -35,15 +35,11 @@ public class SampleTest {
     @Autowired
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
-    private IByteDanceCreativeService creativeService;
-    @Autowired
-    private IByteDanceCampaignService campaignService;
-    @Autowired
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     @Autowired
     private IKuaiShouDailyAgentService kuaiShouDailyAgentService;
     @Autowired
-    private IRefreshTokenService refreshTokenService;
+    private IReportService reportService;
 
     @Test
     public void loadBytedanceCreativeData() {
@@ -97,15 +93,31 @@ public class SampleTest {
             log.info("快手删评论所用时长:{}毫秒",end-start);
         }
     }
-
+    @Autowired
+    private IUserAllocationService allocationService;
     @Test
     public void testLoadBytedanceData() {
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(1673731621920840L);
-        campaignService.getAdvertiserCampaign(token, null, null);
+        List<UserAllocation>allocations = allocationService.getByParams(435L,null,0);
+        for (UserAllocation allocation:allocations) {
+            for(int i=2;i<10;i++){
+                CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
+                Date getDate = DateUtils.addDay(new Date(),-i);
+                reportService.getAdvertiserReport(token,getDate,getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            }
+        }
     }
 
     @Test
     public void loadKuaishouAgentData() {
+//        for(int i=0;i<20;i++){
+//            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-i));
+//            kuaishouReportDailyAgentService.getReport(currentDate,DateUtils.getNowDate("yyyy-MM-dd"));
+//        }
+//
+//        int currentPage = 1;
+//        while (kuaishouReportDailyAgentService.getAccount(currentPage)){
+//            currentPage++;
+//        }
         String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
         kuaishouReportDailyAgentService.getReport(currentDate,DateUtils.getNowDate("yyyy-MM-dd"));
     }

+ 1 - 1
module-check/src/main/java/cn/com/ctop/check/TestGroovy.groovy

@@ -11,7 +11,7 @@ class TestGroovy extends AbstractScript {
     @Override
     Result<Object> exec() {
         println("开始执行脚本")
-        sendWeChatHandle.SendWeChatByMail("bijiequan@c-top.com.cn","执行成功")
+        sendWeChatHandle.sendWeChatByMails("bijiequan@c-top.com.cn","执行成功")
         println("执行完成")
         return Result.ok("666")
     }

+ 1 - 1
module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskExecuteLogController.java

@@ -19,7 +19,7 @@ import javax.servlet.http.HttpServletRequest;
 @Slf4j
 @RestController
 @RequestMapping("/ctop/checkTaskExecuteLog")
-public class CtopCheckTaskExecuteLogController {
+public class CtopCheckTaskExecuteLogCtrl {
 
    @Autowired
    private ICtopCheckTaskExecuteLogService ctopCheckTaskExecuteLogService;

+ 1 - 1
module-check/src/main/java/cn/com/ctop/check/controller/CtopCheckTaskListController.java

@@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
 @Slf4j
 @RestController
 @RequestMapping("/ctop/checkTaskList")
-public class  CtopCheckTaskListController {
+public class CtopCheckTaskListCtrl {
 
     @Autowired
     private ICtopCheckTaskListService ctopCheckTaskListService;

+ 25 - 1
module-check/src/main/java/cn/com/ctop/check/script/TestGroovyScript.java

@@ -2,13 +2,26 @@ package cn.com.ctop.check.script;
 
 import cn.com.ctop.check.component.execute.GroovyScriptExecutor;
 import cn.com.ctop.check.service.ICtopCheckTaskListService;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.ICustomDataByAccountService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.service.impl.CustomDataByAccountImpl;
+import cn.com.ctop.common.module.service.impl.UserAllocationServiceImpl;
+import cn.com.ctop.notice.handler.SendWeChatHandle;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.checkerframework.checker.units.qual.A;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.SystemDateConstant;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/rest/script")
 public class TestGroovyScript {
@@ -22,9 +35,20 @@ public class TestGroovyScript {
     @Autowired
     GroovyScriptExecutor groovyScriptExecutor;
 
+    @Autowired
+    SendWeChatHandle sendWeChatHandle;
+
+    @Autowired
+    IUserAllocationService userAllocationService;
+
+    @Autowired
+    ICustomDataByAccountService customDataByAccountService;
+
     @GetMapping("/test")
     public Result testGroovy(){
-         groovyScriptExecutor.execute(2,"CheckAccountStatusScript");
+        //groovyScriptExecutor.execute(2,"CheckAccountStatusScript");
+        //groovyScriptExecutor.execute(13,"CheckKsDataDiffScript");
+        groovyScriptExecutor.execute(14,"CheckByDataDiffScript");
         return Result.ok();
     }
 }

+ 21 - 1
module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java

@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -22,7 +23,8 @@ public class SendWeChatHandle {
             log.error(String.format("mail's WeChat not found. mail =%s", mail));
             //TODO 通知管理员添加邮箱
         }else{
-            CorpWexinUtils.sendMessageByWeChatId(weChatId,message);
+            List<String> messageList= splitMessage(message);
+            messageList.forEach(it->CorpWexinUtils.sendMessageByWeChatId(weChatId,it));
         }
     }
 
@@ -35,4 +37,22 @@ public class SendWeChatHandle {
         List<String> mail= Arrays.asList(mails.split(","));
         mail.forEach(m-> this.sendWeChatByMail(m,message));
     }
+
+    /**
+     *  消息切割
+     */
+    private List<String> splitMessage(String message){
+        List<String> messageList=new ArrayList<>();
+        if(message.length()>1006){
+            int number=message.length()/1006;
+            for(int i=0;i<number;i++){
+                if(i!=number-1){
+                    messageList.add(message.substring(i*1006,(i+1)*1006-1));
+                }else {
+                    messageList.add(message.substring((i+1)*1006));
+                }
+            }
+        }
+        return messageList;
+    }
 }

+ 34 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/ActCustomForm.java

@@ -0,0 +1,34 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 自定义表单信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_act_custom_form")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_act_custom_form对象", description="自定义表单信息")
+public class ActCustomForm {
+
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	private String name;
+	private String text;
+	private String userId;
+	private Integer status;
+	private Date createTime;
+	private Date updateTime;
+}

+ 35 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormData.java

@@ -0,0 +1,35 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 自定义表单存储数据
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_act_form_data")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_act_form_data对象", description="自定义表单存储数据")
+public class ActFormData {
+
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	private Long formId;
+	private String processId;
+	private String key;
+	private String value;
+	private Integer status;
+	private Date createTime;
+	private Date updateTime;
+}

+ 34 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormField.java

@@ -0,0 +1,34 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 自定义表单字段信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_act_form_field")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_act_form_field对象", description="自定义表单字段信息")
+public class ActFormField {
+
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	private Long formId;
+	private String key;
+	private String type;
+	private Integer status;
+	private Date createTime;
+	private Date updateTime;
+}

+ 33 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/ActFormPorcess.java

@@ -0,0 +1,33 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 自定义表单关联流程信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_act_form_porcess")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_act_form_porcess对象", description="自定义表单关联流程信息")
+public class ActFormPorcess {
+
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	private Long formId;
+	private String processId;
+	private Integer status;
+	private Date createTime;
+	private Date updateTime;
+}

+ 40 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/TagInfo.java

@@ -0,0 +1,40 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 标签信息
+ * @author jeecg-boot
+ * @date   2020-08-26
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_tag_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_tag_info对象", description="标签信息")
+public class TagInfo {
+
+	/**id*/
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+	private Long id;
+	private Long parentId;
+	private String tagName;
+	private Integer tagOrder;
+	private String description;
+	private String tagCode;
+	private Integer status;
+	private Integer delFlag;
+	private Date createTime;
+	private Date updateTime;
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ActCustomFormMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.ActCustomForm;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 自定义表单信息
+ * @author: jeecg-boot
+ * @date:   2020-08-25
+ * @cersion: V1.0
+ */
+public interface ActCustomFormMapper extends BaseMapper<ActCustomForm> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormDataMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.ActFormData;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 自定义表单存储数据
+ * @author: jeecg-boot
+ * @date:   2020-08-25
+ * @cersion: V1.0
+ */
+public interface ActFormDataMapper extends BaseMapper<ActFormData> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormFieldMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.ActFormField;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 自定义表单字段信息
+ * @author: jeecg-boot
+ * @date:   2020-08-25
+ * @cersion: V1.0
+ */
+public interface ActFormFieldMapper extends BaseMapper<ActFormField> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ActFormPorcessMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.ActFormPorcess;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 自定义表单关联流程信息
+ * @author: jeecg-boot
+ * @date:   2020-08-25
+ * @cersion: V1.0
+ */
+public interface ActFormPorcessMapper extends BaseMapper<ActFormPorcess> {
+
+}

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CustomDataByAccountMapper.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.common.module.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+public interface CustomDataByAccountMapper {
+
+    //快手查询广告组日报数据
+    JSONObject queryKsGroupData(@Param("accountId") Long accountId,@Param("date") String date);
+
+    //快手查询广告计划日报数据
+    JSONObject queryKsCampaignData(@Param("accountId") Long accountId,@Param("date") String date);
+
+    //快手查询账户日报数据
+    JSONObject queryKsAccountData(@Param("accountId") Long accountId,@Param("date") String date);
+
+    //头条查询广告组日报数据
+    JSONObject queryByCampaignData(@Param("accountId") Long accountId,@Param("date") String date);
+
+    //头条查询广告计划日报数据
+    JSONObject queryByPlanData(@Param("accountId") Long accountId,@Param("date") String date);
+
+    //头条查询账户日报数据
+    JSONObject queryByAccountData(@Param("accountId") Long accountId,@Param("date") String date);
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/TagInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 标签信息
+ * @author: jeecg-boot
+ * @date:   2020-08-26
+ * @cersion: V1.0
+ */
+public interface TagInfoMapper extends BaseMapper<TagInfo> {
+
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActCustomFormMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.ActCustomFormMapper">
+
+</mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormDataMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.ActFormDataMapper">
+
+</mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormFieldMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.ActFormFieldMapper">
+
+</mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ActFormPorcessMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.ActFormPorcessMapper">
+
+</mapper>

+ 63 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CustomDataByAccountMapper.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.CustomDataByAccountMapper">
+
+    <select id="queryKsCampaignData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(charge)      cost,
+               sum(photo_show)  photoShow,
+               sum(photo_click) photoClick,
+               sum(aclick)      aclick
+        FROM ctop_kuaishou_report_daily_campaign
+        where stat_date = #{date}
+          and account_id = #{accountId}
+    </select>
+
+    <select id="queryKsGroupData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(charge)      cost,
+               sum(photo_show)  photoShow,
+               sum(photo_click) photoClick,
+               sum(aclick)      aclick
+        FROM ctop_kuaishou_report_daily_group
+        where stat_date = #{date}
+          and account_id = #{accountId}
+    </select>
+
+    <select id="queryKsAccountData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(charge)      cost,
+               sum(photo_show)  photoShow,
+               sum(photo_click) photoClick,
+               sum(aclick)      aclick
+        FROM ctop_kuaishou_report_daily_account
+        where stat_date = #{date}
+          and account_id = #{accountId}
+    </select>
+
+    <select id="queryByCampaignData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            sum(cost) cost,
+            sum(show_num) showNum,
+            sum(click) click
+        from ctop_bytedance_report_campaign_daily
+        where stat_datetime = #{date}
+          and advertiser_id = #{accountId}
+    </select>
+
+    <select id="queryByPlanData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(cost)     cost,
+               sum(show_num) showNum,
+               sum(click)    click
+        from ctop_bytedance_report_plan_daily
+        where stat_datetime = '${date} 00:00:00'
+          and advertiser_id = #{accountId}
+    </select>
+
+    <select id="queryByAccountData" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(cost)     cost,
+               sum(show_num) showNum,
+               sum(click)    click
+        FROM ctop_bytedance_report_advertiser_daily
+        where stat_datetime = '${date} 00:00:00'
+          and advertiser_id = #{accountId}
+    </select>
+
+</mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/TagInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.TagInfoMapper">
+
+</mapper>

+ 56 - 0
module-common/src/main/java/cn/com/ctop/common/module/model/TagIdModel.java

@@ -0,0 +1,56 @@
+package cn.com.ctop.common.module.model;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class TagIdModel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    private String key;
+
+    /**
+     * 主键ID
+     */
+    private String value;
+
+    /**
+     * 部门名称
+     */
+    private String title;
+    private String tagCode;
+
+    List<TagIdModel> children = new ArrayList<>();
+
+    /**
+     * 将SysDepartTreeModel的部分数据放在该对象当中
+     * @param treeModel 树状结构
+     * @return 部门信息
+     */
+    public TagIdModel convert(TagInfoTreeModel treeModel) {
+        this.key = treeModel.getId()+"";
+        this.value = treeModel.getId()+"";
+        this.title = treeModel.getTagName();
+        this.tagCode = treeModel.getTagCode();
+        return this;
+    }
+
+    /**
+     * 该方法为用户部门的实现类所使用
+     * @param sysDepart 系统部门信息
+     * @return 部门信息
+     */
+    public TagIdModel convertByUserDepart(TagInfo sysDepart) {
+        this.key = sysDepart.getId()+"";
+        this.value = sysDepart.getId()+"";
+        this.title = sysDepart.getTagName();
+        return this;
+    }
+}

+ 192 - 0
module-common/src/main/java/cn/com/ctop/common/module/model/TagInfoTreeModel.java

@@ -0,0 +1,192 @@
+package cn.com.ctop.common.module.model;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class TagInfoTreeModel implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *对应TagInfo中的id字段,前端数据树中的key
+     */
+    private String key;
+
+    /**
+     *对应TagInfo中的id字段,前端数据树中的value
+     */
+    private String value;
+
+    /**
+     *对应name字段,前端数据树中的title
+     */
+    private String title;
+
+    /**
+     * 以下所有字段均与TagInfo相同
+     */
+    private boolean isLeaf;
+
+    private Long id;
+    private Long parentId;
+    private String tagName;
+    private Integer tagOrder;
+    private String description;
+    private String tagCode;
+    private Integer status;
+    private Integer delFlag;
+    private Date createTime;
+    private Date updateTime;
+    private List<TagInfoTreeModel> children = new ArrayList<>();
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public boolean isLeaf() {
+        return isLeaf;
+    }
+
+    public void setIsLeaf(boolean leaf) {
+        isLeaf = leaf;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getTagName() {
+        return tagName;
+    }
+
+    public void setTagName(String tagName) {
+        this.tagName = tagName;
+    }
+
+    public Integer getTagOrder() {
+        return tagOrder;
+    }
+
+    public void setTagOrder(Integer tagOrder) {
+        this.tagOrder = tagOrder;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getTagCode() {
+        return tagCode;
+    }
+
+    public void setTagCode(String tagCode) {
+        this.tagCode = tagCode;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 将SysDepart对象转换成SysDepartTreeModel对象
+     * @param tagInfo
+     */
+    public TagInfoTreeModel(TagInfo tagInfo) {
+        this.key = tagInfo.getId()+"";
+        this.value = tagInfo.getId()+"";
+        this.title = tagInfo.getTagName();
+        this.id = tagInfo.getId();
+        this.parentId = tagInfo.getParentId();
+        this.tagName = tagInfo.getTagName();
+        this.tagOrder = tagInfo.getTagOrder();
+        this.description = tagInfo.getDescription();
+        this.tagCode = tagInfo.getTagCode();
+        this.status = tagInfo.getStatus();
+        this.delFlag = tagInfo.getDelFlag();
+        this.createTime = tagInfo.getCreateTime();
+        this.updateTime = tagInfo.getUpdateTime();
+    }
+
+
+    public List<TagInfoTreeModel> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<TagInfoTreeModel> children) {
+        if (children==null){
+            this.isLeaf=true;
+        }
+        this.children = children;
+    }
+
+    public TagInfoTreeModel() {
+
+    }
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IActCustomFormService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.ActCustomForm;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 自定义表单信息
+ * @Author: jeecg-boot
+ * @Date:   2020-08-25
+ * @Version: V1.0
+ */
+public interface IActCustomFormService extends IService<ActCustomForm> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IActFormDataService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.ActFormData;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 自定义表单存储数据
+ * @Author: jeecg-boot
+ * @Date:   2020-08-25
+ * @Version: V1.0
+ */
+public interface IActFormDataService extends IService<ActFormData> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IActFormFieldService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.ActFormField;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 自定义表单字段信息
+ * @Author: jeecg-boot
+ * @Date:   2020-08-25
+ * @Version: V1.0
+ */
+public interface IActFormFieldService extends IService<ActFormField> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IActFormPorcessService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.ActFormPorcess;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 自定义表单关联流程信息
+ * @Author: jeecg-boot
+ * @Date:   2020-08-25
+ * @Version: V1.0
+ */
+public interface IActFormPorcessService extends IService<ActFormPorcess> {
+
+}

+ 25 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ICustomDataByAccountService.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.common.module.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface ICustomDataByAccountService {
+
+    //快手查询广告组日报数据
+    JSONObject getKsGroupData(Long account,String date);
+
+    //快手查询广告计划日报数据
+    JSONObject getKsCampaignData(Long account,String date);
+
+    //快手查询账户日报数据
+    JSONObject getKsAccountData(Long account,String date);
+
+    //头条查询广告组日报数据
+    JSONObject getByCampaignData(Long account,String date);
+
+    //头条查询广告计划日报数据
+    JSONObject getByPlanData(Long account,String date);
+
+    //头条查询账户日报数据
+    JSONObject getByAccountData(Long account,String date);
+
+}

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ITagInfoService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * @Description: 标签信息
+ * @Author: jeecg-boot
+ * @Date:   2020-08-26
+ * @Version: V1.0
+ */
+public interface ITagInfoService extends IService<TagInfo> {
+
+    List<TagInfoTreeModel> queryTreeList();
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActCustomFormServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ActCustomForm;
+import cn.com.ctop.common.module.mapper.ActCustomFormMapper;
+import cn.com.ctop.common.module.service.IActCustomFormService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自定义表单信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Service
+public class ActCustomFormServiceImpl extends ServiceImpl<ActCustomFormMapper, ActCustomForm> implements IActCustomFormService {
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormDataServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ActFormData;
+import cn.com.ctop.common.module.mapper.ActFormDataMapper;
+import cn.com.ctop.common.module.service.IActFormDataService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自定义表单存储数据
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Service
+public class ActFormDataServiceImpl extends ServiceImpl<ActFormDataMapper, ActFormData> implements IActFormDataService {
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormFieldServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ActFormField;
+import cn.com.ctop.common.module.mapper.ActFormFieldMapper;
+import cn.com.ctop.common.module.service.IActFormFieldService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自定义表单字段信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Service
+public class ActFormFieldServiceImpl extends ServiceImpl<ActFormFieldMapper, ActFormField> implements IActFormFieldService {
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ActFormPorcessServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ActFormPorcess;
+import cn.com.ctop.common.module.mapper.ActFormPorcessMapper;
+import cn.com.ctop.common.module.service.IActFormPorcessService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自定义表单关联流程信息
+ * @author jeecg-boot
+ * @date   2020-08-25
+ * @version V1.0
+ */
+@Service
+public class ActFormPorcessServiceImpl extends ServiceImpl<ActFormPorcessMapper, ActFormPorcess> implements IActFormPorcessService {
+
+}

+ 44 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CustomDataByAccountImpl.java

@@ -0,0 +1,44 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.mapper.CustomDataByAccountMapper;
+import cn.com.ctop.common.module.service.ICustomDataByAccountService;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CustomDataByAccountImpl implements ICustomDataByAccountService {
+
+    @Autowired
+    CustomDataByAccountMapper customDataByAccountMapper;
+
+    @Override
+    public JSONObject getKsGroupData(Long account, String date) {
+        return customDataByAccountMapper.queryKsGroupData(account,date);
+    }
+
+    @Override
+    public JSONObject getKsCampaignData(Long account, String date) {
+        return customDataByAccountMapper.queryKsCampaignData(account,date);
+    }
+
+    @Override
+    public JSONObject getKsAccountData(Long account, String date) {
+        return customDataByAccountMapper.queryKsAccountData(account,date);
+    }
+
+    @Override
+    public JSONObject getByCampaignData(Long account, String date) {
+        return customDataByAccountMapper.queryByCampaignData(account,date);
+    }
+
+    @Override
+    public JSONObject getByPlanData(Long account, String date) {
+        return customDataByAccountMapper.queryByPlanData(account,date);
+    }
+
+    @Override
+    public JSONObject getByAccountData(Long account, String date) {
+        return customDataByAccountMapper.queryByAccountData(account,date);
+    }
+}

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

@@ -78,9 +78,9 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         String path = URLDecoder.decode(materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/", 10) + 1, materialInfo.getUrl().length()));
         String taskId = videoWatermarkHandle(path, tentcentWatermarkTemplate.getTemplateId());
         DescribeTaskDetailResponse taskDetailResponse = null;
-        for (int i = 0; i < 10; i++) {
+        for (int i = 0; i < 30; i++) {
             try {
-                Thread.sleep(2000);
+                Thread.sleep(4000);
             } catch (InterruptedException e) {
                 log.error(e.getMessage());
             }

+ 40 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/TagInfoServiceImpl.java

@@ -0,0 +1,40 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.mapper.TagInfoMapper;
+import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.utils.FindstagInfosChildrenUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.common.constant.CacheConstant;
+import org.jeecg.common.constant.CommonConstant;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 标签信息
+ * @author jeecg-boot
+ * @date   2020-08-26
+ * @version V1.0
+ */
+@Service
+public class TagInfoServiceImpl extends ServiceImpl<TagInfoMapper, TagInfo> implements ITagInfoService {
+
+    /**
+     * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端
+     */
+    @Cacheable(value = CacheConstant.SYS_TAGINFOS_CACHE)
+    @Override
+    public List<TagInfoTreeModel> queryTreeList() {
+        LambdaQueryWrapper<TagInfo> query = new LambdaQueryWrapper<>();
+        query.eq(TagInfo::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
+        query.orderByAsc(TagInfo::getTagOrder);
+        List<TagInfo> list = this.list(query);
+        // 调用wrapTreeDataToTreeList方法生成树状数据
+        List<TagInfoTreeModel> listResult = FindstagInfosChildrenUtil.wrapTreeDataToTreeList(list);
+        return listResult;
+    }
+}

+ 118 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/FindstagInfosChildrenUtil.java

@@ -0,0 +1,118 @@
+package cn.com.ctop.common.module.utils;
+
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.model.TagIdModel;
+import cn.com.ctop.common.module.model.TagInfoTreeModel;
+import org.jeecg.common.util.oConvertUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FindstagInfosChildrenUtil {
+    //部门树信息-树结构
+    //private static List<SysDepartTreeModel> sysDepartTreeList = new ArrayList<SysDepartTreeModel>();
+
+    //部门树id-树结构
+    //private static List<DepartIdModel> idList = new ArrayList<>();
+
+
+    /**
+     * queryTreeList的子方法 ====1=====
+     * 该方法是s将SysDepart类型的list集合转换成SysDepartTreeModel类型的集合
+     */
+    public static List<TagInfoTreeModel> wrapTreeDataToTreeList(List<TagInfo> recordList) {
+        // 在该方法每请求一次,都要对全局list集合进行一次清理
+        //idList.clear();
+        List<TagIdModel> idList = new ArrayList<>();
+        List<TagInfoTreeModel> records = new ArrayList<>();
+        for (int i = 0; i < recordList.size(); i++) {
+            TagInfo depart = recordList.get(i);
+            records.add(new TagInfoTreeModel(depart));
+        }
+        List<TagInfoTreeModel> tree = findChildren(records, idList);
+        setEmptyChildrenAsNull(tree);
+        return tree;
+    }
+
+    /**
+     * 获取 DepartIdModel
+     * @param recordList
+     * @return
+     */
+    public static List<TagIdModel> wrapTreeDataToDepartIdTreeList(List<TagInfo> recordList) {
+        // 在该方法每请求一次,都要对全局list集合进行一次清理
+        //idList.clear();
+        List<TagIdModel> idList = new ArrayList<TagIdModel>();
+        List<TagInfoTreeModel> records = new ArrayList<>();
+        for (int i = 0; i < recordList.size(); i++) {
+            TagInfo depart = recordList.get(i);
+            records.add(new TagInfoTreeModel(depart));
+        }
+        findChildren(records, idList);
+        return idList;
+    }
+
+    /**
+     * queryTreeList的子方法 ====2=====
+     * 该方法是找到并封装顶级父类的节点到TreeList集合
+     */
+    private static List<TagInfoTreeModel> findChildren(List<TagInfoTreeModel> recordList,
+                                                         List<TagIdModel> departIdList) {
+
+        List<TagInfoTreeModel> treeList = new ArrayList<>();
+        for (int i = 0; i < recordList.size(); i++) {
+            TagInfoTreeModel branch = recordList.get(i);
+            if (oConvertUtils.isEmpty(branch.getParentId())) {
+                treeList.add(branch);
+                TagIdModel departIdModel = new TagIdModel().convert(branch);
+                departIdList.add(departIdModel);
+            }
+        }
+        getGrandChildren(treeList,recordList,departIdList);
+
+        //idList = departIdList;
+        return treeList;
+    }
+
+    /**
+     * queryTreeList的子方法====3====
+     *该方法是找到顶级父类下的所有子节点集合并封装到TreeList集合
+     */
+    private static void getGrandChildren(List<TagInfoTreeModel> treeList,List<TagInfoTreeModel> recordList,List<TagIdModel> idList) {
+
+        for (int i = 0; i < treeList.size(); i++) {
+            TagInfoTreeModel model = treeList.get(i);
+            TagIdModel idModel = idList.get(i);
+            for (int i1 = 0; i1 < recordList.size(); i1++) {
+                TagInfoTreeModel m = recordList.get(i1);
+                if (m.getParentId()!=null && m.getParentId().equals(model.getId())) {
+                    model.getChildren().add(m);
+                    TagIdModel dim = new TagIdModel().convert(m);
+                    idModel.getChildren().add(dim);
+                }
+            }
+            getGrandChildren(treeList.get(i).getChildren(), recordList, idList.get(i).getChildren());
+        }
+
+    }
+
+
+    /**
+     * queryTreeList的子方法 ====4====
+     * 该方法是将子节点为空的List集合设置为Null值
+     */
+    private static void setEmptyChildrenAsNull(List<TagInfoTreeModel> treeList) {
+
+        for (int i = 0; i < treeList.size(); i++) {
+            TagInfoTreeModel model = treeList.get(i);
+            if (model.getChildren().size() == 0) {
+                model.setChildren(null);
+                model.setIsLeaf(true);
+            }else{
+                setEmptyChildrenAsNull(model.getChildren());
+                model.setIsLeaf(false);
+            }
+        }
+        // sysDepartTreeList = treeList;
+    }
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 68 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java


+ 150 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouAccountReportCtrl.java

@@ -0,0 +1,150 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouAccountReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by JQ.bi on 2020.08.23
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/kuaishou/dailyPage")
+public class KuaiShouAccountReportCtrl {
+
+    @Autowired
+    IKuaiShouAccountReportService kuaiShouAccountReportService;
+
+    /**
+     * 查询素材报表chart数据
+     */
+    @PostMapping("/report/chart")
+    public Result<Map<String, Object>> getAccountChartReport(@RequestBody JSONObject requestBody) {
+        Result<Map<String, Object>> resultBody = new Result<>();
+        Map<String, Object> result = new HashMap<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            resultBody.setSuccess(false);
+        }
+        String mediaId = requestBody.getString("mediaId");
+        BigDecimal discount = requestBody.getBigDecimal("discount");
+        JSONArray accounts = requestBody.getJSONArray("accountIds");
+        String startDate = requestBody.getString("startDate");
+        String endDate = requestBody.getString("endDate");
+        try {
+            Map<String, Object> sumData = kuaiShouAccountReportService.getSumDataBy(mediaId, discount, accounts, startDate, endDate);
+            List<JSONObject> chartData = kuaiShouAccountReportService.getChartDataBy(mediaId, discount, accounts, startDate, endDate);
+            result.put("sumData",sumData);
+            result.put("chartData",chartData);
+            resultBody.setResult(result);
+            resultBody.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            resultBody.setSuccess(false);
+        }
+        return resultBody;
+    }
+
+    /**
+     * 查询素材报表表格数据
+     */
+    @PostMapping("/report/list")
+    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            result.setSuccess(false);
+        }
+        String mediaId = requestBody.getString("mediaId");
+        BigDecimal discount = requestBody.getBigDecimal("discount");
+        JSONArray accounts = requestBody.getJSONArray("accountIds");
+        String startDate = requestBody.getString("startDate");
+        String endDate = requestBody.getString("endDate");
+        int hour= requestBody.getInteger("hour");
+        String target= requestBody.getString("target");
+        String order= requestBody.getString("order");
+        try {
+            List<JSONObject> listData= kuaiShouAccountReportService.getListDataBy(mediaId,discount,accounts,startDate,endDate,hour,target,order);
+            result.setResult(listData);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+    /**
+     *  导出数据
+     */
+    @PostMapping("/report/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        JSONArray columns=requestBody.getJSONArray("columns");
+        if(columns.isEmpty()){
+            log.error("请选择需要导出的字段");
+        }
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs,columns);
+        List<String> titles= new ArrayList<>();
+        titles.add("账户Id");
+        titles.add("账户名称");
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs,columns));
+        //此处增加两个元素是为了保证数据有序
+        columns.add(0,"accountId");
+        columns.add(1,"authName");
+        String mediaId = requestBody.getString("mediaId");
+        JSONArray accounts = requestBody.getJSONArray("accountIds");
+        String startDate = requestBody.getString("startDate");
+        String endDate = requestBody.getString("endDate");
+        String target= requestBody.getString("target");
+        String order= requestBody.getString("order");
+        int hour= requestBody.getInteger("hour");
+        List<JSONObject> excelData= kuaiShouAccountReportService.getExcelDataBy(filed,mediaId,accounts,startDate,endDate,hour,target,order);
+        if(excelData.isEmpty()){
+            return;
+        }
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            columns.forEach(k-> temp.add(data.get(k.toString())));
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "头条素材报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "头条素材报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
+        }
+    }
+
+}

+ 47 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouAccountReportMapper.java

@@ -0,0 +1,47 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface KuaiShouAccountReportMapper {
+
+    //今日汇总数据
+    JSONObject queryTodaySumReportBy(@Param("statDate") String statDate, @Param("accountIds") JSONArray accountIds);
+
+    //根据小时区间查询今日汇总数据
+    List<JSONObject> queryTodaySumByHourGroupAccount(@Param("filed") String filed, @Param("statDate") String statDate, @Param("hour") int hour, @Param("accountIds") JSONArray accountIds, String target, String order);
+
+    //根据小时区间查询今日汇总数据
+    JSONObject queryTodaySumByHour(@Param("statDate") String statDate, @Param("hour") int hour, @Param("accountIds") JSONArray accountIds);
+
+    //根据小时区间查询今日汇总数据
+    JSONObject querySumByHour(@Param("filed") String filed, @Param("statDate") String statDate, @Param("hour") int hour, @Param("accountIds") JSONArray accountIds);
+
+    //今日明细数据
+    List<JSONObject> queryTodayDetailReportBy(@Param("filed") String filed, @Param("statDate") String statDate, @Param("accountIds") JSONArray accountIds);
+
+    //根据开始、结束时间 查询汇总数据
+    JSONObject querySumByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+
+    //根据开始、结束时间 查询汇总数据
+    JSONObject queryAllSumByStartEndDate(@Param("filed") String filed, @Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+
+    //根据时间查询数据按账户分组
+    List<JSONObject> querySumByDateGroupAccount(@Param("filed") String filed, @Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds, String target, String order);
+
+    //根据时间查询数据按账户时间分组
+    List<JSONObject> querySumByDateGroupAccountAndDate(@Param("filed") String filed, @Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds, String target, String order);
+
+    //根据开始、结束时间 查询明细数据
+    List<JSONObject> queryDetailByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+
+    //按月分组查询明细数据
+    List<JSONObject> queryDetailGroupMonthByDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+
+    //查询固定月的明细数据
+    List<JSONObject> queryDetailGroupDayByMonth(@Param("month") String month);
+
+}

+ 216 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouAccountReportMapper.xml

@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouAccountReportMapper">
+
+    <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        ROUND(sum(charge),2) cost,
+        sum(photo_show) photoShow,
+        sum(photo_click) photoClick,
+        sum(aClick) as aClick,
+        max(stat_hour) maxHour
+        FROM
+        ctop_kuaishou_report_hourly_account
+        WHERE
+        stat_date = #{statDate}
+        AND account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t2.account_id as accountId,
+        t2.auth_name as authName,
+        ${filed}
+        FROM ctop_kuaishou_report_hourly_account t1
+        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
+        WHERE t1.stat_date = #{statDate}
+        and t1.stat_hour &lt;= #{hour}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by t1.account_id
+        order by ${target} ${order}
+    </select>
+
+    <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+          ROUND(sum(charge),2) cost,
+          sum(photo_show) photoShow,
+          sum(photo_click) photoClick,
+          sum(aClick) as aClick
+        FROM
+          ctop_kuaishou_report_hourly_account
+        WHERE
+          stat_date = #{statDate}
+        AND stat_hour &lt;= #{hour}
+        AND account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        ${filed}
+        FROM
+        ctop_kuaishou_report_hourly_account t1
+        WHERE
+        t1.stat_date = #{statDate}
+        and t1.stat_hour &lt;= #{hour}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+          ROUND(sum(charge),2) cost,
+          sum(photo_show) photoShow,
+          sum(photo_click) photoClick,
+          sum(aClick) as aClick,
+          stat_hour as statHour
+        FROM
+          ctop_kuaishou_report_hourly_account
+        WHERE
+          stat_date = #{statDate}
+        AND account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        stat_hour
+        ORDER BY
+        stat_hour ASC
+    </select>
+
+    <select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        ${filed}
+        FROM ctop_kuaishou_report_daily_account t1
+        WHERE t1.stat_date &lt;= #{endDate}
+        AND t1.stat_date &gt;= #{startDate}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="querySumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+          ROUND(sum(charge),2) cost,
+          sum(photo_show) photoShow,
+          sum(photo_click) photoClick,
+          sum(aClick) as aClick
+        FROM ctop_kuaishou_report_daily_account t1
+        WHERE t1.stat_date &lt;= #{endDate}
+        AND t1.stat_date &gt;= #{startDate}
+        AND account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="querySumByDateGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.stat_date as statDate,
+        t2.account_id as accountId,
+        t2.auth_name as authName,
+        ${filed}
+        FROM
+        ctop_kuaishou_report_daily_account t1
+        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
+        WHERE
+        t1.stat_date &lt;= #{endDate}
+        AND t1.stat_date &gt;= #{startDate}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by t1.account_id
+        order by ${target} ${order}
+    </select>
+
+    <select id="querySumByDateGroupAccountAndDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.stat_date as statDate,
+        t2.account_id as accountId,
+        t2.auth_name as authName,
+        ${filed}
+        FROM
+        ctop_kuaishou_report_daily_account t1
+        left join ctop_user_allocation t2 on t1.account_id=t2.account_id
+        WHERE
+        t1.stat_date &lt;= #{endDate}
+        AND t1.stat_date &gt;= #{startDate}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by t1.stat_date
+        order by ${target} ${order}
+    </select>
+
+    <select id="queryDetailByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+          ROUND(sum(charge),2) cost,
+          sum(photo_show) photoShow,
+          sum(photo_click) photoClick,
+          sum(aClick) as aClick,
+          stat_date as statDate
+        FROM
+          ctop_kuaishou_report_daily_account
+        WHERE stat_date &lt;= #{endDate}
+        AND stat_date &gt;= #{startDate}
+        AND account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by stat_date
+        order by stat_date asc
+    </select>
+
+    <select id="queryDetailGroupMonthByDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+          ROUND(sum(charge),2) cost,
+          sum(photo_show) photoShow,
+          sum(photo_click) photoClick,
+          sum(aClick) as aClick,
+          DATE_FORMAT(t1.stat_date, '%Y-%m') statDate
+        FROM ctop_kuaishou_report_daily_account t1
+        WHERE t1.stat_date &lt;= #{endDate}
+        AND t1.stat_date &gt;= #{startDate}
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        group by DATE_FORMAT(t1.stat_date, '%Y-%m')
+        order by t1.stat_date asc
+    </select>
+
+    <select id="queryDetailGroupDayByMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            stat_date as statDate,
+            SUBSTR(stat_date FROM 9 FOR 2) day
+        FROM ctop_kuaishou_report_daily_account
+        WHERE stat_date like '${month}%'
+        group by DATE_FORMAT(stat_date, '%Y-%m-%d')
+        order by stat_date asc
+    </select>
+
+</mapper>

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

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
+public interface IKuaiShouAccountReportService {
+
+    Map<String,Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate);
+
+    List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException;
+
+    List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
+
+    List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
+
+}

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentService.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -12,7 +13,7 @@ import java.util.List;
  * @version V1.0
  */
 public interface IKuaishouReportDailyAgentService extends IService<KuaishouReportDailyAgent> {
-    void replaceBatch(List<KuaishouReportDailyAgent> list);
+    void replaceBatch(List<KuaiShouDailyAgent> list);
     void getReport(String startDate,String endDate);
     boolean getAccount(int currentPage);
 }

+ 206 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java

@@ -0,0 +1,206 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouAccountReportMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouAccountReportService;
+import cn.com.ctop.kuaishou.modules.utils.LinkUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.constant.SystemDateConstant;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by JQ.bi on 2020.08.23
+ */
+@Service
+public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportService {
+
+    @Autowired
+    KuaiShouAccountReportMapper kuaiShouAccountReportMapper;
+
+    private static final BigDecimal zero=BigDecimal.ZERO;
+
+    @Override
+    public Map<String, Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) {
+        Map<String, Object> result = new HashMap<>();
+        JSONObject after;
+        JSONObject before;
+        if (startDate.equals(endDate)) {
+            after = kuaiShouAccountReportMapper.queryTodaySumReportBy(startDate, accounts);
+            if (after == null) {
+                return result;
+            }
+            before = kuaiShouAccountReportMapper.queryTodaySumByHour(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), after.getInteger("maxHour"), accounts);
+            if(before==null){
+                before = after;
+            }
+        } else {
+            after = kuaiShouAccountReportMapper.querySumByStartEndDate(endDate, startDate, accounts);
+            if(after==null){
+                return result;
+            }
+            before = after;
+        }
+        result.put("Sum", getSumLink(mediaId, discount, after, before));
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
+        List<JSONObject> result=new ArrayList<>();
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
+        if (startDate.equals(endDate)) {
+            List<JSONObject> after = kuaiShouAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
+            List<JSONObject> before = kuaiShouAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
+            if(after.size()==0){
+                return result;
+            }
+            if(before.size()==0){
+                before=nullDataHandle();
+            }
+            List<JSONObject> afterDis = this.countDiscountCost(mediaId, discount, after);
+            List<JSONObject> beforeDis = this.countDiscountCost(mediaId, discount, before);
+            result = LinkUtils.getCompareDate(beforeDis, afterDis, "statHour");
+        } else {
+            List<JSONObject> after;
+            //判断是不是日期间隔大于半年
+            if(DateUtils.isMoreSixMonth(startDate,endDate)){
+                after = kuaiShouAccountReportMapper.queryDetailGroupMonthByDate(endDate, startDate, accounts);
+            }
+            else {
+                after = kuaiShouAccountReportMapper.queryDetailByStartEndDate(endDate, startDate, accounts);
+            }
+            if(after==null){
+                return result;
+            }
+            result = this.countDiscountCost(mediaId, discount, after);
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+        List<JSONObject> result;
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
+        if (startDate.equals(endDate)) {
+            result = kuaiShouAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
+            JSONObject afterSum = kuaiShouAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);
+            JSONObject beforeSum = kuaiShouAccountReportMapper.querySumByHour(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts);
+            result.add(afterSum);
+            result.add(beforeSum);
+            result.add(countTotal(afterSum, beforeSum));
+        } else {
+            if(accounts.size()>1){
+                result = kuaiShouAccountReportMapper.querySumByDateGroupAccount(filedAll, endDate, startDate, accounts, target, order);
+            }else{
+                result = kuaiShouAccountReportMapper.querySumByDateGroupAccountAndDate(filedAll, endDate, startDate, accounts, target, order);
+            }
+            result.add(kuaiShouAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts));
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+        List<JSONObject> result;
+        if (startDate.equals(endDate)) {
+            result = kuaiShouAccountReportMapper.queryTodaySumByHourGroupAccount(filed, startDate, hour, accounts, target, order);
+        } else {
+            result = kuaiShouAccountReportMapper.querySumByDateGroupAccount(filed, endDate, startDate, accounts, target, order);
+        }
+        return result;
+    }
+
+    //计算汇总数据环比
+    private Map<String, Object> getSumLink(String mediaId, BigDecimal discount, JSONObject after, JSONObject before) {
+
+        Map<String, Object> result = new HashMap<>();
+
+        JSONObject costLink = new JSONObject();
+        JSONObject discountCostLink = new JSONObject();
+        JSONObject photoClickLink = new JSONObject();
+        JSONObject photoShowLink = new JSONObject();
+        JSONObject aClickLink = new JSONObject();
+
+        costLink.put("cost", after.getBigDecimal("cost"));
+        costLink.put("CostSumLink", LinkUtils.countLink(after.getBigDecimal("cost"), before.getBigDecimal("cost")));
+        if (mediaId.equals(CtopAdConstant.PLATFORM_TYPE_KUAISHOU)) {
+            discountCostLink.put("discountCost", after.getBigDecimal("cost").divide(discount, 4, RoundingMode.HALF_UP));
+            discountCostLink.put("discountCostLink", LinkUtils.countLink(after.getBigDecimal("cost").divide(discount, 4, RoundingMode.HALF_UP), before.getBigDecimal("cost").divide(discount, 4, RoundingMode.HALF_UP)));
+        } else {
+            discountCostLink.put("discountCost", after.getBigDecimal("cost").multiply(discount));
+            discountCostLink.put("discountCostLink", LinkUtils.countLink(after.getBigDecimal("cost").multiply(discount), before.getBigDecimal("cost").multiply(discount)));
+        }
+        photoClickLink.put("photoClick", after.getBigDecimal("photoClick"));
+        photoClickLink.put("photoClickLink", LinkUtils.countLink(after.getBigDecimal("photoClick"), before.getBigDecimal("photoClick")));
+        photoShowLink.put("photoShow", after.getBigDecimal("photoShow"));
+        photoShowLink.put("photoShowLink", LinkUtils.countLink(after.getBigDecimal("photoShow"), before.getBigDecimal("photoShow")));
+        aClickLink.put("aClick", after.getBigDecimal("aClick"));
+        aClickLink.put("aClickLink", LinkUtils.countLink(after.getBigDecimal("aClick"), before.getBigDecimal("aClick")));
+        result.put("costLink", costLink);
+        result.put("discountCostLink", discountCostLink);
+        result.put("photoClickLink", photoClickLink);
+        result.put("photoShowLink", photoShowLink);
+        result.put("aClickLink", aClickLink);
+        return result;
+    }
+
+    //计算折后消耗
+    private List<JSONObject> countDiscountCost(String mediaId, BigDecimal discount, List<JSONObject> data) {
+        if (data.isEmpty()) {
+            return data;
+        }
+        if (mediaId.equals(CtopAdConstant.PLATFORM_TYPE_KUAISHOU)) {
+            data.forEach(it -> {
+                it.put("discountCost", it.getBigDecimal("cost").divide(discount, 4, RoundingMode.HALF_UP));
+            });
+        } else {
+            data.forEach(it -> {
+                it.put("discountCost", it.getBigDecimal("cost").multiply(discount));
+            });
+        }
+        return data;
+    }
+
+    //计算总计环比
+    private JSONObject countTotal(JSONObject after, JSONObject before) {
+        JSONObject jsonObject = new JSONObject();
+        after.forEach((k, v) -> {
+            //去除没法计算的字段
+            if (k.equals("accountId") || k.equals("authName") || v.toString().contains("%")) {
+                jsonObject.put(k, "-");
+            } else {
+                jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k)==null?zero:after.getBigDecimal(k), before.getBigDecimal(k)==null?zero:before.getBigDecimal(k)));
+            }
+        });
+        return jsonObject;
+    }
+
+    private List<JSONObject> nullDataHandle(){
+        List<JSONObject> objectList= new ArrayList<>();
+        JSONObject jsonObject;
+        for(int i=0;i<24;i++){
+            jsonObject=new JSONObject();
+            jsonObject.put("cost",0);
+            jsonObject.put("photoShow",0);
+            jsonObject.put("photoClick",0);
+            jsonObject.put("aClick",0);
+            jsonObject.put("statHour",i);
+            objectList.add(jsonObject);
+        }
+        return objectList;
+    }
+}

+ 100 - 30
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java

@@ -1,32 +1,40 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.utils.Base64Utils;
+import cn.com.ctop.common.module.utils.ChaojiyingUtils;
 import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAgentAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouDailyAgentMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAgentAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.jeecg.common.util.DateUtils;
-import org.openqa.selenium.By;
-import org.openqa.selenium.Cookie;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.*;
 import org.openqa.selenium.chrome.ChromeDriver;
 import org.openqa.selenium.chrome.ChromeOptions;
+import org.openqa.selenium.interactions.Actions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -42,17 +50,32 @@ import java.util.*;
 @Service
 public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouReportDailyAgentMapper, KuaishouReportDailyAgent> implements IKuaishouReportDailyAgentService {
     @Autowired
-    private KuaishouReportDailyAgentMapper kuaishouReportDailyAgentMapper;
+    private KuaiShouDailyAgentMapper kuaiShouDailyAgentMapper;
     @Autowired
     private KuaishouReportDailyAgentSumMapper kuaishouReportDailyAgentSumMapper;
     @Autowired
     private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
+    @Value("${jeecg.path.kuaishou-agent-image}")
+    private String kuaishouAgentImage;
 
     @Override
-    public void replaceBatch(List<KuaishouReportDailyAgent> list) {
-        kuaishouReportDailyAgentMapper.replaceBatch(list);
+    public void replaceBatch(List<KuaiShouDailyAgent> list) {
+        for(KuaiShouDailyAgent agent:list){
+            kuaiShouDailyAgentMapper.insert(agent);
+        }
+    }
+
+    private void tapPoint(WebDriver driver, Integer x, Integer y) {
+        WebElement element = driver.findElement(By.tagName("iframe"));
+        Actions actions = new Actions(driver);
+        actions.moveToElement(element,x,y).click().perform();
+        try {
+            Thread.sleep(500L);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
     }
 
     public boolean loginAgent() {
@@ -86,7 +109,27 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
             //点击登录
             loginElement.click();
             Thread.sleep(3000L);
-
+            if (null!=webDriverGetElement(webDriver,By.tagName("iframe"))) {
+                log.error("【错误】快手登录出现验证码!");
+                File scrFile = captureElement(webDriver.findElement(By.tagName("iframe")));
+                //clickCharBg
+                FileUtils.copyFile(scrFile, new File(kuaishouAgentImage));
+                String result = ChaojiyingUtils.process(Base64Utils.imageToBase64(kuaishouAgentImage),9104);
+                String pointString = JSONObject.parseObject(result).getString("pic_str");
+                String[] split = pointString.split("\\|");
+                if(split.length>0){
+                    for(int i=0;i<split.length;i++){
+                        String pointStr = split[i];
+                        String [] taps = pointStr.split(",");
+                        tapPoint(webDriver,Integer.parseInt(taps[0]),Integer.parseInt(taps[1]));
+                    }
+                }
+                webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
+                webDriver.findElement(By.xpath("//div[@class='opArea']/span[@id='submit']")).click();
+            }
+            Thread.sleep(3000L);
+            webDriver.get("https://agent.e.kuaishou.com/#/index");
+            Thread.sleep(3000L);
             Set<Cookie> cookies = webDriver.manage().getCookies();
             Iterator iterator = cookies.iterator();
             while (iterator.hasNext()) {
@@ -116,6 +159,32 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
         return loginStatus;
     }
 
+    private WebElement webDriverGetElement(WebDriver webDriver,By by){
+        try {
+            return webDriver.findElement(by);
+        }catch (NoSuchElementException e){
+            return null;
+        }
+    }
+
+    public File captureElement(WebElement element) throws Exception {
+        WrapsDriver wrapsDriver = (WrapsDriver) element;
+        // 截图整个页面
+        File screen = ((TakesScreenshot) wrapsDriver.getWrappedDriver()).getScreenshotAs(OutputType.FILE);
+        FileUtils.copyFile(screen, new File(kuaishouAgentImage));
+        BufferedImage img = ImageIO.read(new File(kuaishouAgentImage));
+        // 获得元素的高度和宽度
+        int width = element.getSize().getWidth();
+        int height = element.getSize().getHeight();
+        // 得到元素的坐标
+        Point p = element.getLocation();
+        BufferedImage dest = img.getSubimage(p.x, p.y, width, height);
+        // 存为png格式
+        ImageIO.write(dest, "png", screen);
+        return screen;
+    }
+
+
     @Override
     public boolean getAccount(int currentPage) {
         boolean hasNextPage = false;
@@ -174,7 +243,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
     public void getReport(String startDate, String endDate) {
         try {
             if (!loginAgent()) {
-                return;
+                return; 
             }
             String currentDate = startDate;
             Map<String, String> headerMap = new HashMap<>();
@@ -197,7 +266,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                 if (code == 1) {
                     Iterator<JsonNode> iterator1 = resultNode.get("data").elements();
                     int i = 0;
-                    List<KuaishouReportDailyAgent> reportList = new ArrayList<>();
+                    List<KuaiShouDailyAgent> reportList = new ArrayList<>();
                     while (iterator1.hasNext()) {
                         JsonNode dataNode = iterator1.next();
                         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -208,7 +277,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                             kuaishouReportDailyAgentSum.setConvertCount(dataNode.get("actionbarClick").asLong());
                             kuaishouReportDailyAgentSum.setCost(dataNode.get("totalChargedInYuan").decimalValue());
                             kuaishouReportDailyAgentSum.setCostCampaignCount(dataNode.get("chargedCampaignCount").asLong());
-                            //-   kuaishouReportDailyAgentSum.setDate(sdf.parse(currentDate));
+                            kuaishouReportDailyAgentSum.setDate(currentDate);
                             kuaishouReportDailyAgentSum.setFengmianClickCount(dataNode.get("adPhotoClick").asLong());
                             kuaishouReportDailyAgentSum.setFengmianClickRate(dataNode.get("clickRatio").decimalValue());
                             kuaishouReportDailyAgentSum.setFengmianShowCount(dataNode.get("impression").asLong());
@@ -223,26 +292,27 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
                             kuaishouReportDailyAgentSumMapper.delete(queryWrapper);
                             kuaishouReportDailyAgentSumMapper.insert(kuaishouReportDailyAgentSum);
                         } else {
-                            KuaishouReportDailyAgent kuaishouReportDailyAgent = new KuaishouReportDailyAgent();
-                            kuaishouReportDailyAgent.setAccountId(dataNode.get("accountId").asInt());
-                            kuaishouReportDailyAgent.setAdvertiserCreateTime(new Date(dataNode.get("createTime").asLong()));
-                            kuaishouReportDailyAgent.setAdvertiserName(dataNode.get("accountName").asText());
-                            kuaishouReportDailyAgent.setBalance(dataNode.get("totalBalanceDouble").decimalValue());
+                            KuaiShouDailyAgent kuaishouReportDailyAgent = new KuaiShouDailyAgent();
+                            kuaishouReportDailyAgent.setAccountId(dataNode.get("accountId").asLong());
+//                            kuaishouReportDailyAgent.setAdvertiserCreateTime(new Date(dataNode.get("createTime").asLong()));
+                            kuaishouReportDailyAgent.setAccountName(dataNode.get("accountName").asText());
+                            kuaishouReportDailyAgent.setTotalBalanceInYuan(dataNode.get("totalBalanceDouble").decimalValue());
                             // kuaishouReportDailyAgent.setConvertClickRate(dataNode.get("actionbarClickRatio").decimalValue());
-                            kuaishouReportDailyAgent.setConvertCount(dataNode.get("actionbarClick").asInt());
-                            kuaishouReportDailyAgent.setCost(dataNode.get("totalChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgent.setCostCampaignCount(dataNode.get("chargedCampaignCount").asInt());
-                            //      kuaishouReportDailyAgent.setDate(sdf.parse(dataNode.get("dateTime").asText()));
-                            kuaishouReportDailyAgent.setFengmianClickCount(dataNode.get("adPhotoClick").asInt());
-                            // kuaishouReportDailyAgent.setFengmianClickRate(dataNode.get("clickRatio").decimalValue());
-                            kuaishouReportDailyAgent.setFengmianShowCount(dataNode.get("impression").asInt());
-                            kuaishouReportDailyAgent.setFandianCost(dataNode.get("rebateRealChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgent.setJiliCost(dataNode.get("directRebateRealChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgent.setKid(dataNode.get("userId").asInt());
-                            kuaishouReportDailyAgent.setKuangfanCost(dataNode.get("contractRebateRealChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgent.setSucaiShowCount(dataNode.get("click").asInt());
-                            kuaishouReportDailyAgent.setXianjinCost(dataNode.get("realChargedInYuan").decimalValue());
-                            kuaishouReportDailyAgent.setXinyongCost(dataNode.get("creditRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setAdItemClick(dataNode.get("actionbarClick").asLong());
+                            kuaishouReportDailyAgent.setTotalChargedInYuan(dataNode.get("totalChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setChargedCampaignCount(dataNode.get("chargedCampaignCount").asLong());
+                            kuaishouReportDailyAgent.setDateTime(dataNode.get("dateTime").asText());
+                            kuaishouReportDailyAgent.setAdPhotoClick(dataNode.get("adPhotoClick").asLong());
+                            kuaishouReportDailyAgent.setPhotoClickRatio(dataNode.get("clickRatio").asText());
+                            kuaishouReportDailyAgent.setAdPhotoImpression(dataNode.get("impression").asLong());
+                            kuaishouReportDailyAgent.setTotalRebateRealChargedInYuan(dataNode.get("rebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setDirectRebateRealChargedInYuan(dataNode.get("directRebateRealChargedInYuan").decimalValue());
+                            //猜测可能是agentId
+                            kuaishouReportDailyAgent.setAgentId(14L);
+                            kuaishouReportDailyAgent.setContractRebateRealChargedInYuan(dataNode.get("contractRebateRealChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setAdItemImpression(dataNode.get("click").asLong());
+                            kuaishouReportDailyAgent.setRealChargedInYuan(dataNode.get("realChargedInYuan").decimalValue());
+                            kuaishouReportDailyAgent.setCreditRealChargedInYuan(dataNode.get("creditRealChargedInYuan").decimalValue());
                             reportList.add(kuaishouReportDailyAgent);
                         }
                         i++;

+ 49 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/utils/LinkUtils.java

@@ -0,0 +1,49 @@
+package cn.com.ctop.kuaishou.modules.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by JQ.bi on 2020.08.23
+ */
+public class LinkUtils {
+
+
+    //数据对比,环比计算
+    public static List<JSONObject> getCompareDate(List<JSONObject> beforeData, List<JSONObject> AfterData, String standard) {
+        List<JSONObject> result = new ArrayList<>();
+        beforeData.forEach(before -> {
+            String yesStat = String.valueOf(before.get(standard));
+            AfterData.forEach(after -> {
+                if ((String.valueOf(after.get(standard))).equals(yesStat)) {
+                    //消耗较昨日环比
+                    after.put("costProportion", countLink(after.getBigDecimal("cost"), before.getBigDecimal("cost")));
+                    //展示量较昨日环比
+                    after.put("photoShowProportion", countLink(BigDecimal.valueOf(after.getLong("photoShow")), BigDecimal.valueOf(before.getLong("photoShow"))));
+                    //点击量较昨日环比
+                    after.put("photoClickProportion", countLink(BigDecimal.valueOf(after.getLong("photoClick")), BigDecimal.valueOf(before.getLong("photoClick"))));
+                    if(after.getLong("aClick")!=null){
+                        after.put("aClickProportion", countLink(BigDecimal.valueOf(after.getLong("aClick")), BigDecimal.valueOf(before.getLong("aClick"))));
+                    }
+                    before.put("afterData", after);
+                }
+            });
+            result.add(before);
+        });
+        return result;
+    }
+
+    //环比计算
+    public static BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
+        BigDecimal link = new BigDecimal(0);
+        if (!(numB.compareTo(BigDecimal.ZERO)==0)) {
+            link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
+        }
+        return link;
+    }
+
+}

+ 186 - 0
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -0,0 +1,186 @@
+{
+  "cost": {
+    "filed": "sum(t1.charge) as cost ",
+    "comment": "消耗"
+  },
+  "photoShow": {
+    "filed": "sum(t1.photo_show) as photoShow ",
+    "comment": "封面曝光数"
+  },
+  "photoClick": {
+    "filed": "sum(t1.photo_click) as photoClick ",
+    "comment": "封面点击数"
+  },
+  "aClick": {
+    "filed": "sum(t1.aclick) as aClick ",
+    "comment": "素材曝光数"
+  },
+  "bClick": {
+    "filed": "sum(t1.bclick) as bClick ",
+    "comment": "行为数"
+  },
+  "clickRate": {
+    "filed": "CASE WHEN sum(t1.photo_click) / sum(t1.photo_show) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.photo_click) / sum(t1.photo_show)) * 100,2),'%') END AS clickRate ",
+    "comment": "封面点击率"
+  },
+  "bClickRate": {
+    "filed": "CASE WHEN sum(t1.bclick) / sum(t1.aclick) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.bclick) / sum(t1.aclick)) * 100,2),'%') 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": "sum(download_started) 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.download_started) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.download_started) / sum(t1.bclick)*100,2),'%') end AS downloadStartRate ",
+    "comment": "安卓开始下载率"
+  },
+  "downloadFinish": {
+    "filed": "sum(download_completed) 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_completed) / sum(t1.download_started) IS NULL THEN 0 ELSE  concat(round(sum(t1.download_completed) / sum(t1.download_started)*100,2),'%') end AS downloadFinishRate ",
+    "comment": "安卓下载完成率"
+  },
+  "active": {
+    "filed": "sum(activation) 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": "激活单价"
+  },
+  "activeRate": {
+    "filed": "CASE WHEN sum(t1.activation) / sum(t1.download_completed) IS NULL THEN 0 ELSE concat(round(sum(t1.activation) / sum(t1.download_completed)*100,2),'%') end as activeRate ",
+    "comment": "下载完成激活率"
+  },
+  "firstDayPay": {
+    "filed": "sum(t1.event_pay_first_day) as firstDayPay  ",
+    "comment": "首日付费次数"
+  },
+  "firstDayPayAmount": {
+    "filed": "sum(t1.event_pay_purchase_amount_first_day) 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": "sum(t1.event_pay) as eventPay  ",
+    "comment": "付费次数"
+  },
+  "eventPayPurchaseAmount": {
+    "filed": "sum(t1.event_pay_purchase_amount) 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": "sum(t1.event_register) 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.event_register) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_register) / sum(t1.activation)*100,2),'%') end as activeRegisterRate ",
+    "comment": "注册率"
+  },
+  "eventJinJianApp": {
+    "filed": "sum(event_jin_jian_app) 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": "sum(event_credit_grant_app) 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_credit_grant_app) / sum(t1.event_jin_jian_app) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_app) / sum(t1.event_jin_jian_app)*100,2),'%') end as eventCreditGrantAppRate ",
+    "comment": "授信率"
+  },
+  "formCount": {
+    "filed": "sum(t1.form_count) as formCount ",
+    "comment": "表单提交数"
+  },
+  "formCountRate": {
+    "filed": "CASE WHEN sum(t1.form_count) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.form_count) / sum(t1.activation)*100,2),'%') 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 eventCreditGrantAppCost ",
+    "comment": "授信成本"
+  },
+  "eventJinJianLandingPage": {
+    "filed": "sum(t1.event_jin_jian_landing_page) 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": "sum(t1.event_credit_grant_landing_page) 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_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') end as formCountRate ",
+    "comment": "落地页授信率"
+  },
+  "submit": {
+    "filed": "sum(t1.submit) 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.submit) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.submit) / sum(t1.bclick)*100,2),'%') end as submitRate ",
+    "comment": "按钮点击率"
+  }
+}

+ 3 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -113,11 +114,11 @@ public class BytedanceAccountReportCtrl {
         if(columns.isEmpty()){
             log.error("请选择需要导出的字段");
         }
-        String filed= JsonResourceUtil.joinFiled(columns);
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMap,columns);
         List<String> titles= new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMap,columns));
         //此处增加两个元素是为了保证数据有序
         columns.add(0,"accountId");
         columns.add(1,"authName");

+ 3 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -11,6 +11,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.constant.AccountReportConstants;
 import org.jeecg.common.constant.SystemDateConstant;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
@@ -65,7 +66,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
         List<JSONObject> result=new ArrayList<>();
-        String filedAll = JsonResourceUtil.joinAllFiled();
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
         if (startDate.equals(endDate)) {
             List<JSONObject> after = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
             List<JSONObject> before = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
@@ -98,7 +99,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
-        String filedAll = JsonResourceUtil.joinAllFiled();
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
         if (startDate.equals(endDate)) {
             result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
             JSONObject afterSum = bytedanceAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);