浏览代码

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

jiequan.bi 4 年之前
父节点
当前提交
df8b869378
共有 22 个文件被更改,包括 277 次插入52 次删除
  1. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 13 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java
  3. 1 1
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  4. 2 2
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  5. 2 2
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  6. 8 8
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  7. 13 15
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  8. 24 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiAdsNewMaterialCreativityJob.java
  9. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAdvertiserStrategyController.java
  10. 12 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java
  11. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountTargetTemplate.java
  12. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountTargetTemplateService.java
  13. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountTargetTemplateServiceImpl.java
  14. 5 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java
  15. 27 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java
  16. 53 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCreativeTemplateController.java
  17. 53 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchGroupTemplateController.java
  18. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCampaignTemplate.java
  19. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  20. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml
  21. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchCampaignTemplateService.java
  22. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchCampaignTemplateServiceImpl.java

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

@@ -183,8 +183,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ruleGroup/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
-        filterChainDefinitionMap.put("/template/kuaiShouBatchCampaignTemplate/*", "anon");
-        filterChainDefinitionMap.put("/batch/kuaiShouGroupTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/**", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 13 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TagInfoController.java

@@ -44,19 +44,27 @@ public class TagInfoController {
 	  * @return
 	  */
 	 @RequestMapping(value = "/treeList", method = RequestMethod.GET)
-	 public Result<IPage<TagInfo>> list(@RequestParam(defaultValue = "10")Integer pageSize,@RequestParam(defaultValue = "1")Integer pageNo) {
+	 public Result<IPage<TagInfo>> list(@RequestParam (required = false)String tagName,@RequestParam(defaultValue = "10")Integer pageSize,@RequestParam(defaultValue = "1")Integer pageNo,@RequestParam(required = false)Long tagCategoryId,@RequestParam(defaultValue = "1")Integer level) {
 		 Result<IPage<TagInfo>> result = new Result<>();
 		 try {
-			QueryWrapper<TagInfo> query = new QueryWrapper<>();
+		 	QueryWrapper<TagInfo> query = new QueryWrapper<>();
 		 	query.eq("del_flag", CommonConstant.DEL_FLAG_0);
-		 	query.eq("level",1);
+		 	if(null!=level){
+				query.eq("level",level);
+			}
+		 	if(null!=tagCategoryId){
+		 		query.eq("tag_category_id",tagCategoryId);
+		 	}
+			 if(null!=tagName&&!"".equals(tagName)){
+				 query.like("tag_name",tagName);
+			 }
 		 	query.orderByAsc("tag_order");
 		 	Page<TagInfo> page = new Page<>(pageNo, pageSize);
 		 	IPage<TagInfo> pageList = tagInfoService.page(page,query);
 		 	List<TagInfo>recordsLevel1 = pageList.getRecords();
 
-			 List<TagInfo>setRecordsLevel1 = new ArrayList<>();
-			 if(null!=recordsLevel1&&!recordsLevel1.isEmpty()){
+		 	List<TagInfo>setRecordsLevel1 = new ArrayList<>();
+		 	if(null!=recordsLevel1&&!recordsLevel1.isEmpty()){
 		 		for (TagInfo level1tag:recordsLevel1) {
 					if(!level1tag.isLeaf()){
 						//非叶子节点

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -135,7 +135,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.151.174:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -259,5 +259,5 @@ bytedance:
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
 ai:
   callback:
-    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
-    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+    callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
+    callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -251,5 +251,5 @@ bytedance:
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
 ai:
   callback:
-    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
-    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+    callback-unit-url: http://139.186.27.96:31012/ai_callback_add_group
+    callback-creative-url: http://139.186.27.96:31012/ai_callback_add_creative

+ 8 - 8
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -95,16 +95,16 @@ spring:
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
-        master:
-          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
-          username: hcst
-          password: hcst@2020
-          driver-class-name: com.mysql.jdbc.Driver
 #        master:
-#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          username: data
-#          password: hcst@2021
+#          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+#          username: hcst
+#          password: hcst@2020
 #          driver-class-name: com.mysql.jdbc.Driver
+        master:
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: data
+          password: hcst@2021
+          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

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

@@ -501,25 +501,23 @@ public class SampleTest {
 //        if (null == accountTargetTemplates || accountTargetTemplates.isEmpty()) {
 //            return;
 //        }
+//        for (AiKuaishouAccountTargetTemplate template:accountTargetTemplates){
+//            if(template.getAccountId()!=9556344L){
+//                AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getByAccountId(template.getAccountId());
+//                aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,50);
+//            }
+//        }
 
-//        AiKuaishouAccountTargetTemplate accountTargetTemplate0 = aiKuaishouAccountTargetTemplateService.getById(1);
-//        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate0,50);
-//
-//        AiKuaishouAccountTargetTemplate accountTargetTemplate1 = aiKuaishouAccountTargetTemplateService.getById(30002);
-//        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate1,50);
-
-        AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(90005);
-        aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(accountTargetTemplate2);
+        AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120001);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,1);
     }
 
+    @Autowired
+    private IBytedancePlanDailyReportService planDailyReportService;
+
     @Test
     public void etlKuaishouProjectData(){
-        String dateString = "2020-08-07";
-        Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
-        for(int i=0;i<=180;i++){
-            Date getDate = DateUtils.addDay(startDate,i);
-            kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
-            bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
-        }
+        CtopOauthToken token = tokenService.getTokenByAccountId(1660666858777607L);
+        reportService.getAdvertiserPlanReport(token,DateUtils.parseDate("2021-01-25","yyyy-MM-dd"),DateUtils.parseDate("2021-01-25","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
     }
 }

+ 24 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiAdsNewMaterialCreativityJob.java

@@ -3,17 +3,24 @@ package cn.com.ctop.job.kuaishou.handler;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
+import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Component
 public class KuaishouAiAdsNewMaterialCreativityJob {
 
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static CountDownLatch countDownLatch = null;
+
     @Autowired
     private IAiKuaishouAccountTargetTemplateService aiKuaishouAccountTargetTemplateService;
     @XxlJob("kuaishouAiAdsNewMaterialCreativityJob")
@@ -32,7 +39,23 @@ public class KuaishouAiAdsNewMaterialCreativityJob {
         if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
             return;
         }
-        accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(targetTemplate, 10));
+        countDownLatch = new CountDownLatch(accountTargetTemplates.size());
+        accountTargetTemplates.forEach(targetTemplate -> executorService.submit(()->{
+            try {
+                aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(targetTemplate, 10);
+                XxlJobHelper.log("账户上新结束=>accountId:{}",targetTemplate.getAccountId());
+            }catch (Exception e) {
+                e.printStackTrace();
+            }finally {
+                countDownLatch.countDown();
+            }
+        }));
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("全部账户上新结束");
     }
 
     @XxlJob("kuaishouAiAdsHotMaterialCreativityJob")

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

@@ -53,11 +53,12 @@ public class AiKuaishouAdvertiserStrategyController {
 		List<AiKuaishouAdvertiserStrategy> records = pageList.getRecords();
 		List<AiKuaishouAdvertiserStrategy> setData = new ArrayList<>();
 		if(null!=records&&!records.isEmpty()){
-
 			records.forEach(record->{
 				Long accountId = record.getAccountId();
 				UserAllocation allocation = allocationService.getByAccountId(accountId);
-				record.setAuthName(allocation.getAuthName());
+				if(null !=allocation){
+					record.setAuthName(allocation.getAuthName());
+				}
 				setData.add(record);
 			});
 			pageList.setRecords(setData);

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

@@ -153,6 +153,7 @@ public class KuaiShouMaterialControer {
                         String signature = videoGet.getSignature();
                         materialJson.put("signature", signature);
                         materialJson.put("video_url", videoGet.getUrl());
+                        materialJson.put("material_type", videoGet.getMaterialType());
                         materialJson.put("channel_type", videoGet.getChannelType());
                         List<String> imageList = lastTimeService.getImageListByMd5(signature);
                         materialJson.put("imageList", imageList);
@@ -255,7 +256,17 @@ public class KuaiShouMaterialControer {
             if (Check.isNull(videoCnt)) {
                 throw new Exception("请输入查询条数");
             }
+            String startTime = requestJson.getString("startTime");
+            if (Check.isNull(startTime)) {
+                throw new Exception("请输入查询开始时间");
+            }
+            String endTime = requestJson.getString("endTime");
+            if (Check.isNull(endTime)) {
+                throw new Exception("请输入查询结束时间");
+            }
             Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("startTime", startTime);
+            requestMap.put("endTime", endTime);
             requestMap.put("accountId", accountId);
             requestMap.put("creativeCount", 0);
             requestMap.put("videoCnt", videoCnt);
@@ -269,6 +280,7 @@ public class KuaiShouMaterialControer {
                         materialJson.put("signature", signature);
                         materialJson.put("video_url", videoGet.getUrl());
                         materialJson.put("channel_type", videoGet.getChannelType());
+                        materialJson.put("material_type", videoGet.getMaterialType());
                         List<String> imageList = lastTimeService.getImageListByMd5(signature);
                         materialJson.put("imageList", imageList);
                     }

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

@@ -119,6 +119,9 @@ public class AiKuaishouAccountTargetTemplate {
      * 创建时间
      */
     private Date createTime;
+    private Integer  filterConvertedLevel;
+    private String actionBarText;
+    private String creativeDescription;
     /**
      * updateTime
      */

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

@@ -15,4 +15,5 @@ public interface IAiKuaishouAccountTargetTemplateService extends IService<AiKuai
 
     List<AiKuaishouAccountTargetTemplate> getAllEffectTemplate();
 
+    AiKuaishouAccountTargetTemplate getByAccountId(Long accountId);
 }

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

@@ -24,4 +24,15 @@ public class AiKuaishouAccountTargetTemplateServiceImpl extends ServiceImpl<AiKu
         queryWrapper.eq("status",1);
         return this.list(queryWrapper);
     }
+
+    @Override
+    public AiKuaishouAccountTargetTemplate getByAccountId(Long accountId) {
+        QueryWrapper<AiKuaishouAccountTargetTemplate> queryWrapper = new QueryWrapper<>();
+        if(null!=accountId&&accountId!=0){
+            queryWrapper.eq("account_id",accountId);
+        }
+        queryWrapper.eq("status",1);
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

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

@@ -318,13 +318,12 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
         creativeParams.put("unit_id",unitId);
         creativeParams.put("photo_id",videoItem.getPhotoId());
         creativeParams.put("creative_material_type",videoItem.getMaterialType());
-        creativeParams.put("action_bar_text","下载抢购");
-        creativeParams.put("description","不买亏大了!众多商品低至一元!看看你多花了多少冤枉钱!");
+        creativeParams.put("action_bar_text",targetTemplate.getActionBarText());
+        creativeParams.put("description",targetTemplate.getCreativeDescription());
         // 安卓下载中间页ID
         JSONArray siteIdArray = JSONArray.parseArray(targetTemplate.getSiteId());
         if(null == siteIdArray||!siteIdArray.isEmpty()){
             JSONObject siteObject = siteIdArray.getJSONObject(0);
-            Long appId = siteObject.getLong("appId");
             Long siteId = siteObject.getLong("siteId");
             if(null!=siteId){
                 creativeParams.put("site_id",siteId);
@@ -407,6 +406,9 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
         if(null!=population&&!population.isEmpty()){
             targetJsonObject.put("population",population);
         }
+        if(null!=targetTemplate.getFilterConvertedLevel()&&targetTemplate.getFilterConvertedLevel()!=0){
+            targetJsonObject.put("filter_converted_level",targetTemplate.getFilterConvertedLevel());
+        }
         JSONArray excludePopulation = JSONArray.parseArray(targetTemplate.getExcludePopulation());
         if(null!=excludePopulation&&!excludePopulation.isEmpty()){
             targetJsonObject.put("exclude_population",excludePopulation);

+ 27 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
 import com.alibaba.fastjson.JSON;
@@ -17,7 +18,14 @@ 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.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+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;
@@ -90,19 +98,29 @@ public class KuaiShouBatchCampaignTemplateController {
      */
     @AutoLog(value = "计划模板-编辑")
     @ApiOperation(value = "计划模板-编辑", notes = "计划模板-编辑")
-    @PutMapping(value = "/edit")
+    @PostMapping(value = "/saveOrUpdate")
     public Result<KuaiShouBatchCampaignTemplate> edit(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
         Result<KuaiShouBatchCampaignTemplate> result = new Result<KuaiShouBatchCampaignTemplate>();
-        KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
-        if (kuaiShouBatchCampaignTemplateEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
+        boolean ok;
+        try {
+            Long id = kuaiShouBatchCampaignTemplate.getId();
+            if (Check.isNull(id)) {
+                ok = kuaiShouBatchCampaignTemplateService.save(kuaiShouBatchCampaignTemplate);
+            } else {
+                KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(id);
+                if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
+                    ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
+                } else {
+                    throw new Exception("未获取到账户id对应的详细信息");
+                }
+            }
             if (ok) {
-                result.success("修改成功!");
+                result.success("操作成功!");
             }
+        } catch (Exception e) {
+            result.error500(e.getMessage());
+            e.printStackTrace();
         }
-
         return result;
     }
 

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

@@ -1,6 +1,8 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCreativeTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCreativeTemplateService;
 import com.alibaba.fastjson.JSON;
@@ -19,7 +21,15 @@ 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.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;
@@ -73,6 +83,48 @@ public class KuaiShouBatchCreativeTemplateController {
         return result;
     }
 
+    @AutoLog(value = "查询创意预设模板")
+    @ApiOperation(value = "查询创意预设模板", notes = "查询创意预设模板")
+    @GetMapping(value = "/getCreativeTemplate")
+    public Result<KuaiShouBatchCreativeTemplate> getCreativeTemplate(Long accountId) {
+        Result<KuaiShouBatchCreativeTemplate> result = new Result<>();
+        QueryWrapper<KuaiShouBatchCreativeTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        KuaiShouBatchCreativeTemplate one = kuaiShouBatchCreativeTemplateService.getOne(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(one);
+        return result;
+    }
+
+    @AutoLog(value = "创建创意预设模板")
+    @ApiOperation(value = "创建创意预设模板", notes = "创建创意预设模板")
+    @PostMapping(value = "/saveOrUpdate")
+    public Result<KuaiShouBatchCreativeTemplate> saveOrUpdate(@RequestBody KuaiShouBatchCreativeTemplate kuaiShouBatchCreativeTemplate) {
+        Result<KuaiShouBatchCreativeTemplate> result = new Result<KuaiShouBatchCreativeTemplate>();
+        boolean ok;
+        try {
+            Long id = kuaiShouBatchCreativeTemplate.getId();
+            if (Check.isNull(id)) {
+                ok = kuaiShouBatchCreativeTemplateService.save(kuaiShouBatchCreativeTemplate);
+            } else {
+                KuaiShouBatchCreativeTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCreativeTemplateService.getById(id);
+                if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
+                    ok = kuaiShouBatchCreativeTemplateService.updateById(kuaiShouBatchCreativeTemplate);
+                } else {
+                    throw new Exception("未获取到账户id对应的详细信息");
+                }
+            }
+            if (ok) {
+                result.success("操作成功!");
+            }
+        } catch (Exception e) {
+            result.error500(e.getMessage());
+            e.printStackTrace();
+        }
+        return result;
+    }
     /**
      * 添加
      *

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchGroupTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchGroupTemplateService;
 import com.alibaba.fastjson.JSON;
@@ -19,7 +20,15 @@ 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.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;
@@ -73,6 +82,49 @@ public class KuaiShouBatchGroupTemplateController {
         return result;
     }
 
+    @AutoLog(value = "查询广告组预设模板")
+    @ApiOperation(value = "查询广告组预设模板", notes = "查询广告组预设模板")
+    @GetMapping(value = "/getGroupTemplate")
+    public Result<KuaiShouBatchGroupTemplate> getGroupTemplate(Long accountId) {
+        Result<KuaiShouBatchGroupTemplate> result = new Result<>();
+        QueryWrapper<KuaiShouBatchGroupTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        KuaiShouBatchGroupTemplate one = kuaiShouBatchGroupTemplateService.getOne(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(one);
+        return result;
+    }
+
+    @AutoLog(value = "创建广告组预设模板")
+    @ApiOperation(value = "创建广告组预设模板", notes = "创建广告组预设模板")
+    @PostMapping(value = "/saveOrUpdate")
+    public Result<KuaiShouBatchGroupTemplate> saveOrUpdate(@RequestBody KuaiShouBatchGroupTemplate kuaiShouBatchGroupTemplate) {
+        Result<KuaiShouBatchGroupTemplate> result = new Result<>();
+        boolean ok;
+        try {
+            Long id = kuaiShouBatchGroupTemplate.getId();
+            if (Check.isNull(id)) {
+                ok = kuaiShouBatchGroupTemplateService.save(kuaiShouBatchGroupTemplate);
+            } else {
+                KuaiShouBatchGroupTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchGroupTemplateService.getById(id);
+                if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
+                    ok = kuaiShouBatchGroupTemplateService.updateById(kuaiShouBatchGroupTemplate);
+                } else {
+                    throw new Exception("未获取到账户id对应的详细信息");
+                }
+            }
+            if (ok) {
+                result.success("操作成功!");
+            }
+        } catch (Exception e) {
+            result.error500(e.getMessage());
+            e.printStackTrace();
+        }
+        return result;
+    }
+
     /**
      * 添加
      *

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

@@ -38,6 +38,8 @@ public class KuaiShouBatchCampaignTemplate {
     @Excel(name = "账户ID", width = 15)
     @ApiModelProperty(value = "账户ID")
     private Long accountId;
+
+    private  Integer groupRule;
     /**
      * 计划名称
      */

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

@@ -92,6 +92,7 @@
         photo_id as 'photo_id',
         signature as 'signature',
         stat_date as 'stat_date',
+        material_type as 'material_type',
         channel_type as 'channel_type',
         url as 'video_url'
         from ctop_kuaishou_video_get

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

@@ -63,6 +63,12 @@
         <if test="creativeCount != null and creativeCount != '' ">
             AND creative_count = #{creativeCount}
         </if>
+        <if test="startTime != null and startTime != '' ">
+            AND stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime != null and endTime != '' ">
+            AND stat_date &lt;= #{endTime}
+        </if>
         ORDER BY stat_date ASC
         LIMIT #{videoCnt}
     </select>
@@ -73,6 +79,7 @@
         t2.signature,
         t1.charge,
         t2.channel_type,
+        t2.material_type as 'material_type',
         t2.url as 'video_url'
         FROM
         (

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
@@ -11,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaiShouBatchCampaignTemplateService extends IService<KuaiShouBatchCampaignTemplate> {
 
+    String previewLogic(JSONObject data);
+
 }

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

@@ -3,7 +3,13 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouBatchCampaignTemplateMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCreativeTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchGroupTemplateService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.enums.NoEn;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -16,4 +22,30 @@ import org.springframework.stereotype.Service;
 @Service
 public class KuaiShouBatchCampaignTemplateServiceImpl extends ServiceImpl<KuaiShouBatchCampaignTemplateMapper, KuaiShouBatchCampaignTemplate> implements IKuaiShouBatchCampaignTemplateService {
 
+    @Autowired
+    IKuaiShouBatchGroupTemplateService kuaiShouBatchGroupTemplateService;
+
+    @Autowired
+    IKuaiShouBatchCreativeTemplateService kuaiShouBatchCreativeTemplateService;
+
+    @Override
+    public String previewLogic(JSONObject data) {
+
+
+        return null;
+    }
+
+    private JSONObject getCampaignsAndGroups(Integer type, JSONArray orientatPkg, JSONArray creativeGroup) {
+        JSONObject ob = new JSONObject();
+        //分组规则 1定向,2创意组
+        if (NoEn.NO1.valueInt() == type) {
+            for (int i = 0; i < orientatPkg.size(); i++) {
+
+            }
+        } else if (NoEn.NO2.valueInt() == type) {
+
+        }
+        return null;
+    }
+
 }