Browse Source

Merge branch 'test' of http://39.106.184.70:3000/ctop/adsp-boot into test

syh 5 years ago
parent
commit
920b970f16
32 changed files with 235 additions and 83 deletions
  1. 9 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  2. 5 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  3. 6 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java
  4. 9 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java
  5. 3 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCampaignGroupJob.java
  6. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyAccountReportLoadJob.java
  7. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCampaignReportLoadJob.java
  8. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCreativeReportLoadJob.java
  9. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java
  10. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java
  11. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyReportTaskJob.java
  12. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouGroupJob.java
  13. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyAccountReportLoadJob.java
  14. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyAccountWarningLoadJob.java
  15. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyCampaignReportLoadJob.java
  16. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyCreativeReportLoadJob.java
  17. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyGroupReportLoadJob.java
  18. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java
  19. 66 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateCampaignJob.java
  20. 15 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCreativeLoadJob.java
  21. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  22. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouSuZaoLoadJob.java
  23. 7 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java
  24. 4 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java
  25. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java
  26. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml
  27. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  28. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  29. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  30. 3 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/AccountWarningServiceImpl.java
  31. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  32. 3 2
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/ByteDanceHourlyAccountWarningServiceImpl.java

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 
 import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
@@ -28,7 +29,6 @@ import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
 import org.jeecg.modules.system.entity.SysUser;
