Browse Source

Merge branch 'master' into test

syh 4 years ago
parent
commit
043e226a7f
25 changed files with 316 additions and 140 deletions
  1. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGui.java
  2. 15 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  3. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  4. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  5. 0 61
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/CutFrameJob.java
  6. 3 5
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java
  7. 0 1
      module-common/src/main/java/cn/com/ctop/common/module/entity/CtopOauthToken.java
  8. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  9. 12 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  10. 20 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java
  11. 30 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyFlowsJob.java
  12. 31 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouTargetingTagsJob.java
  13. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  14. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java
  15. 116 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  16. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  17. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/KuaishouBidWarningServiceImpl.java
  18. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java
  19. 20 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java
  20. 3 26
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java
  21. 5 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreative.java
  22. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceAdvertisePlanMapper.xml
  23. 23 30
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceBidWarningServiceImpl.java
  24. 3 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedancePlanDailyReport.java
  25. 9 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneGui.java

@@ -16,5 +16,6 @@ public class JeecgOneGui {
     public static void main(String[] args) {
     public static void main(String[] args) {
         new CodeWindow().pack();
         new CodeWindow().pack();
     }
     }
-
 }
 }
+
+

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.common.module.utils.StringUtils;
@@ -45,7 +46,8 @@ public class BindAccountLoginController {
     private UserAllocationMapper userAllocationMapper;
     private UserAllocationMapper userAllocationMapper;
     @Autowired
     @Autowired
     private ICreateInternalService createInternalService;
     private ICreateInternalService createInternalService;
-
+    @Autowired
+    private ISysRoleService sysRoleService;
     /**
     /**
      * @param json
      * @param json
      * @return
      * @return
@@ -123,9 +125,20 @@ public class BindAccountLoginController {
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                          HttpServletRequest req) {
                                                          HttpServletRequest req) {
         Result<IPage<BindAccountLogin>> result = new Result<>();
         Result<IPage<BindAccountLogin>> result = new Result<>();
+        String accountName = bindAccountLogin.getAccountName();
+        String loginType = bindAccountLogin.getLoginType();
+        bindAccountLogin.setAccountName(null);
+        bindAccountLogin.setLoginType(null);
         QueryWrapper<BindAccountLogin> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, req.getParameterMap());
         QueryWrapper<BindAccountLogin> queryWrapper = QueryGenerator.initQueryWrapper(bindAccountLogin, req.getParameterMap());
+        if(null!=accountName&&!"".equals(accountName.trim())){
+            queryWrapper.like("account_name",accountName);
+        }
+        if(null != loginType&&!"".equals(loginType.trim())&&!"none".equals(loginType)){
+            queryWrapper.eq("login_type",loginType);
+        }
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        if (!Check.isNull(user)) {
+        String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
+        if(!roleCode.equals("admin")){
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.eq("user_id", user.getId());
         }
         }
         queryWrapper.orderByDesc("id");
         queryWrapper.orderByDesc("id");

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

@@ -107,7 +107,7 @@ public class ByteDanceTemplateController {
                                                               @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, HttpServletRequest req) {
                                                               @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, HttpServletRequest req) {
         Result<IPage<ByteDanceAdvertisePlan>> result = new Result<>();
         Result<IPage<ByteDanceAdvertisePlan>> result = new Result<>();
         QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = QueryGenerator.initQueryWrapper(plan, req.getParameterMap());
         QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = QueryGenerator.initQueryWrapper(plan, req.getParameterMap());
-        queryWrapper.eq("toutiao_id", plan.getToutiaoId()).orderByDesc("id");
+        queryWrapper.eq("account_id", plan.getAccountId()).orderByDesc("id");
         Page<ByteDanceAdvertisePlan> page = new Page<>(pageNo, pageSize);
         Page<ByteDanceAdvertisePlan> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceAdvertisePlan> pageList = planService.page(page, queryWrapper);
         IPage<ByteDanceAdvertisePlan> pageList = planService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setSuccess(true);

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

@@ -178,6 +178,8 @@ public class MaterialInfoController {
                                                      HttpServletRequest req) {
                                                      HttpServletRequest req) {
 
 
         Result<IPage<MaterialInfo>> result = new Result<>();
         Result<IPage<MaterialInfo>> result = new Result<>();
+        String materialName = materialInfo.getMaterialName();
+        materialInfo.setMaterialName(null);
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         Object createTime = materialInfo.getCreateTime();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
         materialInfo.setCreateTime(null);
@@ -214,6 +216,10 @@ public class MaterialInfoController {
                 }
                 }
             }
             }
         }
         }
+        if (!Check.isNull(materialName)) {
+            queryWrapper.like("material_name", materialName);
+
+        }
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
         List<MaterialInfo> materialInfoList = pageList.getRecords();
         List<MaterialInfo> materialInfoList = pageList.getRecords();

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

@@ -1,61 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.common.module.entity.MaterialCutFrameTask;
-import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import cn.com.ctop.common.module.service.IMaterialCutFrameTaskService;
-import cn.com.ctop.common.module.utils.Check;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.Executors;
-
-import static org.jeecg.modules.ctop.job.KuaishouDailyGroupReportLoadJob.executorService;
-
-/**
- * 获取抽帧视频
- */
-@Slf4j
-public class CutFrameJob implements Job {
-    @Autowired
-    private IMaterialCutFrameService materialCutFrameService;
-    @Autowired
-    private IMaterialCutFrameTaskService taskService;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-
-                log.info("开始抽帧定时任务");
-                QueryWrapper<MaterialCutFrameTask> taskQueryWrapper = new QueryWrapper<>();
-                taskQueryWrapper.eq("job_status", 0);
-                //taskQueryWrapper.eq("cloud_type", 2);
-                List<MaterialCutFrameTask> list = taskService.list(taskQueryWrapper);
-
-                if (Check.isNull(list)) {
-                    return;
-                }
-                executorService = Executors.newFixedThreadPool(5);
-                list.forEach(cutFrameTask -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            //获取广告计划信息数据
-                            materialCutFrameService.loadCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());
-                            //materialCutFrameService.loadCosCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());  //腾讯云任务状态查询以及图片下载
-                        }
-                    });
-                });
-            }
-        };
-        thread.start();
-
-
-    }
-}

