浏览代码

修改批量创意列表数据

syh 5 年之前
父节点
当前提交
9745aaa5f3

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java

@@ -107,7 +107,7 @@ public class ByteDanceTemplateController {
                                                               @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, HttpServletRequest req) {
         Result<IPage<ByteDanceAdvertisePlan>> result = new Result<>();
         QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = QueryGenerator.initQueryWrapper(plan, req.getParameterMap());
-        queryWrapper.eq("toutiao_id", plan.getToutiaoId()).orderByDesc("id");
+        queryWrapper.eq("account_id", plan.getAccountId()).orderByDesc("id");
         Page<ByteDanceAdvertisePlan> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceAdvertisePlan> pageList = planService.page(page, queryWrapper);
         result.setSuccess(true);

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java

@@ -54,6 +54,7 @@ public class ByteDanceCampaignController {
                                                           HttpServletRequest req) {
         Result<IPage<ByteDanceCampaign>> result = new Result<>();
         String name = byteDanceCampaign.getName();
+        byteDanceCampaign.setName(null);
         QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, req.getParameterMap());
         if(null!=name&&!"".equalsIgnoreCase(name)){
             queryWrapper.like("name",name);

+ 20 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 今日头条创意信息
@@ -47,11 +49,29 @@ public class ByteDanceCreativeController {
     public Result<IPage<ByteDanceCreative>> queryPageList(ByteDanceCreative byteDanceCreative,
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          @RequestParam(name="startDate",defaultValue = "")String startDate,
+                                                          @RequestParam(name="endDate",defaultValue = "")String endDate,
                                                           HttpServletRequest req) {
         Result<IPage<ByteDanceCreative>> result = new Result<>();
+        String title = byteDanceCreative.getTitle();
+        byteDanceCreative.setTitle(null);
         QueryWrapper<ByteDanceCreative> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreative, req.getParameterMap());
+        if(null!=startDate&&!startDate.trim().equals("")){
+            queryWrapper.ge("",startDate+" 00:00:00");
+        }
+        if(null!=endDate&&!endDate.trim().equals("")){
+            queryWrapper.le("",startDate+" 23:59:59");
+        }
+        if(null!=title&&!"".equals(title.trim())){
+            queryWrapper.like("title",title);
+        }
         Page<ByteDanceCreative> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCreative> pageList = byteDanceCreativeService.page(page, queryWrapper);
+        List<ByteDanceCreative> records = pageList.getRecords();
+        if(null!=records&&!records.isEmpty()){
+            List<ByteDanceCreative> creatives = records.stream().map(creative-> creative.setCreateStatus(creative.getStatus().equalsIgnoreCase("CAMPAIGN_STATUS_ENABLE"))).collect(Collectors.toList());
+            pageList.setRecords(creatives);
+        }
         result.setSuccess(true);
         result.setResult(pageList);
         return result;

+ 3 - 26
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java

@@ -33,29 +33,8 @@ public class ByteDanceAdvertisePlan {
     @TableId
     @ApiModelProperty(value = "头条平台广告计划id")
     private Long id;
-    /**
-     * 平台广告主id
-     */
-    @Excel(name = "平台广告主id", width = 15)
-    @ApiModelProperty(value = "平台广告主id")
-    private String advertiserId;
-    /**
-     * 头条广告主id
-     */
-    @Excel(name = "头条广告主id", width = 15)
-    @ApiModelProperty(value = "头条广告主id")
-    private Long toutiaoId;
-    /**
-     * 计划名称
-     */
-    @Excel(name = "计划名称", width = 15)
-    @ApiModelProperty(value = "计划名称")
+    private String accountId;
     private String name;
-    /**
-     * 广告组id
-     */
-    @Excel(name = "广告组id", width = 15)
-    @ApiModelProperty(value = "广告组id")
     private Long campaignId;
     /**
      * 上次修改时间戳(用于更新时提交,服务端判断是否基于最新信息修改)
@@ -239,7 +218,6 @@ public class ByteDanceAdvertisePlan {
     public ByteDanceAdvertisePlan(JSONObject dataObject, String accountId) {
         Long id = dataObject.getLong("id");
         this.id = id;
-        this.advertiserId = accountId;
         String name = dataObject.getString("name");
         if (null != name && !"".equals(name.trim())) {
             this.name = name;
@@ -275,7 +253,7 @@ public class ByteDanceAdvertisePlan {
         this.updateTime = new Date();
         Long advertiserId = dataObject.getLong("advertiser_id");
         if (null != advertiserId) {
-            this.toutiaoId = advertiserId;
+            this.accountId = advertiserId+"";
         }
         Long campaignId = dataObject.getLong("campaign_id");
         if (null != campaignId) {
@@ -410,7 +388,6 @@ public class ByteDanceAdvertisePlan {
 
     public ByteDanceAdvertisePlan(String advertiserId, Long adId, JSONObject params) {
         this.id = adId;
-        this.advertiserId = advertiserId;
         String name = params.getString("name");
         if (null != name && !"".equals(name.trim())) {
             this.name = name;
@@ -418,7 +395,7 @@ public class ByteDanceAdvertisePlan {
 
         Long toutiaoId = params.getLong("advertiser_id");
         if (null != toutiaoId) {
-            this.toutiaoId = toutiaoId;
+            this.accountId = toutiaoId+"";
         }
         Long campaignId = params.getLong("campaign_id");
         if (null != campaignId) {

+ 5 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreative.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.material.entity;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -41,8 +42,7 @@ public class ByteDanceCreative {
     /**
      * 本平台广告主id
      */
-    @Excel(name = "本平台广告主id", width = 15)
-    @ApiModelProperty(value = "本平台广告主id")
+    @Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
     private String accountId;
     /**
      * 创意素材标题
@@ -59,8 +59,7 @@ public class ByteDanceCreative {
     /**
      * 创意素材状态
      */
-    @Excel(name = "创意素材状态", width = 15)
-    @ApiModelProperty(value = "创意素材状态")
+    @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "57b60cec65bbc7cd3d6da4fbda589594")
     private String status;
     /**
      * 创意素材创作状态
@@ -126,6 +125,8 @@ public class ByteDanceCreative {
      */
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
+    @TableField(exist = false)
+    private Boolean createStatus;
 
     public ByteDanceCreative(){