syh 5 rokov pred
rodič
commit
e75777ff60

+ 51 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceUserOrientationTemplate.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.ctop.entity;
 
+import cn.com.ctop.common.utils.HttpUtils;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
@@ -7,18 +9,21 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.util.Date;
+import java.util.LinkedHashMap;
 
 /**
  * 今日头条受众模板信息
+ *
  * @author jeecg-boot
- * @date 2019-07-23
  * @version V1.0
+ * @date 2019-07-23
  */
 @Data
 @TableName("ctop_bytedance_user_orientation_template")
@@ -223,6 +228,13 @@ public class ByteDanceUserOrientationTemplate {
     private String autoExtendEnabled;
 
     /**
+     * 智能放量
+     */
+    @Excel(name = "区域类型", width = 15)
+    @ApiModelProperty(value = "区域类型")
+    private String areaType;
+
+    /**
      * status
      */
     @Excel(name = "status", width = 15)
@@ -272,8 +284,8 @@ public class ByteDanceUserOrientationTemplate {
                 JSONArray tags = new JSONArray();
                 if (null != categoryList && categoryList.size() > 0) {
                     categoryList.forEach(category -> {
-                        JSONObject categoryObject = (JSONObject) category;
-                        Long id = categoryObject.getLong("id");
+                        JSONObject categoryObject = JSONObject.parseObject(JSONObject.toJSONString(category));
+                        Long id = categoryObject.getLong("value");
                         tags.add(id);
                     });
                 }
@@ -284,6 +296,10 @@ public class ByteDanceUserOrientationTemplate {
         if (null != platformType && !"".equals(platformType)) {
             this.platform = platformType;
         }
+        String areaType = template.getString("areaType");
+        if (null != areaType && !"".equals(areaType)) {
+            this.areaType = areaType;
+        }
         JSONArray netType = template.getJSONArray("netType");
         if (null != netType) {
             this.ac = netType.toJSONString();
@@ -304,5 +320,37 @@ public class ByteDanceUserOrientationTemplate {
                 this.deviceBrand = template.getJSONArray("mobileType").toJSONString();
             }
         }
+        JSONArray cityList = template.getJSONArray("cityList");
+        JSONArray cityArray = new JSONArray();
+        if (null != cityList && cityList.size() > 0) {
+            cityList.forEach(city -> {
+                JSONObject cityObject = JSONObject.parseObject(JSONObject.toJSONString(city));
+                Long id = cityObject.getLong("value");
+                cityArray.add(id);
+            });
+        }
+        this.city = cityArray.toJSONString();
+
+        JSONArray areaList = template.getJSONArray("areaList");
+        JSONArray areaArray = new JSONArray();
+        if (null != areaList && areaList.size() > 0) {
+            areaList.forEach(area -> {
+                JSONObject areaObject = JSONObject.parseObject(JSONObject.toJSONString(area));
+                Long id = areaObject.getLong("value");
+                areaArray.add(id);
+            });
+        }
+        this.district = areaArray.toJSONString();
+
+        JSONArray intrestCategoryList = template.getJSONArray("intrestCategoryList");
+        JSONArray intrestCategoryArray = new JSONArray();
+        if (null != intrestCategoryList && intrestCategoryList.size() > 0) {
+            intrestCategoryList.forEach(intrestCategory -> {
+                JSONObject intrestCategoryObject = JSONObject.parseObject(JSONObject.toJSONString(intrestCategory));
+                Long id = intrestCategoryObject.getLong("value");
+                intrestCategoryArray.add(id);
+            });
+        }
+        this.interestTags = areaArray.toJSONString();
     }
 }

+ 11 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -697,17 +697,22 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             platformArray.add(template.getPlatform());
             data.put("platform", platformArray);
         }
-        if (null != template.getCity() && !"".equals(template.getCity().trim())) {
-            JSONArray cityArray = JSONArray.parseArray(template.getCity());
-            data.put("city", cityArray);
-        }
         if (null != template.getBusinessIds() && !"".equals(template.getBusinessIds().trim())) {
             JSONArray bussinessIdArray = JSONArray.parseArray(template.getBusinessIds());
             data.put("business_ids", bussinessIdArray);
         }
-        if (null != template.getDistrict() && !"".equals(template.getDistrict().trim())) {
-            data.put("district", template.getDistrict());
+        if (null != template.getAreaType() && !"".equals(template.getAreaType().trim())) {
+            data.put("district", template.getAreaType());
+            if ("CITY".equals(template.getAreaType())) {
+                JSONArray cityArray = JSONArray.parseArray(template.getCity());
+                data.put("city", cityArray);
+            } else if ("COUNTY".equals(template.getAreaType())) {
+                JSONArray countyArray = JSONArray.parseArray(template.getDistrict());
+                data.put("city", countyArray);
+            }
+
         }
+
         if (null != template.getLocationType() && !"".equals(template.getLocationType().trim())) {
             data.put("location_type", template.getLocationType());
         }