Jelajahi Sumber

Merge branch 'test' into test-report

# Conflicts:
#	jeecg-boot-module-system/src/main/resources/application-dev.yml
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
yumeng 5 tahun lalu
induk
melakukan
45f699f004
40 mengubah file dengan 926 tambahan dan 201 penghapusan
  1. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java
  2. 0 2
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ureport/ServletConfig.java
  4. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  5. 33 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java
  6. 179 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  7. 0 84
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java
  8. 128 52
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  9. 89 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaItemInfo.java
  10. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaRoleInfo.java
  11. 45 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BakDataBaseJob.java
  12. 4 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java
  13. 25 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCreativeReportLoadJob.java
  14. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/DramaItemInfoMapper.java
  15. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaItemInfoMapper.xml
  16. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaItemInfoService.java
  17. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaRoleInfoService.java
  18. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaItemInfoServiceImpl.java
  19. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaRoleInfoServiceImpl.java
  20. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/controller/QuartzJobController.java
  21. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java
  22. 4 8
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  23. 1 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  24. 122 5
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  25. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java
  26. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  27. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java
  28. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java
  29. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  30. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCampaignServiceImpl.java
  31. 72 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  32. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  33. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAgentSumMapper.xml
  34. 2 1
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java
  35. 1 1
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedancePlanDailyReportMapper.java
  36. 6 8
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml
  37. 1 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedancePlanDailyReportService.java
  38. 10 7
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceCreativeDailyReportServiceImpl.java
  39. 2 4
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedancePlanDailyReportServiceImpl.java
  40. 3 3
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

+ 1 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/system/query/QueryGenerator.java

@@ -357,7 +357,7 @@ public class QueryGenerator {
 			return;
 		}
 		name = oConvertUtils.camelToUnderline(name);
