Ver Fonte

Merge remote-tracking branch 'origin/master'

songyinghao há 5 anos atrás
pai
commit
e0c8e39b9c
18 ficheiros alterados com 271 adições e 53 exclusões
  1. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ureport/ServletConfig.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceMaterialsLoadJob.java
  3. 62 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceNowDatePlanLoadJob.java
  4. 26 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanLoadJob.java
  5. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCampaignGroupJob.java
  6. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyCreativeReportLoadJob.java
  7. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyAccountReportLoadJob.java
  8. 61 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  9. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java
  10. 41 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java
  11. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  12. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/ByteDanceAdvertisePlanMapper.java
  13. 8 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceAdvertisePlanMapper.xml
  14. 10 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertisePlanService.java
  15. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertiserDataService.java
  16. 26 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  17. 10 7
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  18. 6 1
      pom.xml

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

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

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

@@ -43,7 +43,7 @@ public class BytedanceMaterialsLoadJob implements Job {
                         //1:获取当日广告组数据
                         advertiserDataService.getAdvertiserCampaign(token.getAccountId() + "", "", dateString);
                         //1:获取当日广告计划数据
-                        advertiserDataService.getAdvertiserPlan(token, "", dateString);
+                        advertiserDataService.getAdvertiserPlan(token, "", dateString, null);
                         //1:获取全量创意数据
                         creativeService.getAdvertiserCreative(token.getAccountId() + "", "", dateString);
                         //2:获取全量素材数据

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

@@ -0,0 +1,62 @@
+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.toutiao.service.IByteDanceAdvertiserDataService;
+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.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class BytedanceNowDatePlanLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = null;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                //1:查询当日数据
+                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+                executorService = Executors.newFixedThreadPool(8);
+                String nowDate = DateUtils.date2Str();
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                //1:获取当日广告计划数据
+                                advertiserDataService.getAdvertiserPlan(token, "", nowDate, nowDate);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("头条全量计划数据获取完成");
+            }
+
+        };
+        thread.start();
+    }
+
+    public static void main(String[] args) {
+        String nowDate = DateUtils.date2Str();
+        System.err.println(nowDate);
+    }
+}

+ 26 - 20
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanLoadJob.java

@@ -11,8 +11,6 @@ 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;
@@ -29,23 +27,31 @@ public class BytedancePlanLoadJob implements Job {
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        executorService = Executors.newFixedThreadPool(4);
-        tokens.forEach(token -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        //1:获取当日广告计划数据
-                        advertiserDataService.getAdvertiserPlan(token, "", null);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                    }
-                }
-            });
-        });
-        log.info("头条全量计划数据获取完成");
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                //1:查询当日数据
+                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+                executorService = Executors.newFixedThreadPool(4);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                //1:获取当日广告计划数据
+                                advertiserDataService.getAdvertiserPlan(token, "", null, null);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("头条全量计划数据获取完成");
+            }
+
+        };
+        thread.start();
     }
 }

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

