|
@@ -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;
|
|
|
+ }
|
|
|
/**
|
|
|
* 添加
|
|
|
*
|