Forráskód Böngészése

Merge branch 'test' of http://git.tjyourong.com.cn/ctop/adsp-boot into test

 Conflicts:
	module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/ByteDanceBatchController.java
jiequan.bi 4 éve
szülő
commit
2d7895a1bb
95 módosított fájl, 3507 hozzáadás és 1232 törlés
  1. 6 3
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java
  3. 0 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  4. 0 203
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java
  5. 0 162
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaItemInfoController.java
  6. 0 164
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaRoleInfoController.java
  7. 42 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  8. 21 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  9. 49 26
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  10. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/SupplierWatermarkController.java
  11. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  12. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Advertiser.java
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAreaInfo.java
  14. 0 75
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaInfo.java
  15. 0 100
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaItemInfo.java
  16. 0 77
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaRoleInfo.java
  17. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  18. 0 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/DramaInfoMapper.java
  19. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/DramaItemInfoMapper.java
  20. 0 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/DramaRoleInfoMapper.java
  21. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  22. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaInfoMapper.xml
  23. 0 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaRoleInfoMapper.xml
  24. 21 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  25. 0 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaInfoService.java
  26. 0 23
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaItemInfoService.java
  27. 0 18
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaRoleInfoService.java
  28. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  29. 0 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaInfoServiceImpl.java
  30. 0 77
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaItemInfoServiceImpl.java
  31. 0 28
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaRoleInfoServiceImpl.java
  32. 57 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  33. 6 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/SysMessage.java
  34. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java
  35. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
  36. 8 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysAnnouncement.java
  37. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDepart.java
  38. 5 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDictItem.java
  39. 6 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysLog.java
  40. 5 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysPermission.java
  41. 10 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java
  42. 1 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java
  43. 35 19
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  44. 7 7
      module-common/src/main/java/cn/com/ctop/common/module/entity/Project.java
  45. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java
  46. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  47. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  48. 24 5
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  49. 45 35
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  50. 2 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/Actor.java
  51. 55 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  52. 187 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  53. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  54. 0 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  55. 10 30
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  56. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouInfoDTO.java
  57. 53 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccountDTO.java
  58. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouVideoInfoDTO.java
  59. 45 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ProjectAccountDTO.java
  60. 100 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ProjectMember.java
  61. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  62. 556 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  63. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAccountService.java
  64. 162 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAccountServiceImpl.java
  65. 11 0
      module-toutiao/pom.xml
  66. 150 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/BytedanceIndustryInfoController.java
  67. 53 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/entity/BytedanceIndustryInfo.java
  68. 14 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/mapper/BytedanceIndustryInfoMapper.java
  69. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaItemInfoMapper.xml
  70. 19 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/IBytedanceIndustryInfoService.java
  71. 116 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/impl/BytedanceIndustryInfoServiceImpl.java
  72. 241 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceImageInfoController.java
  73. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreative.java
  74. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceEffectVideoInfo.java
  75. 95 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceImageInfo.java
  76. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java
  77. 35 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceImageInfoMapper.xml
  78. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceAdvertiserDataService.java
  79. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceCreativeService.java
  80. 17 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceImageInfoService.java
  81. 52 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  82. 261 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java
  83. 26 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java
  84. 101 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ByteDanceReportAccountDailyDTO.java
  85. 21 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/BytedanceInfoDTO.java
  86. 74 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java
  87. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceAccountReportMapper.java
  88. 181 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml
  89. 10 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java
  90. 90 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  91. 251 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/ApkUtils.java
  92. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/OptimizerRoleInfo.java
  93. 4 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/Performance.java
  94. 4 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformancRraise.java
  95. 5 0
      performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformanceCommission.java

+ 6 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -73,6 +73,11 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/bytedanceAreaInfo/**", "anon");
         filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
         filterChainDefinitionMap.put("/template/creative/words/get", "anon");
+        filterChainDefinitionMap.put("template/bytedance/industry/list", "anon");
+
+        filterChainDefinitionMap.put("/bytedance/batch/creative/words/get", "anon");
+        filterChainDefinitionMap.put("/bytedance/batch/action/text", "anon");
+        filterChainDefinitionMap.put("/bytedance/batch/industry/list", "anon");
         filterChainDefinitionMap.put("/appium/crawler/*", "anon");
 
         filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
@@ -119,9 +124,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
         filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
         filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
-        filterChainDefinitionMap.put("/template/convert/list", "anon");
-        filterChainDefinitionMap.put("/template/convert/list/url", "anon");
-        //文件上传接口
+        filterChainDefinitionMap.put("/template/convert/**", "anon");//文件上传接口
         filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
 

+ 0 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java

@@ -29,19 +29,14 @@ public class MybatisInterceptor implements Interceptor {
 	@Override
 	public Object intercept(Invocation invocation) throws Throwable {
 		MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
-		String sqlId = mappedStatement.getId();
-		log.debug("------sqlId------" + sqlId);
 		SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
 		Object parameter = invocation.getArgs()[1];
-		log.debug("------sqlCommandType------" + sqlCommandType);
-
 		if (parameter == null) {
 			return invocation.proceed();
 		}
 		if (SqlCommandType.INSERT == sqlCommandType) {
 			Field[] fields = oConvertUtils.getAllFields(parameter);
 			for (Field field : fields) {
-				log.debug("------field.name------" + field.getName());
 				try {
 					// 获取登录用户信息
 					LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

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

@@ -128,15 +128,4 @@ public class ByteDanceTemplateController {
         return fileInfoService.getSiteList(accountId);
     }
 
-    /**
-     * 获取动态词包信息
-     *
-     * @param accountId
-     * @return
-     */
-    @GetMapping("creative/words/get")
-    public Map<String, Object> getCreativeWords(Long accountId) {
-        return fileInfoService.getCreativeWords(accountId);
-    }
-
 }

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