@@ -32,14 +32,14 @@ public class KuaishouCampaignGroupJob implements Job {
             public void run() {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                executorService = Executors.newFixedThreadPool(4);
+                executorService = Executors.newFixedThreadPool(3);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
                             try {
                                 //1:获取全量广告计划数据
-                             //   kuaishouInterfaceService.getCampaignList(token, null, null);
+                                kuaishouInterfaceService.getCampaignList(token, null, null);
                                 //1:获取全量广告组数据
                                 kuaishouInterfaceService.getGroupList(token, null, null);
                             } catch (Exception e) {

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

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

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

@@ -51,7 +51,7 @@ public class KuaishouHourlyAccountReportLoadJob implements Job {
                     log.info("定时获取快手数据异常:未获取到可用的token");
                     return;
                 }
-                executorService = Executors.newFixedThreadPool(4);
+                executorService = Executors.newFixedThreadPool(3);
                 countDownLatch = new CountDownLatch(tokens.size());
                 Date finalGetDate = getDate;
                 tokens.forEach(token -> {

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

@@ -0,0 +1,61 @@
+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;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class KuaishouNowDateGroupJob 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:查询当日数据
+                Date nowDate  = DateUtils.getDate();
+                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+                executorService = Executors.newFixedThreadPool(8);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                //1:获取全量广告组数据
+                                kuaishouInterfaceService.getGroupList(token, nowDate, nowDate);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("快手物料数据同步完成");
+            }
+
+        };
+        thread.start();
+
+
+    }
+}

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

@@ -18,6 +18,7 @@ import org.apache.http.impl.cookie.BasicClientCookie;
 import org.bytedeco.javacpp.opencv_core;
 import org.bytedeco.javacv.FFmpegFrameGrabber;
 import org.bytedeco.javacv.Frame;
+import org.bytedeco.javacv.Java2DFrameConverter;
 import org.openqa.selenium.Cookie;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.chrome.ChromeDriver;
@@ -185,14 +186,16 @@ public class OceanengineJob implements Job {
                 }
                 i++;
             }
-            opencv_core.IplImage img = f.image;
-            int owidth = img.width();
-            int oheight = img.height();
+//            opencv_core.IplImage img = f.image;
+            int owidth = f.imageWidth;
+            int oheight = f.imageHeight;
+            Java2DFrameConverter converter =new Java2DFrameConverter();
+            BufferedImage fecthedImage =converter.getBufferedImage(f);
 // 对截取的帧进行等比例缩放
             int width = 800;
             int height = (int) (((double) width / owidth) * oheight);
             BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
-            bi.getGraphics().drawImage(f.image.getBufferedImage().getScaledInstance(width, height, Image.SCALE_SMOOTH),
+            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
                     0, 0, null);
             ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
             ImageIO.write(bi, "jpg", baos);

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

