瀏覽代碼

Merge branch 'master' into test

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
yumeng 4 年之前
父節點
當前提交
40b0df11b2
共有 30 個文件被更改,包括 1072 次插入219 次删除
  1. 9 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 14 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  3. 66 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  4. 69 24
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  5. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  6. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMemberMapper.java
  7. 39 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMemberMapper.xml
  8. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  9. 11 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  10. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/controller/ProductController.java
  11. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  12. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  13. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  14. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountAuthServiceImpl.java
  15. 21 16
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  16. 45 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java
  17. 29 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialSyncMd5Job.java
  18. 33 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  19. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  20. 19 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  21. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java
  22. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouHistoryReportTaskService.java
  23. 33 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  24. 16 19
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  25. 94 18
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  26. 17 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  27. 84 74
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyGroup.java
  28. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyGroupMapper.java
  29. 391 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml
  30. 10 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/MaterialReportMapper.xml

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

@@ -6,7 +6,7 @@ import cn.com.ctop.common.module.entity.Advertiser;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
-import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.IProductService;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.*;
@@ -193,8 +193,6 @@ public class AdvertiserController {
      * @param advertiser
      * @return
      */
-    @Autowired
-    private IProjectService projectService;
 
     @AutoLog(value = "广告主信息表-编辑")
     @ApiOperation(value = "广告主信息表-编辑", notes = "广告主信息表-编辑")
@@ -220,6 +218,9 @@ public class AdvertiserController {
      * @param id
      * @return
      */
+    @Autowired
+    private IProductService productService;
+
     @AutoLog(value = "广告主信息表-通过id删除")
     @ApiOperation(value = "广告主信息表-通过id删除", notes = "广告主信息表-通过id删除")
     @DeleteMapping(value = "/delete")
@@ -237,9 +238,14 @@ public class AdvertiserController {
                     Map<String, Object> map = new HashMap<>();
                     map.put("project_id", project.getId());
                     projectMemberMapper.deleteByMap(map);
+                    userAllocationService.removeByMap(map);
                 }
 
             }
+            Map<String, Object> productDeleteMap = new HashMap<>();
+            productDeleteMap.put("advertiser_id", id);
+            productService.removeByMap(productDeleteMap);
+
             projectMapper.delete(queryWrapper);
             boolean ok = advertiserService.removeById(id);
             if (ok) {

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

@@ -2,10 +2,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.Advertiser;
-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.*;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
@@ -244,18 +241,16 @@ public class ProjectController {
         String projectName = project.getProjectName();
         project.setProjectName(null);
 
-        String userId = project.getUserId();
-        project.setUserId(null);
 
         QueryWrapper<Project> queryWrapper = QueryGenerator.initQueryWrapper(project, req.getParameterMap());
         Page<Project> page = new Page<>(pageNo, pageSize);
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
         if ("operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
-            queryWrapper.eq("responsible_id", userId);
+            queryWrapper.eq("responsible_id", sysUser.getId());
 
         } else if ("plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode) || "clip".equals(roleCode) || "designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode)) {
-            queryWrapper.eq("design_responsible_id", userId);
+            queryWrapper.eq("design_responsible_id", sysUser.getId());
         }
 
         if (!Check.isNull(projectName)) {
@@ -312,18 +307,17 @@ public class ProjectController {
                 project.setIndustryCode(category.getCode());
                 project.setIndustryId(category.getId());
             }*/
-           /* SysUser sysUser = sysUserService.getById(project.getResponsibleId());
+            SysUser sysUser = sysUserService.getById(project.getResponsibleId());
             if (!Check.isNull(sysUser)) {
-                project.setResponsibleName(sysUser.getRealname());
+                //  project.setResponsibleName(sysUser.getRealname());
                 memberMap.put(sysUser.getId(), sysUser.getRealname());
-            }*/
+            }
 
-           /* SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
+            SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
             if (!Check.isNull(designSysUser)) {
-                project.setDesignResponsibleName(designSysUser.getRealname());
+                // project.setDesignResponsibleName(designSysUser.getRealname());
                 memberMap.put(designSysUser.getId(), designSysUser.getRealname());
             }
-*/
             projectService.save(project);
 
             Long id = project.getId();
@@ -368,22 +362,22 @@ public class ProjectController {
     @PutMapping(value = "/edit")
     public Result<Project> edit(@RequestBody Project project) {
         Result<Project> result = new Result<>();
-       /* SysUser sysUser = sysUserService.getById(project.getResponsibleId());
+        SysUser sysUser = sysUserService.getById(project.getResponsibleId());
         if (!Check.isNull(sysUser)) {
-            project.setResponsibleName(sysUser.getRealname());
+            //     project.setResponsibleName(sysUser.getRealname());
             projectMemberService.addMember(sysUser, project);
-        }*/
+        }
 
        /* SysCategory category = sysCategoryService.getById(project.getIndustryId());
         if (null != category) {
             project.setIndustryCode(category.getCode());
             project.setIndustryId(category.getId());
         }*/
-       /* SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
+        SysUser designSysUser = sysUserService.getById(project.getDesignResponsibleId());
         if (!Check.isNull(designSysUser)) {
-            project.setDesignResponsibleName(designSysUser.getRealname());
+            //      project.setDesignResponsibleName(designSysUser.getRealname());
             projectMemberService.addMember(designSysUser, project);
-        }*/
+        }
         Project projectEntity = projectService.getById(project.getId());
         if (projectEntity == null) {
             result.error500("未找到对应实体");

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

@@ -1,10 +1,13 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.Advertiser;
+import cn.com.ctop.common.module.entity.Product;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.SysUser;
+import cn.com.ctop.common.module.service.IProductService;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -54,6 +57,8 @@ public class ProjectMemberController {
     private ISysUserService sysUserService;
     @Autowired
     private IAdvertiserService advertiserService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
 
     /**
@@ -116,6 +121,12 @@ public class ProjectMemberController {
                         SysUser designResponsible = sysUserService.getById(project.getDesignResponsibleId());
                         projectMember.setDesignResponsibleName(designResponsible.getRealname());
 
+                        projectMember.setProjectName(project.getProjectName());
+                        Product product = productService.getById(project.getProductId());
+                        if (!Check.isNull(product)) {
+                            projectMember.setProductId(product.getId());
+                            projectMember.setProductName(product.getProductName());
+                        }
                         Advertiser advertiser = advertiserService.getById(project.getAdvertiserId());
                         projectMember.setAdvertiserName(advertiser.getName());
                         projectMember.setAdvertiserId(project.getAdvertiserId());
@@ -136,6 +147,53 @@ public class ProjectMemberController {
         return map;
     }
 
+
+    @PostMapping(value = "/participateListByMediaId")
+    public Result<List<JSONObject>> participateListByMediaId(@RequestBody JSONObject requestJson) {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            String userId = requestJson.getString("userId");
+            if (Check.isNull(userId)) {
+                throw new Exception("请选择userId");
+            }
+            List<Integer> mediaIds = new ArrayList<>();
+            String type = requestJson.getString("type");
+            if ("kuaishou".equals(type)) {
+                mediaIds.add(2);
+                mediaIds.add(4);
+            } else if ("bytedance".equals(type)) {
+                mediaIds.add(1);
+                mediaIds.add(3);
+            }
+            if (Check.isNull(mediaIds)) {
+                throw new Exception("请选择媒体类型");
+            }
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+            List<JSONObject> projectList = projectMemberService.getProjectByUserIdAndMediaIds(userId, mediaIds);
+            if (!Check.isNull(projectList)) {
+                for (int i = 0; i < projectList.size(); i++) {
+                    JSONObject project = projectList.get(i);
+                    List<JSONObject> accountList = userAllocationService.getAccountListByProject(project.getLong("projectId"));
+                    if (!Check.isNull(accountList)) {
+                        project.put("accountList", accountList);
+                    }
+                }
+            }
+            result.setSuccess(true);
+            result.setResult(projectList);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
     @GetMapping("/projectList")
     public Map<String, Object> projectList() {
         Map<String, Object> result = new HashMap<>();
@@ -159,6 +217,8 @@ public class ProjectMemberController {
         }
     }
 
+    @Autowired
+    private IProductService productService;
 
     @GetMapping(value = "/participateListV2")
     public Result<IPage<ProjectMember>> participateListV2(ProjectMember projectMember,
@@ -189,7 +249,6 @@ public class ProjectMemberController {
         queryWrapper.orderByDesc("create_time");
 
 
-
         Page<ProjectMember> page = new Page<>(pageNo, pageSize);
         IPage<ProjectMember> pageList = projectMemberService.page(page, queryWrapper);
         List<ProjectMember> projectMembers = pageList.getRecords();
@@ -206,6 +265,12 @@ public class ProjectMemberController {
                     SysUser designResponsible = sysUserService.getById(project.getDesignResponsibleId());
                     member.setDesignResponsibleName(designResponsible.getRealname());
                     Advertiser advertiser = advertiserService.getById(project.getAdvertiserId());
+                    member.setProjectName(project.getProjectName());
+                    Product product = productService.getById(project.getProductId());
+                    if (!Check.isNull(product)) {
+                        member.setProductId(product.getId());
+                        member.setProductName(product.getProductName());
+                    }
                     member.setAdvertiserName(advertiser.getName());
                     member.setAdvertiserId(project.getAdvertiserId());
                     member.setAdvertiserId(project.getAdvertiserId());

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

@@ -80,19 +80,61 @@ public class TestController {
     private CrawlerDouyinMusicTaskService crawlerDouyinMusicTaskService;
     @Autowired
     private MusicInfoService musicInfoService;
+    @Autowired
+    private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
-    static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
+    static ExecutorService suzhaoService = Executors.newFixedThreadPool(10);
+
+
+    @GetMapping(value = "/dailyReport")
+    public void dailyReport() {
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取快手数据异常:未获取到可用的token");
+        }
+        for (CtopOauthToken token : tokens) {
+            dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), "2020-09-20");
+        }
+    }
+
+    @GetMapping(value = "/getMd5")
+    public void getMd5() {
+        kuaiShouHistoryReportTaskService.getMd5(null, null);
+
+    }
+
+    @GetMapping(value = "/getGroupReport")
+    public void getGroupReport() throws ParseException {
+        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse1 = simpleDateFormat.parse("2020-09-12");
+        Date parse2 = simpleDateFormat.parse("2020-09-17");
+        for (CtopOauthToken token : tokens) {
+
+            suzhaoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    //1: 获取广告主信息数据
+                    kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
+                }
+            });
+
+
+        }
+    }
+
+
     @GetMapping(value = "/syncDouyinMusicAsc")
-    public String syncDouyinMusicAsc(){
+    public String syncDouyinMusicAsc() {
         QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("status","init").orderByAsc("id").last(" limit 20");
+        queryWrapper.eq("status", "init").orderByAsc("id").last(" limit 20");
 
         List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
 
-        while (list != null){
-            for(CrawlerDouyinMusicTask crawlerDouyinMusicTask : list){
+        while (list != null) {
+            for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                 MusicInfo musicInfo = new MusicInfo();
                 musicInfo.setExtId(crawlerDouyinMusicTask.getId());
                 musicInfo = douyinMusicService.getMusicInfo(musicInfo);
@@ -104,19 +146,20 @@ public class TestController {
         }
         return "success";
     }
+
     @GetMapping(value = "/syncDouyinMusic")
-    public String syncDouyinMusic(){
-        for(int i =0;i<10;i++){
+    public String syncDouyinMusic() {
+        for (int i = 0; i < 10; i++) {
             final int j = i;
-            Thread thread = new Thread(){
+            Thread thread = new Thread() {
                 @Override
                 public void run() {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.eq("status","init").likeLeft("id",j).orderByDesc("id").last(" limit 20");
+                    queryWrapper.eq("status", "init").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null){
-                        log.info("【同步歌曲】第"+j+"线程正在处理:"+list.size()+"条数据");
-                        for(CrawlerDouyinMusicTask crawlerDouyinMusicTask : list){
+                    while (list != null) {
+                        log.info("【同步歌曲】第" + j + "线程正在处理:" + list.size() + "条数据");
+                        for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             MusicInfo musicInfo = new MusicInfo();
                             musicInfo.setExtId(crawlerDouyinMusicTask.getId());
                             douyinMusicService.getMusicInfo(musicInfo);
@@ -130,23 +173,24 @@ public class TestController {
 
         return "success";
     }
+
     @GetMapping(value = "/parseDouyinMusic")
-    public String parseDouyinMusic(){
-        for(int i =0;i<10;i++){
+    public String parseDouyinMusic() {
+        for (int i = 0; i < 10; i++) {
             final int j = i;
-            Thread thread = new Thread(){
+            Thread thread = new Thread() {
                 @Override
                 public void run() {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.eq("status","done").likeLeft("id",j).orderByDesc("id").last(" limit 20");
+                    queryWrapper.eq("status", "done").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null){
-                        log.info("【解析分类】第"+j+"线程正在处理:"+list.size()+"条数据");
-                        for(CrawlerDouyinMusicTask crawlerDouyinMusicTask : list){
+                    while (list != null) {
+                        log.info("【解析分类】第" + j + "线程正在处理:" + list.size() + "条数据");
+                        for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             QueryWrapper<MusicInfo> queryWrapper1 = new QueryWrapper<>();
-                            queryWrapper1.eq("ext_id",crawlerDouyinMusicTask.getId()).last(" limit 1");
+                            queryWrapper1.eq("ext_id", crawlerDouyinMusicTask.getId()).last(" limit 1");
                             MusicInfo musicInfo = musicInfoService.getOne(queryWrapper1);
-                            if(musicInfo != null){
+                            if (musicInfo != null) {
                                 douyinMusicService.parseTag(musicInfo);
                             }
                         }
@@ -159,8 +203,9 @@ public class TestController {
 
         return "success";
     }
+
     @GetMapping(value = "/testdouyinmusic")
-    public String testDouyinMusic(){
+    public String testDouyinMusic() {
         douyinMusicService.getHotMusicList();
         return "success";
     }
@@ -172,7 +217,7 @@ public class TestController {
 
             QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
             userAllocationQueryWrapper.eq("project_id", projectId);
-           // userAllocationQueryWrapper.eq("account_status", 0);
+            // userAllocationQueryWrapper.eq("account_status", 0);
             List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
             if (!Check.isNull(list)) {
                 for (UserAllocation allocation : list) {
@@ -205,7 +250,7 @@ public class TestController {
 
             QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
             userAllocationQueryWrapper.eq("project_id", projectId);
-           // userAllocationQueryWrapper.eq("account_status", 0);
+            // userAllocationQueryWrapper.eq("account_status", 0);
             List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
             if (!Check.isNull(list)) {
                 for (UserAllocation allocation : list) {

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

@@ -28,7 +28,7 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value = "ctop_project_member对象", description = "项目成员")
-public class ProjectMember implements  Serializable{
+public class ProjectMember implements Serializable {
 
     /**
      * id
@@ -89,6 +89,12 @@ public class ProjectMember implements  Serializable{
     @TableField(exist = false)
     private String saleName;
 
+    @TableField(exist = false)
+    private Long productId;
+
+    @TableField(exist = false)
+    private String productName;
+
 
     /**
      * 创建时间

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

@@ -43,4 +43,7 @@ public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
 
     List<Long> getProjectByAccountIds(@Param("accountIds")JSONArray accountIds);
 
+    List<Project> getProjectByUserId(@Param("userId") String userId);
+
+    List<JSONObject> getProjectByUserIdAndMediaIds(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 }

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

@@ -12,16 +12,19 @@
     <!-- 设计师展示所有自己的角色下制作的视频 -->
     <select id="adminProjects" resultType="org.jeecg.modules.ctop.entity.ProjectMember">
         select
-        id as projectId,
-        project_name as projectName,
-        advertiser_id as advertiserId,
-        advertiser_name as advertiserName,
-        media_id as mediaId,
-        max_bid as maxBid,
-        advertiser_name as advertiserName ,
-        responsible_name as responsibleName
+        t1.id as projectId,
+        t1.project_name as projectName,
+        t1.advertiser_id as advertiserId,
+        (
+        select name from ctop_advertiser where id = t1.advertiser_id
+        )
+        as advertiserName,
+        t1.media_id as mediaId,
+        t1.max_bid as maxBid,
+
+        t1.responsible_name as responsibleName
         from
-        ctop_project
+        ctop_project t1
         where
         media_id in
         <foreach collection="mediaIds" item="item" separator=","
@@ -111,7 +114,10 @@
         distinct b.project_id as projectId,
         b.project_name as projectName,
         a.advertiser_id as advertiserId,
-        a.advertiser_name as advertiserName,
+        (
+        select name from ctop_advertiser where id = a.advertiser_id
+        )
+        as advertiserName,
         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId
         from
         ctop_user_allocation a
@@ -173,4 +179,27 @@
         </foreach>
     </select>
 
+
+    <select id="getProjectByUserIdAndMediaIds" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t2.id as 'projectId',
+        t2.project_name as 'projectName',
+        (select name from ctop_advertiser where id = t2.advertiser_id) as 'advertiserName'
+        from ctop_project_member t1
+        left join ctop_project t2
+        on t1.project_id = t2.id
+        where 1 = 1
+        <if test="userId !=null and userId!=''">
+            and t1.user_id = #{userId}
+        </if>
+        and t2.media_id in
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by t2.id
+        order by t2.create_time desc
+    </select>
+
+
 </mapper>

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.service;
 
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.SysUser;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 
@@ -36,4 +35,6 @@ public interface IProjectMemberService extends IService<ProjectMember> {
     List<Project> selectListByUserId(String userId);
 
     List<Long> getProjectByAccountIds(JSONArray accountIds);
+
+    List<JSONObject> getProjectByUserIdAndMediaIds(String userId, List<Integer> mediaIds);
 }

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

@@ -8,6 +8,8 @@ import cn.com.ctop.common.module.service.ISysRoleExtService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONArray;
+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.apache.commons.lang.ArrayUtils;
@@ -104,13 +106,13 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
     }
 
     @Override
-    public List<Map<String, Object>> getProjectAccountByUserId(String userId,String mediaType) {
+    public List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType) {
         List<Map<String, Object>> result = new ArrayList<>();
         List<Integer> mediaList = new ArrayList<>();
-        if(mediaType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE)){
+        if (mediaType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE)) {
             mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT);
             mediaList.add(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INSIDE_INT);
-        }else if(mediaType.equals(CtopAdConstant.PLATFORM_TYPE_KUAISHOU)){
+        } else if (mediaType.equals(CtopAdConstant.PLATFORM_TYPE_KUAISHOU)) {
             mediaList.add(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
             mediaList.add(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INSIDE_INT);
         }
@@ -197,7 +199,6 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
     }
 
     @Override
-
     public List<Project> selectListByUserId(String userId) {
         return memberMapper.getProjectByUserId(userId);
     }
@@ -206,6 +207,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return memberMapper.getProjectByAccountIds(accountIds);
     }
 
+
     //视频报表
     @Override
     public List<ProjectMember> getOwnProjects(List<Integer> mediaIds) {
@@ -229,5 +231,10 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         return projectMemberList;
     }
 
+    @Override
+    public List<JSONObject> getProjectByUserIdAndMediaIds(String userId, List<Integer> mediaIds) {
+        return memberMapper.getProjectByUserIdAndMediaIds(userId, mediaIds);
+    }
+
 
 }

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/controller/ProductController.java

@@ -2,7 +2,10 @@ package cn.com.ctop.common.module.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -31,6 +34,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -145,12 +149,34 @@ public class ProductController {
      * @param id
      * @return
      */
+    @Autowired
+    private ProjectMapper projectMapper;
+    @Autowired
+    private ProjectMapper projectMemberMapper;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+
     @AutoLog(value = "产品表-通过id删除")
     @ApiOperation(value = "产品表-通过id删除", notes = "产品表-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             productService.removeById(id);
+            QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("product_id", id);
+            List<Project> projects = projectMapper.selectList(queryWrapper);
+            if (!Check.isNull(projects)) {
+                for (Project project : projects) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("project_id", project.getId());
+                    projectMemberMapper.deleteByMap(map);
+                    userAllocationService.removeByMap(map);
+                }
+            }
+            Map<String, Object> deleteProjectMap = new HashMap<>();
+            deleteProjectMap.put("product_id", id);
+            projectMapper.deleteByMap(deleteProjectMap);
+
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -15,4 +16,6 @@ import java.util.List;
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     List<UserAllocation> selectAccountListByProjectId(@Param("projectId")Long projectId);
     String queryAdvertiserId(@Param("accountId")Long accountId);
+
+    List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -21,4 +21,14 @@
             ctop_user_allocation
         where account_id=#{accountId}
     </select>
+
+    <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
+       select
+       account_id as 'accountId',
+       user_name as 'userName',
+       auth_name as 'authName'
+       from ctop_user_allocation
+       where project_id = #{projectId}
+       order by create_time desc
+    </select>
 </mapper>

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

@@ -26,4 +26,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     List<UserAllocation> getByMediaId(String mediaId);
 
     String getAdvertiserIdByAccountId(Long accountId);
+
+    List<JSONObject> getAccountListByProject(Long projectId);
 }

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

@@ -92,6 +92,7 @@ public class BindAccountAuthServiceImpl extends ServiceImpl<BindAccountAuthMappe
                 .append(BytedanceInterfaceConstant.AUTH_PATH)
                 .append("?app_id=" + PropertiesUtils.getValue("bytedance_config", "bytedance_appid"))
                 .append("&state=" + URLEncoder.encode(state))
+                .append("&material_auth=1")
                 .append("&redirect_uri=" + URLEncoder.encode(PropertiesUtils.getValue("bytedance_config", "bytedance_callback_url"), "UTF-8"));
         return sb.toString();
     }

+ 21 - 16
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -36,7 +36,7 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
-    public List<UserAllocation> getByParams(Long projectId, String systemType,Integer accountStatus) {
+    public List<UserAllocation> getByParams(Long projectId, String systemType, Integer accountStatus) {
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         if (null != projectId && projectId != 0) {
             queryWrapper.eq("project_id", projectId);
@@ -44,8 +44,8 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         if (null != systemType && !"".equals(systemType.trim())) {
             queryWrapper.eq("system_type", systemType);
         }
-        if(null!=accountStatus){
-            queryWrapper.eq("account_status",accountStatus);
+        if (null != accountStatus) {
+            queryWrapper.eq("account_status", accountStatus);
         }
         queryWrapper.orderByDesc("id");
         return this.list(queryWrapper);
@@ -53,34 +53,34 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
 
     @Override
     public Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data) {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         Long projectId = data.getLong("project_id");
-        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
-        if(null != userId&&!"".equals(userId.trim())){
-            queryWrapper.eq("user_id",userId);
+        if (null != userId && !"".equals(userId.trim())) {
+            queryWrapper.eq("user_id", userId);
         }
-        if(null != projectId&&projectId != 0){
-            queryWrapper.eq("project_id",projectId);
+        if (null != projectId && projectId != 0) {
+            queryWrapper.eq("project_id", projectId);
         }
         List<UserAllocation> allocations = this.list(queryWrapper);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        result.put("data",allocations);
+        result.put("data", allocations);
         return result;
     }
 
     @Override
     public Map<String, Object> getPangolinProjectListByParams(String userId) {
-        Map<String,Object>result = new HashMap<>();
-        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        Map<String, Object> result = new HashMap<>();
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.select("distinct project_id,project_name");
-        queryWrapper.eq("media_id",CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
-        if(null != userId&&!"".equals(userId.trim())){
-            queryWrapper.eq("user_id",userId);
+        queryWrapper.eq("media_id", CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
+        if (null != userId && !"".equals(userId.trim())) {
+            queryWrapper.eq("user_id", userId);
         }
         List<UserAllocation> allocations = this.list(queryWrapper);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        result.put("data",allocations);
+        result.put("data", allocations);
         return result;
     }
 
@@ -98,4 +98,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public String getAdvertiserIdByAccountId(Long accountId) {
         return userAllocationMapper.queryAdvertiserId(accountId);
     }
+
+    @Override
+    public List<JSONObject> getAccountListByProject(Long projectId) {
+        return userAllocationMapper.getAccountListByProject(projectId);
+    }
 }

+ 45 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java

@@ -0,0 +1,45 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+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 com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaishouGroupDailyReportJob {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    @XxlJob("kuaishouGroupDailyReportJob")
+    public ReturnT<String> execute(String param) throws ParseException {
+        String date = DateUtils.getDate("yyyy-MM-dd");
+        String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", date, -2);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = simpleDateFormat.parse(startDate);
+        Date parse2 = simpleDateFormat.parse(endDate);
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        tokens.forEach(token -> executorService.submit(() ->
+                kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse, parse2))
+        );
+        XxlJobLogger.log("快手物料数据同步完成");
+        return ReturnT.SUCCESS;
+    }
+
+}

+ 29 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMaterialSyncMd5Job.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import static org.jeecg.common.util.DateUtils.getAnotherDay;
+
+/**
+ * 检查前一天md5为空的数据
+ *
+ * @author yumeng
+ */
+@Component
+public class KuaishouMaterialSyncMd5Job {
+    @Autowired
+    private IKuaiShouHistoryReportTaskService historyReportTaskService;
+
+    @XxlJob("kuaishouMaterialSyncMd5Job")
+    public ReturnT<String> execute(String param) throws Exception {
+        String nowDate = DateUtils.getDate("yyyy-MM-dd");
+        String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        historyReportTaskService.getMd5V2(statDate);
+        return ReturnT.SUCCESS;
+    }
+}

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

@@ -2291,4 +2291,37 @@ public class BatchController {
         return result;
     }
 
+
+    /**
+     * 同步应用
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/getWhiteList")
+    public Result<JSONObject> getWhiteList(Long accountId) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("入参为空");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+
+            JSONObject data = batchService.getWhiteList(accountId, oauthToken.getAccessToken());
+            result.setSuccess(true);
+            result.setResult(data);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setResult(null);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
 }

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

@@ -20,5 +20,7 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
 
     List<KuaiShouReportDailyMaterialVo> getPhotoList(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 
-    VideoGetvo getVideoGetByPhotoId(Long photoId);
+    VideoGetvo getVideoGetByPhotoId(@Param("photoId") Long photoId);
+
+    List<KuaiShouReportDailyMaterialVo> getPhotoListByDate(@Param("statDate") String statDate);
 }

+ 19 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -108,15 +108,29 @@
     </insert>
 
     <select id="getPhotoList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo">
+           select
+           id as id,
+           photo_id as photoId
+           from
+           ctop_kuaishou_report_daily_material
+           where account_id = #{accountId}
+           <if test="statDate != null and statDate != '' ">
+               and stat_date = #{statDate}
+           </if>
+           group by photo_id
+
+    </select>
+
+    <select id="getPhotoListByDate"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo">
         select
         id as id,
         photo_id as photoId
         from
         ctop_kuaishou_report_daily_material
-        where account_id = #{accountId}
-        <if test="statDate != null and statDate != '' ">
-            and stat_date = #{statDate}
-        </if>
+        WHERE stat_date = #{statDate}
+        and signature is null
+        group by photo_id
     </select>
 
     <select id="getVideoGetByPhotoId" resultType="cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo">
@@ -125,6 +139,7 @@
       channel_type as 'channelType'
       from ctop_kuaishou_video_get
       where photo_id = #{photoId}
+      and signature is not null
       limit 1
     </select>
 

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

@@ -138,4 +138,14 @@ public interface IBatchService {
      * @param copyUnitId
      */
     void copyCreative(Long accountId, Long unitId, Long copyUnitId, JSONObject appJson) throws Exception;
+
+
+    /**
+     * 获取联盟白名单
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    JSONObject getWhiteList(Long accountId, String accessToken);
 }

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

@@ -15,4 +15,7 @@ public interface IKuaiShouHistoryReportTaskService extends IService<KuaiShouHist
 
     void getTaskList();
 
+    void getMd5(String statDate, Long accountId);
+
+    void getMd5V2(String statDate);
 }

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
@@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -1673,6 +1675,37 @@ public class BatchServiceImpl implements IBatchService {
         return returnJson;
     }
 
+
+    /**
+     * 获取联盟白名单
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    @Override
+    public JSONObject getWhiteList(Long accountId, String accessToken) {
+
+        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/advertiser/white_list";
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", accessToken);
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("advertiser_id", accountId);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                return resultJson.getJSONObject("data");
+            }
+
+        }
+        return null;
+    }
+
+
 }
 
 

+ 16 - 19
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -5,9 +5,7 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyReportTask;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouDailyReportTaskMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
-import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
@@ -50,6 +48,8 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
     private KuaishouReportDailyCreativeMapper reportDailyCreativeMapper;
     @Autowired
     private KuaiShouReportDailyMaterialMapper kuaishouReportDailyMaterialMapper;
+    @Autowired
+    private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
     @Override
     public void formatCreativeDailyReportData(Long accountId, String statDate) {
@@ -132,31 +132,28 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
 
                 } else if (task.getViewType() == 4) {
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
-                    Thread.sleep(1 * 1000);
-                    reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), task.getStatDate());
+                  /*  Thread.sleep(1 * 1000);
+                    reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), task.getStatDate());*/
                 } else if (task.getViewType() == 10) {
                     XxlJobLogger.log("下载文件,accountId:{}", task.getAccountId());
                     reportDailyCreativeMapper.loadProgramCreativeDailyReport(task.getAccountId(), localPath);
                     XxlJobLogger.log("下载结束,accountId:{}", task.getAccountId());
                 } else if (task.getViewType() == 5) {
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
-
-                    List<KuaiShouReportDailyMaterialVo> list = kuaishouReportDailyMaterialMapper.getPhotoList(task.getAccountId(), task.getStatDate());
-                    if (!Check.isNull(list)) {
-                        for (KuaiShouReportDailyMaterialVo materialVo : list) {
-                            Long id = materialVo.getId();
-                            Long photoId = materialVo.getPhotoId();
-                            VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
-                            if (!Check.isNull(videoGetvo)) {
-                                KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
-                                material.setId(id);
-                                material.setSignature(videoGetvo.getSignature());
-                                material.setChannelType(videoGetvo.getChannelType());
-                                kuaishouReportDailyMaterialMapper.updateById(material);
+                    Thread thread = new Thread() {
+                        @Override
+                        public void run() {
+                            try {
+                                Thread.sleep(1 * 1000L);
+                                kuaiShouHistoryReportTaskService.getMd5(task.getStatDate(), task.getAccountId());
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
                             }
+
                         }
 
-                    }
+                    };
+                    thread.start();
 
 
                 }

+ 94 - 18
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -30,6 +30,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 快手历史数据任务记录
@@ -108,7 +110,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                             dailyReportTask.setTaskName(taskName);
                             dailyReportTaskService.save(dailyReportTask);
                         } else {
-                            log.error("快手历史报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
+                            log.error("快手分天报表请求失败,accountId:{},返回数据:{}", accountId, resultJson);
                         }
                     }
                 }
@@ -226,7 +228,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
                 } else if (task.getViewType() == 4) {
                     reportDailyCreativeMapper.loadCreativeDailyReport(task.getAccountId(), localPath);
-                    reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), null);
+                    // reportDailyCreativeMapper.formatCreativeDailyReportData(task.getAccountId(), null);
                 } else if (task.getViewType() == 10) {
                     XxlJobLogger.log("下载文件,accountId:{}", task.getAccountId());
                     reportDailyCreativeMapper.loadProgramCreativeDailyReport(task.getAccountId(), localPath);
@@ -235,22 +237,20 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 } else if (task.getViewType() == 5) {
                     kuaishouReportDailyMaterialMapper.loadMaterialDailyReport(task.getAccountId(), localPath);
 
-                    List<KuaiShouReportDailyMaterialVo> list = kuaishouReportDailyMaterialMapper.getPhotoList(task.getAccountId(), null);
-                    if (!Check.isNull(list)) {
-                        for (KuaiShouReportDailyMaterialVo materialVo : list) {
-                            Long id = materialVo.getId();
-                            Long photoId = materialVo.getPhotoId();
-                            VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
-                            if (!Check.isNull(videoGetvo)) {
-                                KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
-                                material.setId(id);
-                                material.setSignature(videoGetvo.getSignature());
-                                material.setChannelType(videoGetvo.getChannelType());
-                                kuaishouReportDailyMaterialMapper.updateById(material);
+                    Thread thread = new Thread() {
+                        @Override
+                        public void run() {
+                            try {
+                                Thread.sleep(1 * 1000L);
+                                getMd5(null, task.getAccountId());
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
                             }
+
                         }
 
-                    }
+                    };
+                    thread.start();
                 }
 
 
@@ -269,13 +269,14 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     private void getHistoryTypeList() {
 
         historyTypeList = new ArrayList<>();
-
+        historyTypeList.add(5);
         historyTypeList.add(1);
         historyTypeList.add(2);
         historyTypeList.add(3);
-        historyTypeList.add(4);
-        historyTypeList.add(5);
         historyTypeList.add(10);
+        historyTypeList.add(4);
+
+
     }
 
     private void getDailyTypeList() {
@@ -287,4 +288,79 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
         dailyTypeList.add(10);
     }
 
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(30);
+
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+    @Override
+    public void getMd5(String statDate, Long accountId) {
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoList(accountId, statDate);
+                if (!Check.isNull(photoList)) {
+                    for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
+                        Long photoId = materialVo.getPhotoId();
+                        VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
+                        if (!Check.isNull(videoGetvo)) {
+                            QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
+                            updateQueryWrapper.eq("photo_id", photoId);
+                            if (!Check.isNull(statDate)) {
+                                updateQueryWrapper.eq("stat_date", statDate);
+                            }
+
+                            updateQueryWrapper.isNull("signature");
+                            KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                            material.setSignature(videoGetvo.getSignature());
+                            material.setChannelType(videoGetvo.getChannelType());
+                            kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
+                            log.info("修改成功:photoId:{},accountId:{}", photoId, accountId);
+                        }
+
+                    }
+                }
+            }
+        });
+
+    }
+
+    @Override
+    public void getMd5V2(String statDate) {
+        List<KuaiShouReportDailyMaterialVo> photoList = kuaishouReportDailyMaterialMapper.getPhotoListByDate(statDate);
+        XxlJobLogger.log("素材未匹配md5:数据长度:{}", photoList.size());
+        if (!Check.isNull(photoList)) {
+            for (KuaiShouReportDailyMaterialVo materialVo : photoList) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        Long photoId = materialVo.getPhotoId();
+                        VideoGetvo videoGetvo = kuaishouReportDailyMaterialMapper.getVideoGetByPhotoId(photoId);
+                        if (!Check.isNull(videoGetvo)) {
+                            QueryWrapper<KuaiShouReportDailyMaterial> updateQueryWrapper = new QueryWrapper<>();
+                            updateQueryWrapper.eq("photo_id", photoId);
+                            if (!Check.isNull(statDate)) {
+                                updateQueryWrapper.eq("stat_date", statDate);
+                            }
+
+                            KuaiShouReportDailyMaterial material = new KuaiShouReportDailyMaterial();
+                            material.setSignature(videoGetvo.getSignature());
+                            material.setChannelType(videoGetvo.getChannelType());
+                            kuaishouReportDailyMaterialMapper.update(material, updateQueryWrapper);
+                            XxlJobLogger.log("修改成功:photoId:{}", photoId);
+
+                        }
+
+
+                    }
+                });
+
+            }
+        }
+
+
+    }
+
+
 }

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

