yumeng преди 5 години
родител
ревизия
c90897e01a

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

@@ -0,0 +1,55 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.ctop.service.ICreativeTitleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/ctop/creativeTitle/")
+public class CreativeTitleController {
+    @Autowired
+    private ICreativeTitleService creativeTitleService;
+
+
+    @GetMapping("getTitleLabel")
+    public Result<JSONArray> getTitleLabel() {
+        Result<JSONArray> result = new Result<>();
+        JSONArray labelArr = creativeTitleService.getTitleLabel();
+        result.setSuccess(true);
+        result.setResult(labelArr);
+        return result;
+
+
+    }
+
+
+    @GetMapping("titleSuggestion")
+    public Result<JSONArray> titleSuggestion(String firstCategory, String secondCategory, String keywords) {
+        Result<JSONArray> result = new Result<>();
+        JSONArray labelArr = creativeTitleService.titleSuggestion(firstCategory, secondCategory, keywords);
+        result.setSuccess(true);
+        result.setResult(labelArr);
+        return result;
+
+
+    }
+
+
+
+    @GetMapping("titleSearch")
+    public Result<JSONArray> titleSearch(String firstCategory, String secondCategory, String keywords) {
+        Result<JSONArray> result = new Result<>();
+        JSONArray labelArr = creativeTitleService.titleSearch(firstCategory, secondCategory, keywords);
+        result.setSuccess(true);
+        result.setResult(labelArr);
+        return result;
+
+
+    }
+
+
+}

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICreativeTitleService.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface ICreativeTitleService {
+    JSONArray getTitleLabel();
+
+    JSONArray titleSuggestion(String firstCategory, String secondCategory, String keywords);
+
+    JSONArray titleSearch(String firstCategory, String secondCategory, String keywords);
+}

+ 83 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreativeTitleServiceImpl.java

@@ -0,0 +1,83 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.ctop.service.ICreativeTitleService;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class CreativeTitleServiceImpl implements ICreativeTitleService {
+    @Override
+    public JSONArray getTitleLabel() {
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        String result = HttpUtils.httpGet("https://cc.oceanengine.com/creative_center_server/api/title/new_title_label", null, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (resultJson.getInteger("code") == 0) {
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (!Check.isNull(dataJson)) {
+                return dataJson.getJSONArray("title_label");
+            }
+
+        }
+        return null;
+    }
+
+
+    @Override
+    public JSONArray titleSuggestion(String firstCategory, String secondCategory, String keywords) {
+        if (Check.isNull(keywords)) {
+            return null;
+        }
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        Map<String, Object> paramsMap = new HashMap<>();
+        paramsMap.put("first_category", firstCategory);
+        paramsMap.put("second_category", secondCategory);
+        JSONObject json = new JSONObject();
+        json.put("keywords", keywords);
+        paramsMap.put("params", json);
+
+        String result = HttpUtils.httpGet("https://cc.oceanengine.com/creative_center_server/api/title/title_suggestion", paramsMap, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (resultJson.getInteger("code") == 0) {
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (!Check.isNull(dataJson)) {
+                return dataJson.getJSONArray("titles");
+            }
+
+        }
+        return null;
+    }
+
+    @Override
+    public JSONArray titleSearch(String firstCategory, String secondCategory, String keywords) {
+        if (Check.isNull(keywords)) {
+            return null;
+        }
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        Map<String, Object> paramsMap = new HashMap<>();
+        paramsMap.put("first_category", firstCategory);
+        paramsMap.put("second_category", secondCategory);
+        JSONObject json = new JSONObject();
+        json.put("keywords", keywords);
+        paramsMap.put("params", json);
+        String result = HttpUtils.httpGet("https://cc.oceanengine.com/creative_center_server/api/title/title_search", paramsMap, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (resultJson.getInteger("code") == 0) {
+            JSONObject dataJson = resultJson.getJSONObject("data");
+            if (!Check.isNull(dataJson)) {
+                return dataJson.getJSONArray("titles");
+            }
+
+        }
+        return null;
+    }
+}

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/KuaiShouYiCheReportMapper.xml

@@ -446,7 +446,7 @@
             and t1.stat_date = #{statDate}
         </if>
         ) t2
-        WHERE t2.campaignName in(845,846,847,848,849,850,1071,1072)
+        WHERE t2.campaignName in(845,846,847,848,849,850,1071,1072,1066)
 
     </select>