@@ -4,10 +4,12 @@ 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;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.toutiao.service.IByteDanceAdvertisePlanService;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
@@ -18,6 +20,8 @@ import org.jeecg.modules.ctop.service.IBidWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -36,6 +40,8 @@ public class BidWarningServiceImpl implements IBidWarningService {
     private KuaiShouGroupMapper groupMapper;
     @Autowired
     private MailLogMapper mailLogMapper;
+    @Autowired
+    private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
 
 
     /**
@@ -48,26 +54,38 @@ public class BidWarningServiceImpl implements IBidWarningService {
         long l = System.currentTimeMillis();
         try {
             QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
-            projectQueryWrapper.eq("media_id", "2");
+            // projectQueryWrapper.eq("media_id", "1");
             List<Project> projects = projectMapper.selectList(projectQueryWrapper);
             if (!Check.isNull(projects)) {
                 for (Project project : projects) {
+                    if (Check.isNull(project)) {
+                        continue;
+                    }
                     Long maxBid = project.getMaxBid();
                     Long projectId = project.getId();
-                    QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
-                    userAllocationQueryWrapper.eq("project_id", projectId);
-                    List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
+
+
+                    List<UserAllocation> userAllocations = getUserAllocationsByProjectId(projectId);
                     if (!Check.isNull(userAllocations)) {
                         for (UserAllocation userAllocation : userAllocations) {
                             Long accountId = userAllocation.getAccountId();
-                            List<String> unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
+                            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);
+                            }else if("2".equals(userAllocation.getMediaId())){
+                                unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
+                            }
+
                             if (!Check.isNull(unitWarning)) {
-                                sendMessage(accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                                sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
                             }
                         }
                     }
                 }
             }
+
             log.info("出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - l) / 1000);
         } catch (Exception e) {
             e.printStackTrace();
@@ -75,9 +93,15 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
 
     }
+    private List<UserAllocation> getUserAllocationsByProjectId(Long projectId) {
+        QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+        userAllocationQueryWrapper.eq("project_id", projectId);
+        List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
+        return userAllocations;
+    }
 
 
-    private void sendMessage(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) {
 
         String createTime = DateUtils.getNowDate("yyyy-MM-dd");
         Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
@@ -93,7 +117,14 @@ public class BidWarningServiceImpl implements IBidWarningService {
                 .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
         if (count < 3) {
             List<String> mailList = mailLogMapper.selectMailList(projectId);
-            String subject = "广告组出价预警";
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+
             try {
                 SendMailUtil.sendMail(mailList, subject, text.toString());
                 MailLog mailLog = new MailLog();
@@ -113,4 +144,6 @@ public class BidWarningServiceImpl implements IBidWarningService {
 
 
     }
+
+
 }

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

@@ -331,7 +331,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 header.put("X-CSRFToken", csrftoken);
                 header.put("X-Requested-With", "XMLHttpRequest");
                 header.put("Referer", "https://ad.oceanengine.com/pages/promotion.html");
-                    // 创建广告组返回信息
+                // 创建广告组返回信息
                 if (null == campaignId || "".equals(campaignId.trim())) {
                     res = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/campaign/create/", campaignParam, header);
                     JsonNode node = mapper.readTree(res);
@@ -486,7 +486,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                         if (null != template) {
                             //获取modify_time
                             Thread.sleep(5000L);
-                            advertiserDataService.getAdvertiserPlan(token, adId + "", null);
+                            advertiserDataService.getAdvertiserPlan(token, adId + "", null, null);
                             advertiserDataService.updateAd(token, adId, template, requestJson);
                         }
                         Long creativeTemplateId = requestJson.getLong("creativeTemplateId");

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/ByteDanceAdvertisePlanMapper.java

@@ -2,6 +2,10 @@ package cn.com.ctop.toutiao.mapper;
 
 import cn.com.ctop.toutiao.entity.ByteDanceAdvertisePlan;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import io.lettuce.core.dynamic.annotation.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * @Description: 今日头条广告计划信息
@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ByteDanceAdvertisePlanMapper extends BaseMapper<ByteDanceAdvertisePlan> {
 
+    List<String> selectWarningGroup(@Param("accountId") Long accountId, @Param("maxBid") BigDecimal maxBid);
 }

+ 8 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceAdvertisePlanMapper.xml

@@ -2,4 +2,12 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.toutiao.mapper.ByteDanceAdvertisePlanMapper">
 
+    <select id="selectWarningGroup" resultType="java.lang.String">
+   SELECT
+   name
+   FROM ctop_bytedance_advertise_plan
+   WHERE advertiser_id = #{accountId}
+   and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
+   and toutiao_status = 'AD_STATUS_DELIVERY_OK'
+    </select>
 </mapper>

+ 10 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertisePlanService.java

@@ -4,6 +4,8 @@ import cn.com.ctop.toutiao.entity.ByteDanceAdvertisePlan;
 import com.baomidou.mybatisplus.extension.service.IService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 
+import java.math.BigDecimal;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -21,4 +23,12 @@ public interface IByteDanceAdvertisePlanService extends IService<ByteDanceAdvert
     Map<String, Object> getAdConvertListByUrlId(Long accountId, Long urlId);
 
     Map<String, Object> getAdConvertListByUrlIdAndBindId(Long bindAccountId, Long urlId);
+
+    /**
+     *  查询需要预警的广告计划名称
+     * @param accountId
+     * @param maxBid
+     * @return
+     */
+    List<String> selectWarningGroup(Long accountId, BigDecimal maxBid);
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertiserDataService.java

@@ -12,7 +12,7 @@ import java.util.Map;
 public interface IByteDanceAdvertiserDataService {
     Map<String, Object> getAdvertiserInfo(String accountId);
 
-    Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date);
+    Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate);
 
     Map<String, Object> getAdvertiserCampaign(String accountId, String ids, String date);
 

+ 26 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java

@@ -1,5 +1,9 @@
 package cn.com.ctop.toutiao.service.impl;
 