+ 3 - 5
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 package cn.com.ctop.common.module.entity;
 
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -51,11 +52,8 @@ public class BindAccountLogin {
     @Excel(name = "平台账户id", width = 15)
     @Excel(name = "平台账户id", width = 15)
     @ApiModelProperty(value = "平台账户id")
     @ApiModelProperty(value = "平台账户id")
     private String accountId;
     private String accountId;
-    /**
-     * 广告id
-     */
-    @Excel(name = "用户Id", width = 15)
-    @ApiModelProperty(value = "用户id")
+
+    @Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
     private String userId;
     private String userId;
     /**
     /**
      * 账号
      * 账号

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

@@ -87,7 +87,6 @@ public class CtopOauthToken {
     private Date refreshTokenExpiresIn;
     private Date refreshTokenExpiresIn;
 
 
 
 
-
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */

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

@@ -33,4 +33,6 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
     List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime);
     List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime);
 
 
     List<CtopOauthToken> getByProjectId(long projectId);
     List<CtopOauthToken> getByProjectId(long projectId);
+
+    CtopOauthToken selectOneByMediaId(String platformTypeKuaishou);
 }
 }

+ 12 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -60,6 +60,8 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         param.put("grant_type", "refresh_token");
         param.put("grant_type", "refresh_token");
         param.put("refresh_token", token.getRefreshToken());
         param.put("refresh_token", token.getRefreshToken());
         String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
         String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        System.err.println(JSONObject.parseObject(result));
