Quellcode durchsuchen

Merge remote-tracking branch 'origin/V1.1.3' into V1.1.3

jiequan.bi vor 4 Jahren
Ursprung
Commit
f4725748f7
24 geänderte Dateien mit 1409 neuen und 61 gelöschten Zeilen
  1. 25 31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  2. 18 3
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  3. 16 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  4. 278 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaiShouAppInfoController.java
  5. 7 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java
  6. 120 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaiShouAppInfo.java
  7. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaiShouAppInfoMapper.java
  8. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaiShouAppInfoMapper.xml
  9. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaiShouAppInfoService.java
  10. 151 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java
  11. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java
  12. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java
  13. 11 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouTemplateController.java
  14. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  15. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java
  16. 1 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java
  17. 330 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java
  18. 112 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouGroupExplore.java
  19. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java
  20. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouGroupExploreMapper.java
  21. 14 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouDailyAgentMapper.xml
  22. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouGroupExploreMapper.xml
  23. 23 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java
  24. 221 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

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

@@ -70,8 +70,6 @@ public class TestController {
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
     @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
-    @Autowired
     private IKuaiShouHistoryReportTaskService historyReportTaskService;
     @Autowired
     private IMaterialInfoService materialInfoService;
@@ -84,8 +82,6 @@ public class TestController {
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
-    private IBytedanceReportService bytedanceReportService;
-    @Autowired
     private IKuaishouInterfaceService2 kuaishouInterfaceService2;
     @Autowired
     private IUserAllocationService userAllocationService;
@@ -229,15 +225,13 @@ public class TestController {
 
     @GetMapping("/getBytedanceMatReport")
     public Map<String,Object>getData(){
-        List<BytedanceAccountReportTaskRecord>  records = reportTaskRecordService.listByParams(100,"ACCOUNT_DAILY");
-        executorService = Executors.newFixedThreadPool(1);
-        CountDownLatch countDownLatch = new CountDownLatch(records.size());
-        records.forEach(record -> executorService.submit(() -> {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        executorService = Executors.newFixedThreadPool(10);
+        CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(record -> executorService.submit(() -> {
             try {
-//                reportService.getAdvertiserReport(record, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//                log.info("账户数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
-                bytedanceReportService.bytedanceMaterialReportV2(record);
-                log.info("素材数据获取完成:account:{},时间:{}-{}",record.getAccountId(),record.getStartDate(),record.getEndDate());
+                reportService.getAdvertiserReport(record, DateUtils.parseDate("2021-01-01","yyyy-MM-dd"), DateUtils.parseDate("2021-01-31","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                log.info("账户数据获取完成:account:{},时间:{}-{}",record.getAccountId(),"2021-01-01","2020-01-31");
             } catch (Exception e) {
 
             } finally {
@@ -250,11 +244,11 @@ public class TestController {
             e.printStackTrace();
         }
         System.out.println("数据获取完成");
-        bytedanceReportMaterialDailyMapper.updateImageReportCode();
-        bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
-        bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
-        bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
-        bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
+//        bytedanceReportMaterialDailyMapper.updateImageReportCode();
+//        bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
+//        bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
+//        bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
+//        bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
         Map<String,Object> result =  new HashMap<>();
         ResultMapUtils.setResultMap(new HashMap<>(),StatusCode.COMMON_SUCCESS);
         return result;
@@ -316,7 +310,7 @@ public class TestController {
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     tokenQueryWrapper.eq("account_id", accountId);
-                    CtopOauthToken token = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken token = tokenMapper.selectOne(tokenQueryWrapper);
                     if (!Check.isNull(token)) {
                         suzhaoService.submit(new Runnable() {
                             @Override
@@ -526,7 +520,7 @@ public class TestController {
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     tokenQueryWrapper.eq("account_id", accountId);
-                    CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
                     if (!Check.isNull(ctopOauthTokens)) {
                         historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
 
@@ -559,7 +553,7 @@ public class TestController {
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
                     tokenQueryWrapper.eq("media_id", 2);
                     tokenQueryWrapper.eq("account_id", accountId);
-                    CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
                     if (!Check.isNull(ctopOauthTokens)) {
                         historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
@@ -586,7 +580,7 @@ public class TestController {
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("account_id", accountId);
-            CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
+            CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), statDate, statDate, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY);
 
@@ -847,7 +841,7 @@ public class TestController {
         oauthTokenQueryWrapper.eq("media_id", 2);
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
-        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+        CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date date1 = sim.parse(startDate);
         Date date2 = sim.parse(endDate);
@@ -865,7 +859,7 @@ public class TestController {
             Date date2 = sim.parse(endDate);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
-            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
+            List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
                     kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2);
@@ -943,7 +937,7 @@ public class TestController {
             oauthTokenQueryWrapper.eq("media_id", 2);
             oauthTokenQueryWrapper.eq("account_id", accountId);
             oauthTokenQueryWrapper.last("limit 1");
-            CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+            CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
             String endDateStr = DateUtils.getDate("yyyy-MM-dd");
             String startDate = DateUtils.addMonth(endDateStr, -6);
             historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
@@ -964,7 +958,7 @@ public class TestController {
             String startDate = DateUtils.addMonth(endDateStr, -6);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
-            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
+            List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
                     historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
@@ -988,7 +982,7 @@ public class TestController {
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             tokenQueryWrapper.eq("account_id", accountId);
-            CtopOauthToken ctopOauthTokens = oauthTokenMapper.selectOne(tokenQueryWrapper);
+            CtopOauthToken ctopOauthTokens = tokenMapper.selectOne(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 historyReportTaskService.createTask(ctopOauthTokens.getAccountId(), ctopOauthTokens.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
 
@@ -1052,7 +1046,7 @@ public class TestController {
     public void gerCreative() {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
         oauthTokenQueryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+        List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
         for (CtopOauthToken token : ctopOauthTokens) {
             executorService.submit(new Runnable() {
                 @Override
@@ -1125,7 +1119,7 @@ public class TestController {
         oauthTokenQueryWrapper.eq("media_id", 2);
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
-        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+        CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
         try {
             // kuaishouInterfaceService.getCampaignList(token, null, null);
             //1:获取全量广告组数据
@@ -1178,7 +1172,7 @@ public class TestController {
         oauthTokenQueryWrapper.eq("media_id", 2);
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
-        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+        CtopOauthToken token = tokenMapper.selectOne(oauthTokenQueryWrapper);
         executorService.submit(new Runnable() {
             @Override
             public void run() {
@@ -1212,7 +1206,7 @@ public class TestController {
 
             QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
             oauthTokenQueryWrapper.eq("media_id", 2);
-            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+            List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
 
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
@@ -1242,7 +1236,7 @@ public class TestController {
 
             QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
             oauthTokenQueryWrapper.eq("media_id", 2);
-            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+            List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(oauthTokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
                     executorService.submit(new Runnable() {

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

@@ -536,9 +536,24 @@ public class SampleTest {
 //                aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,50);
 //            }
 //        }
-
-        AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120001);
-        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 1);
+        /**
+         * 120002
+         * 150001
+         * 150002
+         * 150003
+         * 150004
+         */
+
+        AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120002);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
+        accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150001);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
+        accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150002);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
+        accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150003);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
+        accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150004);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
     }
 
     @Autowired

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -322,5 +322,21 @@ public class KuaishouInterfaceConstant {
      * 频库-视频关联创意数查询
      */
     public static final String VIDEO_RELATE_CREATIVES = "/rest/openapi/v1/file/ad/video/relate/creatives";
+/**
+     * 查询加速探索信息接口
+     */
+    public static final String UNIT_EXPLORE_INFO_GET = "/rest/openapi/v1/ad_unit/explore/info/get";
+/**
+     * 广告组的加速探索预算设置
+     */
+    public static final String UNIT_EXPLORE_BUDGET_UPDATE = "/rest/openapi/v1/ad_unit/explore/budget/update";
+/**
+     * 暂停广告组的加速探索预算
+     */
+    public static final String UNIT_EXPLORE_STATUS_PAUSE = "/rest/openapi/v1/ad_unit/explore/status/pause";
+/**
+     * 查询广告组的加速探索报表接口
+     */
+    public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
 
 }

+ 278 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaiShouAppInfoController.java

@@ -0,0 +1,278 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Slf4j
+@Api(tags = "ai批量上传应用")
+@RestController
+@RequestMapping("/ai/aiKuaiShouAppInfo")
+public class AiKuaiShouAppInfoController {
+    @Autowired
+    private IAiKuaiShouAppInfoService aiKuaiShouAppInfoService;
+
+
+    @PostMapping(value = "/importAppExcel")
+    public Result<?> importExcel(@RequestParam("file") MultipartFile file,
+                                 @RequestParam("accountId") Long accountId,
+                                 @RequestParam("imageToken") String imageToken) {
+
+
+        FileInputStream fis = null;
+        try {
+
+            JSONObject json = aiKuaiShouAppInfoService.importExcel(file, accountId, imageToken);
+            //          System.out.println("导入是否成功:" + flag);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        return Result.ok("文件导入成功!");
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param aiKuaiShouAppInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-分页列表查询")
+    @ApiOperation(value = "ai批量上传应用-分页列表查询", notes = "ai批量上传应用-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AiKuaiShouAppInfo>> queryPageList(AiKuaiShouAppInfo aiKuaiShouAppInfo,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        Result<IPage<AiKuaiShouAppInfo>> result = new Result<>();
+        QueryWrapper<AiKuaiShouAppInfo> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaiShouAppInfo, req.getParameterMap());
+        Page<AiKuaiShouAppInfo> page = new Page<AiKuaiShouAppInfo>(pageNo, pageSize);
+        IPage<AiKuaiShouAppInfo> pageList = aiKuaiShouAppInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param aiKuaiShouAppInfo
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-添加")
+    @ApiOperation(value = "ai批量上传应用-添加", notes = "ai批量上传应用-添加")
+    @PostMapping(value = "/add")
+    public Result<AiKuaiShouAppInfo> add(@RequestBody AiKuaiShouAppInfo aiKuaiShouAppInfo) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        try {
+            aiKuaiShouAppInfoService.save(aiKuaiShouAppInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param aiKuaiShouAppInfo
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-编辑")
+    @ApiOperation(value = "ai批量上传应用-编辑", notes = "ai批量上传应用-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AiKuaiShouAppInfo> edit(@RequestBody AiKuaiShouAppInfo aiKuaiShouAppInfo) {
+        Result<AiKuaiShouAppInfo> result = new Result<AiKuaiShouAppInfo>();
+        AiKuaiShouAppInfo aiKuaiShouAppInfoEntity = aiKuaiShouAppInfoService.getById(aiKuaiShouAppInfo.getId());
+        if (aiKuaiShouAppInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = aiKuaiShouAppInfoService.updateById(aiKuaiShouAppInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-通过id删除")
+    @ApiOperation(value = "ai批量上传应用-通过id删除", notes = "ai批量上传应用-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            aiKuaiShouAppInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-批量删除")
+    @ApiOperation(value = "ai批量上传应用-批量删除", notes = "ai批量上传应用-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<AiKuaiShouAppInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiKuaiShouAppInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-通过id查询")
+    @ApiOperation(value = "ai批量上传应用-通过id查询", notes = "ai批量上传应用-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AiKuaiShouAppInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        AiKuaiShouAppInfo aiKuaiShouAppInfo = aiKuaiShouAppInfoService.getById(id);
+        if (aiKuaiShouAppInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(aiKuaiShouAppInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiKuaiShouAppInfo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiKuaiShouAppInfo aiKuaiShouAppInfo = JSON.parseObject(deString, AiKuaiShouAppInfo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiKuaiShouAppInfo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiKuaiShouAppInfo> pageList = aiKuaiShouAppInfoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "ai批量上传应用列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiKuaiShouAppInfo.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("ai批量上传应用列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<AiKuaiShouAppInfo> listAiKuaiShouAppInfos = ExcelImportUtil.importExcel(file.getInputStream(), AiKuaiShouAppInfo.class, params);
+                aiKuaiShouAppInfoService.saveBatch(listAiKuaiShouAppInfos);
+                return Result.ok("文件导入成功!数据行数:" + listAiKuaiShouAppInfos.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 7 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java

@@ -42,7 +42,7 @@ public class KuaiShouCreativeRefusalController {
     private IKuaiShouImageGetService imageGetService;
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(100);
+    static ExecutorService executorService = Executors.newFixedThreadPool(80);
 
     /**
      * 吃创意拒审重提
@@ -51,7 +51,7 @@ public class KuaiShouCreativeRefusalController {
      * @return
      */
     @PostMapping(value = "again")
-    public JSONObject campaignCreate(@RequestBody JSONObject requestJson) {
+    public JSONObject again(@RequestBody JSONObject requestJson) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson)) {
@@ -90,7 +90,6 @@ public class KuaiShouCreativeRefusalController {
                                     String imageToken = getImageToken(signature, accountId, oauthToken.getAccessToken(), url);
                                     if (!Check.isNull(imageToken)) {
                                         updateJson.put("imageToken", imageToken);
-
                                     }
                                 }
                             } else if (updateType == 1) { // 修改广告语
@@ -104,6 +103,11 @@ public class KuaiShouCreativeRefusalController {
                             } else {
                                 log.info("自动投放拒审重提失败,accountId:{},creativeId:{}", accountId, creativeId);
                             }
+                            try {
+                                Thread.sleep(1000L);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 });

+ 120 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaiShouAppInfo.java

@@ -0,0 +1,120 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Data
+@TableName("ctop_ai_kuaishou_app_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_app_info对象", description = "ai批量上传应用")
+public class AiKuaiShouAppInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 应用标记
+     */
+    @Excel(name = "应用标记", width = 15)
+    @ApiModelProperty(value = "应用标记")
+    private String appVersion;
+    /**
+     * 应用名称
+     */
+    @Excel(name = "应用名称", width = 15)
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+    /**
+     * 应用包名
+     */
+    @Excel(name = "应用包名	", width = 15)
+    @ApiModelProperty(value = "应用包名	")
+    private String packageName;
+    /**
+     * 应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏
+     */
+    @Excel(name = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏", width = 15)
+    @ApiModelProperty(value = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏")
+    private Integer platform;
+    /**
+     * 应用下载地址/网页游戏链接地址
+     */
+    @Excel(name = "应用下载地址/网页游戏链接地址	", width = 15)
+    @ApiModelProperty(value = "应用下载地址/网页游戏链接地址	")
+    private String url;
+    /**
+     * 是否接入快手广告监测SDK	 0:未接入,1:已接入
+     */
+    @Excel(name = "是否接入快手广告监测SDK	 0:未接入,1:已接入", width = 15)
+    @ApiModelProperty(value = "是否接入快手广告监测SDK	 0:未接入,1:已接入")
+    private Integer useSdk;
+    /**
+     * app隐私政策链接 安卓类应用必填
+     */
+    @Excel(name = "app隐私政策链接 安卓类应用必填", width = 15)
+    @ApiModelProperty(value = "app隐私政策链接 安卓类应用必填")
+    private String appPrivacyUrl;
+    private String trackUrl;
+    /**
+     * app文件MD5
+     */
+    @Excel(name = "app文件MD5", width = 15)
+    @ApiModelProperty(value = "app文件MD5")
+    private String appMd5;
+    /**
+     * 状态
+     */
+    @Excel(name = "状态", width = 15)
+    @ApiModelProperty(value = "状态")
+    private Integer status;
+    /**
+     * app_id
+     */
+    @Excel(name = "app_id", width = 15)
+    @ApiModelProperty(value = "app_id")
+    private Long appId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaiShouAppInfoMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * ai批量上传应用
+ *
+ * @author: jeecg-boot
+ * @date: 2021-02-02
+ * @cersion: V1.0
+ */
+public interface AiKuaiShouAppInfoMapper extends BaseMapper<AiKuaiShouAppInfo> {
+
+}

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaiShouAppInfoMapper.xml

@@ -0,0 +1,5 @@
+<?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.ai.mapper.AiKuaiShouAppInfoMapper">
+
+</mapper>

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaiShouAppInfoService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * @Description: ai批量上传应用
+ * @Author: jeecg-boot
+ * @Date: 2021-02-02
+ * @Version: V1.0
+ */
+public interface IAiKuaiShouAppInfoService extends IService<AiKuaiShouAppInfo> {
+
+    JSONObject importExcel(MultipartFile file, Long accountId, String imageToken);
+}

+ 151 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java

@@ -0,0 +1,151 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaiShouAppInfoMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Service
+public class AiKuaiShouAppInfoServiceImpl extends ServiceImpl<AiKuaiShouAppInfoMapper, AiKuaiShouAppInfo> implements IAiKuaiShouAppInfoService {
+
+    /**
+     * 文件导入
+     *
+     * @param
+     * @param accountId
+     * @param imageToken
+     * @return
+     */
+    @Override
+    public JSONObject importExcel(MultipartFile myFile, Long accountId, String imageToken) {
+        try {
+            Workbook workbook = null;
+            String fileName = myFile.getOriginalFilename();
+            if (fileName.endsWith("XLS")) {
+                //2003
+                workbook = new HSSFWorkbook(myFile.getInputStream());
+            } else if (fileName.endsWith("XLSX")) {
+                //2007
+                workbook = new XSSFWorkbook(myFile.getInputStream());
+            } else {
+                //   throw new Exception("文件不是Excel文件");
+            }
+
+            Sheet sheet = workbook.getSheet("Sheet1");
+            int rows = sheet.getLastRowNum();// 指的行数,一共有多少行+
+            if (rows == 0) {
+                // throw new Exception("请填写数据");
+            }
+            for (int i = 1; i <= rows + 1; i++) {
+                // 读取左上端单元格
+                Row row = sheet.getRow(i);
+                // 行不为空
+                if (row != null) {
+                    // **读取cell**
+                    AiKuaiShouAppInfo appInfo = new AiKuaiShouAppInfo();
+
+                    String appName = getCellValue(row.getCell(0));
+                    appInfo.setAppName(appName);
+
+                    String packageName = getCellValue(row.getCell(1));
+                    appInfo.setPackageName(packageName);
+
+                    String appVersion = getCellValue(row.getCell(2));
+                    appInfo.setAppVersion(appVersion);
+
+                    String useSdk = getCellValue(row.getCell(3));
+                    if (!Check.isNull(useSdk)) {
+                        appInfo.setUseSdk(Integer.valueOf(useSdk));
+                    }
+                    String appPrivacyUrl = getCellValue(row.getCell(4));
+                    if (!Check.isNull(appPrivacyUrl)) {
+                        appInfo.setAppPrivacyUrl(appPrivacyUrl);
+                    }
+
+                    String trackUrl = getCellValue(row.getCell(5));
+                    if (!Check.isNull(trackUrl)) {
+                        appInfo.setTrackUrl(trackUrl);
+                    }
+                    //考试时间
+                  /*  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
+                    String dateString = getCellValue(row.getCell(3));
+                    if (!StringUtils.isEmpty(dateString)) {
+                        Date date = sdf.parse(dateString);
+                        student.setTime(date);
+                    }
+                    studentMapper.insert(student);*/
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+        return null;
+    }
+
+
+    private String getCellValue(Cell cell) {
+        String value = "";
+        if (cell != null) {
+            // 以下是判断数据的类型
+            switch (cell.getCellType()) {
+                case HSSFCell.CELL_TYPE_NUMERIC: // 数字
+                    value = cell.getNumericCellValue() + "";
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        if (date != null) {
+                            value = new SimpleDateFormat("yyyy-MM-dd").format(date);
+                        } else {
+                            value = "";
+                        }
+                    } else {
+                        value = new DecimalFormat("0").format(cell.getNumericCellValue());
+                    }
+                    break;
+                case HSSFCell.CELL_TYPE_STRING: // 字符串
+                    value = cell.getStringCellValue();
+                    break;
+                case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
+                    value = cell.getBooleanCellValue() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_FORMULA: // 公式
+                    value = cell.getCellFormula() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_BLANK: // 空值
+                    value = "";
+                    break;
+                case HSSFCell.CELL_TYPE_ERROR: // 故障
+                    value = "非法字符";
+                    break;
+                default:
+                    value = "未知类型";
+                    break;
+            }
+        }
+        return value.trim();
+    }
+}

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

@@ -125,7 +125,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
         String unitNamePrefix = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
         int unitCnt = 0;
         for(KuaiShouVideoGet videoItem: newVideos){
-            KuaishouAccountCreativeOverrunInfo overrunInfo  =  overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
+            KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
             if(null!=overrunInfo){
                 return;
             }

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java

@@ -165,6 +165,16 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                 if (!Check.isNull(groupCreateJson.getLong("fiction_id"))) {
                     createJson.put("fiction_id", groupCreateJson.getLong("fiction_id")); //小说ID
                 }
+
+                if (unit_type == 7) {
+                    if (!Check.isNull(groupCreateJson.getBoolean("smart_cover"))) {
+                        createJson.put("smart_cover", groupCreateJson.getBoolean("smart_cover")); //是否开启智能抽帧
+                    }
+                    if (!Check.isNull(groupCreateJson.getBoolean("asset_mining"))) {
+                        createJson.put("asset_mining", groupCreateJson.getBoolean("asset_mining")); //程序化创意2.0素材挖掘
+                    }
+                }
+
                 if (!Check.isNull(groupCreateJson.getLong("template_id"))) {
                     createJson.put("template_id", groupCreateJson.getLong("template_id")); //定向模板id
                 } else {
@@ -365,6 +375,8 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     }
                 }
                 programJson.put("cover_image_tokens", cover_image_tokens);
+            } else {
+                programJson.put("cover_image_tokens", new JSONArray());
             }
             if (!Check.isNull(programCreativeJson.getLong("site_id"))) {
                 programJson.put("site_id", programCreativeJson.getLong("site_id"));
@@ -399,6 +411,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_CREATE;
             String result = HttpUtils.kuaiShouhttpPostRequest(url, programJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            log.info("创建程序化创意返回结果:{}", resultJson);
             JSONObject returnJson = new JSONObject();
             returnJson.put("creative_uuid", creative_uuid);
             returnJson.put("unit_id", unit_id);

+ 11 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouTemplateController.java

@@ -157,8 +157,17 @@ public class KuaishouTemplateController {
                 throw new Exception("未获取到账户信息");
             }
             JSONObject returnJson = kuaishouTemplateService.updateTemplate(accountId, oauthToken.getAccessToken(), requestJson);
-            result.setSuccess(true);
-            result.setResult(returnJson);
+            Integer code = returnJson.getInteger("code");
+            if (code == 0) {
+                result.setSuccess(true);
+                result.setMessage("修改成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage(returnJson.getString("message"));
+            }
+
+
+            // result.setResult(returnJson);
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);

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

@@ -1022,9 +1022,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNull(dataJson)) {
                         Long unitId = dataJson.getLong("unit_id");
-                        Thread.sleep(100);Thread thread = new Thread(){
+                        Thread.sleep(100);
+                        Thread thread = new Thread() {
                             @Override
-                            public void run(){
+                            public void run() {
                                 getKuaiShouGroupService.getGroupByUnitId(accessToken, advertiserId, unitId);
                             }
                         };

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

@@ -342,6 +342,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
      */
     @Override
     public JSONObject updateTemplate(Long accountId, String accessToken, JSONObject requestJson) {
+        System.err.println(requestJson);
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson.getString("templateName"))) {
@@ -458,6 +459,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", " application/json");
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.TEMPLATE_UPDATE;
+            System.err.println("入参:" + param);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -470,8 +472,9 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
                         returnJson.put("templateId", data.getLong("template_id"));
                     }
                 } else {
+                    log.error("修改失败:{}", resultJson);
                     returnJson.put("code", -1);
-                    returnJson.put("message", returnJson.getString("message"));
+                    returnJson.put("message", resultJson.getString("message"));
                 }
             } else {
                 returnJson.put("code", -1);

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

@@ -76,7 +76,6 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
             params.put("advertiser_id", accountId);
             params.put("photo_ids", photoIds);
             params.put("share_advertiser_ids", shareAdvertiserIds);
-            System.out.println(params);
             String result = HttpUtils.httpPostRequest(url, params, header);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -158,7 +157,7 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
         if(null == matNum||matNum == 0){
             matNum = 10;
         }
-        queryWrapper.eq("creative_count",0);
+        queryWrapper.le("creative_count",30);
         queryWrapper.orderByDesc("stat_date");
         queryWrapper.last("limit "+matNum);
         return this.list(queryWrapper);

+ 330 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java

@@ -0,0 +1,330 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 广告组的加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Slf4j
+@Api(tags = "广告组的加速探索报表")
+@RestController
+@RequestMapping("/explore")
+public class KuaishouGroupExploreController {
+    @Autowired
+    private IKuaishouGroupExploreService kuaishouGroupExploreService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouGroupExplore
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-分页列表查询")
+    @ApiOperation(value = "广告组的加速探索报表-分页列表查询", notes = "广告组的加速探索报表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouGroupExplore>> queryPageList(KuaishouGroupExplore kuaishouGroupExplore,
+                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                             HttpServletRequest req) {
+        Result<IPage<KuaishouGroupExplore>> result = new Result<>();
+        QueryWrapper<KuaishouGroupExplore> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouGroupExplore, req.getParameterMap());
+        Page<KuaishouGroupExplore> page = new Page<KuaishouGroupExplore>(pageNo, pageSize);
+        IPage<KuaishouGroupExplore> pageList = kuaishouGroupExploreService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 查询加速探索信息接口
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "查询加速探索信息接口")
+    @ApiOperation(value = "查询加速探索信息接口", notes = "查询加速探索信息接口")
+    @PostMapping(value = "/unitExploreInfoGet")
+    public Result<Object> unitExploreInfoGet(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.unitExploreInfoGet(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
+    /**
+     * 广告组的加速探索预算设置接口
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索预算设置接口")
+    @ApiOperation(value = "广告组的加速探索预算设置接口", notes = "广告组的加速探索预算设置接口")
+    @PostMapping(value = "/unitExploreBudgetUpdate")
+    public Result<Object> unitExploreBudgetUpdate(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.unitExploreBudgetUpdate(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
+    /**
+     * 暂停广告组的加速探索预算接口
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "暂停广告组的加速探索预算接口")
+    @ApiOperation(value = "暂停广告组的加速探索预算接口", notes = "暂停广告组的加速探索预算接口")
+    @PostMapping(value = "/unitExploreStatusPause")
+    public Result<Object> unitExploreStatusPause(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.unitExploreStatusPause(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
+    /**
+     * 查询广告组的加速探索报表接口
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "查询广告组的加速探索报表接口")
+    @ApiOperation(value = "查询广告组的加速探索报表接口", notes = "查询广告组的加速探索报表接口")
+    @PostMapping(value = "/querySpeedExploreReport")
+    public Result<Object> querySpeedExploreReport(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.querySpeedExploreReport(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-添加")
+    @ApiOperation(value = "广告组的加速探索报表-添加", notes = "广告组的加速探索报表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouGroupExplore> add(@RequestBody KuaishouGroupExplore kuaishouGroupExplore) {
+        Result<KuaishouGroupExplore> result = new Result<>();
+        try {
+            kuaishouGroupExploreService.save(kuaishouGroupExplore);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouGroupExplore
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-编辑")
+    @ApiOperation(value = "广告组的加速探索报表-编辑", notes = "广告组的加速探索报表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouGroupExplore> edit(@RequestBody KuaishouGroupExplore kuaishouGroupExplore) {
+        Result<KuaishouGroupExplore> result = new Result<KuaishouGroupExplore>();
+        KuaishouGroupExplore kuaishouGroupExploreEntity = kuaishouGroupExploreService.getById(kuaishouGroupExplore.getId());
+        if (kuaishouGroupExploreEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouGroupExploreService.updateById(kuaishouGroupExplore);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-通过id删除")
+    @ApiOperation(value = "广告组的加速探索报表-通过id删除", notes = "广告组的加速探索报表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaishouGroupExploreService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-批量删除")
+    @ApiOperation(value = "广告组的加速探索报表-批量删除", notes = "广告组的加速探索报表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaishouGroupExplore> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouGroupExplore> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouGroupExploreService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "广告组的加速探索报表-通过id查询")
+    @ApiOperation(value = "广告组的加速探索报表-通过id查询", notes = "广告组的加速探索报表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouGroupExplore> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouGroupExplore> result = new Result<>();
+        KuaishouGroupExplore kuaishouGroupExplore = kuaishouGroupExploreService.getById(id);
+        if (kuaishouGroupExplore == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouGroupExplore);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouGroupExplore> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouGroupExplore kuaishouGroupExplore = JSON.parseObject(deString, KuaishouGroupExplore.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouGroupExplore, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouGroupExplore> pageList = kuaishouGroupExploreService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "广告组的加速探索报表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouGroupExplore.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告组的加速探索报表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<KuaishouGroupExplore> listKuaishouGroupExplores = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouGroupExplore.class, params);
+                kuaishouGroupExploreService.saveBatch(listKuaishouGroupExplores);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouGroupExplores.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 112 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouGroupExplore.java

@@ -0,0 +1,112 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 广告组的加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Data
+@TableName("ctop_kuaishou_group_explore")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_group_explore对象", description = "广告组的加速探索报表")
+public class KuaishouGroupExplore {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private Long unitId;
+    /**
+     * 探索预算,单位:里
+     */
+    @Excel(name = "探索预算,单位:里", width = 15)
+    @ApiModelProperty(value = "探索预算,单位:里")
+    private Long exploreBudget;
+    /**
+     * 优化目标
+     */
+    @Excel(name = "优化目标", width = 15)
+    @ApiModelProperty(value = "优化目标")
+    private Integer ocpxActionType;
+    /**
+     * 总消耗
+     */
+    @Excel(name = "总消耗", width = 15)
+    @ApiModelProperty(value = "总消耗")
+    private Long totalCharge;
+    /**
+     * 封面曝光数
+     */
+    @Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+    private Long impression;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long click;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 转化数
+     */
+    @Excel(name = "转化数", width = 15)
+    @ApiModelProperty(value = "转化数")
+    private Long unifiedConversion;
+    /**
+     * 转化成本
+     */
+    @Excel(name = "转化成本", width = 15)
+    @ApiModelProperty(value = "转化成本")
+    private java.math.BigDecimal unitfiedConversionCost;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java

@@ -41,13 +41,13 @@ public class KuaishouReportDailyAgent {
     @Excel(name = "账户ID", width = 15)
     @ApiModelProperty(value = "账户ID")
     @TableId(type = IdType.INPUT)
-    private java.lang.Integer accountId;
+    private java.lang.Long accountId;
     /**
      * 快手ID
      */
     @Excel(name = "快手ID", width = 15)
     @ApiModelProperty(value = "快手ID")
-    private java.lang.Integer kid;
+    private java.lang.Long kid;
     /**
      * 广告主名称
      */

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouGroupExploreMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 广告组的加速探索报表
+ * @author: jeecg-boot
+ * @date:   2021-02-02
+ * @cersion: V1.0
+ */
+public interface KuaishouGroupExploreMapper extends BaseMapper<KuaishouGroupExplore> {
+
+}

+ 14 - 14
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouDailyAgentMapper.xml

@@ -6,24 +6,24 @@
     <!-- 代理商列表-->
     <select id="companyReport" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">
         select
-        date_time as date,  <!-- 日期 -->
-        sum(charged_campaign_count) as costCampaignCount,  <!-- 有消费计划数 -->
-        sum(total_balance_in_yuan) as balance,  <!-- 总余额 -->
-        sum(total_charged_in_yuan) as cost,  <!-- 总消耗 -->
-        sum(real_charged_in_yuan) as xianjinCost,  <!-- 现金消耗 -->
-        sum(total_rebate_real_charged_in_yuan) as fandianCost,  <!-- 后返消耗 -->
-        sum(contract_rebate_real_charged_in_yuan) as kuangfanCost,  <!-- 框返消耗 -->
-        sum(direct_rebate_real_charged_in_yuan) as jiliCost,  <!-- 激励账户消耗 -->
-        sum(credit_real_charged_in_yuan) as xinyongCost,  <!-- 信用账户消耗 -->
-        sum(ad_photo_impression) as fengmianShowCount,  <!-- 封面曝光数 -->
-        sum(ad_photo_click) as fengmianClickCount,  <!-- 封面点击数 -->
-        sum(ad_item_impression) as sucaiShowCount,  <!-- 素材曝光数 -->
-        sum(ad_item_click) as convertCount,  <!-- 行为数 -->
+        date_time as date,
+        sum(charged_campaign_count) as costCampaignCount,
+        sum(total_balance_in_yuan) as balance,
+        sum(total_charged_in_yuan) as cost,
+        sum(real_charged_in_yuan) as xianjinCost,
+        sum(total_rebate_real_charged_in_yuan) as fandianCost,
+        sum(contract_rebate_real_charged_in_yuan) as kuangfanCost,
+        sum(direct_rebate_real_charged_in_yuan) as jiliCost,
+        sum(credit_real_charged_in_yuan) as xinyongCost,
+        sum(ad_photo_impression) as fengmianShowCount,
+        sum(ad_photo_click) as fengmianClickCount,
+        sum(ad_item_impression) as sucaiShowCount,
+        sum(ad_item_click) as convertCount,
         (case when sum(ad_photo_impression) != 0
         then sum(ad_photo_click) / sum(ad_photo_impression)
         else 0
         end
-        ) as fengmianClickRate,  <!-- 封面点击率 -->
+        ) as fengmianClickRate,
         (
         case when sum(ad_photo_click) != 0
         THEN sum(ad_item_click) / sum(ad_photo_click)

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouGroupExploreMapper.xml

@@ -0,0 +1,5 @@
+<?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.mapper.KuaishouGroupExploreMapper">
+
+</mapper>

+ 23 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+/**
+ * @Description: 广告组的加速探索报表
+ * @Author: jeecg-boot
+ * @Date:   2021-02-02
+ * @Version: V1.0
+ */
+public interface IKuaishouGroupExploreService extends IService<KuaishouGroupExplore> {
+
+    public Result<Object> unitExploreInfoGet(JSONObject data);
+
+    public Result<Object> unitExploreBudgetUpdate(JSONObject data);
+
+    public Result<Object> unitExploreStatusPause(JSONObject data);
+
+    public Result<Object> querySpeedExploreReport(JSONObject data);
+}

+ 221 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

@@ -0,0 +1,221 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+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.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 广告组的加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Slf4j
+@Service
+public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupExploreMapper, KuaishouGroupExplore> implements IKuaishouGroupExploreService {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+
+
+    /**
+     * 查询加速探索信息
+     *
+     * @param
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> unitExploreInfoGet(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请选择广告组");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UNIT_EXPLORE_INFO_GET;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("unit_id", unitId);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    return Result.ok(resultJson.getJSONObject("data"));
+                } else {
+                    log.info("查询加速探索信息失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("查询加速探索信息失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("查询加速探索信息失败", e);
+        }
+        return Result.error("查询加速探索信息失败");
+    }
+
+    /**
+     * 广告组的加速探索预算设置
+     *
+     * @param
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> unitExploreBudgetUpdate(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请选择广告组");
+            }
+            Long exploreBudget = data.getLong("exploreBudget");
+            if (Check.isNull(exploreBudget)) {
+                return Result.error("请填写加速探索预算");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UNIT_EXPLORE_BUDGET_UPDATE;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("unit_id", unitId);
+            params.put("explore_budget", exploreBudget);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    return Result.ok(resultJson.getJSONObject("data"));
+                } else {
+                    log.info("广告组的加速探索预算设置失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("广告组的加速探索预算设置失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("广告组的加速探索预算设置失败", e);
+        }
+        return Result.error("广告组的加速探索预算设置失败");
+    }
+
+    /**
+     * 暂停广告组的加速探索预算接口
+     *
+     * @param
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> unitExploreStatusPause(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请选择广告组");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UNIT_EXPLORE_STATUS_PAUSE;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("unit_id", unitId);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    return Result.ok(resultJson.getJSONObject("data"));
+                } else {
+                    log.info("暂停广告组的加速探索预算失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("暂停广告组的加速探索预算失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("暂停广告组的加速探索预算失败", e);
+        }
+        return Result.error("暂停广告组的加速探索预算失败");
+    }
+
+    /**
+     * 查询广告组的加速探索报表接口
+     *
+     * @param
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> querySpeedExploreReport(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请选择广告组");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.QUERY_SPEED_EXPLORE_REPORT;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("unit_id", unitId);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject exploreJson = resultJson.getJSONObject("data");
+                    KuaishouGroupExplore kuaishouGroupExplore = JSONObject.toJavaObject(exploreJson, KuaishouGroupExplore.class);
+                    if (Check.isNull(kuaishouGroupExplore)) {
+                        return Result.error("查询失败,结果为空");
+                    }
+                    kuaishouGroupExplore.setAccountId(accountId);
+                    this.saveOrUpdate(kuaishouGroupExplore);
+                    return Result.ok("添加成功");
+                } else {
+                    log.info("查询广告组的加速探索报表失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("查询广告组的加速探索报表失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("查询广告组的加速探索报表失败", e);
+        }
+        return Result.error("查询广告组的加速探索报表失败");
+    }
+
+
+}