-		log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
+//		log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
 		switch (rule) {
 		case GT:
 			queryWrapper.gt(name, value);

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

@@ -143,8 +143,6 @@ public class ShiroConfig {
 		//爬虫接口
 		filterChainDefinitionMap.put("/graphql/video", "anon");
 		filterChainDefinitionMap.put("/ks/web/test", "anon");
-		filterChainDefinitionMap.put("/ctop/materialInfo/excellent/set", "anon");
-        filterChainDefinitionMap.put("/ctop/materialInfo/excellent/list", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
 
 		// 添加自己的过滤器并且取名为jwt

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ureport/ServletConfig.java

@@ -9,7 +9,7 @@ import org.springframework.context.annotation.ImportResource;
 import javax.servlet.Servlet;
 
 @Configuration
-//@ImportResource("classpath:ureport-console-context.xml")
+@ImportResource("classpath:ureport-console-context.xml")
 public class ServletConfig {
 
     @Bean

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

@@ -217,13 +217,13 @@ public class CallbackController {
 
                     //账号绑定
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiserId);
-                    Thread t = new Thread() {
+                   /* Thread t = new Thread() {
                         @Override
                         public void run() {
                             kuaishouInterfaceService.loadKuaishouDataSingle(topOauthToken);
                         }
                     };
-                    t.start();
+                    t.start();*/
                 }
                 return "授权绑定成功";
             }
@@ -313,6 +313,7 @@ public class CallbackController {
             if (!Check.isNull(checkUserAllocation)) {
                 returnMap.put("code", -1);
                 returnMap.put("desc", "授权失败,账号已被:" + checkUserAllocation.getUserName() + "绑定");
+                return returnMap;
             }
 
             String systemType = json.getString("systemType");

+ 33 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,17 +14,18 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.DramaInfo;
+import org.jeecg.modules.ctop.entity.DramaItemInfo;
+import org.jeecg.modules.ctop.entity.DramaRoleInfo;
 import org.jeecg.modules.ctop.service.IDramaInfoService;
+import org.jeecg.modules.ctop.service.IDramaItemInfoService;
+import org.jeecg.modules.ctop.service.IDramaRoleInfoService;
 import org.jeecg.modules.system.entity.SysCategory;
 import org.jeecg.modules.system.service.ISysCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 剧本信息
@@ -38,8 +41,33 @@ public class DramaInfoController {
 	@Autowired
 	private IDramaInfoService dramaInfoService;
 	@Autowired
+	private IDramaItemInfoService dramaItemInfoService;
+	@Autowired
+	private IDramaRoleInfoService dramaRoleInfoService;
+	@Autowired
 	private ISysCategoryService categoryService;
 
+	@GetMapping("/detail")
+	public Map<String, Object> getDetail(Long dramaId) {
+		Map<String, Object> result = new HashMap<>();
+		List<DramaItemInfo> itemInfos = dramaItemInfoService.getByDramaId(dramaId);
+		List<DramaRoleInfo> roleInfos = dramaRoleInfoService.getByDramaId(dramaId);
+		List<DramaRoleInfo> returnRoleInfos = new ArrayList<>();
+		DramaRoleInfo dramaRoleInfo1 = new DramaRoleInfo("情节描述", "scence");
+		returnRoleInfos.add(dramaRoleInfo1);
+		if (null != roleInfos && roleInfos.size() > 0) {
+			for (DramaRoleInfo roleInfo : roleInfos) {
+				roleInfo.setButtonType("dialogue_" + roleInfo.getId());
+				returnRoleInfos.add(roleInfo);
+			}
+		}
+		DramaRoleInfo dramaRoleInfo2 = new DramaRoleInfo("创建角色", "createRole");
+		returnRoleInfos.add(dramaRoleInfo2);
+		result.put("itemInfos", itemInfos);
+		result.put("roleInfos", returnRoleInfos);
+		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+		return result;
+	}
 	/**
 	  * 分页列表查询
 	 * @param dramaInfo
@@ -109,7 +137,7 @@ public class DramaInfoController {
 	 */
 	@AutoLog(value = "剧本信息-编辑")
 	@ApiOperation(value="剧本信息-编辑", notes="剧本信息-编辑")
-	@PutMapping(value = "/edit")
+	@PostMapping(value = "/edit")
 	public Result<DramaInfo> edit(@RequestBody DramaInfo dramaInfo) {
 		Result<DramaInfo> result = new Result<DramaInfo>();
 		DramaInfo dramaInfoEntity = dramaInfoService.getById(dramaInfo.getId());

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

@@ -0,0 +1,179 @@
+package org.jeecg.modules.ctop.controller;
+
+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.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.ctop.entity.DramaItemInfo;
+import org.jeecg.modules.ctop.service.IDramaItemInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * 剧本内容信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-06
+ */
+@Slf4j
+@Api(tags = "剧本内容信息")
+@RestController
+@RequestMapping("/ctop/dramaItemInfo")
+public class DramaItemInfoController {
+    @Autowired
+    private IDramaItemInfoService dramaItemInfoService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param dramaItemInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-分页列表查询")
+    @ApiOperation(value = "剧本内容信息-分页列表查询", notes = "剧本内容信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<DramaItemInfo>> queryPageList(DramaItemInfo dramaItemInfo,
+                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      HttpServletRequest req) {
+        Result<IPage<DramaItemInfo>> result = new Result<IPage<DramaItemInfo>>();
+        QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
+        Page<DramaItemInfo> page = new Page<DramaItemInfo>(pageNo, pageSize);
+        IPage<DramaItemInfo> pageList = dramaItemInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param dramaItemInfo
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-添加")
+    @ApiOperation(value = "剧本内容信息-添加", notes = "剧本内容信息-添加")
+    @PostMapping(value = "/add")
+    public Result<DramaItemInfo> add(@RequestBody DramaItemInfo dramaItemInfo) {
+        Result<DramaItemInfo> result = new Result<>();
+        try {
+            String buttonType = dramaItemInfo.getButtonType();
+            if (buttonType.startsWith("dialogue")) {
+                dramaItemInfo.setType("dialogue");
+                String[] infos = buttonType.split("_");
+                dramaItemInfo.setRoleId(Long.parseLong(infos[1]));
+            } else if (buttonType.startsWith("scence")) {
+                dramaItemInfo.setType("scence");
+            }
+            dramaItemInfoService.save(dramaItemInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param dramaItemInfo
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-编辑")
+    @ApiOperation(value = "剧本内容信息-编辑", notes = "剧本内容信息-编辑")
+    @PostMapping(value = "/edit")
+    public Result<DramaItemInfo> edit(@RequestBody DramaItemInfo dramaItemInfo) {
+        Result<DramaItemInfo> result = new Result<>();
+        DramaItemInfo dramaItemInfoEntity = dramaItemInfoService.getById(dramaItemInfo.getId());
+        if (dramaItemInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            String buttonType = dramaItemInfo.getButtonType();
+            if (buttonType.startsWith("dialogue")) {
+                dramaItemInfo.setType("dialogue");
+                String[] infos = buttonType.split("_");
+                dramaItemInfo.setRoleId(Long.parseLong(infos[1]));
+            } else if (buttonType.startsWith("scence")) {
+                dramaItemInfo.setType("scence");
+            }
+            boolean ok = dramaItemInfoService.updateById(dramaItemInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-通过id删除")
+    @ApiOperation(value = "剧本内容信息-通过id删除", notes = "剧本内容信息-通过id删除")
+    @PostMapping(value = "/delete")
+    public Result<?> delete(@RequestBody DramaItemInfo dramaItemInfo) {
+        try {
+            dramaItemInfoService.removeById(dramaItemInfo.getId());
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-批量删除")
+    @ApiOperation(value = "剧本内容信息-批量删除", notes = "剧本内容信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<DramaItemInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.dramaItemInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "剧本内容信息-通过id查询")
+    @ApiOperation(value = "剧本内容信息-通过id查询", notes = "剧本内容信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<DramaItemInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<DramaItemInfo> result = new Result<DramaItemInfo>();
+        DramaItemInfo dramaItemInfo = dramaItemInfoService.getById(id);
+        if (dramaItemInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(dramaItemInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+}

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

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-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;
@@ -10,28 +9,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.ctop.entity.DramaRoleInfo;
 import org.jeecg.modules.ctop.service.IDramaRoleInfoService;
-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;
 
 /**
  * 剧本角色信息
@@ -177,72 +161,4 @@ public class DramaRoleInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<DramaRoleInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                DramaRoleInfo dramaRoleInfo = JSON.parseObject(deString, DramaRoleInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(dramaRoleInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<DramaRoleInfo> pageList = dramaRoleInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "剧本角色信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, DramaRoleInfo.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<DramaRoleInfo> listDramaRoleInfos = ExcelImportUtil.importExcel(file.getInputStream(), DramaRoleInfo.class, params);
-                dramaRoleInfoService.saveBatch(listDramaRoleInfos);
-                return Result.ok("文件导入成功!数据行数:" + listDramaRoleInfos.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("文件导入失败!");
-    }
-
 }

+ 128 - 52
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -13,8 +13,12 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeStatisticMapper;
 import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -161,34 +165,121 @@ public class TestController {
     }
 
 
-    @GetMapping(value = "/gerCreativeReport")
-    public void gerCreativeReport() {
+    @Autowired
+    private IKuaiShouCampaignService campaignService;
+
+    @GetMapping(value = "/getCreativeReportByAccount")
+    public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr) {
         Thread thread = new Thread() {
             @SneakyThrows
             @Override
             public void run() {
                 SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-                Date startDate = sim.parse("2020-02-10");
-                Date endDate = sim.parse("2020-02-11");
+                Date startDate = sim.parse(startDateStr);
+                Date endDate = sim.parse(endDateStr);
                 //1:查询当日数据
                 //executorService = Executors.newFixedThreadPool(3);
                 QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
                 oauthTokenQueryWrapper.eq("media_id", 2);
-                List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
-                for (CtopOauthToken token : ctopOauthTokens) {
+                oauthTokenQueryWrapper.eq("account_id", accountId);
+                CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+
+                System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
+                QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+                campaignQueryWrapper.eq("account_id", accountId);
+                List<KuaiShouCampaign> list = campaignService.list(campaignQueryWrapper);
+                if (!Check.isNull(list)) {
+                    for (KuaiShouCampaign campaign : list) {
+                        kuaishouInterfaceService.getAdvertiserCreativeReportDailyV2(campaign.getCampaignId(), ctopOauthToken, startDate, endDate);
+
+                    }
+
+                }
+
+
+            }
+        };
+        thread.start();
+    }
+
+
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private KuaishouReportDailyCreativeStatisticMapper reportDailyCreativeStatisticMapper;
+
+
+    @Autowired
+    private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
+
+    @GetMapping(value = "/getCreativeReportByProjectId")
+    public void getCreativeReportByProjectId(Long projectId) {
+
+        try {
+            Map<String, Object> deleteMap = new HashMap<>();
+            String date = DateUtils.getDate("yyyy-MM-dd");
+            String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date endDate = simpleDateFormat.parse(anotherDay);
+            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+            userAllocationQueryWrapper.eq("project_id", projectId);
+            List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
+            if (!Check.isNull(list)) {
+                for (UserAllocation allocation : list) {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            System.err.println("创意报表accountId:" + token.getAccountId());
-                            kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, startDate, endDate);
+                            if (!Check.isNull(allocation)) {
+                                log.info("账号id:{}", allocation.getAccountId());
+
+                                QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+                                oauthTokenQueryWrapper.eq("media_id", 2);
+                                oauthTokenQueryWrapper.eq("account_id", allocation.getAccountId());
+                                CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+                                if (!Check.isNull(ctopOauthToken)) {
+                                    deleteMap.put("account_id", allocation.getAccountId());
+                                    deleteMap.put("stat_date", anotherDay);
+                                    //   reportDailyCreativeStatisticMapper.deleteByMap(deleteMap);
+                                    //  reportDailyCreativeMapper.deleteByMap(deleteMap);
+
+                                    // 1.计划数据
+                                    log.info("获取计划,账号id:{}", allocation.getAccountId());
+                                    kuaishouInterfaceService.getCampaignList(ctopOauthToken, null, null);
+                                    // 2:广告组数据
+                                    log.info("获取广告组,账号id:{}", allocation.getAccountId());
+                                    kuaishouInterfaceService.getGroupList(ctopOauthToken, null, null);
+                                    // 3:创意数据
+                                    log.info("获取创意,账号id:{}", allocation.getAccountId());
+                                    kuaishouInterfaceService.getCreativeList(ctopOauthToken, null, null);
+
+                                    QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+                                    campaignQueryWrapper.eq("account_id", ctopOauthToken.getAccountId());
+                                    log.info("获取创意报表,账号id:{}", allocation.getAccountId());
+                                    List<KuaiShouCampaign> campaigns = campaignService.list(campaignQueryWrapper);
+                                    if (!Check.isNull(campaigns)) {
+                                        for (KuaiShouCampaign campaign : campaigns) {
+                                            kuaishouInterfaceService.getAdvertiserCreativeReportDailyV2(campaign.getCampaignId(), ctopOauthToken, endDate, endDate);
+                                        }
+                                    }
+                                }
+                            }
+
                         }
                     });
 
 
                 }
             }
-        };
-        thread.start();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    public static void main(String[] args) throws ParseException {
+        String date = DateUtils.getDate("yyyy-MM-dd");
+        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
+        System.err.println(anotherDay);
     }
 
 
@@ -199,49 +290,35 @@ public class TestController {
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
-        executorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-
-                    kuaishouInterfaceService.getCampaignList(token, null, null);
-                    //1:获取全量广告组数据
-                    kuaishouInterfaceService.getGroupList(token, null, null);
-
-                    Thread.sleep(1 * 200);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
+        try {
+            System.err.println("获取计划,广告组:" + accountId);
+            kuaishouInterfaceService.getCampaignList(token, null, null);
+            //1:获取全量广告组数据
+            kuaishouInterfaceService.getGroupList(token, null, null);
+            System.err.println("获取计划,广告组:" + accountId);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
 
     }
 
 
-    @GetMapping(value = "/gerCreativeByAccount")
+    @GetMapping(value = "/getCreativeByAccount")
     public void gerCreative(Long accountId) {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
         oauthTokenQueryWrapper.eq("media_id", 2);
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
-        executorService.submit(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    System.err.println("获取创意,accountId:" + token.getAccountId());
-                    kuaishouInterfaceService.getCampaignList(token, null, null);
-                    //1:获取全量广告组数据
-                    kuaishouInterfaceService.getGroupList(token, null, null);
-                    kuaishouInterfaceService.getCreativeList(token, null, null);
 
-                    Thread.sleep(1 * 200);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
+        try {
+            System.err.println("获取创意,accountId:" + token.getAccountId());
+            kuaishouInterfaceService.getCreativeList(token, null, null);
+            System.err.println("获取创意结束,accountId:" + token.getAccountId());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
 
     }
@@ -263,16 +340,23 @@ public class TestController {
                 oauthTokenQueryWrapper.eq("account_id", accountId);
                 CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
                 System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
-                kuaishouInterfaceService.getAdvertiserCreativeReportDaily(ctopOauthToken, startDate, endDate);
 
 
+                QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+                campaignQueryWrapper.eq("account_id", ctopOauthToken.getAccountId());
+
+                List<KuaiShouCampaign> campaigns = campaignService.list(campaignQueryWrapper);
+                if (!Check.isNull(campaigns)) {
+                    for (KuaiShouCampaign campaign : campaigns) {
+                        kuaishouInterfaceService.getAdvertiserCreativeReportDailyV2(campaign.getCampaignId(), ctopOauthToken, endDate, endDate);
+                    }
+                }
+
             }
         };
         thread.start();
     }
 
-    @Autowired
-    private IUserAllocationService userAllocationService;
 
     @Autowired
     private IBytedancePlanDailyReportService planDailyReportService;
@@ -361,7 +445,6 @@ public class TestController {
             log.info("定时获取头条数据异常:为获取到可用的token");
         }
         tokens.forEach(token -> {
-            //3:获取广告计划信息数据
             advertiserDataService.getMaterialList(token);
         });
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
@@ -446,7 +529,6 @@ public class TestController {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    //1: 获取广告主信息数据
                     reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                 }
             });
@@ -493,12 +575,6 @@ public class TestController {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        //清洗关于缘多多数据
-        planDailyReportService.cleanYddData(113, finalGetDate);
-        //清洗关于交友数据
-        planDailyReportService.cleanYddData(112, finalGetDate);
-        //清洗关于附近约会数据
-        planDailyReportService.cleanYddData(222, finalGetDate);
         log.info("头条计划时报数据获取完成");
         Map<String, Object> result = new HashMap<>();
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);

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

@@ -0,0 +1,89 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 剧本内容信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-06
+ */
+@Data
+@TableName("ctop_drama_item_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_drama_item_info对象", description = "剧本内容信息")
+public class DramaItemInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 元素类型1:描述 2:对话
+     */
+    @Excel(name = "元素类型1:描述 2:对话", width = 15)
+    @ApiModelProperty(value = "元素类型1:描述 2:对话")
+    private String type;
+    /**
+     * 剧本id
+     */
+    @Excel(name = "剧本id", width = 15)
+    @ApiModelProperty(value = "剧本id")
+    private Long dramaId;
+    /**
+     * roleId
+     */
+    @Excel(name = "roleId", width = 15)
+    @ApiModelProperty(value = "roleId")
+    private Long roleId;
+    /**
+     * content
+     */
+    @Excel(name = "content", width = 15)
+    @ApiModelProperty(value = "content")
+    private String content;
+    /**
+     * 排序号
+     */
+    @Excel(name = "排序号", width = 15)
+    @ApiModelProperty(value = "排序号")
+    private Integer rank;
+    /**
+     * enabled
+     */
+    @Excel(name = "enabled", width = 15)
+    @ApiModelProperty(value = "enabled")
+    private Integer enabled;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private String roleName;
+
+    @TableField(exist = false)
+    private String buttonType;
+
+}

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -62,4 +63,15 @@ public class DramaRoleInfo {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+
+    @TableField(exist = false)
+    private String buttonType;
+
+    public DramaRoleInfo(String name, String buttonType) {
+        this.name = name;
+        this.buttonType = buttonType;
+    }
+
+    public DramaRoleInfo() {
+    }
 }

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

@@ -0,0 +1,45 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.Date;
+
+@Slf4j
+public class BakDataBaseJob implements Job {
+    @Value("${spring.datasource.master.username}")
+    private String userName;
+    @Value("${spring.datasource.master.password}")
+    private String password;
+    @Value("${jeecg.path.bak-database-file}")
+    private String filePath;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        String currentFileName = filePath + "db-" + DateUtils.formatDate(new Date()) + ".sql";
+        String historyFileName = filePath + "db-" + DateUtils.formatDate(DateUtils.addDay(new Date(), -4)) + ".sql";
+        String command = "mysqldump jeecg-boot -h 127.0.0.1 -u" + userName + " -p" + password + " --default-character-set=utf8mb4 --result-file=" + currentFileName;
+        //1:删除历史数据
+        LoadFileUtil.delFile(historyFileName);
+        //2:导出当天数据
+        Runtime runtime = Runtime.getRuntime();
+        Process pro = null;
+        try {
+            pro = runtime.exec(command);
+            int status = pro.waitFor();
+            if (status == 0) {
+                log.info("数据备份shell脚本执行成功");
+            } else {
+                log.info("数据备份shell脚本执行失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+}

+ 4 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java

@@ -46,10 +46,11 @@ public class BytedancePlanDailyReportLoadJob implements Job {
             reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         });
         formatZybData(215, getDate);
-        planDailyReportService.cleanYddData(112, getDate);
-        planDailyReportService.cleanYddData(113, getDate);
-        planDailyReportService.cleanYddData(222, getDate);
+        planDailyReportService.cleanChannelCodeData(112, getDate);
+        planDailyReportService.cleanChannelCodeData(113, getDate);
+        planDailyReportService.cleanChannelCodeData(222, getDate);
         planDailyReportService.cleanYzData(151);
+        planDailyReportService.cleanChannelCodeData(235, getDate);
     }
 
     private void formatZybData(Integer projectId, Date getDate) {

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

@@ -2,8 +2,11 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.alibaba.fastjson.JSONArray;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -30,6 +33,9 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
 
     static ExecutorService executorService = null;
 
+    @Autowired
+    private IKuaiShouCampaignService campaignService;
+
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         Thread thread = new Thread() {
@@ -39,7 +45,7 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
                 kuaishouInterfaceService.deleteHourlyReport(deleteDate);
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
-                executorService = Executors.newFixedThreadPool(3);
+                executorService = Executors.newFixedThreadPool(4);
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
@@ -50,8 +56,24 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            log.info("获取创意分天报表开始,accountId:{}", token.getAccountId());
-                            kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate);
+
+                            try {
+                                log.info("获取创意分天报表开始,accountId:{}", token.getAccountId());
+                                kuaishouInterfaceService.getCampaignList(token, null, null);
+                                sleep(5 * 100);
+                                List<JSONArray> campaigns = campaignService.getJsonArrByAccount(token.getAccountId(), 20);
+                                if (!Check.isNull(campaigns) && campaigns.size() > 0) {
+                                    for (int i = 0; i < campaigns.size(); i++) {
+                                        JSONArray campaignIds = (JSONArray) JSONArray.parse(campaigns.get(i).toJSONString());
+                                        kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate, campaignIds);
+                                    }
+
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+
+
                         }
                     });
 

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.DramaItemInfo;
+
+/**
+ * 剧本内容信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-06
+ * @cersion: V1.0
+ */
+public interface DramaItemInfoMapper extends BaseMapper<DramaItemInfo> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaItemInfoMapper.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="org.jeecg.modules.ctop.mapper.DramaItemInfoMapper">
+
+</mapper>

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

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.DramaItemInfo;
+
+import java.util.List;
+
+/**
+ * 剧本内容信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-06
+ */
+public interface IDramaItemInfoService extends IService<DramaItemInfo> {
+
+    List<DramaItemInfo> getByDramaId(Long dramaId);
+}

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

@@ -3,6 +3,8 @@ package org.jeecg.modules.ctop.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.ctop.entity.DramaRoleInfo;
 
+import java.util.List;
+
 /**
  * 剧本角色信息
  *
@@ -12,4 +14,5 @@ import org.jeecg.modules.ctop.entity.DramaRoleInfo;
  */
 public interface IDramaRoleInfoService extends IService<DramaRoleInfo> {
 
+    List<DramaRoleInfo> getByDramaId(Long dramaId);
 }

+ 46 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaItemInfoServiceImpl.java

@@ -0,0 +1,46 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.DramaItemInfo;
+import org.jeecg.modules.ctop.entity.DramaRoleInfo;
+import org.jeecg.modules.ctop.mapper.DramaItemInfoMapper;
+import org.jeecg.modules.ctop.service.IDramaItemInfoService;
+import org.jeecg.modules.ctop.service.IDramaRoleInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 剧本内容信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-06
+ */
+@Service
+public class DramaItemInfoServiceImpl extends ServiceImpl<DramaItemInfoMapper, DramaItemInfo> implements IDramaItemInfoService {
+
+    @Autowired
+    private IDramaRoleInfoService roleInfoService;
+
+    @Override
+    public List<DramaItemInfo> getByDramaId(Long dramaId) {
+        QueryWrapper<DramaItemInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("drama_id", dramaId).eq("enabled", 1).orderByAsc("rank");
+        List<DramaItemInfo> infos = this.list(queryWrapper);
+        List<DramaItemInfo> returnInfos = new ArrayList<>();
+        if (null != infos && infos.size() > 0) {
+            for (DramaItemInfo itemInfo : infos) {
+                if (null != itemInfo.getRoleId()) {
+                    DramaRoleInfo roleInfo = roleInfoService.getById(itemInfo.getRoleId());
+                    itemInfo.setRoleName(roleInfo.getName());
+                }
+                returnInfos.add(itemInfo);
+            }
+        }
+        return returnInfos;
+    }
+}

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

@@ -1,11 +1,14 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.ctop.entity.DramaRoleInfo;
 import org.jeecg.modules.ctop.mapper.DramaRoleInfoMapper;
 import org.jeecg.modules.ctop.service.IDramaRoleInfoService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 剧本角色信息
  *
@@ -16,4 +19,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class DramaRoleInfoServiceImpl extends ServiceImpl<DramaRoleInfoMapper, DramaRoleInfo> implements IDramaRoleInfoService {
 
+    @Override
+    public List<DramaRoleInfo> getByDramaId(Long dramaId) {
+        QueryWrapper<DramaRoleInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("drama_id", dramaId);
+        return this.list(queryWrapper);
+    }
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/controller/QuartzJobController.java

@@ -64,7 +64,12 @@ public class QuartzJobController {
 	public Result<IPage<QuartzJob>> queryPageList(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
 			@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
 		Result<IPage<QuartzJob>> result = new Result<IPage<QuartzJob>>();
+		String jobClassName = quartzJob.getJobClassName();
+		quartzJob.setJobClassName(null);
 		QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
+		if (null != jobClassName && !"".equals(jobClassName.trim())) {
+			queryWrapper.like("job_class_name", jobClassName);
+		}
 		Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
 		IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
 		result.setSuccess(true);

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

@@ -107,7 +107,7 @@ public class SysPermissionController {
             if (oConvertUtils.isEmpty(token)) {
                 return Result.error("TOKEN不允许为空!");
             }
-            log.info(" ------ 通过令牌获取用户拥有的访问菜单 ---- TOKEN ------ " + token);
+//            log.info(" ------ 通过令牌获取用户拥有的访问菜单 ---- TOKEN ------ " + token);
             String username = JwtUtil.getUsername(token);
             List<SysPermission> metaList = sysPermissionService.queryByUser(username);
             String roleCode = sysPermissionService.queryRoleCode(username);

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

@@ -98,13 +98,12 @@ spring:
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
         filters: stat,slf4j
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
-
-
+        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?allowMultiQueries=true&characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: root
-          password: hcst2019
+          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:
@@ -150,7 +149,6 @@ jeecg:
     image-upload: D://upFiles//image//
     chrome-driver: D://chromedriver.exe
     csv-upload: D://upFiles//csv//
-    reportDownload: D://report//
 kuaishou:
   group-control:
     path: http://39.106.184.70
@@ -169,5 +167,3 @@ oss:
     replace-old-value: oss-cn-beijing
     download: D:\mnt\file\video
 
-
-

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

@@ -150,6 +150,7 @@ jeecg:
     image-upload: /mnt/upload/image/
     chrome-driver: /usr/bin/chromedriver
     csv-upload: /mnt/upload/csv/
+    bak-database-file: /mnt/data/bak/
 kuaishou:
   group-control:
     path: http://39.106.184.70

+ 122 - 5
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,16 +1,15 @@
 package org.jeecg;
 
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportTaskService;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
@@ -94,7 +93,125 @@ public class SampleTest {
             e.printStackTrace();
 
         }
+    }
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+
+    @Test
+    public void testBakToken() {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("project_id", 215);
+        List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
+        if (null != allocations && allocations.size() > 0) {
+            for (UserAllocation allocation : allocations) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            }
+        }
+        formatZybData(215, getDate);
+    }
+
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
+    private void formatZybData(Integer projectId, Date getDate) {
+        //清洗关于作业帮数据
+        //1:查询作业帮相关的用户数据
+        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
+        wrapper.eq("project_id", projectId);
+        List<UserAllocation> allocations = userAllocationService.list(wrapper);
+        if (null != allocations && allocations.size() > 0) {
+            allocations.forEach(allocation -> {
+                //根据accountId和时间,查询相关的日报表信息
+                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                String dateString = dateFormat.format(getDate) + " 00:00:00";
+                queryWrapper.eq("advertiser_id", allocation.getAccountId())
+                        .eq("stat_datetime", dateString)
+                ;
+                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
+                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                    bytedancePlanDailyReports.forEach(report -> {
+                        String adName = report.getAdName();
+                        String[] tags = adName.split("-");
+                        report.setAdsense(tags[1]);
+                        report.setPlanCode(tags[2]);
+                        String materialName = tags[3];
+                        report.setMaterialName(materialName);
+                        if (materialName.contains("其他")) {
+                            report.setMaterialType("其他");
+                        } else if (materialName.contains("图片轮播")) {
+                            report.setMaterialType("图片轮播");
+                        } else if (materialName.contains("大字报")) {
+                            report.setMaterialType("大字报");
+                        } else if (materialName.contains("文字动画")) {
+                            report.setMaterialType("文字动画");
+                        } else if (materialName.contains("采访形式")) {
+                            report.setMaterialType("采访形式");
+                        } else if (materialName.contains("剧情")) {
+                            report.setMaterialType("剧情");
+                        } else if (materialName.contains("口播")) {
+                            report.setMaterialType("口播");
+                        } else {
+                            report.setMaterialType("其他");
+                        }
+                        planDailyReportService.updateById(report);
+                    });
+                }
+            });
+        }
+    }
 
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+    @Autowired
+    private IReportService reportService;
+
+    /**
+     * CSV文件生成方法
+     *
+     * @param head       文件头
+     * @param dataList   数据列表
+     * @param outPutPath 文件输出路径
+     * @param filename   文件名
+     * @return
+     */
+    public static File createCSVFile(String head, List<CtopOauthToken> dataList, String outPutPath, String filename) {
+
+        File csvFile = null;
+        BufferedWriter csvWtriter = null;
+        try {
+            csvFile = new File(outPutPath + File.separator + filename + ".csv");
+            File parent = csvFile.getParentFile();
+            if (parent != null && !parent.exists()) {
+                parent.mkdirs();
+            }
+            csvFile.createNewFile();
+
+            // GB2312使正确读取分隔符","
+            csvWtriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
+                    csvFile), "GB2312"), 1024);
+            // 写入文件头部
+            writeRow(head, csvWtriter);
+
+            // 写入文件内容
+            for (CtopOauthToken row : dataList) {
+                writeRow(row.toString(), csvWtriter);
+            }
+            csvWtriter.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                csvWtriter.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return csvFile;
+    }
 
     }
 

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java

@@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -142,4 +143,19 @@ public class CtopOauthToken {
         calendar.add(Calendar.SECOND, seconds);
         return calendar.getTime();
     }
+
+    @Override
+    public String toString() {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return id +
+                "," + mediaId +
+                "," + advertiserId +
+                "," + accountId +
+                "," + accessToken +
+                "," + sdf.format(accessTokenExpiresIn) +
+                "," + refreshToken +
+                "," + sdf.format(refreshTokenExpiresIn) +
+                "," + sdf.format(createTime) +
+                "," + sdf.format(updateTime);
+    }
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -340,11 +340,14 @@ public class HttpUtils {
         String strReturn = "";
         try {
             HttpPost httppost = new HttpPost(url);
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(120000).setConnectTimeout(120000).build();
+            httppost.setConfig(requestConfig);
             if (!Check.isNullMap(headers)) {
                 for (String key : headers.keySet()) {
                     httppost.setHeader(key, headers.get(key));
                 }
             }
+
             httppost.setHeader("User-Agent", USER_AGENT);
             if (!Check.isNull(body)) {
                 httppost.setEntity(new StringEntity(body, Charset.forName("UTF-8")));

+ 3 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/service/impl/KuaishouAppServiceImpl.java

@@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
 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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -28,6 +29,7 @@ import java.util.List;
  * @author yumeng
  * 2019年11月12日10:04:00
  */
+@Slf4j
 @Service
 public class KuaishouAppServiceImpl implements IKuaishouAppService {
     @Autowired
@@ -76,6 +78,7 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                             ad.setHeight(ad.getAdCover().getHeight());
                             ad.setType(appFeeds.getType());
                             ad.setAppName(ad.getAppName().replace(".apk","").replace(".APK","").replace("ios","").replace("IOS",""));
+                            System.out.println(ad.getAdCover());
                             appAdService.saveOrUpdate(ad);
                             try {
                                 KuaishouAdAccount kuaishouAdAccount = kuaishouAdAccountService.getById(ad.getUserId());
@@ -93,7 +96,6 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                     }
                 }
             }
-
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -193,7 +195,6 @@ public class KuaishouAppServiceImpl implements IKuaishouAppService {
                     }
                 }
             }
-
         } catch (IOException e) {
             e.printStackTrace();
         }

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
@@ -14,4 +15,6 @@ import java.util.List;
 public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
 
     void replaceBatch(List<KuaiShouCampaign> campaigns);
+
+    List<JSONArray> getJsonArrByAccount(Long accountId, int idSize);
 }

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

@@ -254,7 +254,7 @@ public interface IKuaishouInterfaceService {
 
     void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);
 
-    void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+    void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate,JSONArray campaignIds);
 
     void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
@@ -352,6 +352,7 @@ public interface IKuaishouInterfaceService {
     void getCreative(String token, Long advertiserId, Long creativeId);
 
 
+    void getAdvertiserCreativeReportDailyV2(Long campaignId, CtopOauthToken ctopOauthToken, Date startDate, Date endDate);
 }
 
 

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

@@ -1,12 +1,16 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -24,4 +28,36 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
     public void replaceBatch(List<KuaiShouCampaign> campaigns) {
         campaignMapper.replaceBatch(campaigns);
     }
+
+
+    /**
+     * 获取创意
+     *
+     * @param accountId
+     * @return
+     */
+    @Override
+    public List<JSONArray> getJsonArrByAccount(Long accountId, int idSize) {
+        QueryWrapper<KuaiShouCampaign> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        List<KuaiShouCampaign> list = this.list(queryWrapper);
+        List<JSONArray> campaignArr = new ArrayList<>();
+        if (!Check.isNull(list)) {
+            int arrSize = list.size() % idSize == 0 ? list.size() / idSize : list.size() / idSize + 1;
+            for (int i = 0; i < arrSize; i++) {
+                JSONArray arr = new JSONArray();
+                for (int j = i * idSize; j <= idSize * (i + 1) - 1; j++) {
+                    if (j <= list.size() - 1) {
+                        KuaiShouCampaign campaign = list.get(i);
+                        arr.add(campaign.getCampaignId());
+                    }
+                }
+                campaignArr.add(arr);
+            }
+            return campaignArr;
+        }
+
+        return null;
+    }
+
 }

+ 72 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -777,11 +777,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
     @Override
-    public void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
-        getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, 1);
+    public void getAdvertiserCreativeReportDaily(CtopOauthToken token, Date startDate, Date endDate, JSONArray campaignIds) {
+        getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, campaignIds, 1);
     }
 
-    private void getAdvertiserCreativeReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+    private void getAdvertiserCreativeReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, JSONArray campaignIds, int page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
         headers.put("Content-Type", "application/json");
@@ -793,9 +793,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         if (!Check.isNull(endDate)) {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
+        if (!Check.isNull(campaignIds) && campaignIds.size() > 0) {
+            param.put("campaign_ids", campaignIds);
+
+        }
+
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "DAILY");
-        param.put("page_size", 500);
+        param.put("page_size", 1000);
         param.put("page", page);
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
@@ -830,7 +835,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             dailyCreativeStatisticService.saveOrUpdate(statistic);
             dailyCreativeService.saveOrUpdate(creative);
         }
-        getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, page + 1);
+        getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, campaignIds, page + 1);
     }
 
     private KuaishouReportDailyCreativeStatistic setDailyStatistic(KuaishouReportDailyCreative creative, CtopOauthToken token) {
@@ -1056,7 +1061,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             //3:获取广告组信息数据
             getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
             //4: 获取广告创意信息数据
-            getAdvertiserCreativeReportDaily(token, getStartDate, getEndDate);
+         //   getAdvertiserCreativeReportDaily(token, getStartDate, getEndDate);
 
             //获取全量广告计划数据
             getCampaignList(token, null, null);
@@ -3723,5 +3728,66 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return null;
     }
 
+    @Override
+    public void getAdvertiserCreativeReportDailyV2(Long campaignId, CtopOauthToken token, Date startDate, Date endDate) {
+        getAdvertiserCreativeReportDailyByPageV2(campaignId, token, startDate, endDate, 1);
+    }
+
+    private void getAdvertiserCreativeReportDailyByPageV2(Long campaignId, CtopOauthToken token, Date startDate, Date endDate, int page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+        Map<String, Object> param = new HashMap<String, Object>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", DateUtils.formatDate(startDate));
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", DateUtils.formatDate(endDate));
+        }
+
+        JSONArray jsonArray = new JSONArray();
+        jsonArray.add(campaignId);
+        param.put("campaign_ids", jsonArray);
+        param.put("advertiser_id", token.getAccountId());
+        param.put("temporal_granularity", "DAILY");
+        param.put("page_size", 500);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手广告创意分天报表异常:{},accountId:{}", message, token.getAccountId());
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            log.info("快手广告创意分天报表信息为空=》accountId:{}", token.getAccountId());
+            return;
+        }
+        for (int i = 0; i < details.size(); i++) {
+            var detailJson = details.getJSONObject(i);
+            var show = detailJson.getLong("show");
+            detailJson.put("photo_show", show);
+            var like = detailJson.getLong("like");
+            detailJson.put("photo_like", like);
+            var creative = JSONObject.toJavaObject(detailJson, KuaishouReportDailyCreative.class);
+            creative.setAccountId(token.getAccountId());
+            creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate());
+
+            // 取得MD5
+            String signature = creativeService.getCodeByCreativeId(creative.getCreativeId());
+            if (!Check.isNull(signature)) {
+                creative.setSignature(signature);
+            }
+            KuaishouReportDailyCreativeStatistic statistic = setDailyStatistic(creative, token);
+            dailyCreativeStatisticService.saveOrUpdate(statistic);
+            dailyCreativeService.saveOrUpdate(creative);
+        }
+        getAdvertiserCreativeReportDailyByPageV2(campaignId, token, startDate, endDate, page + 1);
+    }
+
 
 }

+ 16 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -611,6 +611,18 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             //等待2秒用于页面加载,保证Cookie响应全部获取。
             Thread.sleep(10000);
 
+//            WebElement iframeElement = webDriver.findElement(By.tagName("iframe"));
+//            if (iframeElement != null) {
+//                log.error("【错误】快手登录出现验证码!");
+//                File scrFile = captureElement(webDriver.findElement(By.tagName("iframe")));
+//                //clickCharBg
+//                String savePath = "D:/capter.png";
+//                FileUtils.copyFile(scrFile, new File(savePath));
+//                webDriver.switchTo().frame(webDriver.findElement(By.tagName("iframe")));
+//                String result = ChaojiyingUtils.process(Base64Utils.imageToBase64(savePath));
+//                System.out.println(result);
+//                ((JavascriptExecutor) webDriver).executeScript("arguments[0].click();", webDriver.findElement(By.className("aq_icon_refresh")));
+//            }
             webDriver.get("https://b.e.kuaishou.com/#/home/profile");
             //获取Cookie并打印
             Set<org.openqa.selenium.Cookie> cookies = webDriver.manage().getCookies();
@@ -947,6 +959,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode node = mapper.readTree(str);
             Integer result = node.get("result").asInt();
+            JsonNode pcursoNode = node.get("pcursor");
+            if (null == pcursoNode) {
+                log.info("异常数据:{}", str);
+            }
             String pcursor = node.get("pcursor").asText();
             if (result == 1) {
                 Iterator<JsonNode> nodes = node.get("photos").iterator();

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

@@ -25,6 +25,7 @@
         where
         date &lt;= #{endDate} and
         date &gt;= #{startDate}
+        order by date desc
     </select>
 
     <select id="companyReportSum" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">

+ 2 - 1
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java

@@ -3,6 +3,7 @@ package cn.com.ctop.bytedance.mapper;
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import retrofit2.http.PartMap;
 
 import java.util.List;
 import java.util.Map;
@@ -14,7 +15,7 @@ import java.util.Map;
  * @Version: V1.0
  */
 public interface BytedanceCreativeDailyReportMapper extends BaseMapper<BytedanceCreativeDailyReport> {
-    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReport(Map<String, Object> paramsMap);
+    List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReport(@Param("userId")String userId, @Param("startDate")String startDate, @Param("endDate")String endDate);
 
     List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReport(Map<String, Object> paramsMap);
 

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedancePlanDailyReportMapper.java

@@ -31,5 +31,5 @@ public interface BytedancePlanDailyReportMapper extends BaseMapper<BytedancePlan
     @Update("update ctop_bytedance_report_plan_daily " +
             "set channel_code = substring_index(ad_name, '-', 1) " +
             "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId}) and stat_datetime =#{date}")
-    void cleanYddData(@Param(value = "projectId") Integer projectId, @Param(value = "date") String date);
+    void cleanChannelCodeData(@Param(value = "projectId") Integer projectId, @Param(value = "date") String date);
 }

+ 6 - 8
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -29,7 +29,7 @@
         left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
         left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
         where
-        t3.id is not NULL
+        t3.id is not NULL and t4.id is not null
         and t1.media_id = '1'
         and t1.account_id != ''
         <if test="userId != null">
@@ -37,14 +37,13 @@
         </if>
 
         <if test="startDate != null">
-            and t2.stat_datetime &gt;= #{startDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         </if>
         <if test="endDate != null">
-            and t2.stat_datetime &lt;= #{endDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
         </if>
         group by t4.signature
         order by sum(t2.cost) desc
-        limit 100
     </select>
 
     <select id="bytedanceCreativeAccountReport" parameterType="Map"
@@ -79,18 +78,17 @@
                  open="(" separator="," close=")">
             #{item}
         </foreach>
+        and t3.id is not NULL and t4.id is not null
         and t1.media_id = '1'
-        and t1.account_id != ''
         <if test="startDate != null">
-            and t2.stat_datetime &gt;= #{startDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
         </if>
         <if test="endDate != null">
-            and t2.stat_datetime &lt;= #{endDate}
+            and date_format(t2.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
         </if>
         and t3.id is not NULL
         group by t4.signature
         order by sum(t2.cost) desc
-        limit 100
     </select>
 
     <insert id="replaceBatch">

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedancePlanDailyReportService.java

@@ -20,5 +20,5 @@ public interface IBytedancePlanDailyReportService extends IService<BytedancePlan
 
     void cleanYzData(Integer projectId);
 
-    void cleanYddData(Integer projectId, Date getDate);
+    void cleanChannelCodeData(Integer projectId, Date getDate);
 }

+ 10 - 7
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceCreativeDailyReportServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.bytedance.service.impl;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.bytedance.mapper.BytedanceCreativeDailyReportMapper;
+import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.bytedance.service.IBytedanceCreativeDailyReportService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
@@ -24,21 +25,23 @@ import java.util.Map;
 public class BytedanceCreativeDailyReportServiceImpl extends ServiceImpl<BytedanceCreativeDailyReportMapper, BytedanceCreativeDailyReport> implements IBytedanceCreativeDailyReportService {
     @Autowired
     private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
+    @Autowired
+    private MaterialReportMapper materialReportMapper;
 
     @Override
     public List<BytedanceCreativeDailyReport> bytedanceCreativeDailyReportList(JSONObject json) {
         String userId = json.getString("userId");
+        String startDate = json.getString("startDate");
+        String endDate = json.getString("endDate");
         if (Check.isNull(userId)) {
             return null;
         }
-        String nowDate = json.getString("startDate");
-        String endDate = json.getString("endDate");
-        Map<String, Object> paramsMap = new HashMap<>();
-        paramsMap.put("userId", userId);
-        paramsMap.put("startDate", nowDate);
-        paramsMap.put("endDate", endDate);
+        String roleCode = materialReportMapper.getRoleCodeByUserId(json.getString("userId"));
+        if (!"admin".equals(roleCode)) {
+            userId = "";
+        }
 
-        return bytedanceCreativeDailyReportMapper.bytedanceCreativeDailyReport(paramsMap);
+        return bytedanceCreativeDailyReportMapper.bytedanceCreativeDailyReport(userId, startDate, endDate);
     }
 
     @Override

+ 2 - 4
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedancePlanDailyReportServiceImpl.java

@@ -58,10 +58,8 @@ public class BytedancePlanDailyReportServiceImpl extends ServiceImpl<BytedancePl
     }
 
     @Override
-    public void cleanYddData(Integer projectId, Date getDate) {
+    public void cleanChannelCodeData(Integer projectId, Date getDate) {
         String dateString = DateUtils.formatDate(getDate) + " 00:00:00";
-        dailyReportMapper.cleanYddData(projectId, dateString);
-        dailyReportMapper.cleanYddData(projectId, dateString);
-        dailyReportMapper.cleanYddData(projectId, dateString);
+        dailyReportMapper.cleanChannelCodeData(projectId, dateString);
     }
 }

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

@@ -16,7 +16,7 @@
             d4.id as plane_id,
             d4.realname as plane_name
         from ctop_kuaishou_report_daily_creative_statistic a
-        left join ctop_material_info b on a.signature = b.code
+        left join (select id, create_time ,code from ctop_material_info group by code) b on a.signature = b.code
         left join ctop_material_ascription c on b.id = c.material_id
         left join sys_user d1 on c.clip_id = d1.id
         left join sys_user d2 on c.shot_id = d2.id
@@ -481,7 +481,7 @@
         ctop_bytedance_report_creative_daily a
         left join ctop_bytedance_creative b on a.creative_id = b.id
         left join ctop_bytedance_video_info c on b.video_id = c.id
-        left join ctop_material_info d on c.signature = d.code
+        left join (select id, create_time ,code from ctop_material_info group by code) d on c.signature = d.code
         left join ctop_material_ascription e on d.id = e.material_id
         left join sys_user f1 on e.clip_id = f1.id
         left join sys_user f2 on e.shot_id = f2.id
@@ -492,7 +492,7 @@
         date_format(a.stat_datetime, '%Y-%m-%d') &gt;= #{startTime} and
         date_format(a.stat_datetime, '%Y-%m-%d') &lt;= #{endTime} and
         date_format(d.create_time, '%Y-%m-%d') &gt;= #{startDate} and
-        date_format(d.update_time, '%Y-%m-%d') &lt;= #{endDate}
+        date_format(d.create_time, '%Y-%m-%d') &lt;= #{endDate}
         group by c.signature
         having sum(a.cost) >= 5000
     </select>