Browse Source

Merge remote-tracking branch 'origin/master'

zhaoxian 3 năm trước cách đây
mục cha
commit
fb8929c24b
17 tập tin đã thay đổi với 575 bổ sung70 xóa
  1. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  2. 346 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  3. 104 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/TestService.java
  4. 14 14
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  6. 8 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  7. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  8. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProgramCreativeMapper.java
  9. 62 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouProgranCreativeMapper.xml
  10. 4 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  11. 5 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProgramCreativeServiceImpl.java
  12. 8 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/WarningOperationServiceImpl.java
  13. 4 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  14. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java
  15. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  16. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java
  17. 4 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java

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

@@ -597,12 +597,16 @@ public class MaterialInfoController {
                 slogenInfoService.insertSlogans(Check.isNull(materialInfo.getProjectId()) ? materialInfoEntity.getProjectId() : materialInfo.getProjectId(), materialInfoEntity.getCode(), slogans, user.getId());
             }
         }
+
+        //如果状态为1 审核通过,则更新审核时间
+        materialInfo.setConfirmTime(DateUtils.getDate());
         boolean ok = materialInfoService.updateById(materialInfo);
         if (ok) {
             result.success("修改成功!");
         }
 
         Integer status = materialInfo.getStatus();
+
         // 如果状态为2 审核拒绝 给上传人发送消息
         if (status == 2) {
             Product product = productService.getById(materialInfoEntity.getProductId());

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

@@ -13,10 +13,9 @@ import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProgramCreative;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
@@ -25,7 +24,6 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
@@ -35,7 +33,6 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -53,7 +50,6 @@ import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -103,7 +99,7 @@ public class TestController {
     @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
     @Autowired
     private IKuaiShouDailyAgentService dailyAgentService;
@@ -137,13 +133,342 @@ public class TestController {
 
     @Autowired
     private IBatchService batchService;
-    static ExecutorService videoService = Executors.newFixedThreadPool(3);
+    static ExecutorService videoService = Executors.newFixedThreadPool(8);
     @Autowired
     private IMaterialUploadService materialUploadService;
+    @Autowired
+    private IKuaishouProgramCreativeService kuaishouProgramCreativeService;
 
     @Value("${xxl-job.requestUrl}")
     private String jobUrl;
 
+
+    @GetMapping(value = "/getProgramCreative")
+    public void getProgramCreative() {
+        List<Long> list = new ArrayList();
+
+        list.add(10344460L);
+        list.add(10344415L);
+        list.add(10344390L);
+        list.add(10344030L);
+        list.add(10343624L);
+        list.add(10343590L);
+        list.add(10343529L);
+        list.add(10343451L);
+        list.add(10343394L);
+        list.add(10327332L);
+        list.add(10327322L);
+        list.add(10327303L);
+        list.add(10327276L);
+        list.add(10327257L);
+        list.add(10327214L);
+        list.add(10327078L);
+        list.add(10327042L);
+        list.add(10327022L);
+        list.add(10326908L);
+        list.add(10299258L);
+        list.add(10299241L);
+        list.add(10299221L);
+        list.add(10299210L);
+        list.add(10298910L);
+        list.add(10298871L);
+        list.add(10298859L);
+        list.add(10298840L);
+        list.add(10258924L);
+        list.add(10258921L);
+        list.add(10258286L);
+        list.add(10258278L);
+        list.add(10258257L);
+        list.add(10258249L);
+        list.add(10258216L);
+        list.add(10257909L);
+        list.add(10257825L);
+        list.add(10257792L);
+        list.add(10257253L);
+        list.add(10257209L);
+        list.add(10257193L);
+        list.add(10257189L);
+        list.add(10257172L);
+        list.add(10257141L);
+        list.add(10257048L);
+        list.add(10252339L);
+        list.add(10252321L);
+        list.add(10252233L);
+        list.add(10252231L);
+        list.add(10173389L);
+        list.add(10173385L);
+        list.add(10173375L);
+        list.add(10173366L);
+        list.add(10173200L);
+        list.add(10108671L);
+        list.add(10108435L);
+        list.add(10093939L);
+        list.add(10093926L);
+        list.add(10093914L);
+        list.add(10093909L);
+        list.add(10093479L);
+        list.add(9767717L);
+        list.add(9767697L);
+        list.add(9706671L);
+        list.add(9635821L);
+        list.add(9635234L);
+        list.add(9549313L);
+        list.add(9549277L);
+
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            videoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        kuaishouProgramCreativeService.getProgramCreative(oauthToken.getAccountId(), null, oauthToken.getAccessToken(), null, null, 1);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+    }
+
+
+    @GetMapping(value = "/updateProgramCreative")
+    public void updateProgramCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10173366L);
+        list.add(10173375L);
+        list.add(10298910L);
+        list.add(10299210L);
+        list.add(10299221L);
+        list.add(10299241L);
+
+
+
+
+
+
+
+
+
+
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaishouProgramCreative> creativeQueryWrapper = new QueryWrapper<>();
+            creativeQueryWrapper.eq("account_id", accountId);
+            creativeQueryWrapper.lt("creative_create_time", "2021-07-11 00:00:00");
+            List<KuaishouProgramCreative> proList = kuaishouProgramCreativeService.list(creativeQueryWrapper);
+            if (Check.isNull(proList)) {
+                continue;
+            }
+            for (KuaishouProgramCreative programCreative : proList) {
+                Long unitId = programCreative.getUnitId();
+                if (Check.isNull(unitId)) {
+                    continue;
+                }
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            String updateUrl = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/advanced/program/update";
+                            Map<String, String> headers = new HashMap<>();
+                            headers.put("Content-Type", "application/json");
+                            headers.put("Access-Token", token.getAccessToken());
+                            Map<String, Object> param = new HashMap<>();
+                            param.put("advertiser_id", token.getAccountId());
+                            param.put("unit_id", unitId);
+
+                            String replaceUrll = "https://uri6.com/tkio/Yj6773a?imei=__IMEI2__&androidid=__ANDROIDID2__&oaid=__OAID__&mac=__MAC__&ip=__IP__&ry_adcreative_id=__CID__&ry_adplan_id=__DID__&ry_adplan_name=__DNAME__&ry_adgroup_id=__AID__&callback=__CALLBACK__&csite=__CSITE__&accountid=__ACCOUNTID__&ua=__UA__&os=__OS__&noredirect=true";
+                            param.put("click_url", replaceUrll);
+                            String result = HttpUtils.httpPostRequest(updateUrl, param, headers);
+                            JSONObject resultJson = JSONObject.parseObject(result);
+                            Integer code = resultJson.getInteger("code");
+                            if (code == 0) {
+                                log.info("修改成功,accountId:{},unitId:{}", token.getAccountId(), unitId);
+                                QueryWrapper<KuaishouProgramCreative> programCreativeQueryWrapper = new QueryWrapper<>();
+                                programCreativeQueryWrapper.eq("account_id", accountId);
+                                programCreativeQueryWrapper.eq("unit_id", unitId);
+                                kuaishouProgramCreativeService.remove(programCreativeQueryWrapper);
+
+                            } else {
+                                log.info("修改失败,accountId:{},unitId:{},原因:{}", token.getAccountId(), unitId, resultJson.getString("message"));
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+            }
+
+
+        }
+    }
+
+
+    @GetMapping(value = "/campaignList")
+    public void campaignList() {
+        List<Long> list = new ArrayList();
+        list.add(9549277L);
+        list.add(9635234L);
+        list.add(9767697L);
+        list.add(9767717L);
+        list.add(9549313L);
+
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+            videoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        //   kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+                        kuaishouInterfaceService.getGroupList(oauthToken, null, null);
+                        //     kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                        Thread.sleep(1500);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/creativeList")
+    public void creativeList() {
+        List<Long> list = new ArrayList();
+        list.add(10108671L);
+
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+
+
+            suzhaoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                }
+            });
+            try {
+                Thread.sleep(400L);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/updateUnit")
+    public void updateUnit() throws Exception {
+        List<Long> list = new ArrayList();
+        list.add(9556344L);
+        list.add(9743738L);
+
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
+            groupQueryWrapper.eq("account_id", accountId);
+            List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
+            for (KuaiShouGroup group : list1) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("unitId", group.getUnitId());
+                            json.put("cpaBid", 18 * 1000);
+                            //     json.put("gender", "2");
+                            batchService.updateUnit(json, oauthToken);
+                            Thread.sleep(1500);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+
+
+            }
+
+
+        }
+
+
+    }
+
+    @Autowired
+    private IKuaiShouUpdateService kuaiShouUpdateService;
+
+    @GetMapping(value = "/updateCreative")
+    public void updateCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10173366L);
+        list.add(10173375L);
+        list.add(10298910L);
+        list.add(10299210L);
+        list.add(10299221L);
+        list.add(10299241L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
+            creativeQueryWrapper.eq("account_id", accountId);
+            creativeQueryWrapper.eq("status", 52);
+            creativeQueryWrapper.lt("creative_create_time", "2021-07-11 00:00:00");
+            List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
+            if (Check.isNull(creativeList)) {
+                continue;
+            }
+            for (KuaiShouCreative creative : creativeList) {
+                QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
+                groupQueryWrapper.eq("unit_id", creative.getUnitId());
+                groupQueryWrapper.last("limit 1");
+                KuaiShouGroup one = groupService.getOne(groupQueryWrapper);
+                if (Check.isNull(one)) {
+                    continue;
+                }
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("creativeId", creative.getCreativeId());
+                            String url = "https://uri6.com/tkio/Yj6773a?imei=__IMEI2__&androidid=__ANDROIDID2__&oaid=__OAID__&mac=__MAC__&ip=__IP__&ry_adcreative_id=__CID__&ry_adplan_id=__DID__&ry_adplan_name=__DNAME__&ry_adgroup_id=__AID__&callback=__CALLBACK__&csite=__CSITE__&accountid=__ACCOUNTID__&ua=__UA__&os=__OS__&noredirect=true";
+
+                            if (creative.getCreativeMaterialType() == 1) {
+                                json.put("clickTrackUrl", url);
+                            } else if (creative.getCreativeMaterialType() == 4) {
+                                json.put("impressionUrl", url);
+                                json.put("clickTrackUrl", url);
+
+                            }
+                            JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
+                            log.info("修改创意返回信息accountId:{},creative:{},结果:{}", creative.getAccountId(), creative.getCreativeId(), jsonObject);
+                            Thread.sleep(1000L);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+            }
+
+
+        }
+    }
+
+
     @GetMapping("/testSend")
     public void testSend(String userId) {
 
@@ -1262,29 +1587,29 @@ public class TestController {
     }
 
     @GetMapping("checkCostData")
-    public void checkCostData(String date){
-            //1:初始化
-            checkReportTaskInfoService.initTask(date);
-            //2: checkCost
-            List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,date,0);
-            if(null!=taskInfos&&!taskInfos.isEmpty()){
-                for (BytedanceCheckReportTaskInfo task:taskInfos) {
-                    checkReportTaskInfoService.checkCost(task);
-                }
-                log.info("{}:数据获取完成",date);
+    public void checkCostData(String date) {
+        //1:初始化
+        checkReportTaskInfoService.initTask(date);
+        //2: checkCost
+        List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, date, 0);
+        if (null != taskInfos && !taskInfos.isEmpty()) {
+            for (BytedanceCheckReportTaskInfo task : taskInfos) {
+                checkReportTaskInfoService.checkCost(task);
             }
+            log.info("{}:数据获取完成", date);
+        }
     }
 
     @GetMapping("refreshReportData")
-    public void refreshReportData()throws Exception{
+    public void refreshReportData() throws Exception {
         //1:查询异常任务数据
-        List<BytedanceCheckReportTaskInfo>taskInfos = checkReportTaskInfoService.getListByParams(null,null,50001);
-        if(null!=taskInfos&&!taskInfos.isEmpty()){
+        List<BytedanceCheckReportTaskInfo> taskInfos = checkReportTaskInfoService.getListByParams(null, null, 50001);
+        if (null != taskInfos && !taskInfos.isEmpty()) {
             taskInfos.forEach(taskInfo -> {
                 try {
                     checkReportTaskInfoService.reloadData(taskInfo);
                     checkReportTaskInfoService.checkCost(taskInfo);
-                }catch (Exception e) {
+                } catch (Exception e) {
                 }
             });
             log.info("数据更新完成");

+ 104 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/TestService.java

@@ -0,0 +1,104 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class TestService {
+
+
+    public static void main(String[] args) {
+        List<JSONObject> list1 = new ArrayList<>();
+        JSONObject sex = new JSONObject();
+        sex.put("SEX", "男");
+        list1.add(sex);
+        JSONObject sex2 = new JSONObject();
+        sex2.put("SEX", "女");
+        list1.add(sex2);
+
+
+        List<JSONObject> list2 = new ArrayList<>();
+
+        JSONObject age = new JSONObject();
+        age.put("age", "青年");
+        list2.add(age);
+        JSONObject age2 = new JSONObject();
+        age2.put("age", "中年");
+        list2.add(age2);
+
+
+        List<JSONObject> list3 = new ArrayList<>();
+
+        JSONObject area = new JSONObject();
+        JSONArray arr1 = new JSONArray();
+        arr1.add("北京");
+        arr1.add("天津");
+        area.put("area", arr1);
+        list3.add(area);
+
+
+        JSONObject area2 = new JSONObject();
+        JSONArray arr2 = new JSONArray();
+        arr2.add("上海");
+        arr2.add("深圳");
+        area2.put("area", arr2);
+        list3.add(area2);
+
+
+        List<List<JSONObject>> allList = new ArrayList<>();
+        allList.add(list1);
+        allList.add(list2);
+        allList.add(list3);
+
+        calculateCombination(allList);
+    }
+
+
+    public static void calculateCombination(List<List<JSONObject>> inputList) {
+        JSONArray array = new JSONArray();
+        List<Integer> combination = new ArrayList<Integer>();
+        int n = inputList.size();
+        for (int i = 0; i < n; i++) {
+            combination.add(0);
+        }
+        int i = 0;
+        boolean isContinue = false;
+        do {
+            JSONObject dataJson = new JSONObject();
+            //打印一次循环生成的组合
+            for (int j = 0; j < n; j++) {
+                JSONObject jsonObject = inputList.get(j).get(combination.get(j));
+                jsonObject.forEach((key, value) -> {
+                    dataJson.put(key, value);
+                });
+
+            }
+            array.add(dataJson);
+
+            i++;
+            combination.set(n - 1, i);
+            for (int j = n - 1; j >= 0; j--) {
+                if (combination.get(j) >= inputList.get(j).size()) {
+                    combination.set(j, 0);
+                    i = 0;
+                    if (j - 1 >= 0) {
+                        combination.set(j - 1, combination.get(j - 1) + 1);
+                    }
+                }
+            }
+            isContinue = false;
+            for (Integer integer : combination) {
+                if (integer != 0) {
+                    isContinue = true;
+                }
+            }
+        } while (isContinue);
+        System.err.println(array);
+    }
+
+
+}

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

@@ -5,8 +5,8 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 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 cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
@@ -26,6 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -76,19 +77,20 @@ public class SampleTest {
     private IBytedanceReportService bytedanceReportService;
     @Autowired
     private IETLReportBytedanceVideoService etlReportBytedanceVideoService;
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1700996735138951L);
-        advertiserDataService.getMaterialList(tokenByAccountId);
-
-        CtopOauthToken tokenByAccountId1 = tokenService.getTokenByAccountId(1700996735589383L);
-        advertiserDataService.getMaterialList(tokenByAccountId1);
+        CtopOauthToken token = tokenService.getTokenByAccountId(10291211L);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = simpleDateFormat.parse("2021-07-11");
+        Date pars1 = simpleDateFormat.parse("2021-07-12");
+        iKuaishouInterfaceService.getGroupList(token, parse, pars1);
     }
 
 
-
-
     @Test
     public void deleteKuaishouComment() {
         Long start = System.currentTimeMillis();
@@ -123,7 +125,6 @@ public class SampleTest {
     }
 
 
-
     @Test
     public void etlBytedanceVideoInfo() {
         String startDate = "2021-02-01";
@@ -147,7 +148,6 @@ public class SampleTest {
     }
 
 
-
     @Test
     public void formatVideoReportData() {
         for (int i = 1; i < 45; i++) {
@@ -237,11 +237,11 @@ public class SampleTest {
     }
 
     @Test
-    public void loadEffecfData(){
+    public void loadEffecfData() {
         String startDate = "2021-05-01";
-        for(int i=0;i<=70;i++){
-            String getDate = DateUtils.addDay(startDate,i);
-            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(DateUtils.parseDate(getDate,"yyyy-MM-dd"));
+        for (int i = 0; i <= 70; i++) {
+            String getDate = DateUtils.addDay(startDate, i);
+            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(DateUtils.parseDate(getDate, "yyyy-MM-dd"));
         }
     }
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -197,4 +197,6 @@ public class MaterialInfo implements Serializable {
     private Integer slogansCount;
 
     private Integer offlineFlag;
+
+    private Date confirmTime;
 }

+ 8 - 2
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -92,7 +92,8 @@
         matInfo.project_id,
         matInfo.id,
         t.slogansCount,
-        matInfo.offline_flag
+        matInfo.offline_flag,
+        matInfo.confirm_time
         from ctop_material_info matInfo
         left JOIN (
         SELECT
@@ -152,7 +153,12 @@
         <if test="offlineFlag!=null">
             and matInfo.offline_flag = #{offlineFlag}
         </if>
-        order by matInfo.create_time desc
+        <if test="status==1">
+            order by matInfo.confirm_time desc
+        </if>
+        <if test="status!=1">
+            order by matInfo.create_time desc
+        </if>
 
     </select>
     <select id="getListByDate" resultType="cn.com.ctop.common.module.entity.MaterialInfo">

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

@@ -798,6 +798,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 materialInfo.setSlogansCount(info.getSlogansCount());
                 materialInfo.setOfflineFlag(info.getOfflineFlag());
+                materialInfo.setConfirmTime(info.getConfirmTime());
                 //素材名称为空 则使用素材id 同步失败
                 materialInfo.setMaterialName(Check.isNull(materialInfo.getMaterialName()) ? materialInfo.getId() : materialInfo.getMaterialName());
                 //判断是否已经同步到快手平台

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouProgramCreativeMapper.java

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProgramCreative;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 快手-程序化创意
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface KuaishouProgramCreativeMapper extends BaseMapper<KuaishouProgramCreative> {
 
 
+    void replaceBatch(@Param("programCreativeList") List<KuaishouProgramCreative> programCreativeList);
 }

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

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouProgramCreativeMapper">
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_program_creative(
+        id,
+        account_id,
+        unit_id,
+        package_name,
+        horizontal_photo_ids,
+        vertical_photo_ids,
+        cover_image_tokens,
+        cover_image_urls,
+        site_id,
+        sticker_styles,
+        cover_slogans,
+        action_bar,
+        captions,
+        click_url,
+        actionbar_click_url,
+        put_status,
+        view_status,
+        view_status_reason,
+        creative_category,
+        creative_tag,
+        creative_create_time,
+        creative_update_time,
+        create_time,
+        update_time
+        )
+        values
+        <foreach collection="programCreativeList" item="creative" separator=",">
+            (
+            #{creative.id},
+            #{creative.accountId},
+            #{creative.unitId},
+            #{creative.packageName},
+            #{creative.horizontalPhotoIds},
+            #{creative.verticalPhotoIds},
+            #{creative.coverImageTokens},
+            #{creative.coverImageUrls},
+            #{creative.siteId},
+            #{creative.stickerStyles},
+            #{creative.coverSlogans},
+            #{creative.actionBar},
+            #{creative.captions},
+            #{creative.clickUrl},
+            #{creative.actionbarClickUrl},
+            #{creative.putStatus},
+            #{creative.viewStatus},
+            #{creative.viewStatusReason},
+            #{creative.creativeCategory},
+            #{creative.creativeTag},
+            #{creative.creativeCreateTime},
+            #{creative.creativeUpdateTime},
+            #{creative.createTime},
+            #{creative.updateTime})
+        </foreach>
+    </insert>
+
+
+</mapper>

+ 4 - 13
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java

@@ -8,19 +8,8 @@ import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaignDayBudget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaignStatus;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupBid;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupDayBudget;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignDayBudgetMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignStatusMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupBidMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupDayBudgetMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
@@ -69,6 +58,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
     private IKuaishouLandpagePackageService landpagePackageService;
     @Autowired
     private IKuaishouAppPackageService appPackageService;
+
     @Override
     public Map<String, Object> updateCampaign(String token, Long advertiserId, Long campaignId, Long dayBudget, String loginId) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -394,6 +384,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                     } else {
                         groupService.getGroupByUnitId(token, advertiserId, unitId);
                     }
+                    log.info("删除成功,accountId:{}。unitId:{}", advertiserId, unitId);
                 } else {
                     log.error("修改广告组状态失败,advertiserId:{},unitId:{},返回信息:{}", advertiserId, unitId, resultJson);
                     returnMap.put("code", -1);

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

@@ -48,6 +48,8 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
 
     @Autowired
     private IKuaishouLandpagePackageService landpagePackageService;
+    @Autowired
+    private KuaishouProgramCreativeMapper programCreativeMapper;
 
     @Override
     public void getProgramCreative(Long accountId, Long unitId, String accessToken, String startDate, String endDate, Integer page) {
@@ -106,8 +108,8 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
             }
         }
 
-        this.saveOrUpdateBatch(programCreativeList);
-        //    getProgramCreative(accountId, unitId, accessToken, startDate, endDate, page + 1);
+        programCreativeMapper.replaceBatch(programCreativeList);
+        getProgramCreative(accountId, unitId, accessToken, startDate, endDate, page + 1);
 
 
     }
@@ -197,7 +199,7 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
                 if (code == 0) {
                     returnJson.put("isTrueOrFalse", true);
                     returnJson.put("message", "创建成功");
-                    createLandPageAndUnit(pramsJson,jsonObject.getJSONObject("data"));
+                    createLandPageAndUnit(pramsJson, jsonObject.getJSONObject("data"));
                 } else {
                     log.error("创建失败:入参:{}", pramsJson);
                     returnJson.put("isTrueOrFalse", false);

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

@@ -58,15 +58,7 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
 
     @Override
     public void kuaiShouWarningOperation(Long projectId, String projectName, Long advertiserId, Long unitId, String unit_name) {
-
         String userId = userAllocationMapper.queryUserIdByAccountId(advertiserId);
-        try {
-            String text = messageTemplate.getKuaiShouBidTypeMessage(projectName, advertiserId, unitId, unit_name);
-
-            sendMessageService.sendMessage(userId, text);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
         CtopOauthToken token = oauthTokenService.getTokenByAccountId(advertiserId);
         updateService.updateUnitStatus(token.getAccessToken(), advertiserId, unitId, 2, "admin");
         WarningOperationLog warningOperationLog = new WarningOperationLog();
@@ -76,6 +68,14 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
         warningOperationLog.setUserId(userId);
         warningOperationLog.setWarningType(1);
         warningOperationLogService.save(warningOperationLog);
+        log.info("暂停组成功,accountId:{},unitId:{}", advertiserId, unitId);
+        try {
+            String text = messageTemplate.getKuaiShouBidTypeMessage(projectName, advertiserId, unitId, unit_name);
+
+            sendMessageService.sendMessage(userId, text);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
 
     }

+ 4 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -48,6 +48,7 @@ public class BytedanceVideoReportCtrl {
             String clip = requestBody.getString("clip");
             String shot = requestBody.getString("shot");
             String plan = requestBody.getString("plan");
+            String leader = requestBody.getString("leader");
             String target = requestBody.getString("target");
             String order = requestBody.getString("order");
             int pageSize = requestBody.getInteger("pageSize");
@@ -57,7 +58,7 @@ public class BytedanceVideoReportCtrl {
                 if (accountIds.isEmpty()) {
                     accountIds = null;
                 }
-                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot, plan, pageSize, pageNo);
+                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order, clip, shot, plan, leader, pageSize, pageNo);
                 result.setResult(listData);
                 result.setSuccess(true);
             } catch (Exception e) {
@@ -145,11 +146,12 @@ public class BytedanceVideoReportCtrl {
         String clip = requestBody.getString("clip");
         String shot = requestBody.getString("shot");
         String plan = requestBody.getString("plan");
+        String leader = requestBody.getString("leader");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         List<JSONObject> excelData = null;
         if ("exportTable".equals(exportType)) {
-            excelData = bytedanceVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan);
+            excelData = bytedanceVideoReportService.exportExcelReportBy(accountIds, startDate, endDate, filed, target, order, clip, shot, plan, leader);
         } else if ("exportDetail".equals(exportType)) {
             excelData = bytedanceVideoReportService.getVideoDetailBy(accountIds, startDate, endDate, filed, signature);
         }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java

@@ -8,7 +8,7 @@ import java.util.List;
 
 public interface BytedanceVideoReportMapper {
 
-    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("target") String target,@Param("order") String order,@Param("clip") String clip,@Param("shot") String shot,@Param("plan") String plan);
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("target") String target,@Param("order") String order,@Param("clip") String clip,@Param("shot") String shot,@Param("plan") String plan,@Param("leader") String leader);
 
     List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("signature") String signature);
 }

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -12,6 +12,7 @@
         t1.clip_name AS clip,
         t1.shot_name AS shot,
         t1.plan_name AS plan,
+        t1.team_leader as leader,
         t1.material_name AS materialName,
         t1.project_name AS projectName,
         t1.material_create_time AS createTime,
@@ -31,6 +32,7 @@
         AND (t1.clip_name LIKE '%${clip}%')
         AND (t1.shot_name LIKE '%${shot}%')
         AND (t1.plan_name LIKE '%${plan}%')
+        AND (t1.team_leader LIKE '%${leader}%')
         GROUP BY t1.md5
         ORDER BY ${target} ${order}
     </select>

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java

@@ -9,11 +9,11 @@ import java.util.List;
 
 public interface IBytedanceVideoReportService {
 
-    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo);
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, String leader, int pageSize, int pageNo);
 
     List<JSONObject> getVideoDetailBy(JSONArray accountIds, String startDate, String endDate, String filed, String signature);
 
-    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan);
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, String leader);
 
     void pullVideoReport(CtopOauthToken oauthToken,String startDate, String endDate,int page);
 }

+ 4 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java

@@ -32,9 +32,9 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
     IBaseReportBytedanceVideoDailyService baseReportBytedanceVideoDailyService;
 
     @Override
-    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, int pageSize, int pageNo) {
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan,String leader, int pageSize, int pageNo) {
         PageHelper.startPage(pageNo,pageSize);
-        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
+        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan,leader);
         return new PageInfo<>(jsonObjectList);
     }
 
@@ -44,8 +44,8 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
     }
 
     @Override
-    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan) {
-        return bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan);
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, String clip, String shot, String plan, String leader) {
+        return bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order,clip,shot,plan,leader);
     }
 
     @Override