Parcourir la source

修改用户定向回显效果

syh il y a 5 ans
Parent
commit
94efabce87

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

@@ -227,13 +227,28 @@ public class ByteDanceUserOrientationTemplate {
     @ApiModelProperty(value = "是否开启智能放量")
     private String autoExtendEnabled;
 
-    /**
-     * 智能放量
-     */
     @Excel(name = "区域类型", width = 15)
     @ApiModelProperty(value = "区域类型")
     private String areaType;
 
+    @Excel(name = "兴趣类型", width = 15)
+    @ApiModelProperty(value = "兴趣类型")
+    private String intrestType;
+
+    @Excel(name = "文章分类类型", width = 15)
+    @ApiModelProperty(value = "文章分类类型")
+    private String articleCategoryType;
+
+    @Excel(name = "手机品牌", width = 15)
+    @ApiModelProperty(value = "手机品牌")
+    private String mobileBrand;
+
+    private String cityStr;
+
+    private String districtStr;
+
+    private String adTagStr;
+
     /**
      * status
      */
@@ -273,23 +288,30 @@ public class ByteDanceUserOrientationTemplate {
         if (null != ageRange) {
             this.age = ageRange.toJSONString();
         }
+        //兴趣定向类别
         String intrestType = template.getString("intrestType");
         if (null != intrestType && !intrestType.equals("")) {
+            this.intrestType = intrestType;
             if ("NONE".equals(intrestType)) {
                 this.adTag = "[]";
             } else if ("SYSTEM_TJ".equals(intrestType)) {
                 this.adTag = "[" + 0 + "]";
             } else {
+                //兴趣分类
                 JSONArray categoryList = template.getJSONArray("intrestCategoryList");
                 JSONArray tags = new JSONArray();
+                JSONArray adTagStr = new JSONArray();
                 if (null != categoryList && categoryList.size() > 0) {
                     categoryList.forEach(category -> {
                         JSONObject categoryObject = JSONObject.parseObject(JSONObject.toJSONString(category));
+                        adTagStr.add(categoryObject);
                         Long id = categoryObject.getLong("value");
                         tags.add(id);
                     });
                 }
                 this.adTag = tags.toJSONString();
+                this.adTagStr = adTagStr.toJSONString();
+
             }
         }
         String platformType = template.getString("platformType");
@@ -310,45 +332,54 @@ public class ByteDanceUserOrientationTemplate {
         }
         String isArticleCategory = template.getString("isArticleCategory");
         if (null != isArticleCategory && !"".equals(isArticleCategory)) {
+            this.articleCategoryType = isArticleCategory;
             if ("CATEGORY".equals(isArticleCategory)) {
                 this.articleCategory = template.getJSONArray("tags").toJSONString();
             }
         }
-        String isMobileBrand = template.getString("isArticleCategory");
-        if (null != isArticleCategory && !"".equals(isArticleCategory)) {
-            if ("CATEGORY".equals(isArticleCategory)) {
+        String isMobileBrand = template.getString("isMobileBrand");
+        if (null != isMobileBrand && !"".equals(isMobileBrand)) {
+            this.mobileBrand = isMobileBrand;
+            if ("BRAND".equals(isArticleCategory)) {
                 this.deviceBrand = template.getJSONArray("mobileType").toJSONString();
             }
         }
         JSONArray cityList = template.getJSONArray("cityList");
         JSONArray cityArray = new JSONArray();
+        JSONArray cityStr = new JSONArray();
         if (null != cityList && cityList.size() > 0) {
             cityList.forEach(city -> {
                 JSONObject cityObject = JSONObject.parseObject(JSONObject.toJSONString(city));
+                cityStr.add(cityObject);
                 Long id = cityObject.getLong("value");
                 cityArray.add(id);
             });
         }
         this.city = cityArray.toJSONString();
+        this.cityStr = cityStr.toJSONString();
 
         JSONArray areaList = template.getJSONArray("areaList");
         JSONArray areaArray = new JSONArray();
+        JSONArray areaStr = new JSONArray();
         if (null != areaList && areaList.size() > 0) {
             areaList.forEach(area -> {
                 JSONObject areaObject = JSONObject.parseObject(JSONObject.toJSONString(area));
+                areaStr.add(areaObject);
                 Long id = areaObject.getLong("value");
                 areaArray.add(id);
             });
         }
         this.district = areaArray.toJSONString();
+        this.districtStr = areaStr.toJSONString();
 
-        JSONArray intrestCategoryList = template.getJSONArray("intrestCategoryList");
-        JSONArray intrestCategoryArray = new JSONArray();
-        if (null != intrestCategoryList && intrestCategoryList.size() > 0) {
-            intrestCategoryList.forEach(intrestCategory -> {
+        //兴趣关键词
+        JSONArray intrestTagList = template.getJSONArray("intrestTagList");
+        JSONArray intrestTagArray = new JSONArray();
+        if (null != intrestTagList && intrestTagList.size() > 0) {
+            intrestTagList.forEach(intrestCategory -> {
                 JSONObject intrestCategoryObject = JSONObject.parseObject(JSONObject.toJSONString(intrestCategory));
                 Long id = intrestCategoryObject.getLong("value");
-                intrestCategoryArray.add(id);
+                intrestTagArray.add(id);
             });
         }
         this.interestTags = areaArray.toJSONString();

+ 22 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceUserOrientationTemplateServiceImpl.java

@@ -9,13 +9,18 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.ResultMapUtils;
+import org.jeecg.common.util.StatusCode;
 import org.jeecg.modules.ctop.entity.ByteDanceUserOrientationTemplate;
+import org.jeecg.modules.ctop.entity.BytedanceDeliveryTargetTemplate;
+import org.jeecg.modules.ctop.entity.BytedanceUrlInfo;
 import org.jeecg.modules.ctop.mapper.ByteDanceUserOrientationTemplateMapper;
 import org.jeecg.modules.ctop.service.IByteDanceUserOrientationTemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -33,11 +38,26 @@ public class ByteDanceUserOrientationTemplateServiceImpl extends ServiceImpl<Byt
     @Override
     public Map<String, Object> insertTemplate(JSONObject template) {
         Map<String, Object> resultMap = new HashMap<>();
+        Long id = template.getLong("id");
+        String name = template.getString("name");
+        if (null == name || "".equals(name.trim())) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.TEMPLATE_NAME_IS_NULL.getCode());
+            return resultMap;
+        }
+        QueryWrapper<ByteDanceUserOrientationTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("name", name);
+        if (null != id && id != 0) {
+            queryWrapper.ne("id", id);
+        }
+        ByteDanceUserOrientationTemplate templateExist = getOne(queryWrapper);
+        if (null != templateExist) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.TEMPLATE_NAME_HAS_EXIST.getCode());
+            return resultMap;
+        }
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         ByteDanceUserOrientationTemplate orientationTemplate = new ByteDanceUserOrientationTemplate(user.getId(), template);
         this.saveOrUpdate(orientationTemplate);
-        resultMap.put("success", true);
-        resultMap.put("message", "投放目标模板保存成功");
+        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;
     }