Explorar el Código

获取行业类别信息

yangzian hace 4 años
padre
commit
5bc63f3557

+ 39 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/marketing.java

@@ -960,4 +960,43 @@ public class marketing {
 
 
 
+
+
+
+    /**
+     *
+     * @description: 获取行业列表
+     *
+     * @param token
+     * @param type  "ADVERTISER"为原有广告3.0行业, "AGENT"为代理商行业获取,代理商行业level都为1
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getToolIndustryList(CtopOauthToken token,String type) {
+
+        JSONObject params = new JSONObject();
+        params.put("type", type);
+        params.put("level",type.equalsIgnoreCase(BytedanceConstant.LEVEL_AGENT) ? 1 : "");
+        params = Check.jsonRemoveEmpty(params);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_tools_industry_get"),
+                params);
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+        if (null == code || !code.equals(0)) {
+            log.info("获取行业类别信息接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("custom_audience_list");
+        if (null == data || data.isEmpty()) {
+            log.info("行业类别信息不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("人群包信息不存在");
+        }
+        return Result.successMsg("行业类别信息获取成功",data);
+    }
+
+
+
+
+
 }

+ 7 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IAiBytedanceAdvertiserStrategyService.java

@@ -37,4 +37,11 @@ public interface IAiBytedanceAdvertiserStrategyService extends IService<AiByteda
      */
     Result updStaOrCpaOrBudgetById(UpdAdStaOrCpaOrBudget updAdStaOrCpaOrBudget);
 
+    /**
+     * 获取行业列表
+     * @param type
+     * @return
+     */
+    Result getIndustryList(String accountId,String type);
+
 }

+ 27 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -105,6 +105,33 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     }
 
 
+
+    /**
+     *
+     * @description: 获取行业类别
+     *
+     * @param accountId 广告主id
+     * @param type 行业类别
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public Result getIndustryList(String accountId,String type) {
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
+        if (null == token) {
+            log.info("token获取失败=>accountId:{}", token.getAccountId());
+            return Result.error("token获取失败====>>>>accountId:"+token.getAccountId());
+        }
+        // 获取行业列表
+        Result industryList = marketing.getToolIndustryList(token,type);
+        log.error("行业列表=======>>>>>>>>>>>", industryList.getResult());
+        return Result.successMsg("获取行业列表成功。", industryList.getResult());
+    }
+
+
+
+
+
+
     /**
      * 创建 广告 组-计划-创意
      * @param strategy

+ 10 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/constant/BytedanceConstant.java

@@ -44,4 +44,14 @@ public class BytedanceConstant {
     public static final String DELIVERY_RANGE_UNION = "UNION";
     //通投智选
     public static final String DELIVERY_RANGE_UNIVERSAL = "UNIVERSAL";
+
+
+    /**
+     * 行业类型
+     */
+    //为原有广告3.0行业
+    public static final String LEVEL_ADVERTISER = "ADVERTISER";
+
+    //为代理商行业获取,代理商行业level都为1
+    public static final String LEVEL_AGENT = "AGENT";
 }

+ 3 - 0
jeecg-boot-bytedance/src/main/resources/bytedance_config.properties

@@ -65,6 +65,9 @@ bytedance_v2_creative_get=/2/creative/get/
 bytedance_v2_creative_update_v2=/2/creative/update_v2/
 
 
+#»ñÈ¡ÐÐÒµÁбí
+bytedance_v2_tools_industry_get=/2/tools/industry/get/
+
 bytedance_v2_advertiser_report_get=/2/report/advertiser/get/
 bytedance_v2_campaign_report_get=/2/report/campaign/get/
 bytedance_v2_ad_report_get=/2/report/ad/get/

+ 13 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -197,6 +197,19 @@ public class AiBytedanceAdvertiserStrategyController {
 
 
 
+	@ApiOperation(value="头条智能投放账户配置-获取行业类别", notes="头条智能投放账户配置-获取行业类别")
+	@PostMapping(value = "/getIndustryList")
+	public Result getIndustryList(@RequestParam("accountId") String accountId, @RequestParam("type") String type) {
+		try {
+			return aiBytedanceAdvertiserStrategyService.getIndustryList(accountId,type);
+		}catch (Exception e){
+			log.error("创建失败",e.getMessage());
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+
+
 	@ApiOperation(value="头条智能投放账户配置-新建账户配置", notes="头条智能投放账户配置-新建账户配置")
 	@PostMapping(value = "/createADCreative")
 	public Result createADCreative(@RequestBody AiBytedanceAdvertiserStrategy aiBytedanceAdvertiserStrategy) {