@@ -1,203 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.annotation.AutoLog;
-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;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.SecurityUtils;
-import org.jeecg.common.api.vo.Result;
-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.*;
-
-/**
- * 剧本信息
- * @author jeecg-boot
- * @date   2020-03-04
- * @version V1.0
- */
-@Slf4j
-@Api(tags="剧本信息")
-@RestController
-@RequestMapping("/ctop/dramaInfo")
-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<DramaItemInfo> getItemInfos = new ArrayList<>();
-        for (DramaItemInfo itemInfo : itemInfos) {
-            if (itemInfo.getType() == 2) {
-                DramaRoleInfo roleInfo = dramaRoleInfoService.getById(itemInfo.getRoleId());
-                itemInfo.setRoleName(roleInfo.getName());
-            }
-            getItemInfos.add(itemInfo);
-        }
-		List<DramaRoleInfo> roleInfos = dramaRoleInfoService.getByDramaId(dramaId);
-        result.put("itemInfos", getItemInfos);
-        result.put("roleInfos", roleInfos);
-		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-		return result;
-	}
-	/**
-	  * 分页列表查询
-	 * @param dramaInfo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "剧本信息-分页列表查询")
-	@ApiOperation(value="剧本信息-分页列表查询", notes="剧本信息-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<DramaInfo>> queryPageList(DramaInfo dramaInfo,
-												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-												  HttpServletRequest req) {
-        Result<IPage<DramaInfo>> result = new Result<>();
-		QueryWrapper<DramaInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaInfo, req.getParameterMap());
-        Page<DramaInfo> page = new Page<>(pageNo, pageSize);
-		IPage<DramaInfo> pageList = dramaInfoService.page(page, queryWrapper);
-        if (pageList != null && pageList.getRecords() != null && !pageList.getRecords().isEmpty()) {
-			List<DramaInfo> list = new ArrayList<>();
-			for (int i = 0; i < pageList.getRecords().size(); i++) {
-				DramaInfo getDramaInfo = pageList.getRecords().get(i);
-				SysCategory sysCategory = categoryService.getById(getDramaInfo.getCategory());
-				if (sysCategory != null) {
-					getDramaInfo.setCategory(sysCategory.getName());
-				}
-				list.add(getDramaInfo);
-			}
-			pageList.setRecords(list);
-		}
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-
-	/**
-	  *   添加
-	 * @param dramaInfo
-	 * @return
-	 */
-	@AutoLog(value = "剧本信息-添加")
-	@ApiOperation(value="剧本信息-添加", notes="剧本信息-添加")
-	@PostMapping(value = "/add")
-	public Result<DramaInfo> add(@RequestBody DramaInfo dramaInfo) {
-		Result<DramaInfo> result = new Result<>();
-		try {
-			// 获取登录用户信息
-			LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-			dramaInfo.setUserId(sysUser.getId());
-			dramaInfo.setUserName(sysUser.getUsername());
-			dramaInfo.setUpdateTime(new Date());
-			dramaInfoService.save(dramaInfo);
-
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-
-	/**
-	  *  编辑
-	 * @param dramaInfo
-	 * @return
-	 */
-	@AutoLog(value = "剧本信息-编辑")
-	@ApiOperation(value="剧本信息-编辑", notes="剧本信息-编辑")
-	@PostMapping(value = "/edit")
-	public Result<DramaInfo> edit(@RequestBody DramaInfo dramaInfo) {
-        Result<DramaInfo> result = new Result<>();
-		DramaInfo dramaInfoEntity = dramaInfoService.getById(dramaInfo.getId());
-		if(dramaInfoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = dramaInfoService.updateById(dramaInfo);
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-
-		return result;
-	}
-
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "剧本信息-通过id删除")
-	@ApiOperation(value="剧本信息-通过id删除", notes="剧本信息-通过id删除")
-	@DeleteMapping(value = "/delete")
-    public Map<String, Object> delete(@RequestParam(name = "id", required = true) String id) {
-        return dramaInfoService.delete(id);
-	}
-
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "剧本信息-批量删除")
-	@ApiOperation(value="剧本信息-批量删除", notes="剧本信息-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<DramaInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-        Result<DramaInfo> result = new Result<>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.dramaInfoService.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<DramaInfo> queryById(@RequestParam(name="id",required=true) String id) {
-        Result<DramaInfo> result = new Result<>();
-		DramaInfo dramaInfo = dramaInfoService.getById(id);
-		if(dramaInfo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(dramaInfo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
-}

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

@@ -1,162 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.annotation.AutoLog;
-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.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;
-import java.util.Date;
-import java.util.Map;
-
-/**
- * 剧本内容信息
- *
- * @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<>();
-        QueryWrapper<DramaItemInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaItemInfo, req.getParameterMap());
-        Page<DramaItemInfo> page = new Page<>(pageNo, pageSize);
-        queryWrapper.orderByAsc("rank").orderByDesc("update_time");
-        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 {
-            int rank = dramaItemInfoService.getMaxRankByDramaId(dramaItemInfo.getDramaId());
-            dramaItemInfo.setRank(rank);
-            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 {
-            dramaItemInfo.setUpdateTime(new Date());
-            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 Map<String, Object> delete(@RequestBody DramaItemInfo dramaItemInfo) {
-        return dramaItemInfoService.delete(dramaItemInfo.getId());
-    }
-
-    /**
-     * 批量删除
-     *
-     * @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<>();
-        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 = dramaItemInfoService.getById(id);
-        if (dramaItemInfo == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(dramaItemInfo);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-}

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

@@ -1,164 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import cn.com.ctop.common.module.annotation.AutoLog;
-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.modules.ctop.entity.DramaRoleInfo;
-import org.jeecg.modules.ctop.service.IDramaRoleInfoService;
-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-05
- */
-@Slf4j
-@Api(tags = "剧本角色信息")
-@RestController
-@RequestMapping("/ctop/dramaRoleInfo")
-public class DramaRoleInfoController {
-    @Autowired
-    private IDramaRoleInfoService dramaRoleInfoService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param dramaRoleInfo
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "剧本角色信息-分页列表查询")
-    @ApiOperation(value = "剧本角色信息-分页列表查询", notes = "剧本角色信息-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<DramaRoleInfo>> queryPageList(DramaRoleInfo dramaRoleInfo,
-                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                      HttpServletRequest req) {
-        Result<IPage<DramaRoleInfo>> result = new Result<>();
-        QueryWrapper<DramaRoleInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaRoleInfo, req.getParameterMap());
-        Page<DramaRoleInfo> page = new Page<>(pageNo, pageSize);
-        IPage<DramaRoleInfo> pageList = dramaRoleInfoService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param dramaRoleInfo
-     * @return
-     */
-    @AutoLog(value = "剧本角色信息-添加")
-    @ApiOperation(value = "剧本角色信息-添加", notes = "剧本角色信息-添加")
-    @PostMapping(value = "/add")
-    public Result<DramaRoleInfo> add(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<>();
-        try {
-            dramaRoleInfoService.save(dramaRoleInfo);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param dramaRoleInfo
-     * @return
-     */
-    @AutoLog(value = "剧本角色信息-编辑")
-    @ApiOperation(value = "剧本角色信息-编辑", notes = "剧本角色信息-编辑")
-    @PutMapping(value = "/edit")
-    public Result<DramaRoleInfo> edit(@RequestBody DramaRoleInfo dramaRoleInfo) {
-        Result<DramaRoleInfo> result = new Result<>();
-        DramaRoleInfo dramaRoleInfoEntity = dramaRoleInfoService.getById(dramaRoleInfo.getId());
-        if (dramaRoleInfoEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = dramaRoleInfoService.updateById(dramaRoleInfo);
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "剧本角色信息-通过id删除")
-    @ApiOperation(value = "剧本角色信息-通过id删除", notes = "剧本角色信息-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            dramaRoleInfoService.removeById(id);
-        } 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<DramaRoleInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<DramaRoleInfo> result = new Result<>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.dramaRoleInfoService.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<DramaRoleInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<DramaRoleInfo> result = new Result<>();
-        DramaRoleInfo dramaRoleInfo = dramaRoleInfoService.getById(id);
-        if (dramaRoleInfo == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(dramaRoleInfo);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-}

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

@@ -4,6 +4,7 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
@@ -25,7 +26,6 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -70,8 +70,47 @@ public class MaterialInfoController {
     private IProjectMemberService memberService;
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
-    @Autowired
-    private IKuaiShouUploadService uploadService;
+
+
+    @GetMapping("/supplierWatermark")
+    public Result<String> supplierWatermark(String id) {
+        Result<String> result = new Result<>();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("请选择素材");
+            }
+            MaterialInfo materialInfo = materialInfoService.getById(id);
+            if (Check.isNull(materialInfo)) {
+                throw new Exception("素材信息为空");
+            }
+            QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+            parameterQueryWrapper.eq("material_id", materialInfo.getCode());
+            parameterQueryWrapper.last("limit 1");
+            MaterialParameter parameter = materialParameterService.getOne(parameterQueryWrapper);
+            if (Check.isNull(parameter)) {
+                throw new Exception("素材基本信息为空");
+            }
+
+            Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(parameter.getWidth()), Integer.valueOf(parameter.getHeight()));
+            String s = null;
+            if (!Check.isNull(templateId)) {
+                s = materialInfoService.watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+
+            }
+            if (Check.isNull(s)) {
+                result.setSuccess(false);
+                result.setMessage("水印生成失败");
+            } else {
+                result.setSuccess(true);
+                result.setResult(s);
+            }
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
 
 
     @PostMapping("/correlationUpload")

+ 21 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -4,12 +4,10 @@ import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.SupplierList;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.service.IProjectService;
-import cn.com.ctop.common.module.service.ISysRoleService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -156,6 +154,8 @@ public class ProjectController {
 
     @Autowired
     private ISysCategoryService sysCategoryService;
+    @Autowired
+    private ISupplierListService supplierListService;
 
     /**
      * 分页列表查询
@@ -202,6 +202,23 @@ public class ProjectController {
             queryWrapper.like("project_name", projectName);
         }
         IPage<Project> pageList = projectService.page(page, queryWrapper);
+        List<Project> records = pageList.getRecords();
+        if (!Check.isNull(records)) {
+            for (Project project1 : records) {
+                if (!Check.isNull(project1.getSupplierCode())) {
+                    QueryWrapper<SupplierList> supplierListQueryWrapper = new QueryWrapper<>();
+                    supplierListQueryWrapper.eq("supplier_code", project1.getSupplierCode());
+                    supplierListQueryWrapper.last("limit 1");
+                    SupplierList one = supplierListService.getOne(supplierListQueryWrapper);
+                    if (!Check.isNull(one)) {
+                        project1.setSupplierCode_dictText(one.getSupplierName());
+                    }
+                }
+
+
+            }
+
+        }
         result.setSuccess(true);
         result.setResult(pageList);
         return result;

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

@@ -1,6 +1,5 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
@@ -11,7 +10,6 @@ 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.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
@@ -58,8 +56,6 @@ public class ProjectMemberController {
      * @param projectId
      * @return
      */
-    @AutoLog(value = "项目成员-分页列表查询")
-    @ApiOperation(value = "项目成员-分页列表查询", notes = "项目成员-分页列表查询")
     @GetMapping(value = "/getMemberList")
     public Map<String, Object> getMemberList(String projectId) {
         Map<String, Object> map = new HashMap<>();
@@ -86,8 +82,6 @@ public class ProjectMemberController {
      * @param userId
      * @return
      */
-    @AutoLog(value = "项目成员-分页列表查询")
-    @ApiOperation(value = "项目成员-分页列表查询", notes = "项目成员-分页列表查询")
     @GetMapping(value = "/participateList")
     public Map<String, Object> participateList(String userId) {
         Map<String, Object> map = new HashMap<>();
@@ -116,7 +110,6 @@ public class ProjectMemberController {
                         projectMember.setMaxBid(project.getMaxBid());
                         projectMemberList.add(projectMember);
                     }
-
                 }
             }
             map.put("code", 0);
@@ -141,8 +134,6 @@ public class ProjectMemberController {
      * @param req
      * @return
      */
-    @AutoLog(value = "项目成员-分页列表查询")
-    @ApiOperation(value = "项目成员-分页列表查询", notes = "项目成员-分页列表查询")
     @GetMapping(value = "/list")
     public Result<IPage<ProjectMember>> queryPageList(ProjectMember projectMember,
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -164,10 +155,6 @@ public class ProjectMemberController {
      * @param jsonObject
      * @return
      */
-
-
-    @AutoLog(value = "项目成员-添加")
-    @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/batchAdd")
     public Result<ProjectMember> batchAdd(@RequestBody JSONObject jsonObject) {
         Result<ProjectMember> result = new Result<>();
@@ -222,8 +209,6 @@ public class ProjectMemberController {
      * @param projectMember
      * @return
      */
-    @AutoLog(value = "项目成员-添加")
-    @ApiOperation(value = "项目成员-添加", notes = "项目成员-添加")
     @PostMapping(value = "/add")
     public Result<ProjectMember> add(@RequestBody ProjectMember projectMember) {
         Result<ProjectMember> result = new Result<>();
@@ -243,8 +228,6 @@ public class ProjectMemberController {
      * @param projectMember
      * @return
      */
-    @AutoLog(value = "项目成员-编辑")
-    @ApiOperation(value = "项目成员-编辑", notes = "项目成员-编辑")
     @PutMapping(value = "/edit")
     public Result<ProjectMember> edit(@RequestBody ProjectMember projectMember) {
         Result<ProjectMember> result = new Result<>();
@@ -267,8 +250,6 @@ public class ProjectMemberController {
      * @param id
      * @return
      */
-    @AutoLog(value = "项目成员-通过id删除")
-    @ApiOperation(value = "项目成员-通过id删除", notes = "项目成员-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
@@ -286,8 +267,6 @@ public class ProjectMemberController {
      * @param ids
      * @return
      */
-    @AutoLog(value = "项目成员-批量删除")
-    @ApiOperation(value = "项目成员-批量删除", notes = "项目成员-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ProjectMember> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
         Result<ProjectMember> result = new Result<>();
@@ -306,8 +285,6 @@ public class ProjectMemberController {
      * @param id
      * @return
      */
-    @AutoLog(value = "项目成员-通过id查询")
-    @ApiOperation(value = "项目成员-通过id查询", notes = "项目成员-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ProjectMember> queryById(@RequestParam(name = "id", required = true) String id) {
         Result<ProjectMember> result = new Result<>();
@@ -326,8 +303,6 @@ public class ProjectMemberController {
      *
      * @return
      */
-    @AutoLog(value = "头条视频报表-参与项目列表")
-    @ApiOperation(value = "头条视频报表-参与项目列表", notes = "头条视频报表-参与项目列表")
     @GetMapping(value = "/bytedanceProjectParticipateInList")
     public Result<List<ProjectMember>> bytedanceProjectParticipateInList() {
         Result<List<ProjectMember>> result = new Result<>();
@@ -350,7 +325,7 @@ public class ProjectMemberController {
      *
      * @return
      */
-    @GetMapping(value = "/getProjectAccountByUserId")
+    @GetMapping("/getProjectAccountByUserId")
     public Result<List<Map<String, Object>>> getProjectAccountBy() {
         Result<List<Map<String, Object>>> resultBody = new Result<>();
         try {
@@ -366,4 +341,52 @@ public class ProjectMemberController {
     }
 
 
+    /**
+     * 销售的项目
+     *
+     * @return
+     */
+    @PostMapping(value = "/getSaleOwnProjects")
+    public Result<List<ProjectMember>> getSaleOwnProjects(@RequestParam(required = true ,name = "mediaIds") List<Integer> mediaIds) {
+        Result<List<ProjectMember>> result = new Result<>();
+
+        List<ProjectMember> projectMemberList = projectMemberService.getSaleOwnProjects(mediaIds);
+        if (projectMemberList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(projectMemberList);
+            result.setSuccess(true);
+        }
+        return result;
+
+    }
+
+    /**
+     * 自己所在的项目
+     *
+     * @return
+     */
+    @PostMapping("/getOwnProjects")
+    public Result<List<ProjectMember>> getOwnProjects(@RequestBody JSONObject data) {
+        Result<List<ProjectMember>> result = new Result<>();
+        JSONArray ids = data.getJSONArray("mediaIds");
+        List<Integer> mediaIds = new ArrayList<>();
+        if(null!=ids&&!ids.isEmpty()){
+            for(int i=0;i<ids.size();i++){
+                mediaIds.add(ids.getIntValue(i));
+            }
+        }
+        List<ProjectMember> projectMemberList = projectMemberService.getOwnProjects(mediaIds);
+        if (projectMemberList == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(projectMemberList);
+            result.setSuccess(true);
+        }
+        return result;
+
+    }
+
+
+
 }

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

@@ -43,7 +43,7 @@ import java.util.Map;
 @Slf4j
 @Api(tags = "供应商水印")
 @RestController
-@RequestMapping("/a12/supplierWatermark")
+@RequestMapping("/ctop/supplierWatermark")
 public class SupplierWatermarkController {
     @Autowired
     private ISupplierWatermarkService supplierWatermarkService;

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

@@ -835,7 +835,7 @@ public class TestController {
 
             tokens.forEach(token -> {
 
-                kuaishouInterfaceService.getAppList2(token.getAccountId(),token.getAccessToken());
+                kuaishouInterfaceService.getAppList(token.getAccountId(),token.getAccessToken());
                 //suzhaoService.submit(new Runnable() {
                 //    @Override
                 //    public void run() {

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -46,6 +47,7 @@ public class Advertiser {
      */
     @Excel(name = "行业ID", width = 15)
     @ApiModelProperty(value = "行业ID")
+    @Dict(dicCode = "id",dictTable="sys_category",dicText="name")
     private String industryId;
     private String industryCode;
     /**
@@ -53,6 +55,7 @@ public class Advertiser {
      */
     @Excel(name = "销售ID", width = 15)
     @ApiModelProperty(value = "销售ID")
+    @Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
     private String saleId;
     /**
      * 销售ID

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAreaInfo.java

@@ -29,7 +29,7 @@ public class BytedanceAreaInfo {
     /**
      * id
      */
-    @TableId(type = IdType.UUID)
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
     private Integer id;
     /**

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

@@ -1,75 +0,0 @@
-package org.jeecg.modules.ctop.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-03-04
- * @version V1.0
- */
-@Data
-@TableName("ctop_drama_info")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="ctop_drama_info对象", description="剧本信息")
-public class DramaInfo {
-	@TableId(type = IdType.AUTO)
-	private Long id;
-	private String userId;
-	private String category;
-	private String dramaName;
-	private String tag;
-	private String userName;
-	private Integer nonpublic;
-	private String introduction;
-	private Integer status;
-    private Integer enabled;
-    /**
-     * 场景
-     */
-    private String scnece;
-    /**
-     * 视频类型
-     */
-    private String videoType;
-    /**
-     * 时长
-     */
-    private Long timeLong;
-    /**
-     * 演员id
-     */
-    private String actorId;
-    /**
-     * 卖点
-     */
-    private String usp;
-    /**
-     * 演员/服化道备注
-     */
-    private String actorRemark;
-    /**
-     * 拍摄要求
-     */
-    private String shootReq;
-    /**
-     * 封面文案
-     */
-    private String coverText;
-    /**
-     * 剪辑备注
-     */
-    private String clipRemark;
-
-	private Date createTime;
-	private Date updateTime;
-}

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

@@ -1,100 +0,0 @@
-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 Integer type;
-    private Integer plainSeq;
-    /**
-     * 剧本id
-     */
-    @Excel(name = "剧本id", width = 15)
-    @ApiModelProperty(value = "剧本id")
-    private Long dramaId;
-    /**
-     * roleId
-     */
-    @Excel(name = "roleId", width = 15)
-    @ApiModelProperty(value = "roleId")
-    private Long roleId;
-    /**
-     * 台词
-     */
-    @Excel(name = "line", width = 15)
-    @ApiModelProperty(value = "content")
-    private String line;
-    /**
-     * 排序号
-     */
-    @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;
-
-    /**
-     * 场景
-     */
-    private String scene;
-    /**
-     * 剪辑描述
-     */
-    private String clipRemark;
-    /**
-     * 画面内容
-     */
-    private String picContent;
-
-    @TableField(exist = false)
-    private String roleName;
-
-}

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

@@ -1,77 +0,0 @@
-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-05
- */
-@Data
-@TableName("ctop_drama_role_info")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_drama_role_info对象", description = "剧本角色信息")
-public class DramaRoleInfo {
-
-    /**
-     * id
-     */
-    @TableId(type = IdType.AUTO)
-    @ApiModelProperty(value = "id")
-    private Long id;
-
-    private Long dramaId;
-    /**
-     * name
-     */
-    @Excel(name = "name", width = 15)
-    @ApiModelProperty(value = "name")
-    private String name;
-    /**
-     * introduction
-     */
-    @Excel(name = "introduction", width = 15)
-    @ApiModelProperty(value = "introduction")
-    private String introduction;
-    /**
-     * sex
-     */
-    @Excel(name = "sex", width = 15)
-    @ApiModelProperty(value = "sex")
-    private Integer sex;
-    /**
-     * createTime
-     */
-    @ApiModelProperty(value = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @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() {
-    }
-}

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

@@ -80,6 +80,12 @@ public class ProjectMember implements  Serializable{
     @TableField(exist = false)
     private String mediaId;
 
+    @TableField(exist = false)
+    private String saleId;
+
+    @TableField(exist = false)
+    private String saleName;
+
 
     /**
      * 创建时间

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

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

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

@@ -1,15 +0,0 @@
-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> {
-
-}

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

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

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

@@ -31,4 +31,7 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<ProjectMember> queryProjectMemberByUserId(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
 
+
+    List<ProjectMember> getSaleProjects(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+
 }

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

@@ -1,5 +0,0 @@
-<?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.DramaInfoMapper">
-
-</mapper>

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

@@ -1,5 +0,0 @@
-<?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.DramaRoleInfoMapper">
-
-</mapper>

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

@@ -122,4 +122,25 @@
             #{item}
         </foreach>
     </select>
+
+    <select id="getSaleProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
+            select
+            distinct a.id as projectId,
+            a.project_name as projectName,
+            a.advertiser_id as advertiserId,
+            a.advertiser_name as advertiserName,
+            a.media_id as mediaId,
+            a.sale_id as saleId,
+            b.realname as saleName
+        from
+        ctop_project a
+        left join sys_user b on a.sale_id = b.id
+        where a.sale_id = #{userId}
+        and a.media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

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

@@ -1,17 +0,0 @@
-package org.jeecg.modules.ctop.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.DramaInfo;
-
-import java.util.Map;
-
-/**
- * 剧本信息
- * @author jeecg-boot
- * @date   2020-03-04
- * @version V1.0
- */
-public interface IDramaInfoService extends IService<DramaInfo> {
-
-    Map<String, Object> delete(String id);
-}

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

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

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

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

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

@@ -25,4 +25,8 @@ public interface IProjectMemberService extends IService<ProjectMember> {
     List<Map<String, Object>> getProjectAccountByUserId(String userId);
 
     ProjectMember getProjectByParams(Long targetProject, String userId);
+    List<ProjectMember> getOwnProjects(List<Integer> mediaIds);
+
+    List<ProjectMember> getSaleOwnProjects(List<Integer> mediaIds);
+
 }

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

@@ -1,35 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.DramaInfo;
-import org.jeecg.modules.ctop.mapper.DramaInfoMapper;
-import org.jeecg.modules.ctop.service.IDramaInfoService;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 剧本信息
- * @author jeecg-boot
- * @date   2020-03-04
- * @version V1.0
- */
-@Service
-public class DramaInfoServiceImpl extends ServiceImpl<DramaInfoMapper, DramaInfo> implements IDramaInfoService {
-    @Override
-    public Map<String, Object> delete(String id) {
-        Map<String, Object> result = new HashMap<>();
-        DramaInfo info = this.getById(id);
-        if (null == info) {
-            ResultMapUtils.setResultMap(result, StatusCode.COMMON_DATA_NOT_EXIST);
-            return result;
-        }
-        info.setEnabled(0);
-        this.updateById(info);
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-}

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

@@ -1,77 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-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.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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 剧本内容信息
- *
- * @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").orderByDesc("update_time");
-        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;
-    }
-
-    @Override
-    public int getMaxRankByDramaId(Long dramaId) {
-        QueryWrapper<DramaItemInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("drama_id", dramaId);
-        queryWrapper.orderByDesc("rank").last(" limit 1");
-        DramaItemInfo itemInfo = this.getOne(queryWrapper);
-        if (null == itemInfo) {
-            return 1;
-        } else {
-            return itemInfo.getRank() + 1;
-        }
-    }
-
-    @Override
-    public Map<String, Object> delete(Long id) {
-        Map<String, Object> result = new HashMap<>();
-        DramaItemInfo info = this.getById(id);
-        if (null == info) {
-            ResultMapUtils.setResultMap(result, StatusCode.COMMON_DATA_NOT_EXIST);
-            return result;
-        }
-        info.setEnabled(0);
-        this.updateById(info);
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-}

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

@@ -1,28 +0,0 @@
-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;
-
-/**
- * 剧本角色信息
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-03-05
- */
-@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);
-    }
-}

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

@@ -89,7 +89,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         } else if (roleCode.equals("admin")) {
             projectMemberList = memberMapper.adminProjects(mediaIds);
         } else if (roleCode.equals("operator") || roleCode.equals("operationAssistant") || roleCode.equals("touTiaoOperationManager")) {
-            projectMemberList = memberMapper.operationProjects(userId, mediaIds);
+            projectMemberList = memberMapper.designProjects(userId, mediaIds);
+        }else{
+            //如果以上角色都不是的话直接查询此角色所属项目
+            projectMemberList = memberMapper.designProjects(userId, mediaIds);
+        }
+
+        if(null == projectMemberList){
+            projectMemberList = new ArrayList<>();
         }
 
         return projectMemberList;
@@ -151,4 +158,53 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         }
         return memberMapper.queryProjectMemberByUserId(userId, mediaIds);
     }
+
+
+    //查看销售所在平台项目
+    @Override
+    public List<ProjectMember> getSaleOwnProjects(List<Integer> mediaIds) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = sysUser.getId();
+        String roleCode = memberMapper.getRoleCodeByUserId(userId);
+
+        //角色权限判断
+        List<ProjectMember> projectMemberList = null;
+        if (roleCode.equals("admin")) {
+            projectMemberList = memberMapper.adminProjects(mediaIds);
+        }else{
+            //如果以上角色都不是的话直接查询此角色所属项目
+            projectMemberList = memberMapper.getSaleProjects(userId, mediaIds);
+        }
+
+        if(null == projectMemberList){
+            projectMemberList = new ArrayList<>();
+        }
+
+        return projectMemberList;
+    }
+
+    //视频报表
+    @Override
+    public List<ProjectMember> getOwnProjects(List<Integer> mediaIds) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = sysUser.getId();
+        String roleCode = memberMapper.getRoleCodeByUserId(userId);
+
+        //角色权限判断
+        List<ProjectMember> projectMemberList = null;
+       if (roleCode.equals("admin")) {
+            projectMemberList = memberMapper.adminProjects(mediaIds);
+        }else{
+            //如果以上角色都不是的话直接查询此角色所属项目
+            projectMemberList = memberMapper.designProjects(userId, mediaIds);
+        }
+
+        if(null == projectMemberList){
+            projectMemberList = new ArrayList<>();
+        }
+
+        return projectMemberList;
+    }
+
+
 }

+ 6 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/entity/SysMessage.java

@@ -1,15 +1,14 @@
 package org.jeecg.modules.message.entity;
 
-import org.jeecg.common.system.base.entity.JeecgEntity;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.system.base.entity.JeecgEntity;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * @Description: 消息
@@ -39,6 +38,7 @@ public class SysMessage extends JeecgEntity {
 	private java.lang.Integer esSendNum;
 	/**推送状态 0未推送 1推送成功 2推送失败*/
 	@Excel(name = "推送状态 0未推送 1推送成功 2推送失败", width = 15)
+	@Dict(dicCode = "msgSendStatus")
     private java.lang.String esSendStatus;
 	/**推送时间*/
 	@Excel(name = "推送时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@@ -50,6 +50,7 @@ public class SysMessage extends JeecgEntity {
 	private java.lang.String esTitle;
 	/**推送方式:1短信 2邮件 3微信*/
 	@Excel(name = "推送方式:1短信 2邮件 3微信", width = 15)
+	@Dict(dicCode = "msgType")
     private java.lang.String esType;
 	/**备注*/
 	@Excel(name = "备注", width = 15)

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java

@@ -42,7 +42,6 @@ public class DictAspect {
      * 定义切点Pointcut
      */
     @Pointcut("execution(public * org.jeecg.modules..*.*Controller.*(..))||execution(public * cn.com.ctop..*.*Controller.*(..))")
-//    @Pointcut(value = "@annotation(cn.com.ctop.common.module.annotation.Dict)")
     public void excudeService() {
     }
 

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

@@ -146,7 +146,6 @@ public class SysDictController {
 
 			 result.setSuccess(true);
 			 result.setResult(ls);
-			 log.info(result.toString());
 		} catch (Exception e) {
 			log.error(e.getMessage(),e);
 			result.error500("操作失败");

+ 8 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysAnnouncement.java

@@ -1,15 +1,16 @@
 package org.jeecg.modules.system.entity;
 
-import java.io.Serializable;
-
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+
 /**
  * @Description: 系统通告表
  * @Author: jeecg-boot
@@ -59,22 +60,26 @@ public class SysAnnouncement implements Serializable {
      * 优先级(L低,M中,H高)
      */
     @Excel(name = "优先级", width = 15, dicCode = "priority")
+    @Dict(dicCode = "priority")
     private java.lang.String priority;
 
     /**
      * 消息类型1:通知公告2:系统消息
      */
     @Excel(name = "消息类型", width = 15, dicCode = "msg_category")
+    @Dict(dicCode = "msg_category")
     private java.lang.String msgCategory;
     /**
      * 通告对象类型(USER:指定用户,ALL:全体用户)
      */
     @Excel(name = "通告对象类型", width = 15, dicCode = "msg_type")
+    @Dict(dicCode = "msg_type")
     private java.lang.String msgType;
     /**
      * 发布状态(0未发布,1已发布,2已撤销)
      */
     @Excel(name = "发布状态", width = 15, dicCode = "send_status")
+    @Dict(dicCode = "send_status")
     private java.lang.String sendStatus;
     /**
      * 发布时间

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDepart.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.system.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -64,9 +65,11 @@ public class SysDepart implements Serializable {
 	private String memo;
 	/**状态(1启用,0不启用)*/
 	@Excel(name="状态",width=15)
+	@Dict(dicCode = "depart_status")
     private String status;
 	/**删除状态(0,正常,1已删除)*/
 	@Excel(name="删除状态",width=15)
+	@Dict(dicCode = "del_flag")
     private String delFlag;
 	/**创建人*/
 	private String createBy;

+ 5 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysDictItem.java

@@ -1,16 +1,16 @@
 package org.jeecg.modules.system.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.io.Serializable;
+import java.util.Date;
+
 /**
  * <p>
  *
@@ -65,6 +65,7 @@ public class SysDictItem implements Serializable {
     /**
      * 状态(1启用 0不启用)
      */
+    @Dict(dicCode = "dict_item_status")
     private Integer status;
 
     private String createBy;

+ 6 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysLog.java

@@ -1,15 +1,16 @@
 package org.jeecg.modules.system.entity;
 
-import java.util.Date;
-
-import org.springframework.format.annotation.DateTimeFormat;
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -99,6 +100,7 @@ public class SysLog implements Serializable {
 	/**
 	 * 日志类型(1登录日志,2操作日志)
 	 */
+	@Dict(dicCode = "log_type")
 	private Integer logType;
 
 	/**

+ 5 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysPermission.java

@@ -1,7 +1,6 @@
 package org.jeecg.modules.system.entity;
 
-import java.io.Serializable;
-import java.util.Date;
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -9,6 +8,9 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.util.Date;
+
 /**
  * <p>
  * 菜单权限表
@@ -81,6 +83,7 @@ public class SysPermission implements Serializable {
 	/**
 	 * 类型(0:一级菜单;1:子菜单 ;2:按钮权限)
 	 */
+	@Dict(dicCode = "menu_type")
 	private Integer menuType;
 
 	/**

+ 10 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUser.java

@@ -1,21 +1,19 @@
 package org.jeecg.modules.system.entity;
 
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fasterxml.jackson.annotation.JsonFormat;
-
-import java.io.Serializable;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -78,6 +76,7 @@ public class SysUser implements Serializable {
      * 性别(1:男 2:女)
      */
     @Excel(name = "性别", width = 15, dicCode = "sex")
+    @Dict(dicCode = "sex")
     private Integer sex;
 
     /**
@@ -101,6 +100,7 @@ public class SysUser implements Serializable {
      * 状态(1:正常  2:冻结 )
      */
     @Excel(name = "状态", width = 15, dicCode = "user_status")
+    @Dict(dicCode = "user_status")
     private Integer status;
 
     /**

+ 1 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java

@@ -31,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.net.URLEncoder;
 import java.util.*;
 
 /**
@@ -173,8 +172,7 @@ public class WpsFileServiceImpl extends ServiceImpl<WpsFileMapper, WpsFile> impl
         FileDTO file = new FileDTO();
         BeanUtils.copyProperties(fileEntity,file);
         String url = fileEntity.getDownloadUrl();
-        url = URLEncoder.encode(url.replace(OSS_URL_PREFIX,""));
-        file.setDownload_url(OSS_URL_PREFIX+url);
+        file.setDownload_url(url);
         file.setUser_acl(userAcl);
         file.setWatermark(watermark);
         result.put("file",file);

+ 35 - 19
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,15 +5,17 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.material.vo.BytedanceCampaignEditVo;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -41,20 +43,18 @@ public class SampleTest {
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
     private IReportService reportService;
+    @Autowired
+    private IKuaishouInterfaceService interfaceService;
+
     @Test
     public void loadBytedanceCampaignData() {
-//        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
-//        tokens.forEach(token -> campaignService.getAdvertiserCampaign(token, null, null));
-//        campaignService.createCampaign(1649600126891015L,"测试广告组123",null,"BUDGET_MODE_DAY",15000,"APP",null);
-//        campaignService.getAdvertiserCampaign(token, null, null);
-
-        campaignService.updateCampaignStatus(1649600126891015L,"1673352811480076,1673351071217708","enable");
-        BytedanceCampaignEditVo vo = new BytedanceCampaignEditVo();
-        vo.setAccountId(1649600126891015L);
-        vo.setId(1673352811480076L);
-        vo.setCampaignName("咩哈哈哈哈哈");
-        vo.setBudget(10000);
-        campaignService.updateCampaign(vo);
+
+
+       // CorpWexinUtils.sendMessageByWeChatId("34585ddd4bd86e57756cf6a51b9443a5","测试消息发送");
+        interfaceService.getAppList(23212L,"493aedfee07d9c500c50077e7c808145");
+
+
+
     }
 
     @Autowired
@@ -167,15 +167,31 @@ public class SampleTest {
         List<KuaishouEffectVideoInfo>videoInfos = effectVideoInfoService.list();
         for (KuaishouEffectVideoInfo video:videoInfos) {
             if(null!=video.getSignature()&&!"".equals(video.getSignature())){
-//                effectVideoInfoService.updateFinalCostDateBySignature(video.getSignature());
-//                effectVideoInfoService.updateInitialCostDateBySignature(video.getSignature());
-//                effectVideoInfoService.updateTotalCostBySignature(video.getSignature());
-                if(null==video.getTwoWeekCost()){
-                    effectVideoInfoService.updateTowWeekCostBySignature(video.getSignature());
-                }
+                effectVideoInfoService.updateFinalCostDateBySignature(video.getSignature());
+                effectVideoInfoService.updateInitialCostDateBySignature(video.getSignature());
+                effectVideoInfoService.updateTotalCostBySignature(video.getSignature());
+//                effectVideoInfoService.updateTowWeekCostBySignature(video.getSignature());
             }
         }
     }
+
+    @Test
+    public void getIndustryInfo(){
+        String access_token = "cbdf6502c04978ae401cb92a64530fb73a8c7dbe";
+        // 请求地址
+        String url = "https://ad.oceanengine.com/open_api/2/tools/industry/get/";
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(access_token, url, new JSONObject());
+        System.out.println(jsonObject.toJSONString());
+    }
+
+    @Test
+    public void loadImageInfo()throws Exception{
+        List<CtopOauthToken>tokens = oauthTokenService.selectToutiaoToken();
+        for (CtopOauthToken token:tokens) {
+            advertiserDataService.getImageByPage(token,null,1);
+            Thread.sleep(1000L);
+        }
+    }
 }
 
 

+ 7 - 7
module-common/src/main/java/cn/com/ctop/common/module/entity/Project.java

@@ -30,7 +30,6 @@ import java.util.Date;
 @Accessors(chain = true)
 @ApiModel(value = "ctop_project对象", description = "项目")
 public class Project {
-
     /**
      * id
      */
@@ -56,7 +55,7 @@ public class Project {
 
     @Dict(dicCode = "id", dictTable = "sys_category", dicText = "name")
     private String industryId;
-    @Dict(dicCode = "code",dictTable="sys_category",dicText="name")
+    @Dict(dicCode = "code", dictTable = "sys_category", dicText = "name")
     private String industryCode;
     /**
      * 创建人
@@ -100,10 +99,14 @@ public class Project {
      */
     private Long maxBid;
 
-    //供应商
-    @Dict(dicCode = "supplier_code", dictTable = "ctop_supplier_list", dicText = "supplier_name")
     private String supplierCode;
 
+    /**
+     * 销售
+     */
+    @TableField(exist = false)
+    private String supplierCode_dictText;
+
     // 销售
     @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
     private String saleId;
@@ -128,10 +131,7 @@ public class Project {
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
 
-
     @TableField(exist = false)
     private Integer needExamine;
 
-
-
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java

@@ -29,4 +29,6 @@ public interface IFileInfoService extends IService<FileInfo> {
     JSONObject getCreativeWord(CtopOauthToken token, Long advertiserId);
 
     String downLoadByUrl(String fileUrl);
+
+    JSONObject getActionText(Long accountId, String landingType);
 }

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

@@ -24,7 +24,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
      * @param videoUrl
      * @param templateId
      */
-    void watermarkVideoBySupplierCode(String videoSignature, String videoUrl, Long templateId);
+    String watermarkVideoBySupplierCode(String videoSignature, String videoUrl, Long templateId);
 
     MaterialInfo getMaterialInfoByCodeAndProjectId(String code, Long projectId);
 

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

@@ -32,6 +32,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
     @Autowired
     private BindAccountAuthMapper bindAccountAuthMapper;
 
+
     /**
      * 授权 绑定账号信息
      *
@@ -73,7 +74,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
             // &scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D
             sb.append(PropertiesUtils.getValue("kuaishou_config", "kuaishou_auth_url"))
                     .append(KuaishouInterfaceConstant.AUTH_PATH)
-                    .append("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_third_appid"))
+                    .append ("?app_id=" + PropertiesUtils.getValue("kuaishou_config", "kuaishou_third_appid"))
                     .append("&state=" + URLEncoder.encode(URLEncoder.encode(state)))
                     .append("&scope=%5B%22report_service%22%2C%22ad_query%22%2C%22account_service%22%2C%22ad_manage%22%5D")
                     .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("kuaishou_config", "kuaishou_callback_url"), "UTF-8"));

+ 24 - 5
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -132,21 +132,40 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         JSONArray creativeWords = resultObject.getJSONObject("data").getJSONArray("creative_word");
         resultObject.remove("data");
         JSONArray array = new JSONArray();
-        if (null != creativeWords && creativeWords.size() > 0) {
+        if (null != creativeWords && !creativeWords.isEmpty()) {
             creativeWords.forEach(word -> {
                 JSONObject getWord = (JSONObject) word;
-                getWord.remove("user_rate");
-                getWord.remove("content_type");
-                getWord.remove("default_word");
+                String name = getWord.getString("name");
+                getWord.remove("words");
+                getWord.put("name",name);
                 getWord.remove("words");
                 getWord.remove("max_word_len");
-                array.add(getWord);
+                String status = getWord.getString("status");
+                if(null!=status&&status.trim().equals("CREATIVE_WORD_STATUS_APPROVE")){
+                    array.add(getWord);
+                }
             });
         }
         resultObject.put("creative_word", array);
         return resultObject;
     }
 
+    /**
+     * 行动号召数据获取
+     * @return
+     */
+    @Override
+    public JSONObject getActionText(Long accountId,String landingType) {
+        CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(accountId);
+        // 请求地址
+        String url = "https://ad.oceanengine.com/open_api/2/tools/action_text/get/";
+        // 请求参数
+        JSONObject data = new JSONObject();
+        data.put("advertiser_id", accountId);
+        data.put("landing_type",landingType);
+        return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, data);
+    }
+
     private JSONObject imageUpload(CtopOauthToken token, String advertiserId, String imageUrl) {
         // 请求地址
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_file_image_ad");

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

@@ -107,7 +107,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public void watermarkVideoBySupplierCode(String videoSignature, String videoUrl, Long templateId) {
+    public String watermarkVideoBySupplierCode(String videoSignature, String videoUrl, Long templateId) {
         try {
 
             QueryWrapper<SupplierWatermark> supplierWatermarkQueryWrapper = new QueryWrapper<>();
@@ -115,43 +115,45 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             supplierWatermarkQueryWrapper.last("limit 1");
             SupplierWatermark one = supplierWatermarkService.getOne(supplierWatermarkQueryWrapper);
             if (!Check.isNull(one)) {
-                return;
+                log.info("供应商水印已存在,videoCode:{}", videoSignature);
+                return one.getWatermarkUrl();
             }
+            String path = URLDecoder.decode(videoUrl).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+            String taskId = videoWatermarkHandle(path, templateId);
+            DescribeTaskDetailResponse taskDetailResponse = null;
+            for (int i = 0; i < 30; i++) {
+                try {
+                    Thread.sleep(2000);
+                } catch (InterruptedException e) {
+                    log.error(e.getMessage());
+                }
+                taskDetailResponse = getTaskDetailResponse(taskId);
+                if (taskDetailResponse.getStatus().equals("FINISH")) {
+                    break;
+                }
+            }
+            if (taskDetailResponse.getStatus().equals("FINISH")) {
+                String url = taskDetailResponse.getWorkflowTask().getMediaProcessResultSet()[0].getTranscodeTask().getOutput().getPath();
+                SupplierWatermark supplierWatermark = new SupplierWatermark();
+                supplierWatermark.setVideoSignature(videoSignature);
+                String watermarkUrl = "https://media-1301855440.cos.ap-chongqing.myqcloud.com" + url;
+                supplierWatermark.setWatermarkUrl(watermarkUrl);
+                boolean save = supplierWatermarkService.save(supplierWatermark);
+                if (save) {
+                    log.info("供应商水印生成完毕,videoCode:{}", videoSignature);
 
-
-            Thread thread = new Thread() {
-                @Override
-                public void run() {
-                    String path = URLDecoder.decode(videoUrl).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
-                    String taskId = videoWatermarkHandle(path, templateId);
-                    DescribeTaskDetailResponse taskDetailResponse = null;
-                    for (int i = 0; i < 20; i++) {
-                        try {
-                            Thread.sleep(2000);
-                        } catch (InterruptedException e) {
-                            log.error(e.getMessage());
-                        }
-                        taskDetailResponse = getTaskDetailResponse(taskId);
-                        if (taskDetailResponse.getStatus().equals("FINISH")) {
-                            break;
-                        }
-                    }
-                    if (taskDetailResponse.getStatus().equals("FINISH")) {
-                        String url = taskDetailResponse.getWorkflowTask().getMediaProcessResultSet()[0].getTranscodeTask().getOutput().getPath();
-                        SupplierWatermark supplierWatermark = new SupplierWatermark();
-                        supplierWatermark.setVideoSignature(videoSignature);
-                        supplierWatermark.setWatermarkUrl("https://media-1301855440.cos.ap-chongqing.myqcloud.com" + url);
-                        supplierWatermarkService.save(supplierWatermark);
-                    }
                 }
-            };
-            thread.start();
+                return watermarkUrl;
+            }
+
 
         } catch (Exception e) {
+            log.info("供应商水印生成异常,videoCode:{}", videoSignature);
             e.printStackTrace();
 
-        }
 
+        }
+        return null;
 
     }
 
@@ -437,7 +439,16 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                                 // 默认抽帧 素造供应商
                                 Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
                                 if (!Check.isNull(templateId)) {
-                                    watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+
+                                    Thread thread = new Thread() {
+                                        @Override
+                                        public void run() {
+                                            watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+                                        }
+                                    };
+                                    thread.start();
+
+
                                 }
                             }
 
@@ -539,13 +550,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setCreateTime(new Date());
             info.setUpdateTime(new Date());
             info.setType(type);
-
             Project project = projectService.getById(projectId);
             if (!Check.isNull(project)) {
-                info.setSupplierCode(project.getSupplierCode());
+                if (!Check.isNull(project.getSupplierCode())) {
+                    info.setSupplierCode(project.getSupplierCode());
+                }
             }
-
-
             MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
             if (Check.isNull(cutFrame)) {
                 String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");

+ 2 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/actor/entity/Actor.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.manage.modules.actor.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -27,6 +28,7 @@ public class Actor {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date birthday;
     private String coverUrl;
+    @Dict(dicCode = "sex")
     private Integer sex;
     private String speciality;
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

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

@@ -1148,7 +1148,6 @@ public class BatchController {
         return result;
     }
 
-
     /**
      * 获取素材信息
      *
@@ -2239,4 +2238,59 @@ public class BatchController {
     }
 
 
+    /**
+     * 同步素材
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/syncVideo")
+    public Result<Boolean> syncVideo(Long accountId) {
+        Result<Boolean> result = new Result<>();
+        try {
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, 1);
+            syncPullMaterialService.getSyncVideoList(accountId, nowDate, nowDate);
+            syncPullMaterialService.getSyncSuZaoList(accountId, nowDate, endDate);
+            Thread.sleep(5 * 1000L);
+            result.setSuccess(true);
+            result.setResult(true);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 同步应用
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/syncAppList")
+    public Result<Boolean> syncAppList(Long accountId) {
+        Result<Boolean> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("入参为空");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            iKuaishouInterfaceService.getAppList(oauthToken.getAccountId(), oauthToken.getAccessToken());
+            result.setSuccess(true);
+            result.setResult(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setResult(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
 }

+ 187 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -3,17 +3,27 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouInfoDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
  * @author yumeng
  * 2019年11月12日10:04:00
  */
+@Slf4j
 @RestController
 @RequestMapping("/kuaishou")
 public class KuaiShouController {
@@ -22,6 +32,8 @@ public class KuaiShouController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouReportDailyAccountService accountService;
 
     @RequestMapping("report")
     public Map<String, Object> getReport(String accountId, String startDate, String endDate, Integer type, String temporalGranularity) {
@@ -56,4 +68,177 @@ public class KuaiShouController {
         }
         return result;
     }
+
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouProjectInfo")
+    public Result<PageInfo<ProjectAccountDTO>> getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
+            result.setResult(projectAccountDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouSaleProjectInfo")
+    public Result<PageInfo<ProjectAccountDTO>> getKuaishouSaleProjectInfo(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<ProjectAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<ProjectAccountDTO> projectAccountDTOList = accountService.getKuaishouSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageSize(),dto.getPageNum(), "");
+            result.setResult(projectAccountDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouAccountInfoByProjectId")
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouAccountInfoByProjectId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getProjectId()==null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouReportDailyAccountDTOList = accountService.getKuaishouAccountInfoByProjectId(dto.getProjectId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            result.setResult(kuaishouReportDailyAccountDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouCampaignInfoByAccountId")
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouCampaignInfoByAccountId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getAccountId()==null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCampaignInfoByAccountId(dto.getAccountId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            result.setResult(kuaishouCampaignInfoList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouUnitInfoByCampaignId")
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouUnitInfoByCampaignId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getCampaignId()==null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouUnitInfoByCampaignId(dto.getCampaignId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            result.setResult(kuaishouCampaignInfoList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+    @ResponseBody
+    @RequestMapping("/getKuaishouCreativeInfoByUnitId")
+    public Result<PageInfo<KuaishouReportDailyAccountDTO>> getKuaishouCreativeInfoByUnitId(@RequestBody KuaishouInfoDTO dto) {
+        Result<PageInfo<KuaishouReportDailyAccountDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null || dto.getUnitId()==null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+        if(dto.getPageSize() == 0){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<KuaishouReportDailyAccountDTO> kuaishouCampaignInfoList = accountService.getKuaishouCreativeInfoByUnitId(dto.getUnitId(), dto.getStartDate(), dto.getEndDate(),dto.getPageSize(),dto.getPageNum());
+            result.setResult(kuaishouCampaignInfoList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
 }

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

@@ -77,6 +77,8 @@ public class KuaiShouVideoGet {
     private Date statDate;
 
     private Integer materialType;
+
+    private String materialId;
     /**
      * 创建时间
      */

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

@@ -265,13 +265,6 @@ public interface IKuaishouInterfaceService {
      */
     void getAppList(Long advertiserId, String accessToken);
 
-    /**
-     * 获取应用列表
-     *
-     * @param advertiserId
-     * @param accessToken
-     */
-    void getAppList2(Long advertiserId, String accessToken);
 
     /**
      * 文件上传 发送请求

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

@@ -2424,13 +2424,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return returnMap;
     }
 
-    /**
-     * 获取应用列表
-     *
-     * @param advertiserId
-     * @param accessToken
-     */
-    @Override
+
+    /*@Override
     public void getAppList(Long advertiserId, String accessToken) {
         try {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_LIST;
@@ -2476,7 +2471,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         } catch (Exception e) {
             e.printStackTrace();
         }
-    }
+    }*/
 
 
     public Object jsonToObj(Object t, String jsonStr) throws
@@ -2949,6 +2944,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     kuaiShouVideoGet.setStatDate(jsonObject.getDate("sync_date"));
                     kuaiShouVideoGet.setChannelType(1);
                     kuaiShouVideoGet.setUserId(userId);
+                    kuaiShouVideoGet.setMaterialId(jsonObject.getString("material_id"));
                     Integer type = MaterialEnum.getTypeBySize(kuaiShouVideoGet.getWidth(), kuaiShouVideoGet.getHeight());
                     if (!Check.isNull(type)) {
                         kuaiShouVideoGet.setMaterialType(type);
@@ -3242,8 +3238,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param accessToken
      */
     @Override
-    public void getAppList2(Long advertiserId, String accessToken) {
-        Integer pageSize = 20;
+    public void getAppList(Long advertiserId, String accessToken) {
+        Integer pageSize = 50;
         Integer page = 1;
         getAppList2ByPage(advertiserId, accessToken, page, pageSize);
     }
@@ -3263,7 +3259,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
-                    if(page == 1){ //分页保存数据,如果页数为1,删除之前的数据重新入库
+                    if (page == 1) { //分页保存数据,如果页数为1,删除之前的数据重新入库
                         Map<String, Object> deleteMap = new HashMap<>();
                         deleteMap.put("account_id", advertiserId);
                         appListMapper.deleteByMap(deleteMap);
@@ -3289,9 +3285,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                 appListMapper.insert(appList);
                             }
                         }
-                        Integer totalPage = (totalCount-1)/pageSize + 1;
-                        if(page < totalPage ){
-                            getAppList2ByPage(advertiserId,accessToken,page+1,pageSize);
+                        Integer totalPage = (totalCount - 1) / pageSize + 1;
+                        if (page < totalPage) {
+                            getAppList2ByPage(advertiserId, accessToken, page + 1, pageSize);
                         }
                     }
                 } else {
@@ -3306,20 +3302,4 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 }

+ 22 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouInfoDTO.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.github.pagehelper.PageInfo;
+import com.github.pagehelper.page.PageMethod;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+
+@Data
+public class KuaishouInfoDTO extends PageInfo implements Serializable {
+    private String startDate;
+    private String endDate;
+    private Long unitId;
+    private List<Long> projectList;
+    private Long accountId;  //广告主名称
+    private Long campaignId;
+    private Long projectId;
+
+}

+ 53 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccountDTO.java

@@ -0,0 +1,53 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class KuaishouReportDailyAccountDTO implements Serializable {
+    private String statDate;
+    private String accountId;
+    private String authName;
+    private Long projectId;
+    private String projectName;
+    private Long campaignId;
+    private String campaignName;
+    private Long creativeId;
+    private String creativeName;
+    private Long unitId;
+    private String unitName;
+    private BigDecimal charge;  //消耗
+    private Long photoShow;  //封面曝光数
+    private Long photoClick;  //封面点击数
+    private Long aclick;  //素材曝光数
+    private Long bclick;  //行为数
+    private Long activation;  //激活数
+    private Long submit;  //提交按钮点击数
+    private Long eventRegister;  //注册数
+    private Long eventNextDayStay;  //次日留存数
+    private BigDecimal activationCost;  //激活成本
+    private String photoClickRatio;  //封面点击率
+    private String actionRate;  //行为率
+    //@JsonSerialize(using = ToStringSerializer.class)
+    private BigDecimal impression1kCost;  //均千次封面曝光花费
+    private BigDecimal photoClickCost;  //平均封面点击单价
+    private BigDecimal actionCost;  //平均行为单价
+    private Long photoShare;  //分享数
+    private Long photoComment;  //评论数
+    private Long photoLike;  //点赞数
+    private Long follow;  //新增关注数
+    private Long report;  //举报数
+    private Long cancelFollow;  //取消关注数
+    private Long block;  //拉黑数
+    private Long nagative;  //减少此类作品数
+    private Long downloadStarted;  //应用下载数据-安卓下载开始数
+    private Long downloadCompleted;  //应用下载数据-安卓下载完成数
+    private BigDecimal eventNextDayStayCost;  //次日留存成本
+    private Long photoId;
+    private String url;
+    private String coverUrl;
+}

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouVideoInfoDTO.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class KuaishouVideoInfoDTO implements Serializable {
+    private String url;
+    private String coverUrl;
+
+}

+ 45 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ProjectAccountDTO.java

@@ -0,0 +1,45 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+
+@Data
+public class ProjectAccountDTO implements Serializable {
+    private String statDate;
+    private Long projectId;
+    private String projectName;
+    private String responsibleName;
+    private String advertiserName;  //广告主名称
+    private String designResponsibleName;
+    private String saleId;
+    private String saleName;
+    private BigDecimal charge;
+    private Long photoShow;
+    private Long photoClick;
+    private Long aclick;
+    private Long bclick;
+    private Long activation;
+    private Long submit;
+    private Long eventRegister;
+    private Long eventNextDayStay;
+    private BigDecimal activationCost;
+    private String photoClickRate;
+    private String bclickRate;
+    private BigDecimal impression1kCost;
+    private BigDecimal photoClickCost;
+    private BigDecimal actionCost;
+    private Long photoShare;
+    private Long photoComment;
+    private Long photoLike;
+    private Long follow;
+    private Long report;
+    private Long cancelFollow;
+    private Long block;
+    private Long nagative;
+    private Long downloadStarted;
+    private Long downloadCompleted;
+    private BigDecimal eventNextDayStayCost;
+}

+ 100 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ProjectMember.java

@@ -0,0 +1,100 @@
+package cn.com.ctop.kuaishou.modules.report.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 com.fasterxml.jackson.annotation.JsonFormat;
+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 org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 项目成员
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-19
+ */
+@Data
+@TableName("ctop_project_member")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_project_member对象", description = "项目成员")
+public class ProjectMember implements  Serializable{
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+
+
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 成员id
+     */
+    @Excel(name = "成员id", width = 15)
+    @ApiModelProperty(value = "成员id")
+    private String userId;
+
+    @Excel(name = "成员名称", width = 15)
+    @ApiModelProperty(value = "成员名称")
+    private String userName;
+
+    private String roleCode;
+
+    @TableField(exist = false)
+    private Long maxBid;
+
+
+    @TableField(exist = false)
+    private String responsibleName;
+
+
+    @TableField(exist = false)
+    private String designResponsibleName;
+
+    @TableField(exist = false)
+    private String advertiserName;
+    @TableField(exist = false)
+    private String advertiserId;
+
+
+    @TableField(exist = false)
+    private String mediaId;
+
+
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

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

@@ -1,6 +1,9 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -15,4 +18,27 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     List<JSONObject> selectCost(@Param("accountId") Long accountId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
+    ProjectAccountDTO getKuaishouProjectInfo(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId);
+
+    List<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId);
+
+    List<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("accountId")Long accountId);
+
+    List<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("campaignId")Long campaignId);
+
+    List<ProjectAccountDTO> queryProjectMemberByUserId(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+
+    List<ProjectAccountDTO> queryProjectInfoBySaleId(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+
+    List<ProjectAccountDTO> queryProjectMemberByIds(@Param("projectIds")List<Long> projectIds);
+
+    String getRoleCodeByUserId(@Param("userId")String userId);
+
+    List<ProjectAccountDTO> queryProjectMemberByAdmins(@Param("mediaIds")List<Long> mediaIds);
+
+    List<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("unitId")Long unitId);
+
+    KuaishouVideoInfoDTO getVideoUrl(@Param("photoId")Long photoId);
+
+    List<Long> getUserProjectAccountIds(@Param("userId")String userId);
 }

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

@@ -530,4 +530,559 @@
         group by stat_date
     </select>
 
-</mapper>
+    <select id="getKuaishouAccountInfoByProjectId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        a.account_id as 'accountId',
+        b.auth_name as 'authName',
+        b.project_id as 'projectId',
+        b.project_name as 'projectName',
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick',  -- 素材曝光数
+        sum(a.bclick) as 'bclick',  -- 行为数
+        sum(a.activation) as 'activation',  -- 激活数
+        sum(a.submit) as 'submit',   -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister',   -- 注册数
+        sum(a.event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        (case
+        when sum(a.photo_show) != 0
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.photo_click) != 0
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost'  -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_account a
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        <if test="projectId!=null and projectId != '' ">
+            and
+            b.project_id = #{projectId}
+        </if>>
+        group by a.account_id
+        order by sum(a.charge) desc
+    </select>
+
+    <select id="getKuaishouProjectInfo" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
+        select
+        concat(#{startDate}, '~' , #{endDate}) as 'statDate',
+        (select project_id from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectId',
+        (select project_name from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectName',
+        (select advertiser_name from ctop_project where id = (select project_id from ctop_user_allocation where
+         					account_id = a.account_id limit 1
+					)) as 'advertiserName',
+        (select responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where
+        					account_id = a.account_id limit 1
+					)) as 'responsibleName',
+        (select design_responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where 					account_id = a.account_id limit 1
+					)) as 'designResponsibleName',
+        ifnull(round(sum(a.charge),2),0) as 'charge',
+        ifnull(sum(a.photo_show),0) as 'photoShow',  -- 封面曝光数
+        ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
+        ifnull(sum(a.aclick),0) as 'aclick',  -- 素材曝光数
+        ifnull(sum(a.bclick),0) as 'bclick',  -- 行为数
+        ifnull(sum(a.activation),0) as 'activation',  -- 激活数
+        ifnull(sum(a.submit),0) as 'submit',   -- 提交按钮点击数
+        ifnull(sum(a.event_register),0) as 'eventRegister',   -- 注册数
+        ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',   -- 封面点击率
+        case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate',  -- 行为率
+        (case
+        when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
+        then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
+        then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN ( sum(a.photo_click) is not null and sum(a.photo_click) != 0)
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        ifnull(sum(a.photo_share),0) as 'photoShare',  -- 分享数
+        ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
+        ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
+        ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
+        ifnull(sum(a.report),0) as 'report', -- 举报数
+        ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
+        ifnull(sum(a.block),0) as 'block', -- 拉黑数
+        ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
+        ifnull(sum(a.download_started),0) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        ifnull(sum(a.download_completed),0) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
+        THEN round(  ifnull(sum(a.charge),0) / sum(a.event_next_day_stay)  ,2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost'  -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_account a
+        left join  (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        -- left join ctop_project c on b.project_id = c.id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        and
+        b.project_id = #{projectId}
+<!--        <foreach collection="projectList" item="item" separator=","-->
+<!--                 open="(" close=")">-->
+<!--            #{item}-->
+<!--        </foreach>-->
+<!--        group by b.project_id-->
+    </select>
+
+    <!-- 计划汇总 -->
+    <select id="getKuaishouCampaignInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        b.project_name as 'projectName',
+        b.auth_name as 'authName',
+        a.account_id as 'accountId',
+        a.campaign_id as 'campaignId',  -- 计划id
+        a.campaign_name as 'campaignName',   -- 计划名称
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick',  -- 素材曝光数
+        sum(a.bclick) as 'bclick',  -- 行为数
+        sum(a.activation) as 'activation',  -- 激活数
+        sum(a.submit) as 'submit',   -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister',   -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        (case
+        when sum(a.photo_show) != 0
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.photo_click) != 0
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost'  -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_campaign a
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        <if test="accountId !=null and accountId != '' ">
+            and
+            a.account_id = #{accountId}
+        </if>
+        group by a.campaign_id
+    </select>
+
+    <!-- 根据计划id获取组信息 -->
+    <select id="getKuaishouUnitInfoByCampaignId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        b.project_name as 'projectName',
+        a.account_id as 'accountId',
+        b.auth_name as 'authName',
+        a.campaign_id as 'campaignId',  -- 计划id
+        a.campaign_name as 'campaignName',  -- 计划名称
+        a.unit_id as 'unitId',  -- 组id,
+        a.unit_name as 'unitName',  -- 组名称
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick',  -- 素材曝光数
+        sum(a.bclick) as 'bclick',  -- 行为数
+        sum(a.activation) as 'activation',  -- 激活数
+        sum(a.submit) as 'submit',   -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister',   -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        (case
+        when sum(a.photo_show) != 0
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.photo_click) != 0
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost'  -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_group a
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+--         left join ctop_kuaishou_campaign c on a.campaign_id = c.campaign_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        <if test="campaignId != null and campaignId != ''">
+            and
+            a.campaign_id = #{campaignId}
+        </if>
+        group by unit_id
+    </select>
+
+    <select id="queryProjectMemberByUserId" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
+        select
+        distinct a.project_id as projectId,
+        a.project_name as projectName,
+--         a.advertiser_id as advertiserId,
+        a.advertiser_name as advertiserName,
+--         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
+        c.responsible_name as responsibleName,
+        c.design_responsible_name as designResponsibleName
+        from
+        ctop_user_allocation a
+        left join ctop_project_member b on a.project_id = b.project_id
+        left join ctop_project c on a.project_id = c.id
+        where b.user_id = #{userId}
+        and a.media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        order by c.create_time desc
+    </select>
+
+    <select id="queryProjectInfoBySaleId" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
+        select
+        distinct c.id as projectId,
+        c.project_name as projectName,
+        --         a.advertiser_id as advertiserId,
+        c.advertiser_name as advertiserName,
+        --         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
+        c.responsible_name as responsibleName,
+        c.design_responsible_name as designResponsibleName,
+        c.sale_id as saleId,
+        u.realname as saleName
+        from
+        ctop_project c
+        left join sys_user u on c.sale_id = u.id
+        where c.sale_id = #{userId}
+        and c.media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        order by c.create_time desc
+    </select>
+
+    <select id="queryProjectMemberByIds" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
+        select
+        distinct id as projectId,
+                project_name as projectName,
+        --         a.advertiser_id as advertiserId,
+                advertiser_name as advertiserName,
+        --         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
+                responsible_name as responsibleName,
+                design_responsible_name as designResponsibleName
+        from ctop_project
+        where
+        id in
+            <foreach collection="projectIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        order by create_time desc
+    </select>
+
+    <select id="getRoleCodeByUserId" resultType="string">
+        select
+        role_code
+        from
+        sys_user_role a
+        left join sys_role b on a.role_id = b.id
+        where a.user_id = #{userId}
+    </select>
+
+    <!-- 设计师展示所有自己的角色下制作的视频 -->
+    <select id="queryProjectMemberByAdmins" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
+        select
+        id as projectId,
+        project_name as projectName,
+        advertiser_name as advertiserName ,
+        responsible_name as responsibleName,
+        design_responsible_name as designResponsibleName
+        from
+        ctop_project
+        where
+        media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        order by create_time desc
+    </select>
+
+    <select id="getKuaishouCreativeInfoByUnitId2" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        a.*,
+        b.photo_id as 'photoId'
+        from
+        (
+            select
+            concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+            b.project_id as 'projectId',
+            b.project_name as 'projectName',
+            a.account_id as 'accountId',
+            b.auth_name as 'authName',
+            a.creative_id as 'creativeId',
+            a.creative_name as 'creativeName',
+            a.campaign_id as 'campaignId',  -- 计划id
+            a.campaign_name as 'campaignName',  -- 计划名称
+            a.unit_id as 'unitId',  -- 组id,
+            a.unit_name as 'unitName',  -- 组名称
+            round(sum(a.charge),2) as 'charge',
+            sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+            sum(a.photo_click) as 'photoClick', -- 封面点击数
+            sum(a.aclick) as 'aclick',  -- 素材曝光数
+            sum(a.bclick) as 'bclick',  -- 行为数
+            sum(a.activation) as 'activation',  -- 激活数
+            sum(a.submit) as 'submit',   -- 提交按钮点击数
+            sum(a.event_register) as 'eventRegister',   -- 注册数
+            sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+            ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+            case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+            case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+            (case
+            when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
+            then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+            else 0
+            end
+            ) as 'impression1kCost', -- 均千次封面曝光花费
+            (case
+            when sum(a.photo_click) != 0
+            then round(sum(a.charge) / sum(a.photo_click),2)
+            else 0
+            end
+            ) as 'photoClickCost', -- 平均封面点击单价
+            (CASE
+            WHEN sum(a.photo_click) != 0
+            THEN round(sum(a.charge) / sum(a.photo_click),2)
+            ELSE 0
+            end
+            ) as 'actionCost', -- 平均行为单价
+            sum(a.photo_share) as 'photoShare',  -- 分享数
+            sum(a.photo_comment) as 'photoComment', -- 评论数
+            sum(a.photo_like) as 'photoLike', -- 点赞数
+            sum(a.follow) as 'follow', -- 新增关注数
+            sum(a.report) as 'report', -- 举报数
+            sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+            sum(a.block) as 'block', -- 拉黑数
+            sum(a.negative) as 'nagative', -- 减少此类作品数
+            sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+            sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+            (CASE
+            WHEN sum(a.event_next_day_stay) != 0
+            THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+            ELSE 0
+            end
+            ) as 'eventNextDayStayCost'  -- 次日留存成本
+            from
+            ctop_kuaishou_report_daily_creative a
+            left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+            where
+            a.stat_date &gt;= #{startDate}
+            and
+            a.stat_date &lt;= #{endDate}
+            <if test="unitId != null and unitId !='' ">
+                and
+                a.unit_id = #{unitId}
+            </if>
+            group by creative_id
+        ) a
+        left join  ctop_kuaishou_creative b on a.creativeId = b.creative_id
+    </select>
+
+    <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        select
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        b.project_name as 'projectName',
+        a.account_id as 'accountId',
+        b.auth_name as 'authName',
+        a.creative_id as 'creativeId',
+        a.creative_name as 'creativeName',
+        a.campaign_id as 'campaignId',  -- 计划id
+        a.campaign_name as 'campaignName',  -- 计划名称
+        a.unit_id as 'unitId',  -- 组id,
+        a.unit_name as 'unitName',  -- 组名称
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick',  -- 素材曝光数
+        sum(a.bclick) as 'bclick',  -- 行为数
+        sum(a.activation) as 'activation',  -- 激活数
+        sum(a.submit) as 'submit',   -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister',   -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        (case
+        when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.photo_click) != 0
+        THEN round(sum(a.charge) / sum(a.photo_click),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost',  -- 次日留存成本
+        (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
+        (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl
+        from
+        ctop_kuaishou_report_daily_creative a
+        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        <if test="unitId != null and unitId !='' ">
+            and
+            a.unit_id = #{unitId}
+        </if>
+        group by a.creative_id
+    </select>
+
+    <select id="getVideoUrl" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO">
+        select
+        url as url,
+        cover_url as coverUrl
+        from
+        ctop_kuaishou_video_get
+        where photo_id = #{photoId}
+        limit 1
+    </select>
+
+    <!-- 获取项目成员所在所有项目下的所有账户id -->
+    <select id="getUserProjectAccountIds" resultType="long">
+        select
+        a.account_id
+        from
+        (select * from ctop_user_allocation  group by account_id) a
+        left join ctop_project_member b on a.project_id=b.project_id
+        where b.user_id = #{userId}
+    </select>
+
+</mapper>

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

@@ -1,13 +1,31 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public interface IKuaishouReportDailyAccountService extends IService<KuaishouReportDailyAccount> {
 
     List<JSONObject> selectCost(Long accountId, String startDate, String endDate);
 
+    PageInfo<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList , Integer pageSize, Integer pageNum, String sort );
+
+    PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort);
+
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+
+    PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum);
+
 }

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

@@ -1,13 +1,23 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO;
+import cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAccountService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.mgt.SecurityManager;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 @Service
@@ -20,4 +30,156 @@ public class KuaishouReportDailyAccountServiceImpl extends ServiceImpl<KuaishouR
     public List<JSONObject> selectCost(Long accountId, String startDate, String endDate) {
         return dailyAccountMapper.selectCost(accountId, startDate, endDate);
     }
+
+    @Override
+    public PageInfo<ProjectAccountDTO> getKuaishouProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
+        List<ProjectAccountDTO> projectAccountDTOList = new ArrayList<>();
+
+        if(projectList==null || projectList.size()==0){
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //String userId = "a6abfea0f27843bf8595a234410afb04";
+            String userId = sysUser.getId();
+            String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
+
+            List<Long> mediaIds = new ArrayList<>();
+            mediaIds.add(2L);
+            mediaIds.add(4L);
+
+            if("admin".equals(roleCode)){
+                PageHelper.startPage(pageNum,pageSize);
+                projectAccountDTOList = dailyAccountMapper.queryProjectMemberByAdmins(mediaIds);
+            }else{
+                PageHelper.startPage(pageNum,pageSize);
+                projectAccountDTOList = dailyAccountMapper.queryProjectMemberByUserId(userId,mediaIds);
+            }
+        }else{
+            PageHelper.startPage(pageNum,pageSize);
+            projectAccountDTOList = dailyAccountMapper.queryProjectMemberByIds(projectList);
+        }
+
+        for(ProjectAccountDTO project:projectAccountDTOList){
+            ProjectAccountDTO project2 = dailyAccountMapper.getKuaishouProjectInfo(startDate, endDate, project.getProjectId());
+            project.setCharge(project2.getCharge());
+            project.setPhotoShow(project2.getPhotoShow());
+            project.setPhotoClick(project2.getPhotoClick());
+            project.setAclick(project2.getAclick());
+            project.setBclick(project2.getBclick());
+            project.setActivation(project2.getActivation());
+            project.setSubmit(project2.getSubmit());
+            project.setEventRegister(project2.getEventRegister());
+            project.setEventNextDayStay(project2.getEventNextDayStay());
+            project.setActivationCost(project2.getActivationCost());
+            project.setPhotoClickRate(project2.getPhotoClickRate());
+            project.setBclickRate(project2.getBclickRate());
+            project.setImpression1kCost(project2.getImpression1kCost());
+            project.setPhotoClickCost(project2.getPhotoClickCost());
+            project.setPhotoShare(project2.getPhotoShare());
+            project.setActionCost(project2.getActionCost());
+            project.setPhotoComment(project2.getPhotoComment());
+            project.setPhotoLike(project2.getPhotoLike());
+            project.setFollow(project2.getFollow());
+            project.setReport(project2.getReport());
+            project.setCancelFollow(project2.getCancelFollow());
+            project.setBlock(project2.getBlock());
+            project.setNagative(project2.getNagative());
+            project.setDownloadStarted(project2.getDownloadStarted());
+            project.setDownloadCompleted(project2.getDownloadCompleted());
+            project.setEventNextDayStayCost(project2.getEventNextDayStayCost());
+            project.setStatDate(startDate + "~" + endDate);
+        }
+
+        return new PageInfo<>(projectAccountDTOList);
+    }
+
+    @Override
+    public PageInfo<ProjectAccountDTO> getKuaishouSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageSize, Integer pageNum, String sort ){
+        List<ProjectAccountDTO> projectAccountDTOList = new ArrayList<>();
+
+        if(projectList==null || projectList.size()==0){
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            //String userId = "e9ca23d68d884d4ebb19d07889727dae";
+            String userId = sysUser.getId();
+            String roleCode = dailyAccountMapper.getRoleCodeByUserId(userId);
+
+            List<Long> mediaIds = new ArrayList<>();
+            mediaIds.add(2L);
+            mediaIds.add(4L);
+
+            if("admin".equals(roleCode)){
+                PageHelper.startPage(pageNum,pageSize);
+                projectAccountDTOList = dailyAccountMapper.queryProjectMemberByAdmins(mediaIds);
+            }else{
+                PageHelper.startPage(pageNum,pageSize);
+                projectAccountDTOList = dailyAccountMapper.queryProjectInfoBySaleId(userId,mediaIds);
+            }
+        }else{
+            PageHelper.startPage(pageNum,pageSize);
+            projectAccountDTOList = dailyAccountMapper.queryProjectMemberByIds(projectList);
+        }
+
+        for(ProjectAccountDTO project:projectAccountDTOList){
+            ProjectAccountDTO project2 = dailyAccountMapper.getKuaishouProjectInfo(startDate, endDate, project.getProjectId());
+            project.setCharge(project2.getCharge());
+            project.setPhotoShow(project2.getPhotoShow());
+            project.setPhotoClick(project2.getPhotoClick());
+            project.setAclick(project2.getAclick());
+            project.setBclick(project2.getBclick());
+            project.setActivation(project2.getActivation());
+            project.setSubmit(project2.getSubmit());
+            project.setEventRegister(project2.getEventRegister());
+            project.setEventNextDayStay(project2.getEventNextDayStay());
+            project.setActivationCost(project2.getActivationCost());
+            project.setPhotoClickRate(project2.getPhotoClickRate());
+            project.setBclickRate(project2.getBclickRate());
+            project.setImpression1kCost(project2.getImpression1kCost());
+            project.setPhotoClickCost(project2.getPhotoClickCost());
+            project.setPhotoShare(project2.getPhotoShare());
+            project.setActionCost(project2.getActionCost());
+            project.setPhotoComment(project2.getPhotoComment());
+            project.setPhotoLike(project2.getPhotoLike());
+            project.setFollow(project2.getFollow());
+            project.setReport(project2.getReport());
+            project.setCancelFollow(project2.getCancelFollow());
+            project.setBlock(project2.getBlock());
+            project.setNagative(project2.getNagative());
+            project.setDownloadStarted(project2.getDownloadStarted());
+            project.setDownloadCompleted(project2.getDownloadCompleted());
+            project.setEventNextDayStayCost(project2.getEventNextDayStayCost());
+            project.setStatDate(startDate + "~" + endDate);
+        }
+
+        return new PageInfo<>(projectAccountDTOList);
+    }
+
+
+    @Override
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouAccountInfoByProjectId(Long projectId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+        PageHelper.startPage(pageNum,pageSize);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouAccountInfoByProjectId(startDate, endDate, projectId));
+    }
+
+    @Override
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCampaignInfoByAccountId(Long accountId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+        PageHelper.startPage(pageNum,pageSize);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouCampaignInfoByAccountId(startDate, endDate, accountId));
+    }
+
+    @Override
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouUnitInfoByCampaignId(Long campaignId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+        PageHelper.startPage(pageNum,pageSize);
+        return new PageInfo<>(dailyAccountMapper.getKuaishouUnitInfoByCampaignId(startDate, endDate, campaignId));
+    }
+
+    @Override
+    public PageInfo<KuaishouReportDailyAccountDTO> getKuaishouCreativeInfoByUnitId(Long unitId, String startDate, String endDate, Integer pageSize, Integer pageNum){
+        PageHelper.startPage(pageNum,pageSize);
+        List<KuaishouReportDailyAccountDTO> kuaishouCreativeInfoList = dailyAccountMapper.getKuaishouCreativeInfoByUnitId(startDate, endDate, unitId);
+        //for(KuaishouReportDailyAccountDTO creativeInfo:kuaishouCreativeInfoList){
+        //    KuaishouVideoInfoDTO videoInfo = dailyAccountMapper.getVideoUrl(creativeInfo.getPhotoId());
+        //    creativeInfo.setUrl(videoInfo.getUrl());
+        //    creativeInfo.setCoverUrl(videoInfo.getCoverUrl());
+        //}
+        return new PageInfo<>(kuaishouCreativeInfoList);
+    }
+
 }

+ 11 - 0
module-toutiao/pom.xml

@@ -32,6 +32,17 @@
             <artifactId>module-crawler</artifactId>
             <version>2.0.2</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.googlecode.plist</groupId>
+            <artifactId>dd-plist</artifactId>
+            <version>1.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.tony19</groupId>
+            <artifactId>apktool-lib</artifactId>
+            <version>1.4.4-3</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 150 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/BytedanceIndustryInfoController.java

@@ -0,0 +1,150 @@
+package cn.com.ctop.toutiao.modules.batch.controller;
+
+import cn.com.ctop.toutiao.modules.batch.entity.BytedanceIndustryInfo;
+import cn.com.ctop.toutiao.modules.batch.service.IBytedanceIndustryInfoService;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+ /**
+ * 头条行业类别
+ * @author jeecg-boot
+ * @date   2020-07-30
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条行业类别")
+@RestController
+@RequestMapping("/ctop/bytedanceIndustryInfo")
+public class BytedanceIndustryInfoController {
+	@Autowired
+	private IBytedanceIndustryInfoService bytedanceIndustryInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceIndustryInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@ApiOperation(value="头条行业类别-分页列表查询", notes="头条行业类别-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceIndustryInfo>> queryPageList(BytedanceIndustryInfo bytedanceIndustryInfo,
+															  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															  HttpServletRequest req) {
+		Result<IPage<BytedanceIndustryInfo>> result = new Result<>();
+		QueryWrapper<BytedanceIndustryInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceIndustryInfo, req.getParameterMap());
+		Page<BytedanceIndustryInfo> page = new Page<BytedanceIndustryInfo>(pageNo, pageSize);
+		IPage<BytedanceIndustryInfo> pageList = bytedanceIndustryInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceIndustryInfo
+	 * @return
+	 */
+	@ApiOperation(value="头条行业类别-添加", notes="头条行业类别-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceIndustryInfo> add(@RequestBody BytedanceIndustryInfo bytedanceIndustryInfo) {
+		Result<BytedanceIndustryInfo> result = new Result<>();
+		try {
+			bytedanceIndustryInfoService.save(bytedanceIndustryInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceIndustryInfo
+	 * @return
+	 */
+	@ApiOperation(value="头条行业类别-编辑", notes="头条行业类别-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceIndustryInfo> edit(@RequestBody BytedanceIndustryInfo bytedanceIndustryInfo) {
+		Result<BytedanceIndustryInfo> result = new Result<BytedanceIndustryInfo>();
+		BytedanceIndustryInfo bytedanceIndustryInfoEntity = bytedanceIndustryInfoService.getById(bytedanceIndustryInfo.getId());
+		if(bytedanceIndustryInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceIndustryInfoService.updateById(bytedanceIndustryInfo);
+			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 {
+			bytedanceIndustryInfoService.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<BytedanceIndustryInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<BytedanceIndustryInfo> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceIndustryInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value="头条行业类别-通过id查询", notes="头条行业类别-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceIndustryInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceIndustryInfo> result = new Result<>();
+		BytedanceIndustryInfo bytedanceIndustryInfo = bytedanceIndustryInfoService.getById(id);
+		if(bytedanceIndustryInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceIndustryInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+}

+ 53 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/entity/BytedanceIndustryInfo.java

@@ -0,0 +1,53 @@
+package cn.com.ctop.toutiao.modules.batch.entity;
+
+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
+ * @date   2020-07-30
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_industry_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_industry_info对象", description="头条行业类别")
+public class BytedanceIndustryInfo {
+
+	/**id*/
+	@TableId
+    @ApiModelProperty(value = "id")
+	private Long id;
+	/**name*/
+	@Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+	private String name;
+	/**code*/
+	@Excel(name = "code", width = 15)
+    @ApiModelProperty(value = "code")
+	private String code;
+	/**parentCode*/
+	@Excel(name = "parentCode", width = 15)
+    @ApiModelProperty(value = "parentCode")
+	private String parentCode;
+	/**level*/
+	@Excel(name = "level", width = 15)
+    @ApiModelProperty(value = "level")
+	private Integer level;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

+ 14 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/mapper/BytedanceIndustryInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.toutiao.modules.batch.mapper;
+
+import cn.com.ctop.toutiao.modules.batch.entity.BytedanceIndustryInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 头条行业类别
+ * @author: jeecg-boot
+ * @date:   2020-07-30
+ * @cersion: V1.0
+ */
+public interface BytedanceIndustryInfoMapper extends BaseMapper<BytedanceIndustryInfo> {
+
+}

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

@@ -1,5 +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 namespace="cn.com.ctop.toutiao.modules.batch.mapper.BytedanceIndustryInfoMapper">
 
 </mapper>

+ 19 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/IBytedanceIndustryInfoService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.toutiao.modules.batch.service;
+
+import cn.com.ctop.toutiao.modules.batch.entity.BytedanceIndustryInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * 头条行业类别
+ * @author jeecg-boot
+ * @date   2020-07-30
+ * @version V1.0
+ */
+public interface IBytedanceIndustryInfoService extends IService<BytedanceIndustryInfo> {
+
+    Map<String, Object> getBytedanceIndustryList(Long accountId,Integer level);
+
+    Map<String, Object> getIndustryList();
+}

+ 116 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/service/impl/BytedanceIndustryInfoServiceImpl.java

@@ -0,0 +1,116 @@
+package cn.com.ctop.toutiao.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.toutiao.modules.batch.entity.BytedanceIndustryInfo;
+import cn.com.ctop.toutiao.modules.batch.mapper.BytedanceIndustryInfoMapper;
+import cn.com.ctop.toutiao.modules.batch.service.IBytedanceIndustryInfoService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 头条行业类别
+ * @author jeecg-boot
+ * @date   2020-07-30
+ * @version V1.0
+ */
+@Service
+public class BytedanceIndustryInfoServiceImpl extends ServiceImpl<BytedanceIndustryInfoMapper, BytedanceIndustryInfo> implements IBytedanceIndustryInfoService {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Override
+    public Map<String, Object> getBytedanceIndustryList(Long accountId,Integer level) {
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        // 请求地址
+        String url = "https://ad.oceanengine.com/open_api/2/tools/industry/get/";
+        // 请求参数
+        JSONObject data = new JSONObject();
+        if(null!=level&&level!=0){
+            data.put("level",level);
+        }
+        JSONObject result = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, data);
+        JSONArray arrays = result.getJSONObject("data").getJSONArray("list");
+        for(int i=0;i<arrays.size();i++){
+            JSONObject getData = arrays.getJSONObject(i);
+            BytedanceIndustryInfo industryInfo = new BytedanceIndustryInfo();
+            Integer getLevel = getData.getInteger("level");
+            industryInfo.setLevel(getLevel);
+            industryInfo.setName(getData.getString("industry_name"));
+            industryInfo.setCode(getData.getLong("industry_id")+"");
+            industryInfo.setId(getData.getLong("industry_id"));
+            if(getLevel == 1){
+                industryInfo.setParentCode("0");
+            }
+            if(getLevel == 2){
+                industryInfo.setParentCode(getData.getLong("first_industry_id")+"");
+            }
+            if(getLevel == 3){
+                industryInfo.setParentCode(getData.getLong("second_industry_id")+"");
+            }
+            industryInfo.setUpdateTime(new Date());
+            this.saveOrUpdate(industryInfo);
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> getIndustryList() {
+        Map<String,Object>result = new HashMap<>();
+        List<BytedanceIndustryInfo>firstLevelIndustry = this.getListByParams(1,"0");
+        JSONArray array = new JSONArray();
+        for (BytedanceIndustryInfo firstInfo:firstLevelIndustry) {
+            JSONObject firstData = new JSONObject();
+            firstData.put("id",firstInfo.getId());
+            firstData.put("name",firstInfo.getName());
+            List<BytedanceIndustryInfo>secondLevelIndustry = this.getListByParams(2,firstInfo.getCode());
+            if(null!=secondLevelIndustry&&!secondLevelIndustry.isEmpty()){
+                JSONArray firstChildrenArray = new JSONArray();
+                for(BytedanceIndustryInfo secendInfo:secondLevelIndustry){
+                    JSONObject secondData = new JSONObject();
+                    secondData.put("id",secendInfo.getId());
+                    secondData.put("name",secendInfo.getName());
+                    List<BytedanceIndustryInfo>thirdLevelIndustry = this.getListByParams(3,secendInfo.getCode());
+                    if(null!=thirdLevelIndustry&&!thirdLevelIndustry.isEmpty()){
+                        JSONArray secondChildrenArray = new JSONArray();
+                        for (BytedanceIndustryInfo thirdInfo:thirdLevelIndustry) {
+                            JSONObject thirdChData = new JSONObject();
+                            thirdChData.put("id",thirdInfo.getId());
+                            thirdChData.put("name",thirdInfo.getName());
+                            secondChildrenArray.add(thirdChData);
+                        }
+                        secondData.put("children",secondChildrenArray);
+                    }
+                    firstChildrenArray.add(secondData);
+                }
+                firstData.put("children",firstChildrenArray);
+            }
+            array.add(firstData);
+        }
+        result.put("data",array);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    public List<BytedanceIndustryInfo>getListByParams(Integer level,String parentCode){
+        QueryWrapper<BytedanceIndustryInfo>queryWrapper = new QueryWrapper<>();
+        if(null!=level&&level!=0){
+            queryWrapper.eq("level",level);
+        }
+        if(null!=parentCode&&!parentCode.trim().equals("")){
+            queryWrapper.eq("parent_code",parentCode);
+        }
+       return this.list(queryWrapper);
+    }
+}

+ 241 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/BytedanceImageInfoController.java

@@ -0,0 +1,241 @@
+package cn.com.ctop.toutiao.modules.material.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceImageInfo;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceImageInfoService;
+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-01
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="头条图片素材")
+@RestController
+@RequestMapping("/ctop/bytedanceImageInfo")
+public class BytedanceImageInfoController {
+	@Autowired
+	private IBytedanceImageInfoService bytedanceImageInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceImageInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "头条图片素材-分页列表查询")
+	@ApiOperation(value="头条图片素材-分页列表查询", notes="头条图片素材-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceImageInfo>> queryPageList(BytedanceImageInfo bytedanceImageInfo,
+														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														   HttpServletRequest req) {
+		Result<IPage<BytedanceImageInfo>> result = new Result<>();
+		QueryWrapper<BytedanceImageInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceImageInfo, req.getParameterMap());
+		Page<BytedanceImageInfo> page = new Page<BytedanceImageInfo>(pageNo, pageSize);
+		IPage<BytedanceImageInfo> pageList = bytedanceImageInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceImageInfo
+	 * @return
+	 */
+	@AutoLog(value = "头条图片素材-添加")
+	@ApiOperation(value="头条图片素材-添加", notes="头条图片素材-添加")
+	@PostMapping(value = "/add")
+	public Result<BytedanceImageInfo> add(@RequestBody BytedanceImageInfo bytedanceImageInfo) {
+		Result<BytedanceImageInfo> result = new Result<>();
+		try {
+			bytedanceImageInfoService.save(bytedanceImageInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceImageInfo
+	 * @return
+	 */
+	@AutoLog(value = "头条图片素材-编辑")
+	@ApiOperation(value="头条图片素材-编辑", notes="头条图片素材-编辑")
+	@PutMapping(value = "/edit")
+	public Result<BytedanceImageInfo> edit(@RequestBody BytedanceImageInfo bytedanceImageInfo) {
+		Result<BytedanceImageInfo> result = new Result<BytedanceImageInfo>();
+		BytedanceImageInfo bytedanceImageInfoEntity = bytedanceImageInfoService.getById(bytedanceImageInfo.getId());
+		if(bytedanceImageInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceImageInfoService.updateById(bytedanceImageInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "头条图片素材-通过id删除")
+	@ApiOperation(value="头条图片素材-通过id删除", notes="头条图片素材-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			bytedanceImageInfoService.removeById(id);
+		} 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<BytedanceImageInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<BytedanceImageInfo> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.bytedanceImageInfoService.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<BytedanceImageInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceImageInfo> result = new Result<>();
+		BytedanceImageInfo bytedanceImageInfo = bytedanceImageInfoService.getById(id);
+		if(bytedanceImageInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceImageInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+      // Step.1 组装查询条件
+      QueryWrapper<BytedanceImageInfo> queryWrapper = null;
+      try {
+          String paramsStr = request.getParameter("paramsStr");
+          if (oConvertUtils.isNotEmpty(paramsStr)) {
+              String deString = URLDecoder.decode(paramsStr, "UTF-8");
+              BytedanceImageInfo bytedanceImageInfo = JSON.parseObject(deString, BytedanceImageInfo.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(bytedanceImageInfo, request.getParameterMap());
+          }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+
+      //Step.2 AutoPoi 导出Excel
+      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+      List<BytedanceImageInfo> pageList = bytedanceImageInfoService.list(queryWrapper);
+      //导出文件名称
+      mv.addObject(NormalExcelConstants.FILE_NAME, "头条图片素材列表");
+      mv.addObject(NormalExcelConstants.CLASS, BytedanceImageInfo.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<BytedanceImageInfo> listBytedanceImageInfos = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceImageInfo.class, params);
+              bytedanceImageInfoService.saveBatch(listBytedanceImageInfos);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceImageInfos.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("文件导入失败!");
+  }
+
+}

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreative.java

@@ -42,6 +42,7 @@ public class ByteDanceCreative {
     /**
      * 本平台广告主id
      */
+    @Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
     private String accountId;
     /**
      * 创意素材标题

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceEffectVideoInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.material.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -28,9 +29,13 @@ public class BytedanceEffectVideoInfo {
 	private String url;
 	private String initialCostDate;
 	private String finalCostDate;
+	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	private String plane;
+	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	private String plan;
+	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	private String shot;
+	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	private String clip;
 	private String manager;
 	private java.math.BigDecimal twoWeekCost;

+ 95 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/BytedanceImageInfo.java

@@ -0,0 +1,95 @@
+package cn.com.ctop.toutiao.modules.material.entity;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import com.alibaba.fastjson.JSONObject;
+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
+ * @date   2020-08-01
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_bytedance_image_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_bytedance_image_info对象", description="头条图片素材")
+public class BytedanceImageInfo {
+
+	/**id*/
+	@TableId()
+    @ApiModelProperty(value = "id")
+	private String id;
+	/**头条平台账号id*/
+	private Long accountId;
+	/**advertiserId*/
+	private Long materialId;
+	/**图片大小*/
+	@Excel(name = "图片大小", width = 15)
+    @ApiModelProperty(value = "图片大小")
+	private Long size;
+	/**图片宽度*/
+	@Excel(name = "图片宽度", width = 15)
+    @ApiModelProperty(value = "图片宽度")
+	private Long width;
+	/**图片高度*/
+	@Excel(name = "图片高度", width = 15)
+    @ApiModelProperty(value = "图片高度")
+	private Long height;
+	/**预览地址*/
+	@Excel(name = "预览地址", width = 15)
+    @ApiModelProperty(value = "预览地址")
+	private String url;
+	private String imageUrl;
+	/**图片格式*/
+	@Excel(name = "图片格式", width = 15)
+    @ApiModelProperty(value = "图片格式")
+	private String format;
+	/**图片Md5*/
+	@Excel(name = "图片Md5", width = 15)
+    @ApiModelProperty(value = "图片Md5")
+	private String signature;
+	private String imageCreateTime;
+	private String fileName;
+	/**createTime*/
+    @ApiModelProperty(value = "createTime")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+
+	public BytedanceImageInfo(JSONObject dataObject, CtopOauthToken token) {
+		String id = dataObject.getString("id");
+		if(null!=id&&id.contains("web")){
+			this.imageUrl = "https://sf6-ttcdn-tos.pstatp.com/obj/"+id;
+		}else{
+			this.imageUrl = "https://sf6-ttcdn-tos.pstatp.com/obj/mosaic-legacy/"+id;
+		}
+		this.id = dataObject.getString("id");
+		this.accountId = token.getAccountId();
+		this.materialId = dataObject.getLong("material_id");
+		this.size = dataObject.getLong("size");
+		this.width = dataObject.getLong("width");
+		this.height = dataObject.getLong("height");
+		this.url = dataObject.getString("url");
+		this.format = dataObject.getString("format");
+		this.signature = dataObject.getString("signature");
+		this.imageCreateTime = dataObject.getString("create_time");
+		this.fileName = dataObject.getString("filename");
+		this.createTime = new Date();
+		this.updateTime = new Date();
+	}
+
+	public BytedanceImageInfo() {
+	}
+}

+ 18 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.toutiao.modules.material.mapper;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceImageInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 头条图片素材
+ * @author: jeecg-boot
+ * @date:   2020-08-01
+ * @cersion: V1.0
+ */
+public interface BytedanceImageInfoMapper extends BaseMapper<BytedanceImageInfo> {
+
+    void replaceBatch(@Param(value = "imageInfos")List<BytedanceImageInfo> imageInfos);
+}

+ 35 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceImageInfoMapper.xml

@@ -0,0 +1,35 @@
+<?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.toutiao.modules.material.mapper.BytedanceImageInfoMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_bytedance_image_info(
+        id,
+        account_id,
+        material_id,
+        size,
+        width,
+        height,
+        url,
+        format,
+        signature,
+        image_create_time,
+        create_time,
+        update_time,image_url)
+        values
+        <foreach collection="imageInfos" item="imageInfo" separator=",">
+            (#{imageInfo.id},
+            #{imageInfo.accountId},
+            #{imageInfo.materialId},
+            #{imageInfo.size},
+            #{imageInfo.width},
+            #{imageInfo.height},
+            #{imageInfo.url},
+            #{imageInfo.format},
+            #{imageInfo.signature},
+            #{imageInfo.imageCreateTime},
+            #{imageInfo.createTime},
+            #{imageInfo.updateTime},#{imageInfo.imageUrl})
+        </foreach>
+    </insert>
+</mapper>

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceAdvertiserDataService.java

@@ -33,4 +33,6 @@ public interface IByteDanceAdvertiserDataService {
     Map<String, Object> flowPackageGet(String accountId);
 
     void getMaterialList(CtopOauthToken token);
+
+    void getImageByPage(CtopOauthToken token, String imageIds, int page);
 }

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceCreativeService.java

@@ -29,4 +29,6 @@ public interface IByteDanceCreativeService extends IService<ByteDanceCreative> {
     Map<String,Object> updateCreative(Long accountId, JSONObject data);
 
     Map<String,Object> getCreativeRejectReason(Long accountId, Long creativeId);
+
+    Map<String, Object> batchCreate(JSONObject data);
 }

+ 17 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceImageInfoService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.toutiao.modules.material.service;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceImageInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 头条图片素材
+ * @author jeecg-boot
+ * @date   2020-08-01
+ * @version V1.0
+ */
+public interface IBytedanceImageInfoService extends IService<BytedanceImageInfo> {
+
+    void replaceBatch(List<BytedanceImageInfo> videoInfoList);
+}

+ 52 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -576,6 +576,54 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     @Override
     public void getMaterialList(CtopOauthToken token) {
         getVideoByPage(token, "", 1);
+        getImageByPage(token, "", 1);
+    }
+
+    @Autowired
+    private IBytedanceImageInfoService imageInfoService;
+    @Override
+    public void getImageByPage(CtopOauthToken token, String imageIds, int page) {
+        // 请求地址
+        String url = "https://ad.oceanengine.com/open_api/2/file/image/get/";
+        // 请求参数
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", token.getAccountId());
+        param.put("page", page);
+        param.put("page_size", 100);
+        if (null != imageIds && !"".equals(imageIds.trim())) {
+            String[] getIds = imageIds.split(StringUtils.COMMA);
+            if (getIds.length > 0) {
+                JSONObject filter = new JSONObject();
+                JSONArray idArray = new JSONArray();
+                Collections.addAll(idArray, getIds);
+                filter.put("image_ids", idArray);
+                param.put("filtering", filter);
+            }
+        }
+
+        JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
+        if(null==resultObject){
+            log.error("获取图片素材库接口异常==》accountId:{}", token.getAccountId());
+            return;
+        }
+        Integer code = resultObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.error("获取图片素材库接口异常==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
+            return;
+        }
+        JSONArray data = resultObject.getJSONObject("data").getJSONArray("list");
+        if (null == data || data.isEmpty()) {
+            log.info("获取图片素材完成==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
+            return;
+        }
+        List<BytedanceImageInfo> videoInfoList = new ArrayList<>();
+        for (int i = 0; i < data.size(); i++) {
+            JSONObject dataObject = data.getJSONObject(i);
+            BytedanceImageInfo imageInfo = new BytedanceImageInfo(dataObject, token);
+            videoInfoList.add(imageInfo);
+        }
+        imageInfoService.replaceBatch(videoInfoList);
+        getImageByPage(token, imageIds, page + 1);
     }
 
     private void getVideoByPage(CtopOauthToken token, String videoIds, int page) {
@@ -598,6 +646,10 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         }
 
         JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
+        if(null==resultObject){
+            log.error("获取视频素材库接口异常==》accountId:{}", token.getAccountId());
+            return;
+        }
         Integer code = resultObject.getInteger("code");
         if (null == code || !code.equals(0)) {
             log.error("获取视频素材库接口异常==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));

+ 261 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java

@@ -267,4 +267,265 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS);
         return resultMap;
     }
+
+    @Override
+    public Map<String, Object> batchCreate(JSONObject data) {
+        log.info(data.toJSONString());
+        Map<String,Object>result = new HashMap<>();
+        Long accountId = data.getLong("advertiserId");
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        if(null == token){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        JSONArray planIds = data.getJSONArray("adIds");
+        if(null == planIds||planIds.isEmpty()){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        //拼接参数
+        JSONObject params  = initParams(data);
+
+        return null;
+    }
+
+    private JSONObject initParams(JSONObject data) {
+        JSONObject params = new JSONObject();
+        String creativeWay = data.getString("creativeWay");
+        params.put("advertiser_id",data.getLong("accountId"));
+        //###############公共参数开始################################
+        JSONArray inventoryType = data.getJSONArray("inventoryType");
+        if(null!=inventoryType){
+            params.put("inventory_type",inventoryType);
+        }
+        Integer smartInventory = data.getInteger("smartInventory");
+        if(null!=smartInventory){
+            params.put("smart_inventory",smartInventory);
+        }
+        String sceneInventory = data.getString("sceneInventory");
+        if(null!=sceneInventory&&!sceneInventory.trim().equals("")){
+            params.put("scene_inventory",sceneInventory);
+        }
+        JSONArray adKeywords = data.getJSONArray("adKeywords");
+        if(null!=adKeywords&&!adKeywords.isEmpty()){
+            params.put("ad_keywords",adKeywords);
+        }
+        Long thirdIndustryId = data.getLong("thirdIndustryId");
+        if(null!=thirdIndustryId&&thirdIndustryId!=0){
+            params.put("third_industry_id",thirdIndustryId);
+        }
+
+        String creativeDisplayMode = data.getString("creativeDisplayMode");
+        if(null!=creativeDisplayMode&&creativeDisplayMode.trim().equals("")){
+            params.put("creative_display_mode",creativeDisplayMode);
+        }
+        String trackUrl = data.getString("trackUrl");
+        if(null!=trackUrl&&trackUrl.trim().equals("")){
+            params.put("track_url",trackUrl);
+        }
+        String actionTrackUrl = data.getString("actionTrackUrl");
+        if(null!=actionTrackUrl&&actionTrackUrl.trim().equals("")){
+            params.put("action_track_url",actionTrackUrl);
+        }
+        String videoPlayEffectiveTrackUrl = data.getString("videoPlayEffectiveTrackUrl");
+        if(null!=videoPlayEffectiveTrackUrl&&videoPlayEffectiveTrackUrl.trim().equals("")){
+            params.put("video_play_effective_track_url",videoPlayEffectiveTrackUrl);
+        }
+        String videoPlayDoneTrackUrl = data.getString("videoPlayDoneTrackUrl");
+        if(null!=videoPlayDoneTrackUrl&&videoPlayDoneTrackUrl.trim().equals("")){
+            params.put("video_play_done_track_url",videoPlayDoneTrackUrl);
+        }
+        String videoPlayTrackUrl = data.getString("videoPlayTrackUrl");
+        if(null!=videoPlayTrackUrl&&videoPlayTrackUrl.trim().equals("")){
+            params.put("video_play_track_url",videoPlayTrackUrl);
+        }
+        Long isCommentDisable = data.getLong("isCommentDisable");
+        if(null!=isCommentDisable&&isCommentDisable!=0){
+            params.put("is_comment_disable",isCommentDisable);
+        }
+        Long closeVideoDetail = data.getLong("closeVideoDetail");
+        if(null!=closeVideoDetail){
+            params.put("close_video_detail",closeVideoDetail);
+        }
+        Long generateDerivedAd = data.getLong("generateDerivedAd");
+        if(null!=generateDerivedAd&&generateDerivedAd!=0){
+            params.put("generate_derived_ad",generateDerivedAd);
+        }
+        String playableUrl = data.getString("playable_url");
+        if(null!=playableUrl&&!"".equals(playableUrl.trim())){
+            params.put("playable_url",playableUrl);
+        }
+        Long isPresentedVideo = data.getLong("isPresentedVideo");
+        if(null!=isCommentDisable&&isPresentedVideo!=0){
+            params.put("is_presented_video",isPresentedVideo);
+        }
+        Long creativeAutoGenerateSwitch = data.getLong("creativeAutoGenerateSwitch");
+        if(null!=creativeAutoGenerateSwitch&&creativeAutoGenerateSwitch!=0){
+            params.put("creative_auto_generate_switch",creativeAutoGenerateSwitch);
+        }
+        String trackUrlSendType = data.getString("trackUrlSendType");
+        if(null!=trackUrlSendType&&!"".equals(trackUrlSendType.trim())){
+            params.put("track_url_send_type",trackUrlSendType);
+        }
+        String iesCoreUserId = data.getString("iesCoreUserId");
+        if(null!=iesCoreUserId&&!"".equals(iesCoreUserId)){
+            params.put("ies_core_user_id",iesCoreUserId);
+        }
+        Long isFeedAndFavSee = data.getLong("isFeedAndFavSee");
+        if(null!=isFeedAndFavSee&&isFeedAndFavSee!=0){
+            params.put("is_feed_and_fav_see",isFeedAndFavSee);
+        }
+        JSONArray subLinkIdList = data.getJSONArray("subLinkIdList");
+        if(null!=subLinkIdList&&!subLinkIdList.isEmpty()){
+            params.put("sub_link_id_list",subLinkIdList);
+        }
+
+        String source = data.getString("source");
+        if(null!=source&&!source.trim().equals("")){
+            params.put("source",source);
+        }
+        //###############公共参数结束################################
+
+        //#######推广目的为APP######################################
+        String appName = data.getString("appName");
+        if(null!=appName&&!appName.trim().equals("")){
+            params.put("app_name",appName);
+        }
+        String webUrl = data.getString("webUrl");
+        if(null!=webUrl&&!webUrl.trim().equals("")){
+            params.put("web_url",webUrl);
+        }
+        String actionText = data.getString("actionText");
+        if(null!=actionText&&!actionText.trim().equals("")){
+            params.put("action_text",actionText);
+        }
+        String subTitle = data.getString("subTitle");
+        if(null!=subTitle&&!subTitle.trim().equals("")){
+            params.put("sub_title",subTitle);
+        }
+        //###############################################
+        //############创意推广目的为link的时候###################
+        String advancedCreativeType = data.getString("advancedCreativeType");
+        if(null!=advancedCreativeType&&!advancedCreativeType.trim().equals("")){
+            params.put("advanced_creative_type",advancedCreativeType);
+        }
+        String advancedCreativeTitle = data.getString("advancedCreativeTitle");
+        if(null!=advancedCreativeTitle&&!advancedCreativeTitle.trim().equals("")){
+            params.put("advanced_creative_title",advancedCreativeTitle);
+        }
+        String phoneNumber = data.getString("phoneNumber");
+        if(null!=phoneNumber&&!phoneNumber.trim().equals("")){
+            params.put("phone_number",phoneNumber);
+        }
+        String buttonText = data.getString("buttonText");
+        if(null!=buttonText&&!buttonText.trim().equals("")){
+            params.put("button_text",buttonText);
+        }
+        String formUrl = data.getString("formUrl");
+        if(null!=formUrl&&!formUrl.trim().equals("")){
+            params.put("form_url",formUrl);
+        }
+
+        if(null!=creativeWay&&creativeWay.trim().equals("proceduralCreativity")){
+            //程序化
+            params.put("creative_material_mode","STATIC_ASSEMBLE");
+            JSONArray titleList = data.getJSONArray("titleList");
+            if(null!=titleList&&!titleList.isEmpty()){
+                JSONArray setTitleList = new JSONArray();
+                for (int i=0;i<titleList.size();i++){
+                    JSONObject titleObject = titleList.getJSONObject(i);
+                    JSONArray creativeWordIds = titleObject.getJSONArray("creativeWordIds");
+                    titleObject.remove("creativeWordIds");
+                    if(null!=creativeWordIds&&!creativeWordIds.isEmpty()){
+                        titleObject.put("creative_word_ids",creativeWordIds);
+                    }
+                    setTitleList.add(titleObject);
+                }
+                params.put("title_list",setTitleList);
+            }
+            JSONArray imageList = data.getJSONArray("imageList");
+            if(null!=imageList&&!imageList.isEmpty()){
+                JSONArray setImageList = new JSONArray();
+                for (int i=0;i<imageList.size();i++){
+                    JSONObject imageObject = imageList.getJSONObject(i);
+                    String imageMode = imageObject.getString("imageMode");
+                    JSONArray imageIds = imageObject.getJSONArray("imageIds");
+                    String imageId = imageObject.getString("imageId");
+                    String videoId = imageObject.getString("videoId");
+                    Integer templateId = imageObject.getInteger("templateId");
+                    imageObject.remove("imageMode");
+                    imageObject.remove("imageIds");
+                    imageObject.remove("imageId");
+                    imageObject.remove("videoId");
+                    imageObject.remove("templateId");
+                    imageObject.put("image_mode",imageMode);
+                    if(null!=imageIds&&!imageIds.isEmpty()){
+                        imageObject.put("image_ids",imageIds);
+                    }
+                    if(null!=imageId&&!"".equals(imageId.trim())){
+                        imageObject.put("image_id",imageId);
+                    }
+                    if(null!=videoId&&!"".equals(videoId.trim())){
+                        imageObject.put("video_id",videoId);
+                    }
+                    if(null!=templateId&&templateId!=0){
+                        imageObject.put("template_id",templateId);
+                    }
+
+                    setImageList.add(imageObject);
+                }
+                params.put("image_list",setImageList);
+            }
+        }else{
+            //自定义创意
+            JSONArray creatives = data.getJSONArray("creatives");
+            if(null!=creatives&&!creatives.isEmpty()){
+                JSONArray setCreatives = new JSONArray();
+                for(int i=0;i<creatives.size();i++){
+                    JSONObject creativeObject = creatives.getJSONObject(i);
+                    JSONArray creativeWordIds = creativeObject.getJSONArray("creativeWordIds");
+                    creativeObject.remove("creativeWordIds");
+                    if(null!=creativeWordIds&&!creativeWordIds.isEmpty()){
+                        creativeObject.put("creative_word_ids",creativeWordIds);
+                    }
+                    String imageMode = creativeObject.getString("imageMode");
+                    creativeObject.remove("imageMode");
+                    creativeObject.put("image_mode",imageMode);
+                    JSONArray imageIds = creativeObject.getJSONArray("imageIds");
+                    creativeObject.remove("imageIds");
+                    if(null!=imageIds&&!imageIds.isEmpty()){
+                        creativeObject.put("image_ids",imageIds);
+                    }
+                    String imageId = creativeObject.getString("imageId");
+                    creativeObject.remove("imageId");
+                    if(null!=imageId&&!"".equals(imageId.trim())){
+                        creativeObject.put("image_id",imageId);
+                    }
+                    String videoId = creativeObject.getString("videoId");
+                    creativeObject.remove("videoId");
+                    if(null!=videoId&&!"".equals(videoId.trim())){
+                        creativeObject.put("video_id",videoId);
+                    }
+                    Integer templateId = creativeObject.getInteger("templateId");
+                    creativeObject.remove("templateId");
+                    if(null!=templateId&&templateId!=0){
+                        creativeObject.put("template_id",templateId);
+                    }
+                    JSONArray dpaDictIds = creativeObject.getJSONArray("dpaDictIds");
+                    creativeObject.remove("dpaDictIds");
+                    if(null!=creativeWordIds&&!creativeWordIds.isEmpty()){
+                        creativeObject.put("creative_word_ids",creativeWordIds);
+                    }
+                    Integer derivePosterCid = creativeObject.getInteger("derivePosterCid");
+                    creativeObject.remove("derivePosterCid");
+                    if(null!=derivePosterCid&&derivePosterCid!=0){
+                        creativeObject.put("derive_poster_cid",derivePosterCid);
+                    }
+                    setCreatives.add(creativeObject);
+                }
+                params.put("creatives",setCreatives);
+            }
+        }
+        return params;
+    }
 }

+ 26 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.toutiao.modules.material.service.impl;
+
+import cn.com.ctop.toutiao.modules.material.entity.BytedanceImageInfo;
+import cn.com.ctop.toutiao.modules.material.mapper.BytedanceImageInfoMapper;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceImageInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 头条图片素材
+ * @author jeecg-boot
+ * @date   2020-08-01
+ * @version V1.0
+ */
+@Service
+public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInfoMapper, BytedanceImageInfo> implements IBytedanceImageInfoService {
+    @Autowired
+    private BytedanceImageInfoMapper bytedanceImageInfoMapper;
+    @Override
+    public void replaceBatch(List<BytedanceImageInfo> videoInfoList) {
+        bytedanceImageInfoMapper.replaceBatch(videoInfoList);
+    }
+}

+ 101 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ByteDanceReportAccountDailyDTO.java

@@ -0,0 +1,101 @@
+package cn.com.ctop.toutiao.modules.report.DTO;
+
+import lombok.Data;
+
+@Data
+public class ByteDanceReportAccountDailyDTO {
+	private Integer mediaId;
+
+	private String advertiserId;
+
+	private String advertiserName;
+
+	private String responsibleName;
+
+	private String designResponsibleName;
+
+	private String saleId;
+
+	private String saleName;
+
+	private String statDate;
+
+	private String accountId;
+
+	private String authName;
+
+	private Long projectId;
+
+	private String projectName;
+
+	private java.math.BigDecimal cost;  //消耗
+
+	private Long active;  //应用下载-激活
+
+	private Long downloadFinish;  //应用下载-安卓下载完成
+
+	private Long downloadStart;  //应用下载-安卓下载开始
+
+	private Long installFinish;  //应用下载-安卓安装完成
+
+	private Long register;  //应用下载-注册
+
+	private Long payCount;  //应用下载-付费数
+
+	private Long form;  //表单提交数
+
+	private Long totalPlay;  //视频-总播放
+
+	private Long validPlay;  //视频-有效播放
+
+	private Long wifiPlay;  //视频-wifi播放
+
+	private java.math.BigDecimal play25FeedBreakRate;  //25%进度播放率
+
+	private Long play25FeedBreak;  //视频-播放25%进度总数
+
+	private Long play50FeedBreak;  //视频-播放50%进度总数
+
+	private Long play75FeedBreak;  //视频-播放75%进度总数
+
+	private Long play100FeedBreak;  //视频-播放100%进度总数
+
+	private Long shareMaterial;  //互动数据-分享数
+
+	private Long follow;  //互动数据-新增关注数
+
+	private Long nextDayOpen;  //次留数
+
+	private java.math.BigDecimal nextDayOpenRate;  //次留率 = 次留数/激活数
+
+	private java.math.BigDecimal nextDayOpenCost;  //次留成本 = 消耗/次留数
+
+	private Long convertMaterial;  //转化数据-转化数
+
+	private java.math.BigDecimal cpc;  //平均点击单价
+
+	private java.math.BigDecimal ctr;  //展现数据-点击率   广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
+
+	private java.math.BigDecimal cpm;  //平均千次展现费用  广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
+
+	private Long likeMaterial;  //互动数据-点赞数
+
+	private java.math.BigDecimal activeCost;  //应用下载广告数据-激活成本  计算方式:总花费/激活数。
+
+	private java.math.BigDecimal activeRate;  //应用下载广告数据-激活率   计算方式:激活数/点击数*100%
+
+	private java.math.BigDecimal activeRegisterRate;  //应用下载广告数据-注册率   注册用户占激活用户的比例
+
+	private java.math.BigDecimal activeRegisterCost;  //应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
+
+	private Long showMaterial;  //展现数据-展示数
+
+	private java.math.BigDecimal convertRate;  //转化率  转化数/点击数*100%
+
+	private java.math.BigDecimal convertCost;  //转化数据-转化成本=总花费/转化数
+
+    private Long clickMaterial;  //点击数
+
+	private Long clickInstall;  //应用下载-点击安装数
+
+}

+ 21 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/BytedanceInfoDTO.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.toutiao.modules.report.DTO;
+
+import com.github.pagehelper.PageInfo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class BytedanceInfoDTO extends PageInfo implements Serializable{
+    private String startDate;
+    private String endDate;
+    private Long unitId;
+    private List<Long> projectList;
+    private Long accountId;  //广告主名称
+    private Long campaignId;
+    private Long projectId;
+    private String sort;
+
+}

+ 74 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

@@ -2,10 +2,14 @@ package cn.com.ctop.toutiao.modules.report.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
+import cn.com.ctop.toutiao.modules.report.DTO.BytedanceInfoDTO;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
@@ -13,7 +17,9 @@ import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -28,6 +34,8 @@ public class BytedanceReportController {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+    @Autowired
+    private IBytedanceAccountReportService bytedanceAccountReportService;
 
     @PostMapping("/kuaiShou/accountReport")
     public Result<JSONObject> getKuaiShouAccountReport(@RequestBody JSONObject requestJson) {
@@ -383,4 +391,70 @@ public class BytedanceReportController {
         return result;
     }
 
+    @ResponseBody
+    @RequestMapping("/getBytedanceAccountInfoByProjectId")
+    public Result<PageInfo<ByteDanceReportAccountDailyDTO>> getBytedanceAccountInfoByProjectId(@RequestBody BytedanceInfoDTO dto) {
+        Result<PageInfo<ByteDanceReportAccountDailyDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            result.setSuccess(false);
+            result.setMessage("参数有误");
+            return result;
+        }
+
+        if(dto.getPageSize() == 0 ){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceAccountInfoByProjectId(dto.getStartDate(), dto.getEndDate(), dto.getProjectId(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
+            result.setResult(byteDanceReportAccountDailyDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
+    @ResponseBody
+    @RequestMapping("/getBytedanceSaleProjectInfo")
+    public Result<PageInfo<ByteDanceReportAccountDailyDTO>> getBytedanceSaleProjectInfo(@RequestBody BytedanceInfoDTO dto) {
+        Result<PageInfo<ByteDanceReportAccountDailyDTO>> result = new Result<>();
+        result.setSuccess(true);
+
+        if(dto == null || dto.getStartDate() ==null || dto.getEndDate() == null){
+            //result.setSuccess(false);
+            //result.setMessage("参数有误");
+            //return result;
+
+            Date getDate = DateUtils.addDay(new Date(), -1);
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            String dateString = dateFormat.format(getDate);
+
+            dto = new BytedanceInfoDTO();
+            dto.setStartDate(dateString);
+            dto.setEndDate(dateString);
+        }
+
+        if(dto.getPageSize() == 0 ){
+            dto.setPageSize(20);
+        }
+
+        try{
+            PageInfo<ByteDanceReportAccountDailyDTO> byteDanceReportAccountDailyDTOList = bytedanceAccountReportService.getBytedanceSaleProjectInfo(dto.getStartDate(), dto.getEndDate(), dto.getProjectList(),dto.getPageNum(),dto.getPageSize(),dto.getSort());
+            result.setResult(byteDanceReportAccountDailyDTOList);
+        }catch(Exception e){
+            log.error(e.getMessage());
+            result.setSuccess(false);
+            result.setMessage("执行出错");
+        }finally {
+        }
+
+        return result;
+    }
+
 }

+ 15 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceAccountReportMapper.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.mapper;
 
+import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
@@ -44,4 +45,18 @@ public interface BytedanceAccountReportMapper {
     //查询固定月的明细数据
     List<JSONObject> queryDetailGroupDayByMonth(@Param("month") String month);
 
+    List<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId);
+
+    ByteDanceReportAccountDailyDTO getBytedanceProjectInfo(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("projectId")Long projectId);
+
+    String getRoleCodeByUserId(@Param("userId")String userId);
+
+    //List<Long> queryProjectInfoByAdmin(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+
+    List<ByteDanceReportAccountDailyDTO> getSaleProjects(@Param("userId")String userId, @Param("mediaIds")List<Long> mediaIds);
+
+    List<ByteDanceReportAccountDailyDTO> queryProjectInfoByAdmin(@Param("mediaIds")List<Long> mediaIds);
+
+    List<ByteDanceReportAccountDailyDTO> queryProjectMemberByIds(@Param("projectIds")List<Long> projectIds);
+
 }

+ 181 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml

@@ -212,4 +212,185 @@
         order by stat_datetime asc
     </select>
 
+    <sql id="selectSql">
+        ifnull(sum(a.show_num),0)                          as showMaterial,                   -- 展现数据-展示数
+        ifnull(sum(a.click),0)                             as clickMaterial,                  -- 点击数
+        ifnull(sum(a.convert_num),0)                       as convertMaterial,                -- 转化数据-转化数
+        ifnull(sum(a.cost),0)                              as cost,                           -- 消耗
+        ifnull(sum(a.active),0)                            as active,                         -- 应用下载-激活
+        ifnull(sum(a.download_finish),0)                   as downloadFinish,                 -- 应用下载-安卓下载完成
+        ifnull(sum(a.download_start),0)                    as downloadStart,                  -- 应用下载-安卓下载开始
+		ifnull(sum(a.click_install),0)                     as clickInstall,                   -- 应用下载-点击安装数
+		ifnull(sum(a.install_finish),0)                    as installFinish,                  -- 应用下载-安卓安装完成
+		ifnull(sum(a.register),0)                          as register,                       -- 应用下载-注册
+        ifnull(sum(a.pay_count),0)                         as payCount,                       -- 应用下载-付费数
+		ifnull(sum(a.form),0)                              as form,                           --  表单提交数
+		ifnull(sum(a.total_play),0)                        as totalPlay,                      -- 视频-总播放
+        ifnull(sum(a.valid_play),0)                        as validPlay,                      -- 视频-有效播放
+        ifnull(sum(a.wifi_play),0)                         as wifiPlay,                       -- 视频-wifi播放
+        ifnull(sum(a.play25_feed_break),0)                 as play25FeedBreak,                -- 视频-播放25%进度总数
+        ifnull(sum(a.play50_feed_break),0)                 as play50FeedBreak,                -- 视频-播放50%进度总数
+        ifnull(sum(a.play75_feed_break),0)                 as play75FeedBreak,                -- 视频-播放75%进度总数
+        ifnull(sum(a.play100_feed_break),0)                as play100FeedBreak,               -- 视频-播放100%进度总数
+		ifnull(sum(a.share),0)                             as shareMaterial,                  -- 互动数据-分享数
+		ifnull(sum(a.like_num),0)                          as likeMaterial,                   -- 互动数据-点赞数
+		case
+        when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play25_feed_break) is not null
+        then round(sum(a.play25_feed_break) / sum(a.total_play),2)
+        else 0 end                               as play25FeedBreakRate,            -- 25%进度播放率
+		case
+        when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert_num) is not null
+        then round(sum(a.convert_num) / sum(a.click),2)
+        else 0 end                               as convertRate,                    -- 转化率  转化数/点击数*100% !
+        case
+        when sum(a.convert_num) != 0 and sum(a.convert_num) is not null and sum(a.cost) is not null
+        then round(sum(a.cost)/sum(a.convert_num),2)
+        else 0 end as convertCost, --  转化数据-转化成本=总花费/转化数
+		ifnull(sum(a.follow),0)                            as follow,                         -- 互动数据-新增关注数
+        ifnull(sum(a.next_day_open),0)                     as nextDayOpen,                    -- 次留数
+        case
+        when sum(a.active) != 0 and sum(a.next_day_open) is not null and sum(a.active) is not null
+        then round(sum(a.next_day_open) / sum(a.active),2)
+        else 0 end                               as nextDayOpenRate,                -- 次留率 = 次留数/激活数
+        case
+        when sum(a.next_day_open) != 0 and sum(a.next_day_open) is not null and sum(a.cost) is not null
+        then round(sum(a.cost) / sum(a.next_day_open),2)
+        else 0 end                               as nextDayOpenCost,                -- 次留成本 = 消耗/次留数
+		case
+        when sum(a.click) != 0 and sum(a.click) is not null and sum(a.cost) is not null
+        then round(sum(a.cost) / sum(a.click),2)
+        else 0 end                               as cpc,                            -- 平均点击单价
+        case
+        when sum(a.show_num) != 0 and sum(a.show_num) is not null and sum(a.click) is not null
+        then round(sum(a.click) / sum(a.show_num),2)
+        else 0 end                               as ctr,                            -- 展现数据-点击率   广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
+        case
+        when sum(a.show_num) != 0 and sum(a.cost) is not null and sum(a.show_num) is not null
+        then round(sum(a.cost) / sum(a.show_num) * 1000,2)
+        else 0 end                               as cpm,                            -- 平均千次展现费用  广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
+		case
+        when sum(a.active) != 0 and sum(a.cost) is not null and sum(a.active) is not null
+        then round(sum(a.cost) / sum(a.active),2)
+        else 0 end                               as activeCost,                     -- 应用下载广告数据-激活成本  计算方式:总花费/激活数。
+		case
+        when sum(a.click) != 0 and sum(a.active) is not null and sum(a.click) is not null
+        then round(sum(a.active) / sum(a.click),2)
+        else 0 end                               as activeRate,                     -- 应用下载广告数据-激活率   计算方式:激活数/点击数*100%
+        case
+        when sum(a.active) != 0 and sum(a.register) is not null and sum(a.active) is not null
+        then round(sum(a.register) / sum(a.active),2)
+        else 0 end                               as activeRegisterRate,             -- 应用下载广告数据-注册率   注册用户占激活用户的比例
+        case
+        when sum(a.register) != 0 and sum(a.cost) is not null and sum(a.register) is not null
+        then round(sum(a.cost) / sum(a.register),2)
+        else 0 end                               as activeRegisterCost               -- 应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
+    </sql>
+
+    <select id="getBytedanceAccountInfoByProjectId" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+            select
+            concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+            a.advertiser_id as 'accountId',
+            b.auth_name as 'authName',
+            b.project_id as 'projectId',
+            b.project_name as 'projectName',
+            <include refid="selectSql"></include>
+        from
+        ctop_bytedance_report_advertiser_daily a
+        left join (select * from ctop_user_allocation group by account_id) b on a.advertiser_id = b.account_id
+        where
+        date_format(a.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
+        and
+        date_format(a.stat_datetime,'%Y-%m-%d') &lt;= #{endDate}
+        <if test="projectId!=null and projectId!=''">
+            and
+            b.project_id = #{projectId}
+        </if>
+        group by a.advertiser_id
+        -- order by sum(a.cost) desc
+    </select>
+
+    <select id="getBytedanceProjectInfo" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+            select
+            <include refid="selectSql"></include>
+        from
+        ctop_bytedance_report_advertiser_daily a
+        left join (select * from ctop_user_allocation group by account_id) b on a.advertiser_id = b.account_id
+        left join ctop_project c on b.project_id = c.id
+        where
+        date_format(a.stat_datetime, '%Y-%m-%d') &gt;= #{startDate}
+        and
+        date_format(a.stat_datetime, '%Y-%m-%d') &lt;= #{endDate}
+        and
+        b.project_id = #{projectId}
+    </select>
+
+    <select id="getRoleCodeByUserId" resultType="string">
+        select
+        role_code
+        from
+        sys_user_role a
+        left join sys_role b on a.role_id = b.id
+        where a.user_id = #{userId}
+    </select>
+
+    <select id="queryProjectInfoByAdmin" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+        select
+        id as projectId,
+        project_name as projectName,
+        advertiser_id as advertiserId,
+        advertiser_name as advertiserName,
+        responsible_name as responsibleName,
+        media_id as mediaId
+        from
+        ctop_project
+        where
+        media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="getSaleProjects" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+        select
+        distinct a.id as projectId,
+        a.project_name as projectName,
+        a.advertiser_id as advertiserId,
+        a.advertiser_name as advertiserName,
+        a.media_id as mediaId,
+        a.sale_id as saleId,
+        b.realname as saleName
+        from
+        ctop_project a
+        left join sys_user b on a.sale_id = b.id
+        where a.sale_id = #{userId}
+        and a.media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="queryProjectMemberByIds" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+        select
+        distinct id as projectId,
+        project_name as projectName,
+        advertiser_id as advertiserId,
+        advertiser_name as advertiserName,
+        media_id as mediaId,
+        responsible_name as responsibleName,
+        design_responsible_name as designResponsibleName
+        from
+        left join ctop_project
+        where
+        id in
+        <foreach collection="projectIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        order by create_time desc
+    </select>
+
+
+
 </mapper>

+ 10 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -1,7 +1,9 @@
 package cn.com.ctop.toutiao.modules.report.service;
 
+import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -16,4 +18,12 @@ public interface IBytedanceAccountReportService {
     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);
+
+    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList);
+
+    PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort);
+
+    PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort);
+
+    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, Long projectId, int pageNum, int pageSize, String sort);
 }

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

@@ -1,12 +1,18 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceAccountReportMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
 import cn.com.ctop.toutiao.modules.utils.LinkUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+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.SystemDateConstant;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -180,4 +186,88 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
         });
         return jsonObject;
     }
+
+    @Override
+    public PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort){
+        List<ByteDanceReportAccountDailyDTO> list = new ArrayList<>();
+
+        if(projectList==null || projectList.size()==0){
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String userId = sysUser.getId();
+            //String userId = "388e787edd294ecfb9243fe176a3ae56";
+            String roleCode = bytedanceAccountReportMapper.getRoleCodeByUserId(userId);
+
+            List<Long> mediaIds = new ArrayList<>();
+            mediaIds.add(1L);
+            mediaIds.add(3L);
+
+            if("admin".equals(roleCode)){
+                PageHelper.startPage(pageNum,pageSize);
+                list = bytedanceAccountReportMapper.queryProjectInfoByAdmin(mediaIds);
+            }else{
+                PageHelper.startPage(pageNum,pageSize);
+                list = bytedanceAccountReportMapper.getSaleProjects(userId,mediaIds);
+            }
+        }else{
+            PageHelper.startPage(pageNum,pageSize);
+            list = bytedanceAccountReportMapper.queryProjectMemberByIds(projectList);
+        }
+
+        //List<ByteDanceReportAccountDailyDTO> projectAccountDTOList = new ArrayList<>();
+
+        for(ByteDanceReportAccountDailyDTO project:list){
+            ByteDanceReportAccountDailyDTO p = bytedanceAccountReportMapper.getBytedanceProjectInfo(startDate, endDate, project.getProjectId());
+
+            project.setShowMaterial(p.getShowMaterial());
+            project.setClickMaterial(p.getClickMaterial());
+            project.setConvertMaterial(p.getConvertMaterial());
+            project.setCost(p.getCost());
+            project.setActive(p.getActive());
+            project.setDownloadFinish(p.getDownloadFinish());
+            project.setDownloadStart(p.getDownloadStart());
+            project.setClickInstall(p.getClickInstall());
+            project.setInstallFinish(p.getInstallFinish());
+            project.setRegister(p.getRegister());
+            project.setPayCount(p.getPayCount());
+            project.setForm(p.getForm());
+            project.setTotalPlay(p.getTotalPlay());
+            project.setValidPlay(p.getValidPlay());
+            project.setWifiPlay(p.getWifiPlay());
+            project.setPlay25FeedBreak(p.getPlay25FeedBreak());
+            project.setPlay50FeedBreak(p.getPlay50FeedBreak());
+            project.setPlay75FeedBreak(p.getPlay75FeedBreak());
+            project.setPlay100FeedBreak(p.getPlay100FeedBreak());
+            project.setShareMaterial(p.getShareMaterial());
+            project.setLikeMaterial(p.getLikeMaterial());
+            project.setPlay25FeedBreakRate(p.getPlay25FeedBreakRate());
+            project.setConvertRate(p.getConvertRate());
+            project.setConvertCost(p.getConvertCost());
+            project.setFollow(p.getFollow());
+            project.setNextDayOpen(p.getNextDayOpen());
+            project.setNextDayOpenRate(p.getNextDayOpenRate());
+            project.setNextDayOpenCost(p.getNextDayOpenCost());
+            project.setCpc(p.getCpc());
+            project.setCtr(p.getCtr());
+            project.setCpm(p.getCpm());
+            project.setActiveCost(p.getActiveCost());
+            project.setActiveRate(p.getActiveRate());
+            project.setActiveRegisterRate(p.getActiveRegisterRate());
+            project.setActiveRegisterCost(p.getActiveRegisterCost());
+        }
+
+        return new PageInfo<>(list);
+    }
+
+    @Override
+    public PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort){
+        if(StringUtils.isBlank(sort)){
+            sort = "cost-";
+        }
+        sort = sort.replace("-", " desc,").replace("+", " asc,");  //sort=id-name+age+
+        sort = sort.substring(0, sort.length() - 1);
+        PageHelper.startPage(pageNo,pageSize,sort);
+        return new PageInfo<>(bytedanceAccountReportMapper.getBytedanceAccountInfoByProjectId(startDate,endDate,projectId));
+    }
+
+
 }

+ 251 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/ApkUtils.java

@@ -0,0 +1,251 @@
+package cn.com.ctop.toutiao.modules.report.utils;
+
+import android.util.TypedValue;
+import brut.androlib.res.decoder.AXmlResourceParser;
+import com.dd.plist.NSArray;
+import com.dd.plist.NSDictionary;
+import com.dd.plist.NSString;
+import com.dd.plist.PropertyListParser;
+import org.xmlpull.v1.XmlPullParser;
+
+import java.io.*;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+public class ApkUtils {
+    /**
+     * 读取apk
+     * @param apkUrl
+     * @return
+     */
+    public static Map<String,Object> readAPK(String apkUrl){
+        ZipFile zipFile;
+        Map<String,Object> map = new HashMap<String, Object>();
+        try {
+            zipFile = new ZipFile(apkUrl);
+            Enumeration<?> enumeration = zipFile.entries();
+            ZipEntry zipEntry = null;
+            while (enumeration.hasMoreElements()) {
+                zipEntry = (ZipEntry) enumeration.nextElement();
+                if (zipEntry.isDirectory()) {
+
+                } else {
+                    if ("androidmanifest.xml".equals(zipEntry.getName().toLowerCase())) {
+                        AXmlResourceParser parser = new AXmlResourceParser();
+                        parser.open(zipFile.getInputStream(zipEntry));
+                        while (true) {
+                            int type = parser.next();
+                            if (type == XmlPullParser.END_DOCUMENT) {
+                                break;
+                            }
+                            String name = parser.getName();
+                            if(null != name && name.toLowerCase().equals("manifest")){
+                                for (int i = 0; i != parser.getAttributeCount(); i++) {
+                                    if ("versionName".equals(parser.getAttributeName(i))) {
+                                        String versionName = getAttributeValue(parser, i);
+                                        if(null == versionName){
+                                            versionName = "";
+                                        }
+                                        map.put("versionName", versionName);
+                                    } else if ("package".equals(parser.getAttributeName(i))) {
+                                        String packageName = getAttributeValue(parser, i);
+                                        if(null == packageName){
+                                            packageName = "";
+                                        }
+                                        map.put("package", packageName);
+                                    } else if("versionCode".equals(parser.getAttributeName(i))){
+                                        String versionCode = getAttributeValue(parser, i);
+                                        if(null == versionCode){
+                                            versionCode = "";
+                                        }
+                                        map.put("versionCode", versionCode);
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                    }
+
+                }
+            }
+            zipFile.close();
+        } catch (Exception e) {
+            map.put("code", "fail");
+            map.put("error","读取apk失败");
+        }
+        return map;
+    }
+
+    private static String getAttributeValue(AXmlResourceParser parser, int index) {
+        int type = parser.getAttributeValueType(index);
+        int data = parser.getAttributeValueData(index);
+        if (type == TypedValue.TYPE_STRING) {
+            return parser.getAttributeValue(index);
+        }
+        if (type == TypedValue.TYPE_ATTRIBUTE) {
+            return String.format("?%s%08X", getPackage(data), data);
+        }
+        if (type == TypedValue.TYPE_REFERENCE) {
+            return String.format("@%s%08X", getPackage(data), data);
+        }
+        if (type == TypedValue.TYPE_FLOAT) {
+            return String.valueOf(Float.intBitsToFloat(data));
+        }
+        if (type == TypedValue.TYPE_INT_HEX) {
+            return String.format("0x%08X", data);
+        }
+        if (type == TypedValue.TYPE_INT_BOOLEAN) {
+            return data != 0 ? "true" : "false";
+        }
+        if (type == TypedValue.TYPE_DIMENSION) {
+            return Float.toString(complexToFloat(data)) + DIMENSION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
+        }
+        if (type == TypedValue.TYPE_FRACTION) {
+            return Float.toString(complexToFloat(data)) + FRACTION_UNITS[data & TypedValue.COMPLEX_UNIT_MASK];
+        }
+        if (type >= TypedValue.TYPE_FIRST_COLOR_INT && type <= TypedValue.TYPE_LAST_COLOR_INT) {
+            return String.format("#%08X", data);
+        }
+        if (type >= TypedValue.TYPE_FIRST_INT && type <= TypedValue.TYPE_LAST_INT) {
+            return String.valueOf(data);
+        }
+        return String.format("<0x%X, type 0x%02X>", data, type);
+    }
+
+    private static String getPackage(int id) {
+        if (id >>> 24 == 1) {
+            return "android:";
+        }
+        return "";
+    }
+
+    // ///////////////////////////////// ILLEGAL STUFF, DONT LOOK :)
+    public static float complexToFloat(int complex) {
+        return (float) (complex & 0xFFFFFF00) * RADIX_MULTS[(complex >> 4) & 3];
+    }
+
+    private static final float RADIX_MULTS[] =
+            {
+                    0.00390625F, 3.051758E-005F,
+                    1.192093E-007F, 4.656613E-010F
+            };
+    private static final String DIMENSION_UNITS[] = { "px", "dip", "sp", "pt", "in", "mm", "", "" };
+    private static final String FRACTION_UNITS[] = { "%", "%p", "", "", "", "", "", "" };
+
+    /**
+     * 读取ipa
+     */
+    public static Map<String,Object> readIPA(String ipaURL){
+        Map<String,Object> map = new HashMap<String,Object>();
+        try {
+            File file = new File(ipaURL);
+            InputStream is = new FileInputStream(file);
+            InputStream is2 = new FileInputStream(file);
+            ZipInputStream zipIns = new ZipInputStream(is);
+            ZipInputStream zipIns2 = new ZipInputStream(is2);
+            ZipEntry ze;
+            ZipEntry ze2;
+            InputStream infoIs = null;
+            NSDictionary rootDict = null;
+            String icon = null;
+            while ((ze = zipIns.getNextEntry()) != null) {
+                if (!ze.isDirectory()) {
+                    String name = ze.getName();
+                    if (null != name &&
+                            name.toLowerCase().contains(".app/info.plist")) {
+                        ByteArrayOutputStream _copy = new
+                                ByteArrayOutputStream();
+                        int chunk = 0;
+                        byte[] data = new byte[1024];
+                        while(-1!=(chunk=zipIns.read(data))){
+                            _copy.write(data, 0, chunk);
+                        }
+                        infoIs = new ByteArrayInputStream(_copy.toByteArray());
+                        rootDict = (NSDictionary) PropertyListParser.parse(infoIs);
+
+                        //我们可以根据info.plist结构获取任意我们需要的东西
+                        //比如下面我获取图标名称,图标的目录结构请下面图片
+                        //获取图标名称
+                        NSDictionary iconDict = (NSDictionary) rootDict.get("CFBundleIcons");
+
+                        while (null != iconDict) {
+                            if(iconDict.containsKey("CFBundlePrimaryIcon")){
+                                NSDictionary CFBundlePrimaryIcon = (NSDictionary)iconDict.get("CFBundlePrimaryIcon");
+                                if(CFBundlePrimaryIcon.containsKey("CFBundleIconFiles")){
+                                    NSArray CFBundleIconFiles =(NSArray)CFBundlePrimaryIcon.get("CFBundleIconFiles");
+                                    icon = CFBundleIconFiles.getArray()[0].toString();
+                                    if(icon.contains(".png")){
+                                        icon = icon.replace(".png", "");
+                                    }
+                                    System.out.println("获取icon名称:" + icon);
+                                    break;
+                                }
+                            }
+                        }
+                        break;
+                    }
+                }
+            }
+
+            //根据图标名称下载图标文件到指定位置
+            while ((ze2 = zipIns2.getNextEntry()) != null) {
+                if (!ze2.isDirectory()) {
+                    String name = ze2.getName();
+                    System.out.println(name);
+                    if(name.contains(icon.trim())){
+                        System.out.println(11111);
+                        FileOutputStream fos = new FileOutputStream(new File("E:\\python\\img\\icon.png"));
+                        int chunk = 0;
+                        byte[] data = new byte[1024];
+                        while(-1!=(chunk=zipIns2.read(data))){
+                            fos.write(data, 0, chunk);
+                        }
+                        fos.close();
+                        break;
+                    }
+                }
+            }
+
+            ////////////////////////////////////////////////////////////////
+            //如果想要查看有哪些key ,可以把下面注释放开
+//            for (String keyName : rootDict.allKeys()) {
+//				System.out.println(keyName + ":" + rootDict.get(keyName).toString());
+//			  }
+
+
+            // 应用包名
+            NSString parameters = (NSString) rootDict.get("CFBundleIdentifier");
+            map.put("package", parameters.toString());
+            // 应用版本名
+            parameters = (NSString) rootDict.objectForKey("CFBundleShortVersionString");
+            map.put("versionName", parameters.toString());
+            //应用版本号
+            parameters = (NSString) rootDict.get("CFBundleVersion");
+            map.put("versionCode", parameters.toString());
+
+            /////////////////////////////////////////////////
+            infoIs.close();
+            is.close();
+            zipIns.close();
+
+        } catch (Exception e) {
+            map.put("code", "fail");
+            map.put("error","读取ipa文件失败");
+        }
+        return map;
+    }
+
+
+    public static void main(String[] args) {
+        System.out.println("======apk=========");
+        String apkUrl = "D:\\data\\YouYuan_1119929.apk";
+        Map<String,Object> mapApk = ApkUtils.readAPK(apkUrl);
+        for (String key : mapApk.keySet()) {
+            System.out.println(key + ":" + mapApk.get(key));
+        }
+    }
+}

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/OptimizerRoleInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.performanceappraisal.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -43,12 +44,14 @@ public class OptimizerRoleInfo {
      */
     @Excel(name = "角色类型 1:运营经理 2:运营专员", width = 15)
     @ApiModelProperty(value = "角色类型 1:运营经理 2:运营专员")
+    @Dict(dicCode = "optimizer_type")
     private Integer type;
     /**
      * 用户id
      */
     @Excel(name = "用户id", width = 15)
     @ApiModelProperty(value = "用户id")
+    @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
     private String userId;
     private String realname;
     /**
@@ -56,12 +59,14 @@ public class OptimizerRoleInfo {
      */
     @Excel(name = "归属人id", width = 15)
     @ApiModelProperty(value = "归属人id")
+    @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
     private String belongerId;
     /**
      * enabled
      */
     @Excel(name = "enabled", width = 15)
     @ApiModelProperty(value = "enabled")
+    @Dict(dicCode = "valid_status")
     private Integer enabled;
     /**
      * createTime

+ 4 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/Performance.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.performanceappraisal.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -37,12 +38,14 @@ public class Performance {
      */
     @Excel(name = "sys_user的主键id", width = 15)
     @ApiModelProperty(value = "sys_user的主键id")
+    @Dict(dicCode = "id", dictTable = "sys_user", dicText = "realname")
     private String userId;
     /**
      * sys_role的主键id
      */
     @Excel(name = "sys_role的主键id", width = 15)
     @ApiModelProperty(value = "sys_role的主键id")
+    @Dict(dicCode = "id", dictTable = "sys_role", dicText = "role_name")
     private String roleId;
     /**
      * 年度
@@ -103,6 +106,7 @@ public class Performance {
      */
     @Excel(name = "媒体类型1_头条2_快手", width = 15)
     @ApiModelProperty(value = "媒体类型1_头条2_快手")
+    @Dict(dicCode = "app_type")
     private Integer appType;
     /**
      * 创建时间

+ 4 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformancRraise.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.performanceappraisal.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -37,6 +38,7 @@ public class RolePerformancRraise {
      */
     @Excel(name = "角色id", width = 15)
     @ApiModelProperty(value = "角色id")
+    @Dict(dicCode = "id", dictTable = "sys_role", dicText = "role_name")
     private String roleId;
     /**
      * 提点梯度级别
@@ -61,12 +63,14 @@ public class RolePerformancRraise {
      */
     @Excel(name = "媒体类型1_头条2_快手", width = 15)
     @ApiModelProperty(value = "媒体类型1_头条2_快手")
+    @Dict(dicCode = "media_type")
     private Integer appType;
     /**
      * 是否可用
      */
     @Excel(name = "是否可用", width = 15)
     @ApiModelProperty(value = "是否可用")
+    @Dict(dicCode = "valid_status")
     private Integer enabled;
     /**
      * createTime

+ 5 - 0
performance-appraisal/src/main/java/cn/com/ctop/performanceappraisal/entity/RolePerformanceCommission.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.performanceappraisal.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -37,6 +38,7 @@ public class RolePerformanceCommission {
      */
     @Excel(name = "sys_role的主键id", width = 15)
     @ApiModelProperty(value = "sys_role的主键id")
+    @Dict(dicCode = "id", dictTable = "sys_role", dicText = "role_name")
     private String roleId;
     /**
      * 角色提成比例
@@ -49,16 +51,19 @@ public class RolePerformanceCommission {
      */
     @Excel(name = "是否可用", width = 15)
     @ApiModelProperty(value = "是否可用 1:可用 2:不可用")
+    @Dict(dicCode = "valid_status")
     private Integer enabled;
     /**
      * 1:快手  2:头条
      */
     @Excel(name = "媒体类型1_头条2_快手", width = 15)
     @ApiModelProperty(value = "媒体类型1_头条2_快手")
+    @Dict(dicCode = "media_type")
     private Integer appType;
 
     @Excel(name = "是否有平面", width = 15)
     @ApiModelProperty(value = "是否有平面")
+    @Dict(dicCode = "has_plane")
     private Integer hasPlane;
     /**
      * 开始时间