@@ -16,6 +16,7 @@ import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
 import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -103,6 +104,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouReportDailyCampaignService dailyCampaignService;
     @Autowired
     private IKuaishouReportDailyGroupService dailyGroupService;
+
+    @Autowired
+    private KuaishouReportDailyGroupMapper dailyGroupMapper;
+
     @Autowired
     private IKuaishouReportHourlyGroupService hourlyGroupService;
     @Autowired
@@ -489,6 +494,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
     private void getAdvertiserGroupReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+        log.info("获取广告组日报,accountId:{},开始时间:{},结束时间:{}", token.getAccountId(), DateUtils.formatDate(startDate), DateUtils.formatDate(endDate));
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
@@ -522,14 +528,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         for (int i = 0; i < details.size(); i++) {
             var detailJson = details.getJSONObject(i);
-            var show = detailJson.getLong("show");
-            detailJson.put("photo_show", show);
-            var like = detailJson.getLong("like");
-            detailJson.put("photo_like", like);
+
+            detailJson.put("photo_share", detailJson.getString("share"));
+            detailJson.put("photo_comment", detailJson.getString("comment"));
+            detailJson.put("photo_like", detailJson.getString("like"));
+            detailJson.put("photo_show", detailJson.getString("show"));
+
             var dailyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportDailyGroup.class);
             dailyGroup.setAccountId(token.getAccountId());
