소스 검색

修改配置文件mapper包扫描路径

syh 5 년 전
부모
커밋
211379f9be

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

@@ -181,7 +181,6 @@ public class ByteDanceTemplateController {
      */
     @PostMapping("userorentation/insert")
     public Map<String, Object> userOrentationTemplateInsert(@RequestBody JSONObject template, HttpServletRequest req) {
-        System.out.println(template.toJSONString());
         return orientationTemplateService.insertTemplate(template);
     }
 

+ 0 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/ImageUtils.java

@@ -175,7 +175,6 @@ public class ImageUtils {
         String[] sourceFiles = sourceFile.list();
         for (String str : sourceFiles) {
             String imagePath = sourceFile.getAbsolutePath() + "/" + str;
-            System.out.println(imagePath);
             new ImageUtils().resize(720, 1280, imagePath, targetPath + "/" + UUID.randomUUID() + ".jpg");
         }
 

+ 79 - 5
module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/ByteDanceUserOrientationTemplate.java

@@ -222,6 +222,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
      */
@@ -261,29 +283,40 @@ 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) category;
-                        Long id = categoryObject.getLong("id");
+                        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");
         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();
@@ -294,15 +327,56 @@ 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 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");
+                intrestTagArray.add(id);
+            });
+        }
+        this.interestTags = areaArray.toJSONString();
     }
 }

+ 19 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceUserOrientationTemplateServiceImpl.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.toutiao.service.impl;
 
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.toutiao.entity.ByteDanceUserOrientationTemplate;
 import cn.com.ctop.toutiao.mapper.ByteDanceUserOrientationTemplateMapper;
 import cn.com.ctop.toutiao.service.IByteDanceUserOrientationTemplateService;
@@ -33,11 +35,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;
     }