+        XxlJobLogger.log("头条刷新token;accountId:{},返回信息:{}", token.getAccountId(), result);
         if(null == result||result.trim().equals("")||result.equalsIgnoreCase("null")){
         if(null == result||result.trim().equals("")||result.equalsIgnoreCase("null")){
             XxlJobLogger.log("头条刷新token失败;accountId:{},返回信息:{}", token.getAccountId(), result);
             XxlJobLogger.log("头条刷新token失败;accountId:{},返回信息:{}", token.getAccountId(), result);
             resultMap.put("message", "token刷新失败");
             resultMap.put("message", "token刷新失败");
@@ -81,7 +83,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
             updateRefreshToken.setRefreshTokenExpiresIn(addSecond(now, refreshTokenExpiresIn));
             updateRefreshToken.setRefreshTokenExpiresIn(addSecond(now, refreshTokenExpiresIn));
             updateRefreshToken.setAccessTokenExpiresIn(addSecond(now, expiresIn));
             updateRefreshToken.setAccessTokenExpiresIn(addSecond(now, expiresIn));
             QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
             QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("access_token", token);
+            queryWrapper.eq("access_token", token.getAccessToken());
             queryWrapper.eq("media_id", 1);
             queryWrapper.eq("media_id", 1);
             int i = ctopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
             int i = ctopOauthTokenMapper.update(updateRefreshToken, queryWrapper);
             if (i > 0) {
             if (i > 0) {
@@ -217,6 +219,15 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
         return this.list(queryWrapper);
         return this.list(queryWrapper);
     }
     }
 
 
+    @Override
+    public CtopOauthToken selectOneByMediaId(String platformTypeKuaishou) {
+        QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+        tokenQueryWrapper.eq("media_id", platformTypeKuaishou);
+        tokenQueryWrapper.orderByDesc("create_time");
+        tokenQueryWrapper.last("limit 1");
+        return this.getOne(tokenQueryWrapper);
+    }
+
     private Date addSecond(Date date, int seconds) {
     private Date addSecond(Date date, int seconds) {
         Calendar calendar = Calendar.getInstance();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.setTime(date);

+ 20 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -344,7 +344,25 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
             this.save(coveCutFrame);
             this.save(coveCutFrame);
             LoadFileUtil.delFile(coverCutFramePath);
             LoadFileUtil.delFile(coverCutFramePath);
             // 请求从数据接口 获取其余14张截图
             // 请求从数据接口 获取其余14张截图
+            getCut(materialId, videoUrl, loadImage, 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+    private void getCut(String materialId, String videoUrl, String loadImage, Integer count) {
+        try {
             Map<String, Object> coverMap = CloudVideoProcessUtil.videoCutFrameHandle(videoUrl, loadImage);
             Map<String, Object> coverMap = CloudVideoProcessUtil.videoCutFrameHandle(videoUrl, loadImage);
+            if (Check.isNullMap(coverMap) && count < 4) {
+                getCut(materialId, videoUrl, loadImage, count + 1);
+            }
+
+            if (Check.isNullMap(coverMap)) {
+                return;
+            }
             for (int i = 0; i <= 13; i++) {
             for (int i = 0; i <= 13; i++) {
                 String url = (String) coverMap.get(String.valueOf(i));
                 String url = (String) coverMap.get(String.valueOf(i));
                 if (!Check.isNull(url)) {
                 if (!Check.isNull(url)) {
@@ -360,8 +378,10 @@ public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMap
                 }
                 }
 
 
             }
             }
+
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
+
         }
         }
 
 
     }
     }

+ 30 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyFlowsJob.java

@@ -0,0 +1,30 @@
+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.common.module.utils.Check;
+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 org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class KuaishouDailyFlowsJob {
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @XxlJob("kuaishouDailyFlowsJob")
+    public ReturnT<String> execute(String param) {
+        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
+        if (!Check.isNull(tokens)) {
+            for (CtopOauthToken ctopOauthToken : tokens) {
+                kuaishouInterfaceService.getDailyFlows(ctopOauthToken);
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+}

+ 31 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouTargetingTagsJob.java

@@ -0,0 +1,31 @@
+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.common.module.utils.CtopAdConstant;
+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 org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouTargetingTagsJob {
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
+    /**
+     * 定时更新 快手 标签
+     * @throws JobExecutionException
+     */
+    @XxlJob("kuaishouTargetingTagsJob")
+    public ReturnT<String> execute(String params)throws Exception {
+        CtopOauthToken token = oauthTokenService.selectOneByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        kuaishouInterfaceService.getTargetingTags(token.getAccountId(), token.getAccessToken());
+        kuaishouInterfaceService.areaList(token.getAccessToken());
+        return ReturnT.SUCCESS;
+    }
+}

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

@@ -1133,6 +1133,7 @@ public class BatchController {
                 queryWrapper.between("stat_date", startDate, endDate);
                 queryWrapper.between("stat_date", startDate, endDate);
             }
             }
             queryWrapper.orderByDesc("stat_date");
             queryWrapper.orderByDesc("stat_date");
+            queryWrapper.orderByDesc("photo_id");
             queryWrapper.groupBy("signature");
             queryWrapper.groupBy("signature");
             Page<KuaiShouVideoGet> page = new Page<>(pageNo, pageSize);
             Page<KuaiShouVideoGet> page = new Page<>(pageNo, pageSize);
             IPage<KuaiShouVideoGet> pageList = kuaiShouVideoGetService.page(page, queryWrapper);
             IPage<KuaiShouVideoGet> pageList = kuaiShouVideoGetService.page(page, queryWrapper);
@@ -1695,7 +1696,7 @@ public class BatchController {
             }
             }
             JSONArray unitIds = requestJson.getJSONArray("unitIds");
             JSONArray unitIds = requestJson.getJSONArray("unitIds");
             if (Check.isNull(unitIds)) {
             if (Check.isNull(unitIds)) {
-                throw new Exception("请选择需要修改的广告组");
+                throw new Exception("请选择需要复制的广告组");
             }
             }
 
 
             Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
             Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
@@ -1707,6 +1708,7 @@ public class BatchController {
                     continue;
                     continue;
                 }
                 }
                 kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
                 kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
+                kuaiShouGroupService.getCreativeByUnit(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
                 QueryWrapper<KuaiShouGroup> queryWrapper = new QueryWrapper<>();
                 QueryWrapper<KuaiShouGroup> queryWrapper = new QueryWrapper<>();
                 queryWrapper.eq("account_id", accountId);
                 queryWrapper.eq("account_id", accountId);
                 queryWrapper.eq("unit_id", unitId);
                 queryWrapper.eq("unit_id", unitId);
@@ -1769,6 +1771,7 @@ public class BatchController {
 
 
             Long unitId = requestJson.getLong("unitId");
             Long unitId = requestJson.getLong("unitId");
             kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
             kuaiShouGroupService.getGroupByUnitId(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
+            kuaiShouGroupService.getCreativeByUnit(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitId);
             Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
             Long copyToCampaignId = requestJson.getLong("copyToCampaignId");
             JSONArray failArr = new JSONArray();
             JSONArray failArr = new JSONArray();
             Integer createCount = requestJson.getInteger("createCount");
             Integer createCount = requestJson.getInteger("createCount");
@@ -1868,6 +1871,8 @@ public class BatchController {
             if (Check.isNull(oauthToken)) {
             if (Check.isNull(oauthToken)) {
                 throw new Exception("未获取到账户信息");
                 throw new Exception("未获取到账户信息");
             }
             }
+            Long copyUnitId = requestJson.getLong("copyUnitId");
+            kuaiShouGroupService.getCreativeByUnit(oauthToken.getAccessToken(), oauthToken.getAccountId(), copyUnitId);
             JSONObject returnJson = new JSONObject();
             JSONObject returnJson = new JSONObject();
             JSONObject groupJson = requestJson.getJSONObject("groupArr");
             JSONObject groupJson = requestJson.getJSONObject("groupArr");
             requestJson.remove("groupArr");
             requestJson.remove("groupArr");

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

@@ -14,4 +14,6 @@ public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
     void getGroupList(String accessToken, Long accountId);
     void getGroupList(String accessToken, Long accountId);
 
 
     void getGroupByUnitId(String accessToken, Long accountId, Long unitId);
     void getGroupByUnitId(String accessToken, Long accountId, Long unitId);
+
+    void getCreativeByUnit(String accessToken, Long accountId, Long unitId);
 }
 }

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

@@ -10,6 +10,7 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouScheduleMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouScheduleMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -44,6 +45,8 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
     @Autowired
     @Autowired
     private KuaiShouGroupTargetMapper groupTargetMapper;
     private KuaiShouGroupTargetMapper groupTargetMapper;
     private static ExecutorService executorService = Executors.newFixedThreadPool(10);
     private static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
 
 
 
 
     /**
     /**
@@ -139,6 +142,119 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
     }
     }
 
 
 
 
+    /**
+     * 根据组获取创意
+     *
+     * @param accessToken
+     * @param accountId
+     * @param unitId
+     */
+    @Override
+    public void getCreativeByUnit(String accessToken, Long accountId, Long unitId) {
+
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", " application/json");
+            headers.put("Access-Token", accessToken);
+            JSONObject param = new JSONObject();
+            param.put("advertiser_id", accountId);
+            param.put("page_size", 200);
+
+
+            param.put("unit_id", unitId);
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (Check.isNull(resultJson)) {
+                log.error("获取广告创意返回结果为空,advertiserId:{}", accountId);
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            String message = resultJson.getString("message");
+            if (null == code || code != 0) {
+                log.error("获取广告创意返回结果异常,advertiserId:{},message:{}", accountId, message);
+                return;
+            }
+            JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+            if (null == details || details.size() <= 0) {
+                return;
+            }
+            for (int i = 0; i < details.size(); i++) {
+                JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
+                if (!Check.isNull(detailJson)) {
+                    KuaiShouCreative creative = new KuaiShouCreative();
+                    creative.setId("" + accountId + detailJson.getLong("creative_id"));
+                    creative.setAccountId(accountId);
+                    creative.setCampaignId(detailJson.getLong("campaign_id"));
+                    creative.setUnitId(detailJson.getLong("unit_id"));
+                    creative.setCreativeId(detailJson.getLong("creative_id"));
+                    creative.setCreativeName(detailJson.getString("creative_name"));
+                    creative.setCreativeMaterialType(detailJson.getInteger("creative_material_type"));
+                    if (!Check.isNull(detailJson.getJSONArray("material_url"))) {
+                        creative.setMaterialUrl(detailJson.getJSONArray("material_url").toJSONString());
+                    }
+
+                    if (!Check.isNull(detailJson.getJSONArray("image_tokens"))) {
+                        creative.setImageTokens(detailJson.getJSONArray("image_tokens").toJSONString());
+                    }
+                    creative.setStatus(detailJson.getInteger("status"));
+                    creative.setPutStatus(detailJson.getInteger("put_status"));
+                    creative.setCreateChannel(detailJson.getInteger("create_channel"));
+                    creative.setReviewDetail(detailJson.getString("review_detail"));
+                    creative.setCoverUrl(detailJson.getString("cover_url"));
+                    creative.setImageToken(detailJson.getString("image_token"));
+                    creative.setCoverWidth(detailJson.getString("cover_width"));
+                    creative.setCoverHeight(detailJson.getString("cover_height"));
+                    creative.setOverlayBgUrl(detailJson.getString("overlay_bg_url"));
+                    creative.setOverlayBgImageToken(detailJson.getString("overlay_bg_image_token"));
+                    creative.setStickerTitle(detailJson.getString("sticker_title"));
+                    creative.setOverlayType(detailJson.getString("overlay_type"));
+                    creative.setClickTrackUrl(detailJson.getString("click_track_url"));
+                    creative.setImpressionUrl(detailJson.getString("impression_url"));
+                    creative.setAdPhotoPlayedT3sUrl(detailJson.getString("ad_photo_played_t3s_url"));
+                    creative.setCreativeCreateTime(detailJson.getDate("create_time"));
+                    creative.setCreativeUpdateTime(detailJson.getDate("update_time"));
+                    creative.setFirstFrameType(detailJson.getInteger("first_frame_type"));
+                    JSONObject displayInfoJson = detailJson.getJSONObject("display_info");
+                    if (!Check.isNull(displayInfoJson)) {
+                        creative.setDescription(displayInfoJson.getString("description"));
+                        creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
+                    }
+                    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();
+                        JSONObject programmed_creative_material = detailJson.getJSONObject("programmed_creative_material");
+                        if (!Check.isNull(programmed_creative_material)) {
+                            creative.setProgrammedCreativeMaterial(programmed_creative_material.toJSONString());
+                            JSONArray materials = programmed_creative_material.getJSONArray("materials");
+                            if (!Check.isNull(materials)) {
+                                for (int j = 0; j < materials.size(); j++) {
+                                    JSONObject materialJson = materials.getJSONObject(j);
+                                    if (!Check.isNull(materialJson)) {
+                                        Long photo_id = materialJson.getLong("photo_id");
+                                        photoIds.add(String.valueOf(photo_id));
+                                    }
+                                }
+                                creative.setPhotoIds(photoIds.toJSONString());
+                            }
+                        }
+                    }
+                    creativeService.saveOrUpdate(creative);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+
+
+    }
+
+
     private void addGroupV2(Long advertiserId, JSONArray details) {
     private void addGroupV2(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             List<KuaiShouGroup> groups = new ArrayList<>();

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

@@ -2984,10 +2984,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             param.put("advertiser_id", accountId);
             param.put("advertiser_id", accountId);
             param.put("page_size", 200);
             param.put("page_size", 200);
 
 
-            Map<String, Object> deleteMap = new HashMap<>();
+           /* Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("account_id", accountId);
             deleteMap.put("account_id", accountId);
             deleteMap.put("campaign_id", campaignId);
             deleteMap.put("campaign_id", campaignId);
-            creativeService.removeByMap(deleteMap);
+            creativeService.removeByMap(deleteMap);*/
             QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
             QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
             groupQueryWrapper.eq("account_id", accountId);
             groupQueryWrapper.eq("account_id", accountId);
             groupQueryWrapper.eq("campaign_id", campaignId);
             groupQueryWrapper.eq("campaign_id", campaignId);

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/KuaishouBidWarningServiceImpl.java

@@ -61,6 +61,8 @@ public class KuaishouBidWarningServiceImpl implements IKuaishouBidWarningService
                         List<String> unitWarning = new ArrayList<>();
                         List<String> unitWarning = new ArrayList<>();
                         if ("2".equals(userAllocation.getMediaId())) {
                         if ("2".equals(userAllocation.getMediaId())) {
                             unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
                             unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
+                        }
+                        if (!Check.isNull(unitWarning)) {
                             sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
                             sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
                         }
                         }
                     }
                     }

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

@@ -54,6 +54,7 @@ public class ByteDanceCampaignController {
                                                           HttpServletRequest req) {
                                                           HttpServletRequest req) {
         Result<IPage<ByteDanceCampaign>> result = new Result<>();
         Result<IPage<ByteDanceCampaign>> result = new Result<>();
         String name = byteDanceCampaign.getName();
         String name = byteDanceCampaign.getName();
+        byteDanceCampaign.setName(null);
         QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, req.getParameterMap());
         QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, req.getParameterMap());
         if(null!=name&&!"".equalsIgnoreCase(name)){
         if(null!=name&&!"".equalsIgnoreCase(name)){
             queryWrapper.like("name",name);
             queryWrapper.like("name",name);

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

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * @Description: 今日头条创意信息
  * @Description: 今日头条创意信息
@@ -47,11 +49,29 @@ public class ByteDanceCreativeController {
     public Result<IPage<ByteDanceCreative>> queryPageList(ByteDanceCreative byteDanceCreative,
     public Result<IPage<ByteDanceCreative>> queryPageList(ByteDanceCreative byteDanceCreative,
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          @RequestParam(name="startDate",defaultValue = "")String startDate,
+                                                          @RequestParam(name="endDate",defaultValue = "")String endDate,
                                                           HttpServletRequest req) {
                                                           HttpServletRequest req) {
         Result<IPage<ByteDanceCreative>> result = new Result<>();
         Result<IPage<ByteDanceCreative>> result = new Result<>();
+        String title = byteDanceCreative.getTitle();
+        byteDanceCreative.setTitle(null);
         QueryWrapper<ByteDanceCreative> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreative, req.getParameterMap());
         QueryWrapper<ByteDanceCreative> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreative, req.getParameterMap());
+        if(null!=startDate&&!startDate.trim().equals("")){
+            queryWrapper.ge("",startDate+" 00:00:00");
+        }
+        if(null!=endDate&&!endDate.trim().equals("")){
+            queryWrapper.le("",startDate+" 23:59:59");
+        }
+        if(null!=title&&!"".equals(title.trim())){
+            queryWrapper.like("title",title);
+        }
         Page<ByteDanceCreative> page = new Page<>(pageNo, pageSize);
         Page<ByteDanceCreative> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCreative> pageList = byteDanceCreativeService.page(page, queryWrapper);
         IPage<ByteDanceCreative> pageList = byteDanceCreativeService.page(page, queryWrapper);
+        List<ByteDanceCreative> records = pageList.getRecords();
+        if(null!=records&&!records.isEmpty()){
+            List<ByteDanceCreative> creatives = records.stream().map(creative-> creative.setCreateStatus(creative.getStatus().equalsIgnoreCase("CAMPAIGN_STATUS_ENABLE"))).collect(Collectors.toList());
+            pageList.setRecords(creatives);
+        }
         result.setSuccess(true);
         result.setSuccess(true);
         result.setResult(pageList);
         result.setResult(pageList);
         return result;
         return result;

+ 3 - 26
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java

@@ -33,29 +33,8 @@ public class ByteDanceAdvertisePlan {
     @TableId
     @TableId
     @ApiModelProperty(value = "头条平台广告计划id")
     @ApiModelProperty(value = "头条平台广告计划id")
     private Long id;
     private Long id;
-    /**
-     * 平台广告主id
-     */
-    @Excel(name = "平台广告主id", width = 15)
-    @ApiModelProperty(value = "平台广告主id")
-    private String advertiserId;
-    /**
-     * 头条广告主id
-     */
-    @Excel(name = "头条广告主id", width = 15)
-    @ApiModelProperty(value = "头条广告主id")
-    private Long toutiaoId;
-    /**
-     * 计划名称
-     */
-    @Excel(name = "计划名称", width = 15)
-    @ApiModelProperty(value = "计划名称")
+    private String accountId;
     private String name;
     private String name;
-    /**
-     * 广告组id
-     */
-    @Excel(name = "广告组id", width = 15)
-    @ApiModelProperty(value = "广告组id")
     private Long campaignId;
     private Long campaignId;
     /**
     /**
      * 上次修改时间戳(用于更新时提交,服务端判断是否基于最新信息修改)
      * 上次修改时间戳(用于更新时提交,服务端判断是否基于最新信息修改)
@@ -239,7 +218,6 @@ public class ByteDanceAdvertisePlan {
     public ByteDanceAdvertisePlan(JSONObject dataObject, String accountId) {
     public ByteDanceAdvertisePlan(JSONObject dataObject, String accountId) {
         Long id = dataObject.getLong("id");
         Long id = dataObject.getLong("id");
         this.id = id;
         this.id = id;
-        this.advertiserId = accountId;
         String name = dataObject.getString("name");
         String name = dataObject.getString("name");
         if (null != name && !"".equals(name.trim())) {
         if (null != name && !"".equals(name.trim())) {
             this.name = name;
             this.name = name;
@@ -275,7 +253,7 @@ public class ByteDanceAdvertisePlan {
         this.updateTime = new Date();
         this.updateTime = new Date();
         Long advertiserId = dataObject.getLong("advertiser_id");
         Long advertiserId = dataObject.getLong("advertiser_id");
         if (null != advertiserId) {
         if (null != advertiserId) {
-            this.toutiaoId = advertiserId;
+            this.accountId = advertiserId+"";
         }
         }
         Long campaignId = dataObject.getLong("campaign_id");
         Long campaignId = dataObject.getLong("campaign_id");
         if (null != campaignId) {
         if (null != campaignId) {
@@ -410,7 +388,6 @@ public class ByteDanceAdvertisePlan {
 
 
     public ByteDanceAdvertisePlan(String advertiserId, Long adId, JSONObject params) {
     public ByteDanceAdvertisePlan(String advertiserId, Long adId, JSONObject params) {
         this.id = adId;
         this.id = adId;
-        this.advertiserId = advertiserId;
         String name = params.getString("name");
         String name = params.getString("name");
         if (null != name && !"".equals(name.trim())) {
         if (null != name && !"".equals(name.trim())) {
             this.name = name;
             this.name = name;
@@ -418,7 +395,7 @@ public class ByteDanceAdvertisePlan {
 
 
         Long toutiaoId = params.getLong("advertiser_id");
         Long toutiaoId = params.getLong("advertiser_id");
         if (null != toutiaoId) {
         if (null != toutiaoId) {
-            this.toutiaoId = toutiaoId;
+            this.accountId = toutiaoId+"";
         }
         }
         Long campaignId = params.getLong("campaign_id");
         Long campaignId = params.getLong("campaign_id");
         if (null != campaignId) {
         if (null != campaignId) {

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

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.material.entity;
 
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -41,8 +42,7 @@ public class ByteDanceCreative {
     /**
     /**
      * 本平台广告主id
      * 本平台广告主id
      */
      */
-    @Excel(name = "本平台广告主id", width = 15)
-    @ApiModelProperty(value = "本平台广告主id")
+    @Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
     private String accountId;
     private String accountId;
     /**
     /**
      * 创意素材标题
      * 创意素材标题
@@ -59,8 +59,7 @@ public class ByteDanceCreative {
     /**
     /**
      * 创意素材状态
      * 创意素材状态
      */
      */
-    @Excel(name = "创意素材状态", width = 15)
-    @ApiModelProperty(value = "创意素材状态")
+    @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "57b60cec65bbc7cd3d6da4fbda589594")
     private String status;
     private String status;
     /**
     /**
      * 创意素材创作状态
      * 创意素材创作状态
@@ -126,6 +125,8 @@ public class ByteDanceCreative {
      */
      */
     @ApiModelProperty(value = "updateTime")
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
     private Date updateTime;
+    @TableField(exist = false)
+    private Boolean createStatus;
 
 
     public ByteDanceCreative(){
     public ByteDanceCreative(){
 
 

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceAdvertisePlanMapper.xml

@@ -6,7 +6,7 @@
    SELECT
    SELECT
    name
    name
    FROM ctop_bytedance_advertise_plan
    FROM ctop_bytedance_advertise_plan
-   WHERE advertiser_id = #{accountId}
+   WHERE account_id = #{accountId}
    and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
    and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
    and toutiao_status = 'AD_STATUS_DELIVERY_OK'
    and toutiao_status = 'AD_STATUS_DELIVERY_OK'
     </select>
     </select>
@@ -16,7 +16,7 @@
    SELECT
    SELECT
    name
    name
    FROM ctop_bytedance_advertise_plan
    FROM ctop_bytedance_advertise_plan
-   WHERE advertiser_id = #{accountId}
+   WHERE account_id = #{accountId}
    and deep_cpabid &gt; #{maxCpaBid}
    and deep_cpabid &gt; #{maxCpaBid}
    and toutiao_status = 'AD_STATUS_DELIVERY_OK'
    and toutiao_status = 'AD_STATUS_DELIVERY_OK'
     </select>
     </select>

+ 23 - 30
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceBidWarningServiceImpl.java

@@ -4,7 +4,6 @@ import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
-import cn.com.ctop.common.module.service.ICorpFeishuUserService;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
@@ -28,8 +27,6 @@ import java.util.List;
 @Slf4j
 @Slf4j
 public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningService {
 public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningService {
     @Autowired
     @Autowired
-    private ICorpFeishuUserService corpFeishuUserService;
-    @Autowired
     private IProjectService projectService;
     private IProjectService projectService;
     @Autowired
     @Autowired
     private IUserAllocationService userAllocationService;
     private IUserAllocationService userAllocationService;
@@ -40,46 +37,42 @@ public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningServi
 
 
     @Override
     @Override
     public void bidWarning() {
     public void bidWarning() {
-        XxlJobLogger.log("---------头条出价预警定时任务开始----------");
+        XxlJobLogger.log("开始头条出价预警定时任务");
         long start = System.currentTimeMillis();
         long start = System.currentTimeMillis();
         try {
         try {
             List<Project> projects = projectService.list();
             List<Project> projects = projectService.list();
-            if (Check.isNull(projects)) {
-                XxlJobLogger.log("查询所属项目为空");
-                return ;
-            }
-            for (Project project : projects) {
-                if (Check.isNull(project)) {
-                    continue;
-                }
-                Long maxBid = project.getMaxBid();
-                Long projectId = project.getId();
-                List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
-                if (Check.isNull(userAllocations)) {
-                    continue;
-                }
-                for (UserAllocation userAllocation : userAllocations) {
-                    if (userAllocation.getAccountStatus() == 1) {
+            if (!Check.isNull(projects)) {
+                for (Project project : projects) {
+                    if (Check.isNull(project)) {
                         continue;
                         continue;
                     }
                     }
-                    Long accountId = userAllocation.getAccountId();
-                    List<String> unitWarning = new ArrayList<>();
-                    if ("1".equals(userAllocation.getMediaId())) {
-                        BigDecimal bid = new BigDecimal(maxBid);
-                        BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
-                        unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
-                        if (!Check.isNull(unitWarning)) {
-                            sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                    Long maxBid = project.getMaxBid();
+                    Long projectId = project.getId();
+                    List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
+                    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())) {
+                                BigDecimal bid = new BigDecimal(maxBid);
+                                BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
+                                unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
+                            }
+                            if (!Check.isNull(unitWarning)) {
+                                sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
             }
             }
+
             XxlJobLogger.log("头条出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
             XxlJobLogger.log("头条出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-
-
     }
     }
 
 
     private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
     private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {

+ 3 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedancePlanDailyReport.java

@@ -425,7 +425,7 @@ public class BytedancePlanDailyReport {
         if (null != playFeedBreak75) {
         if (null != playFeedBreak75) {
             this.play75FeedBreak = playFeedBreak75;
             this.play75FeedBreak = playFeedBreak75;
         }
         }
-        Long nextDayOpen = data.getLong("next_day_open");
+        Long nextDayOpen = data.getLong("attribution_next_day_open_cnt");
         if (null != nextDayOpen) {
         if (null != nextDayOpen) {
             this.nextDayOpen = nextDayOpen;
             this.nextDayOpen = nextDayOpen;
         }
         }
@@ -509,7 +509,7 @@ public class BytedancePlanDailyReport {
         if (null != inAppPay) {
         if (null != inAppPay) {
             this.inAppPay = inAppPay;
             this.inAppPay = inAppPay;
         }
         }
-        BigDecimal nextDayOpenCost = data.getBigDecimal("next_day_open_cost");
+        BigDecimal nextDayOpenCost = data.getBigDecimal("attribution_next_day_open_cost");
         if (null != nextDayOpenCost) {
         if (null != nextDayOpenCost) {
             this.nextDayOpenCost = nextDayOpenCost;
             this.nextDayOpenCost = nextDayOpenCost;
         }
         }
@@ -525,7 +525,7 @@ public class BytedancePlanDailyReport {
         if (null != show) {
         if (null != show) {
             this.showNum = show;
             this.showNum = show;
         }
         }
-        BigDecimal nextDayOpenRate = data.getBigDecimal("next_day_open_rate");
+        BigDecimal nextDayOpenRate = data.getBigDecimal("attribution_next_day_open_rate");
         if (null != nextDayOpenRate) {
         if (null != nextDayOpenRate) {
             this.nextDayOpenRate = nextDayOpenRate;
             this.nextDayOpenRate = nextDayOpenRate;
         }
         }

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

@@ -151,7 +151,9 @@ public class ReportServiceImpl implements IReportService {
         var config = new SerializeConfig();
         var config = new SerializeConfig();
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         var jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         var jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
+
         JSONObject getObject = getAdStat(token, jsonObject);
         JSONObject getObject = getAdStat(token, jsonObject);
+       // System.out.println(conditions.getStartDate()  + " "  + conditions.getEndDate() + " " + getObject.getString("request_id"));
         if (null == getObject) {
         if (null == getObject) {
             log.error("广告计划报表数据获取异常=》account:{};message:{}", token.getAccountId(), "返回数据异常");
             log.error("广告计划报表数据获取异常=》account:{};message:{}", token.getAccountId(), "返回数据异常");
             return;
             return;
@@ -381,6 +383,13 @@ public class ReportServiceImpl implements IReportService {
         JSONArray groupBy = new JSONArray();
         JSONArray groupBy = new JSONArray();
         groupBy.add("STAT_GROUP_BY_FIELD_ID");
         groupBy.add("STAT_GROUP_BY_FIELD_ID");
         groupBy.add("STAT_GROUP_BY_FIELD_STAT_TIME");
         groupBy.add("STAT_GROUP_BY_FIELD_STAT_TIME");
+
+
+        JSONObject status = new JSONObject();
+        status.put("status","AD_STATUS_ALL");
+
+
+        conditions.put("filtering",status);
         conditions.put("group_by", groupBy);
         conditions.put("group_by", groupBy);
         return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, conditions);
         return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, conditions);
     }
     }