-            dailyGroup.setId("" + dailyGroup.getAccountId() + dailyGroup.getUnitId() + dailyGroup.getStatDate());
-            dailyGroupService.saveOrUpdate(dailyGroup);
+            dailyGroupMapper.insertSelective(dailyGroup);
         }
         getAdvertiserGroupReportDailyByPage(token, startDate, endDate, page + 1);
     }
@@ -557,8 +564,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             List<KuaishouReportDailyGroup> dailyGroups = kuaishouResult.getData().getDetails();
             dailyGroups.forEach((dailyGroup) -> {
                 dailyGroup.setAccountId(advertiserId);
-                dailyGroup.setId("" + dailyGroup.getAccountId() + dailyGroup.getUnitId() + dailyGroup.getStatDate());
-                dailyGroupService.saveOrUpdate(dailyGroup);
+                //  dailyGroup.setId("" + dailyGroup.getAccountId() + dailyGroup.getUnitId() + dailyGroup.getStatDate());
+                dailyGroupMapper.insertSelective(dailyGroup);
             });
         } catch (Exception e) {
             e.printStackTrace();
@@ -2747,6 +2754,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             JSONObject requestJson = new JSONObject();
             requestJson.put("advertiser_id", accountId);
             requestJson.put("status", 4);
+            requestJson.put("page", 1);
+            requestJson.put("page_size", 500);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {

+ 84 - 74
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyGroup.java

@@ -1,9 +1,9 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -14,118 +14,128 @@ import java.util.Date;
 @TableName("ctop_kuaishou_report_daily_group")
 public class KuaishouReportDailyGroup implements Serializable {
     private static final long serialVersionUID = 1L;
-    @TableId
-    private String id;
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
 
     private Long accountId;
 
+    private Long unitId;
+
     private Long campaignId;
-    private String campaignName;
 
-    @JsonProperty("unit_id")
-    private Long unitId;
     private String unitName;
-    private Integer status;
 
-    @JsonProperty("stat_date")
-    private String statDate;
+    private String campaignName;
+
+    private Integer status;
 
-    @JsonProperty
     private BigDecimal charge;
-    @JsonProperty
+
     private Long photoShow;
-    @JsonProperty("photo_click")
-    @TableField("photo_click")
-    private Long photoClick;
-    @JsonProperty
+
     private Long aclick;
-    @JsonProperty
+
     private Long bclick;
-    @JsonProperty
-    private Long share;
-    @JsonProperty
-    private Long comment;
-    @JsonProperty
+
+    private Long photoShare;
+
+    private Long photoComment;
+
     private Long photoLike;
-    @JsonProperty
+
     private Long follow;
-    @JsonProperty("cancel_follow")
+
     private Long cancelFollow;
-    @JsonProperty
+
     private Long report;
-    @JsonProperty
+
     private Long block;
-    @JsonProperty
+
     private Long negative;
-    @JsonProperty("download_started")
+
     private Long downloadStarted;
-    @JsonProperty("download_completed")
+
     private Long downloadCompleted;
-    @JsonProperty
+
     private Long activation;
-    @JsonProperty
+
     private Long submit;
 
-    @JsonProperty
-    private BigDecimal photoClickRatio;
-    @JsonProperty
-    private BigDecimal actionRatio;
-    @JsonProperty("impression_1k_cost")
-    @TableField("impression_1k_cost")
+    private String statDate;
+
+    private Long photoClick;
+
+    private Double photoClickRatio;
+
+    private Double actionRatio;
+
     private BigDecimal impression1kCost;
-    @JsonProperty
+
     private BigDecimal photoClickCost;
-    @JsonProperty
+
     private BigDecimal actionCost;
-    @JsonProperty
+
     private Long eventPayFirstDay;
-    @JsonProperty
-    private BigDecimal eventPayFirstDayRoi;
-    @JsonProperty
-    private BigDecimal eventPay;
-    @JsonProperty
+
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+
+    private Double eventPayFirstDayRoi;
+
+    private Long eventPay;
+
     private BigDecimal eventPayPurchaseAmount;
-    @JsonProperty
-    private BigDecimal eventPayRoi;
-    @JsonProperty
+
+    private Double eventPayRoi;
+
     private Long eventRegister;
-    @JsonProperty
+
     private BigDecimal eventRegisterCost;
-    @JsonProperty
+
+    private Double eventRegisterRatio;
+
     private Long eventJinJianApp;
-    @JsonProperty
+
     private BigDecimal eventJinJianAppCost;
-    @JsonProperty
-    private BigDecimal eventPayPurchaseAmountFirstDay;
-    @JsonProperty
+
     private Long eventCreditGrantApp;
-    @JsonProperty
+
     private BigDecimal eventCreditGrantAppCost;
-    @JsonProperty
-    private BigDecimal eventCreditGrantAppRatio;
-    @JsonProperty
-    private BigDecimal eventOrderPaid;
-    @JsonProperty
+
+    private Double eventCreditGrantAppRatio;
+
+    private Long eventOrderPaid;
+
     private BigDecimal eventOrderPaidPurchaseAmount;
-    @JsonProperty
-    private BigDecimal eventOrderPaidCost;
-    @JsonProperty
-    private Long formCount;
-    @JsonProperty
-    private BigDecimal formCost;
-    @JsonProperty
-    private BigDecimal formActionRatio;
-    @JsonProperty
+
     private Long eventJinJianLandingPage;
-    @JsonProperty
+
     private BigDecimal eventJinJianLandingPageCost;
-    @JsonProperty
+
     private Long eventCreditGrantLandingPage;
-    @JsonProperty
+
     private BigDecimal eventCreditGrantLandingPageCost;
-    @JsonProperty
+
+    private Double eventCreditGrantLandingRatio;
+
+    private BigDecimal eventNextDayStayCost;
+
+    private Long eventNextDayStayRatio;
+
+    private Double formActionRatio;
+
+    private BigDecimal eventOrderPaidCost;
+
+    private Long eventNextDayStay;
+
+    private BigDecimal formCost;
+
+    private Long formCount;
+
+    private Double play3sRatio;
+
     private Date createTime;
-    @JsonProperty
+
     private Date updateTime;
 
     private String channelCode;

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

@@ -12,4 +12,6 @@ public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouRepor
             "set channel_code = substring_index(unit_name, '-', 1) " +
             "where stat_date =#{date}")
     void formatChannelCode(@Param("date") String date);
+
+    int insertSelective(KuaishouReportDailyGroup record);
 }

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

@@ -108,4 +108,395 @@
     </insert>
 
 
+
+
+
+
+
+
+
+
+
+    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup" >
+        replace into ctop_kuaishou_report_daily_group
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                id,
+            </if>
+            <if test="accountId != null" >
+                account_id,
+            </if>
+            <if test="unitId != null" >
+                unit_id,
+            </if>
+            <if test="campaignId != null" >
+                campaign_id,
+            </if>
+            <if test="status != null" >
+                status,
+            </if>
+            <if test="charge != null" >
+                charge,
+            </if>
+            <if test="photoShow != null" >
+                photo_show,
+            </if>
+            <if test="aclick != null" >
+                aclick,
+            </if>
+            <if test="bclick != null" >
+                bclick,
+            </if>
+            <if test="photoShare != null" >
+                photo_share,
+            </if>
+            <if test="photoComment != null" >
+                photo_comment,
+            </if>
+            <if test="photoLike != null" >
+                photo_like,
+            </if>
+            <if test="follow != null" >
+                follow,
+            </if>
+            <if test="cancelFollow != null" >
+                cancel_follow,
+            </if>
+            <if test="report != null" >
+                report,
+            </if>
+            <if test="block != null" >
+                block,
+            </if>
+            <if test="negative != null" >
+                negative,
+            </if>
+            <if test="downloadStarted != null" >
+                download_started,
+            </if>
+            <if test="downloadCompleted != null" >
+                download_completed,
+            </if>
+            <if test="activation != null" >
+                activation,
+            </if>
+            <if test="submit != null" >
+                submit,
+            </if>
+            <if test="statDate != null" >
+                stat_date,
+            </if>
+            <if test="photoClick != null" >
+                photo_click,
+            </if>
+            <if test="photoClickRatio != null" >
+                photo_click_ratio,
+            </if>
+            <if test="actionRatio != null" >
+                action_ratio,
+            </if>
+            <if test="impression1kCost != null" >
+                impression_1k_cost,
+            </if>
+            <if test="photoClickCost != null" >
+                photo_click_cost,
+            </if>
+            <if test="actionCost != null" >
+                action_cost,
+            </if>
+            <if test="eventPayFirstDay != null" >
+                event_pay_first_day,
+            </if>
+            <if test="eventPayPurchaseAmountFirstDay != null" >
+                event_pay_purchase_amount_first_day,
+            </if>
+            <if test="eventPayFirstDayRoi != null" >
+                event_pay_first_day_roi,
+            </if>
+            <if test="eventPay != null" >
+                event_pay,
+            </if>
+            <if test="eventPayPurchaseAmount != null" >
+                event_pay_purchase_amount,
+            </if>
+            <if test="eventPayRoi != null" >
+                event_pay_roi,
+            </if>
+            <if test="eventRegister != null" >
+                event_register,
+            </if>
+            <if test="eventRegisterCost != null" >
+                event_register_cost,
+            </if>
+            <if test="eventRegisterRatio != null" >
+                event_register_ratio,
+            </if>
+            <if test="eventJinJianApp != null" >
+                event_jin_jian_app,
+            </if>
+            <if test="eventJinJianAppCost != null" >
+                event_jin_jian_app_cost,
+            </if>
+            <if test="eventCreditGrantApp != null" >
+                event_credit_grant_app,
+            </if>
+            <if test="eventCreditGrantAppCost != null" >
+                event_credit_grant_app_cost,
+            </if>
+            <if test="eventCreditGrantAppRatio != null" >
+                event_credit_grant_app_ratio,
+            </if>
+            <if test="eventOrderPaid != null" >
+                event_order_paid,
+            </if>
+            <if test="eventOrderPaidPurchaseAmount != null" >
+                event_order_paid_purchase_amount,
+            </if>
+            <if test="eventJinJianLandingPage != null" >
+                event_jin_jian_landing_page,
+            </if>
+            <if test="eventJinJianLandingPageCost != null" >
+                event_jin_jian_landing_page_cost,
+            </if>
+            <if test="eventCreditGrantLandingPage != null" >
+                event_credit_grant_landing_page,
+            </if>
+            <if test="eventCreditGrantLandingPageCost != null" >
+                event_credit_grant_landing_page_cost,
+            </if>
+            <if test="eventCreditGrantLandingRatio != null" >
+                event_credit_grant_landing_ratio,
+            </if>
+            <if test="eventNextDayStayCost != null" >
+                event_next_day_stay_cost,
+            </if>
+            <if test="eventNextDayStayRatio != null" >
+                event_next_day_stay_ratio,
+            </if>
+            <if test="formActionRatio != null" >
+                form_action_ratio,
+            </if>
+            <if test="eventOrderPaidCost != null" >
+                event_order_paid_cost,
+            </if>
+            <if test="eventNextDayStay != null" >
+                event_next_day_stay,
+            </if>
+            <if test="formCost != null" >
+                form_cost,
+            </if>
+            <if test="formCount != null" >
+                form_count,
+            </if>
+            <if test="play3sRatio != null" >
+                play_3s_ratio,
+            </if>
+            <if test="createTime != null" >
+                create_time,
+            </if>
+            <if test="updateTime != null" >
+                update_time,
+            </if>
+            <if test="channelCode != null" >
+                channel_code,
+            </if>
+            <if test="unitName != null" >
+                unit_name,
+            </if>
+            <if test="campaignName != null" >
+                campaign_name,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="id != null" >
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="accountId != null" >
+                #{accountId,jdbcType=BIGINT},
+            </if>
+            <if test="unitId != null" >
+                #{unitId,jdbcType=BIGINT},
+            </if>
+            <if test="campaignId != null" >
+                #{campaignId,jdbcType=BIGINT},
+            </if>
+            <if test="status != null" >
+                #{status,jdbcType=INTEGER},
+            </if>
+            <if test="charge != null" >
+                #{charge,jdbcType=DECIMAL},
+            </if>
+            <if test="photoShow != null" >
+                #{photoShow,jdbcType=BIGINT},
+            </if>
+            <if test="aclick != null" >
+                #{aclick,jdbcType=BIGINT},
+            </if>
+            <if test="bclick != null" >
+                #{bclick,jdbcType=BIGINT},
+            </if>
+            <if test="photoShare != null" >
+                #{photoShare,jdbcType=BIGINT},
+            </if>
+            <if test="photoComment != null" >
+                #{photoComment,jdbcType=BIGINT},
+            </if>
+            <if test="photoLike != null" >
+                #{photoLike,jdbcType=BIGINT},
+            </if>
+            <if test="follow != null" >
+                #{follow,jdbcType=BIGINT},
+            </if>
+            <if test="cancelFollow != null" >
+                #{cancelFollow,jdbcType=BIGINT},
+            </if>
+            <if test="report != null" >
+                #{report,jdbcType=BIGINT},
+            </if>
+            <if test="block != null" >
+                #{block,jdbcType=BIGINT},
+            </if>
+            <if test="negative != null" >
+                #{negative,jdbcType=BIGINT},
+            </if>
+            <if test="downloadStarted != null" >
+                #{downloadStarted,jdbcType=BIGINT},
+            </if>
+            <if test="downloadCompleted != null" >
+                #{downloadCompleted,jdbcType=BIGINT},
+            </if>
+            <if test="activation != null" >
+                #{activation,jdbcType=BIGINT},
+            </if>
+            <if test="submit != null" >
+                #{submit,jdbcType=BIGINT},
+            </if>
+            <if test="statDate != null" >
+                #{statDate,jdbcType=VARCHAR},
+            </if>
+            <if test="photoClick != null" >
+                #{photoClick,jdbcType=BIGINT},
+            </if>
+            <if test="photoClickRatio != null" >
+                #{photoClickRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="actionRatio != null" >
+                #{actionRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="impression1kCost != null" >
+                #{impression1kCost,jdbcType=DECIMAL},
+            </if>
+            <if test="photoClickCost != null" >
+                #{photoClickCost,jdbcType=DECIMAL},
+            </if>
+            <if test="actionCost != null" >
+                #{actionCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayFirstDay != null" >
+                #{eventPayFirstDay,jdbcType=BIGINT},
+            </if>
+            <if test="eventPayPurchaseAmountFirstDay != null" >
+                #{eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayFirstDayRoi != null" >
+                #{eventPayFirstDayRoi,jdbcType=DOUBLE},
+            </if>
+            <if test="eventPay != null" >
+                #{eventPay,jdbcType=BIGINT},
+            </if>
+            <if test="eventPayPurchaseAmount != null" >
+                #{eventPayPurchaseAmount,jdbcType=DECIMAL},
+            </if>
+            <if test="eventPayRoi != null" >
+                #{eventPayRoi,jdbcType=DOUBLE},
+            </if>
+            <if test="eventRegister != null" >
+                #{eventRegister,jdbcType=BIGINT},
+            </if>
+            <if test="eventRegisterCost != null" >
+                #{eventRegisterCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventRegisterRatio != null" >
+                #{eventRegisterRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventJinJianApp != null" >
+                #{eventJinJianApp,jdbcType=BIGINT},
+            </if>
+            <if test="eventJinJianAppCost != null" >
+                #{eventJinJianAppCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantApp != null" >
+                #{eventCreditGrantApp,jdbcType=BIGINT},
+            </if>
+            <if test="eventCreditGrantAppCost != null" >
+                #{eventCreditGrantAppCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantAppRatio != null" >
+                #{eventCreditGrantAppRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventOrderPaid != null" >
+                #{eventOrderPaid,jdbcType=BIGINT},
+            </if>
+            <if test="eventOrderPaidPurchaseAmount != null" >
+                #{eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
+            </if>
+            <if test="eventJinJianLandingPage != null" >
+                #{eventJinJianLandingPage,jdbcType=BIGINT},
+            </if>
+            <if test="eventJinJianLandingPageCost != null" >
+                #{eventJinJianLandingPageCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantLandingPage != null" >
+                #{eventCreditGrantLandingPage,jdbcType=BIGINT},
+            </if>
+            <if test="eventCreditGrantLandingPageCost != null" >
+                #{eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventCreditGrantLandingRatio != null" >
+                #{eventCreditGrantLandingRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventNextDayStayCost != null" >
+                #{eventNextDayStayCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventNextDayStayRatio != null" >
+                #{eventNextDayStayRatio,jdbcType=BIGINT},
+            </if>
+            <if test="formActionRatio != null" >
+                #{formActionRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="eventOrderPaidCost != null" >
+                #{eventOrderPaidCost,jdbcType=DECIMAL},
+            </if>
+            <if test="eventNextDayStay != null" >
+                #{eventNextDayStay,jdbcType=BIGINT},
+            </if>
+            <if test="formCost != null" >
+                #{formCost,jdbcType=DECIMAL},
+            </if>
+            <if test="formCount != null" >
+                #{formCount,jdbcType=BIGINT},
+            </if>
+            <if test="play3sRatio != null" >
+                #{play3sRatio,jdbcType=DOUBLE},
+            </if>
+            <if test="createTime != null" >
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateTime != null" >
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="channelCode != null" >
+                #{channelCode,jdbcType=VARCHAR},
+            </if>
+            <if test="unitName != null" >
+                #{unitName,jdbcType=LONGVARCHAR},
+            </if>
+            <if test="campaignName != null" >
+                #{campaignName,jdbcType=LONGVARCHAR},
+            </if>
+        </trim>
+    </insert>
+
+
+
 </mapper>

+ 10 - 15
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/MaterialReportMapper.xml

@@ -71,19 +71,13 @@
         ELSE 0
         END
         ) conversionPrice, -- 转化单价