+import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.toutiao.entity.ByteDanceAdvertisePlan;
@@ -13,14 +17,12 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
-import cn.com.ctop.common.module.entity.BindAccountLogin;
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -40,6 +42,8 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
     private ICtopOauthTokenService tokenService;
     @Autowired
     private ByteDanceAdvertisePlanMapper planMapper;
+    @Autowired
+    private ByteDanceAdvertisePlanMapper byteDanceAdvertisePlanMapper;
 
     @Override
     public Map<String, Object> advertiserPlanCreate(CtopOauthToken token, Long campaignId, String dataString) {
@@ -92,6 +96,7 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         return getAdConvertByUrlInfo(token, urlInfo);
     }
 
+
     private Map<String, Object> getAdConvertByUrlInfo(CtopOauthToken token, BytedanceUrlInfo urlInfo) {
 
         Long advertiserId = token.getAccountId();
@@ -176,4 +181,21 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create");
         return HttpUtils.bytedancePostRequest(token, url, data);
     }
+
+
+    /**
+     * 查询需要预警的广告计划名称
+     *
+     * @param accountId
+     * @param maxBid
+     * @return
+     */
+
+    @Override
+    public List<String> selectWarningGroup(Long accountId, BigDecimal maxBid) {
+        return  byteDanceAdvertisePlanMapper.selectWarningGroup(accountId, maxBid);
+
+    }
+
+
 }

+ 10 - 7
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -80,7 +80,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
 
 
-    public void getAd(CtopOauthToken token, int pageNum, String ids, String date) {
+    public void getAd(CtopOauthToken token, int pageNum, String ids, String date, String updateDate) {
         JSONArray getIds = null;
         if (null != ids && !ids.equals("")) {
             String[] idString = ids.split(StringUtils.COMMA);
@@ -102,6 +102,9 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         if (null != date && !"".equals(date)) {
             filtering.put("ad_create_time", date);
         }
+        if (null != updateDate && !"".equals(updateDate)) {
+            filtering.put("ad_modify_time", updateDate);
+        }
 
         JSONObject param = new JSONObject();
         param.put("advertiser_id", token.getAccountId());
@@ -124,12 +127,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             ByteDanceAdvertisePlan advertisePlan = new ByteDanceAdvertisePlan(dataObject, String.valueOf(token.getAccountId()));
             advertisePlanService.saveOrUpdate(advertisePlan);
         }
-        getAd(token, pageNum + 1, ids, date);
+        getAd(token, pageNum + 1, ids, date, updateDate);
     }
 
     @Override
-    public Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date) {
-        getAd(token, 1, ids, date);
+    public Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate) {
+        getAd(token, 1, ids, date, updateDate);
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("code", 0);
         resultMap.put("message", "获取广告计划信息成功");
@@ -378,7 +381,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         JSONArray getAdIds = data.getJSONArray("ad_ids");
         if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(token, adIds, null);
+            getAdvertiserPlan(token, adIds, null, null);
         }
         resultMap.put("code", 0);
         resultMap.put("message", "广告组状态修改成功");
@@ -430,7 +433,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
         if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(token, adIds, null);
+            getAdvertiserPlan(token, adIds, null, null);
         }
         resultMap.put("code", 0);
         resultMap.put("message", "修改计划出价成功");
@@ -481,7 +484,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
         if (null != getAdIds && getAdIds.size() > 0) {
             //获取广告计划信息
-            getAdvertiserPlan(token, adIds, null);
+            getAdvertiserPlan(token, adIds, null, null);
         }
         resultMap.put("code", 0);
         resultMap.put("message", "修改计划预算成功");

+ 6 - 1
pom.xml

@@ -386,7 +386,12 @@
         <dependency>
             <groupId>org.bytedeco</groupId>
             <artifactId>javacv</artifactId>
-            <version>0.8</version>
+            <version>1.4.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.bytedeco</groupId>
+            <artifactId>javacv-platform</artifactId>
+            <version>1.4.2</version>
         </dependency>
         <!--<dependency>
             <groupId>org.bytedeco</groupId>