Bladeren bron

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

syh 4 jaren geleden
bovenliggende
commit
1b0f38274e

+ 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);

+ 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

+ 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);
                     }

+ 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;
+    }
+
 }