-
-        -- t2.url url, -- 视频url
-
-        (SELECT url
-        FROM ctop_kuaishou_video_get
-        WHERE signature = t2.signature
-        LIMIT 1
-        ) url,
+        t2.photo_url as  'url',
+        t2.cover_url as  'coverUrl',
         t2.signature signature -- 视频md5
         from
         ctop_user_allocation t1
         left join
-        ctop_kuaishou_report_daily_creative t2
+        ctop_kuaishou_report_daily_material t2
         on t1.account_id = t2.account_id
 
         <where>
@@ -248,13 +242,13 @@
         ELSE 0
         END
         ) conversionPrice, -- 转化单价
-        ( SELECT url from ctop_kuaishou_video_get WHERE signature = t2.signature limit 1) url,
-        -- t2.url url, -- 视频url
+        t2.photo_url as  'url',
+        t2.cover_url as  'coverUrl',
         t2.signature signature -- 视频md5
         from
         ctop_user_allocation t1
         left join
-        ctop_kuaishou_report_daily_creative t2
+        ctop_kuaishou_report_daily_material t2
         on t1.account_id = t2.account_id
         <where>
             <if test="userId != null">
@@ -338,7 +332,7 @@
         END
         ) conversionPrice -- 转化单价
         from
-        ctop_kuaishou_report_daily_creative
+        ctop_kuaishou_report_daily_material
         <where>
             <if test="signature != null">
                 and signature = #{signature}
@@ -511,11 +505,12 @@
         END
         ) conversionPrice, -- 转化单价
 
-        ( SELECT url from ctop_kuaishou_video_get WHERE signature = t1.signature limit 1) url,
+        t1.photo_url  as  'url',
+        t1.cover_url as  'coverUrl',
         t1.signature signature, -- 视频md5
         t1.account_id accountId
         from
-        ctop_kuaishou_report_daily_creative t1
+        ctop_kuaishou_report_daily_material t1
         where t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">