Parcourir la source

Merge remote-tracking branch 'origin/batch' into batch

yumeng il y a 4 ans
Parent
commit
9e94e63e5b

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

@@ -183,7 +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("/template/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -18,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;
@@ -100,7 +107,7 @@ public class KuaiShouBatchCampaignTemplateController {
             if (Check.isNull(id)) {
                 ok = kuaiShouBatchCampaignTemplateService.save(kuaiShouBatchCampaignTemplate);
             } else {
-                KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
+                KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(id);
                 if (!Check.isNull(kuaiShouBatchCampaignTemplateEntity)) {
                     ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
                 } else {
@@ -113,10 +120,7 @@ public class KuaiShouBatchCampaignTemplateController {
         } catch (Exception e) {
             result.error500(e.getMessage());
             e.printStackTrace();
-
-
         }
-
         return result;
     }
 

+ 54 - 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,49 @@ 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<KuaiShouBatchGroupTemplate>();
+        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;
+    }
+
     /**
      * 添加
      *