-import org.jeecg.modules.system.mapper.UserCompanyMapper;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -73,9 +73,9 @@ public class ProjectController {
     @Autowired
     private MaterialReportMapper materialReportMapper;
     @Autowired
-    private UserCompanyMapper userCompanyMapper;
-    @Autowired
     private ITransferAccountService transferAccountService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
 
     /**
      * 根据 项目 媒体类型 查看项目
@@ -303,13 +303,17 @@ public class ProjectController {
         } else {
             boolean ok = projectService.updateById(project);
 
-
             QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
             memberQueryWrapper.eq("project_id", project.getId());
             ProjectMember updateMember = new ProjectMember();
             updateMember.setProjectName(project.getProjectName());
             projectMemberService.update(updateMember, memberQueryWrapper);
-            //      projectMemberMapper.update()
+
+            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+            userAllocationQueryWrapper.eq("project_id", project.getId());
+            UserAllocation updateUserAllocation = new UserAllocation();
+            updateUserAllocation.setProjectName(project.getProjectName());
+            userAllocationService.update(updateUserAllocation, userAllocationQueryWrapper);
 
             if (ok) {
                 result.success("修改成功!");
@@ -319,8 +323,6 @@ public class ProjectController {
         return result;
     }
 
-    @Autowired
-    private IUserAllocationService userAllocationService;
 
     /**
      * 通过id删除

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

@@ -70,15 +70,6 @@ public class UserAllocationController {
     private IProjectMemberService projectMemberService;
 
 
-    @PostMapping(value = "/transferAccount")
-    public Result transferAccount(Long accountId, Long projectId) {
-
-
-        return null;
-
-    }
-
-
     @GetMapping(value = "/accountTurnProject")
     public Result getAccountList(Long accountId, Long projectId) {
         Result result = new Result<>();
@@ -246,8 +237,11 @@ public class UserAllocationController {
         Result<IPage<UserAllocation>> result = new Result<IPage<UserAllocation>>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
-        queryWrapper.eq("user_id", user.getId());
-        queryWrapper.orderByDesc("id");
+        String roleCode = materialReportMapper.getRoleCodeByUserId(user.getId());
+        if (!"admin".equals(roleCode)) {
+            queryWrapper.eq("user_id", user.getId());
+            queryWrapper.orderByDesc("id");
+        }
         Page<UserAllocation> page = new Page<UserAllocation>(pageNo, pageSize);
         IPage<UserAllocation> pageList = userAllocationService.page(page, queryWrapper);
         result.setSuccess(true);

+ 6 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/DailyFlowsJob.java

@@ -1,10 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -16,7 +15,8 @@ public class DailyFlowsJob implements Job {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
+    private ICtopOauthTokenService oauthTokenService;
+
 
     /**
      * 刷新token
@@ -26,12 +26,9 @@ public class DailyFlowsJob implements Job {
      */
     @Override
     public void execute(JobExecutionContext jobExecutionContext) {
-        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("media_id", "2");
-        queryWrapper.groupBy("account_id");
-        List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(queryWrapper);
-        if (!Check.isNull(ctopOauthTokens)) {
-            for (CtopOauthToken ctopOauthToken : ctopOauthTokens) {
+        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
+        if (!Check.isNull(tokens)) {
+            for (CtopOauthToken ctopOauthToken : tokens) {
                 kuaishouInterfaceService.getDailyFlows(ctopOauthToken);
             }
 

+ 9 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java

@@ -2,8 +2,9 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -21,8 +22,10 @@ import java.util.concurrent.Executors;
 public class KuaishouAppListJob implements Job {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+
     @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
+    private ICtopOauthTokenService oauthTokenService;
+
 
     static ExecutorService executorService = Executors.newFixedThreadPool(2);
 
@@ -32,10 +35,11 @@ public class KuaishouAppListJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-                oauthTokenQueryWrapper.eq("media_id", 2);
-                List<CtopOauthToken> tokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+                List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
                 for (CtopOauthToken token : tokens) {
+                    if (Check.isNull(token)) {
+                        continue;
+                    }
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
@@ -15,7 +14,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 @Slf4j
-public class KuaishouCampaignGroupJob implements Job {
+public class KuaishouCampaignJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
@@ -31,8 +30,8 @@ public class KuaishouCampaignGroupJob implements Job {
             @Override
             public void run() {
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                executorService = Executors.newFixedThreadPool(3);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+                executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override
@@ -40,8 +39,6 @@ public class KuaishouCampaignGroupJob implements Job {
                             try {
                                 //1:获取全量广告计划数据
                                 kuaishouInterfaceService.getCampaignList(token, null, null);
-                                //1:获取全量广告组数据
-                                kuaishouInterfaceService.getGroupList(token, null, null);
                             } catch (Exception e) {
                                 e.printStackTrace();
                             } finally {

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -38,7 +37,7 @@ public class KuaishouDailyAccountReportLoadJob implements Job {
                 kuaishouInterfaceService.deleteHourlyReport(deleteDate);
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCampaignReportLoadJob.java

@@ -38,7 +38,7 @@ public class KuaishouDailyCampaignReportLoadJob implements Job {
                 kuaishouInterfaceService.deleteHourlyReport(deleteDate);
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

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

@@ -46,7 +46,7 @@ public class KuaishouDailyCreativeReportLoadJob implements Job {
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
                 executorService = Executors.newFixedThreadPool(4);
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java

@@ -38,7 +38,7 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
                 kuaishouInterfaceService.deleteHourlyReport(deleteDate);
                 Date getDate = DateUtils.addDay(new Date(), -1);
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyLoadFileJob.java

@@ -40,7 +40,7 @@ public class KuaishouDailyLoadFileJob implements Job {
                 String nowDate = DateUtils.getDate("yyyy-MM-dd");
                 String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -1);
                 //  查询快手token
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyReportTaskJob.java

@@ -26,7 +26,7 @@ public class KuaishouDailyReportTaskJob implements Job {
         log.info("快手获取日报数据任务执行开始");
         Long start = System.currentTimeMillis();
         Date getDate = DateUtils.addDay(new Date(), -1);
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         if (null == tokens || tokens.size() <= 0) {
             log.info("快手获取日报数据任务执行失败:未获取到可用的token");
             return;

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

@@ -0,0 +1,57 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class KuaishouGroupJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                //1:查询当日数据
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+                executorService = Executors.newFixedThreadPool(3);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+
+                                kuaishouInterfaceService.getGroupList(token, null, null);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("快手物料数据同步完成");
+            }
+
+        };
+        thread.start();
+
+
+    }
+}

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

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -46,7 +45,7 @@ public class KuaishouHourlyAccountReportLoadJob implements Job {
                     getDate = DateUtils.addDay(getDate, -1);
                 }
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyAccountWarningLoadJob.java

@@ -38,7 +38,7 @@ public class KuaishouHourlyAccountWarningLoadJob implements Job {
                 log.info("开始时段消耗预警定时任务");
                 long l = System.currentTimeMillis();
                 try {
-                    List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                    List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                     if (null == tokens || tokens.size() <= 0) {
                         log.info("定时获取快手数据异常:未获取到可用的token");
                         return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyCampaignReportLoadJob.java

@@ -47,7 +47,7 @@ public class KuaishouHourlyCampaignReportLoadJob implements Job {
                     getDate = DateUtils.addDay(getDate, -1);
                 }
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyCreativeReportLoadJob.java

@@ -46,7 +46,7 @@ public class KuaishouHourlyCreativeReportLoadJob implements Job {
                     getDate = DateUtils.addDay(getDate, -1);
                 }
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyGroupReportLoadJob.java

@@ -46,7 +46,7 @@ public class KuaishouHourlyGroupReportLoadJob implements Job {
                     getDate = DateUtils.addDay(getDate, -1);
                 }
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 if (null == tokens || tokens.size() <= 0) {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java

@@ -34,7 +34,7 @@ public class KuaishouMaterialsLoadJob implements Job {
                 Date startDate = DateUtils.addDay(new Date(), -1);
                 Date endDate = new Date();
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 executorService = Executors.newFixedThreadPool(8);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

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

@@ -0,0 +1,66 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class KuaishouNowDateCampaignJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+
+        Thread thread = new Thread() {
+            @SneakyThrows
+            @Override
+            public void run() {
+                //1:查询当日数据
+                Date endDate  = DateUtils.getDate();
+                String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                Date startDate = sim.parse(anotherDay);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+                executorService = Executors.newFixedThreadPool(5);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                kuaishouInterfaceService.getCampaignList(token, startDate, endDate);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("快手物料数据同步完成");
+            }
+
+        };
+        thread.start();
+
+
+    }
+
+}

+ 15 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCreativeLoadJob.java

@@ -2,8 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -11,13 +11,14 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 @Slf4j
-public class KuaishouCreativeLoadJob implements Job {
+public class KuaishouNowDateCreativeJob implements Job {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
@@ -25,30 +26,26 @@ public class KuaishouCreativeLoadJob implements Job {
 
     static ExecutorService executorService = null;
 
-    /**
-     * 获取全量创意
-     *
-     * @param jobExecutionContext
-     * @throws JobExecutionException
-     */
-
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+
         Thread thread = new Thread() {
+            @SneakyThrows
             @Override
             public void run() {
-                //增加接口的开始和结束日期
-                Date startDate = DateUtils.addDay(new Date(), -1);
-                Date endDate = new Date();
                 //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                executorService = Executors.newFixedThreadPool(4);
+                Date endDate  = DateUtils.getDate();
+                String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                Date startDate = sim.parse(anotherDay);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+                executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
                             try {
-                                //1:获取全量创意数据
                                 kuaishouInterfaceService.getCreativeList(token, startDate, endDate);
                             } catch (Exception e) {
                                 e.printStackTrace();
@@ -59,8 +56,11 @@ public class KuaishouCreativeLoadJob implements Job {
                 });
                 log.info("快手物料数据同步完成");
             }
+
         };
         thread.start();
 
+
     }
+
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java

@@ -41,7 +41,7 @@ public class KuaishouNowDateGroupJob implements Job {
                 String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
                 SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
                 Date startDate = sim.parse(anotherDay);
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouSuZaoLoadJob.java

@@ -28,7 +28,7 @@ public class KuaishouSuZaoLoadJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
                 executorService = Executors.newFixedThreadPool(8);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

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

@@ -68,13 +68,16 @@ public class BidWarningServiceImpl implements IBidWarningService {
                     List<UserAllocation> userAllocations = getUserAllocationsByProjectId(projectId);
                     if (!Check.isNull(userAllocations)) {
                         for (UserAllocation userAllocation : userAllocations) {
+                            if (userAllocation.getAccountStatus() == 1) {
+                                continue;
+                            }
                             Long accountId = userAllocation.getAccountId();
                             List<String> unitWarning = new ArrayList<>();
-                            if("1".equals(userAllocation.getMediaId())){
+                            if ("1".equals(userAllocation.getMediaId())) {
                                 BigDecimal bid = new BigDecimal(maxBid);
                                 BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
-                                unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId,bigDecimal);
-                            }else if("2".equals(userAllocation.getMediaId())){
+                                unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
+                            } else if ("2".equals(userAllocation.getMediaId())) {
                                 unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
                             }
 
@@ -93,6 +96,7 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
 
     }
+
     private List<UserAllocation> getUserAllocationsByProjectId(Long projectId) {
         QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
         userAllocationQueryWrapper.eq("project_id", projectId);

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

@@ -58,6 +58,9 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
             List<UserAllocation> userAllocations = getUserAllocationsByProjectId(project.getId());
             if (!Check.isNull(userAllocations)) {
                 for (UserAllocation userAllocation : userAllocations) {
+                    if (userAllocation.getAccountStatus() == 1) {
+                        continue;
+                    }
                     Long accountId = userAllocation.getAccountId();
                     List<String> unitWarning = new ArrayList<>();
                     if ("1".equals(userAllocation.getMediaId())) {
@@ -68,7 +71,7 @@ public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
                     }
 
                     if (!Check.isNull(unitWarning)) {
-                        sendMessage(project.getMediaId(), accountId, project.getId(), project.getProjectName(), userAllocation.getAuthName(), unitWarning,maxDeepCpaBid );
+                        sendMessage(project.getMediaId(), accountId, project.getId(), project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxDeepCpaBid);
                     }
                 }
             }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java

@@ -32,4 +32,6 @@ public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
      * @return
      */
     CtopOauthToken selectByAccountId(Long accountId);
+
+    List<CtopOauthToken> selectKuaiShouToken();
 }

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

@@ -75,4 +75,14 @@
         limit 1
     </select>
 
+
+    <select id="selectKuaiShouToken" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
+        select  t1.*
+        from ctop_oauth_token t1
+        left join ctop_user_allocation t2
+        on t1.account_id = t2.account_id
+        where t2.account_status = 0
+        and t1.media_id = 2
+
+    </select>
 </mapper>

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

@@ -23,4 +23,6 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
     Map<String, Object> getKuaiShouRefreshToken(Long accountId, String refreshToken);
 
     List<CtopOauthToken> getTokenListByType(String platformTypeBytedance);
+
+    List<CtopOauthToken> selectKuaiShouToken();
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -157,4 +157,15 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         queryWrapper.eq("media_id", platformType).orderByDesc("account_id");
         return this.list(queryWrapper);
     }
+
+    /**
+     * 获取快手有效账户列表
+     *
+     * @return
+     */
+
+    @Override
+    public List<CtopOauthToken> selectKuaiShouToken() {
+        return cTopOauthTokenMapper.selectKuaiShouToken();
+    }
 }

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

@@ -30,6 +30,9 @@
         description,
         action_bar_text,
         first_frame_type,
+        site_id,
+        programmed_creative_material,
+        photo_ids,
         creative_create_time,
         creative_update_time,
         create_time,
@@ -64,6 +67,9 @@
             #{creative.description},
             #{creative.actionBarText},
             #{creative.firstFrameType},
+            #{creative.siteId},
+            #{creative.programmedCreativeMaterial},
+            #{creative.photoIds},
             #{creative.creativeCreateTime},
             #{creative.creativeUpdateTime},
             #{creative.createTime},

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

@@ -50,6 +50,9 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
             if (Check.isNull(userAllocation)) {
                 return;
             }
+            if (userAllocation.getAccountStatus() == 1) {
+                return;
+            }
             BigDecimal warningAmount = userAllocation.getWarningAmount();
             BigDecimal warningProportion = userAllocation.getWarningProportion();
             BigDecimal nowCost = hourlyAccountMapper.getCost(accountId, maxHour, statDate);
@@ -167,12 +170,4 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
     }
 
 
-
-
-
-
-
-
-
-
 }

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

@@ -2015,6 +2015,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
                     creative.setCreateTime(new Date());
                     creative.setUpdateTime(new Date());
+                    creative.setSiteId(detailJson.getLong("site_id"));
                     creative.setPhotoId(detailJson.getString("photo_id"));
                     if (detailJson.getLong("photo_id") == 0) {
                         JSONArray photoIds = new JSONArray();
@@ -2034,7 +2035,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             }
                         }
                     }
+                    creatives.add(creative);
                 }
+
             }
             creativeService.replaceBatch(creatives);
             getCreativeListByPage(accessToken, advertiserId, startDate, endDate, page + 1);

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

@@ -6,7 +6,6 @@ import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
-import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.SendMailUtil;
@@ -23,7 +22,6 @@ import java.util.List;
 public class ByteDanceHourlyAccountWarningServiceImpl implements IByteDanceHourlyAccountWarningService {
 
 
-
     @Autowired
     private BytedanceAdvertiserHourlyReportMapper bytedanceAdvertiserHourlyReportMapper;
     @Autowired
@@ -53,6 +51,9 @@ public class ByteDanceHourlyAccountWarningServiceImpl implements IByteDanceHourl
             if (Check.isNull(userAllocation)) {
                 return;
             }
+            if (userAllocation.getAccountStatus() == 1) {
+                return;
+            }
             BigDecimal warningAmount = userAllocation.getWarningAmount();
             BigDecimal warningProportion = userAllocation.getWarningProportion();
             BigDecimal nowCost = bytedanceAdvertiserHourlyReportMapper.getCost(accountId, maxHour, statDate);