Bladeren bron

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

zhaoxian 4 jaren geleden
bovenliggende
commit
be5bc0ca5f

+ 18 - 2
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -7,6 +7,8 @@ import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCommentService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
@@ -246,8 +248,12 @@ public class SampleTest {
 
     @Test
     public void testData11(){
-        CtopOauthToken token =tokenService.getTokenByAccountId(1683711016125448L);
-        reportService.getAdvertiserPlanRuleData(token,new Date(),new Date(), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        CtopOauthToken token =tokenService.getTokenByAccountId(9556344L);
+        int dimeDiff = 5;
+        Date now = new Date();
+        String startTime = DateUtils.formatDate("2021-01-11 18:25:00");
+        String endTime = DateUtils.formatDate(now,"2021-01-11 18:35:00");
+        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startTime, endTime);
     }
 
     @Test
@@ -453,4 +459,14 @@ public class SampleTest {
 
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+    @Autowired
+    private IAiKuaishouAccountTargetTemplateService aiKuaishouAccountTargetTemplateService;
+    @Test
+    public void createPlan(){
+        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+        if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
+            return;
+        }
+        accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
+    }
 }

+ 7 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java

@@ -64,11 +64,12 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
 
         // 2.2 执行 素造的 视频拉取服务,时间过滤执行 yyyy-MM-dd HH:mm:ss
         // 时间差,单位为分钟
-        int dimeDiff = 5;
-        Date now = new Date();
-        String startTime = DateUtils.formatDate(new Date(now.getTime() - dimeDiff*60*1000),"yyyy-MM-dd HH:mm:ss");
-        String endTime = DateUtils.formatDate(now,"yyyy-MM-dd HH:mm:ss");
-        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startTime, endTime);
+        int timeStart = -10;
+        int timeEnd = -5;
+        Long now = System.currentTimeMillis();
+        String startTime = DateUtils.formatDate(new Date(now + timeStart*60*1000),"yyyy-MM-dd HH:mm:ss");
+        String endTime = DateUtils.formatDate(new Date(now + timeEnd*60*1000),"yyyy-MM-dd HH:mm:ss");
+        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startTime,endTime);
 
 
         // 3、获取5分钟内,ctop_kuaishou_video_get 的视频数据,记为 N,如果有数据则执行下面步骤
@@ -84,7 +85,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
         JSONArray campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(),1);
         boolean isHaveNewCampaign = false;
         Long newCampaignId = 0L;
-        if (campaignList.size()>0){
+        if (null!=campaignList&&campaignList.size()>0){
             for(int i = 0;i<campaignList.size();i++){
                 JSONObject jsonObject = campaignList.getJSONObject(i);
                 if (jsonObject.getString("campaign_name").contains("素材上新")){

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

@@ -2945,6 +2945,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
+//        System.out.println(resultJson.toJSONString());
         if (Check.isNull(resultJson)) {
             return;
         }