Browse Source

Merge remote-tracking branch 'origin/master'

songyh 4 years ago
parent
commit
20f5dcd287
14 changed files with 878 additions and 591 deletions
  1. 746 0
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/marketing.java
  2. 5 1
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/entity/ByteDanceAdvertisePlan.java
  3. 0 10
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceAdvertisePlanService.java
  4. 0 6
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceAdvertiserDataService.java
  5. 0 2
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceCampaignService.java
  6. 0 2
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceCreativeService.java
  7. 0 211
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  8. 0 123
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  9. 0 96
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceCampaignServiceImpl.java
  10. 7 138
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceCreativeServiceImpl.java
  11. 25 0
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/AdGroupSearchVo.java
  12. 33 0
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/ByteDanceSearchVo.java
  13. 28 0
      jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/PlanSearchVo.java
  14. 34 2
      jeecg-boot-bytedance/src/main/resources/bytedance_config.properties

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

@@ -0,0 +1,746 @@
+package org.jeecg.modules.bytedance.advertise.dockapi;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.bytedance.advertise.entity.ByteDanceAdvertisePlan;
+import org.jeecg.modules.bytedance.advertise.vo.AdGroupSearchVo;
+import org.jeecg.modules.bytedance.advertise.vo.ByteDanceSearchVo;
+import org.jeecg.modules.bytedance.advertise.vo.PlanSearchVo;
+import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
+import org.jeecg.modules.bytedance.common.utils.HttpUtils;
+import org.jeecg.modules.bytedance.common.utils.PropertiesUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 头条-巨量引擎API 接口
+ * zianY
+ * 2021/4/16
+ **/
+
+@Slf4j
+public class marketing {
+
+    private static final String urlPath = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url");
+
+
+
+    /**
+     *
+     * @description: 获取账户日预算
+     *
+     * @param token 授权access_token
+     * @param advertiser_ids  广告主id列表,长度限制:[1,100]
+     * @return: java.util.Map<java.lang.String,java.lang.Object>
+     * @author: zianY
+     */
+    public static Result getBudget(CtopOauthToken token, List<Long> advertiser_ids) {
+        JSONObject params = new JSONObject();
+        //广告主id列表,长度限制:[1,100]
+        params.put("advertiser_ids", advertiser_ids);
+        //调用api接口--获取账户日预算
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get_budget"),
+                params);
+        int code = jsonObject.getInteger("code");
+        if (code!=0) {
+            log.info("获取账户日预算接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error(jsonObject.getString("message"));
+        }
+        return Result.successMsg("获取账户日预算成功",jsonObject.get("data"));
+    }
+
+
+    /**
+     *
+     * @description: 更新账户日预算
+     *
+     * @param token 授权access_token
+     * @param budgetMode 预算模式
+     * @param budget 预算值
+     * @return: java.util.Map<java.lang.String,java.lang.Object>
+     */
+    public static Result updateBudget(CtopOauthToken token, String budgetMode, String budget) {
+        JSONObject params = new JSONObject();
+        //广告主ID
+        params.put("advertiser_id", token.getAccountId());
+        //预算模式
+        // BUDGET_MODE_DAY(日预算)
+        //BUDGET_MODE_INFINITE(不限)
+        params.put("budget_mode", budgetMode);
+        //预算值
+        params.put("budget", budget);
+        //调用api接口--更新广告主账号设置的预算类型与预算
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget"),
+                params);
+        int code = jsonObject.getInteger("code");
+        if (code!=0) {
+            log.info("修改计划预算接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error(jsonObject.getString("message"));
+        }
+        return Result.successMsg("修改计划预算成功",null);
+    }
+
+
+
+
+    /**
+     *
+     * @description: 查询广告主下存在的的人群包列表和信息
+     *
+     * @param token
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result selectCustomAudience(CtopOauthToken token) {
+        JSONObject params = new JSONObject();
+        //广告主ID
+        params.put("advertiser_id", token.getAccountId());
+        //查询类型,枚举值:"0":该广告主创建的人群包和被推送给该广告主的人群包,"1":状态为可投放的人群包
+        params.put("select_type", "1");
+        params.put("offset", "0");
+        params.put("limit", "100");
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_dmp_custom_audience_select"),
+                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);
+    }
+
+
+    /**
+     *
+     * @description: 获取创意审核建议
+     *
+     * @param token
+     * @param creativeIds 广告创意ID 长度限制:1~10。创意ID需要属于当前广告主,否则会报错。只有审核不通过的创意才有审核建议,审核通过的创意没有审核建议。
+     *                    (所有的程序化创意都是审核通过的)
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getCreativeRejectReason(CtopOauthToken token,String creativeIds) {
+        JSONObject params = new JSONObject();
+        //广告主ID
+        params.put("advertiser_id", token.getAccountId());
+        //广告创意ID
+        params.put("creative_ids", creativeIds);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_create_reject_reason"),
+                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("list");
+        if (null == data || data.isEmpty()) {
+            log.info("创意审核建议不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("创意审核建议不存在");
+        }
+        return Result.successMsg("获取创意审核建议成功",data);
+    }
+
+
+    /**
+     *
+     * @description: 获取创意素材信息
+     *
+     * @param token
+     * @param creativeIds 创意ID集合,支持最大长度为100。创意ID需属于当前广告主,否则会报错
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getMaterialRead(CtopOauthToken token,String[] creativeIds) {
+
+        JSONObject params = new JSONObject();
+        //广告主ID
+        params.put("advertiser_id", token.getAccountId());
+        //创意ID集合
+        params.put("creative_ids", creativeIds);
+        //查询字段集合, 默认查询所有字段
+        //String[] fields={"id", "ad_id", "advertiser_id", "title", "image_info","image_mode", "opt_status"};
+        //params.put("fields",fields);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_material_get"),
+                params);
+        Integer code = jsonObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.error("获取广告主创意素材信息接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告主创意素材信息接口异常");
+        }
+        JSONArray data = jsonObject.getJSONArray("data");
+        if (null == data || data.isEmpty()) {
+            return Result.successMsg("获取广告主预算信息为空。",null);
+        }
+        return Result.successMsg("获取广告主预算信息完成",jsonObject.get("data"));
+    }
+
+
+
+
+    /**
+     *
+     * @description: 修改创意状态
+     *
+     * @param token
+     * @param creativeIds  创意ID列表,长度限制1~100;创意ID需属于广告主,否则会报错!
+     * @param optStatus 操作, "enable"表示启用, "disable"表示暂停
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result updateCreativeStatus(CtopOauthToken token, String[] creativeIds, String optStatus) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        params.put("creative_ids", creativeIds);
+        params.put("opt_status", optStatus);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_update_status"),
+                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("修改创意状态接口异常。");
+        }
+        JSONObject data = jsonObject.getJSONObject("data");
+        if (null == data || data.isEmpty()) {
+            log.info("修改创意状态返回数据为空==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("修改创意状态返回数据为空。");
+        }
+        JSONArray ids = data.getJSONArray("creative_ids");
+        return Result.successMsg("创意状态修改成功。",ids);
+    }
+
+
+
+
+    /**
+     *
+     * @description: 创建广告组
+     *
+     * @param token
+     * @param campaignName 广告组名称
+     * @param budgetMode 广告组预算类型
+     *          //BUDGET_MODE_INFINITE 不限
+     *         //BUDGET_MODE_DAY 日预算
+     *         //BUDGET_MODE_TOTAL 总预算
+     *
+     * @param budget 广告组预算
+     *               取值范围: ≥ 0
+     *               当budget_mode为"BUDGET_MODE_DAY"时,必填,且日预算不少于300元
+     *
+     * @return: org.jeecg.common.api.vo.Result
+     * @time: 2021/4/19 10:47
+     */
+    public static Result createCampaign(CtopOauthToken token,String campaignName,String budgetMode, String budget,String landingType) {
+        JSONObject param = new JSONObject();
+        //广告主id
+        param.put("advertiser_id",token.getAccountId());
+        //广告组名称,长度为1-100个字符,其中1个中文字符算2位
+        param.put("campaign_name",campaignName);
+        //广告组状态 "enable","disable"默认值:enable开启状态
+        param.put("operation","enable");
+        param.put("budget_mode", budgetMode);
+        //广告组预算
+        param.put("budget",budget);
+        //广告组推广目的
+        param.put("landing_type",landingType);
+
+        JSONObject data = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath+PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_create"),
+                param);
+        if(data == null){
+            log.error("创建广告组异常=>param:{}",param.toJSONString());
+            return Result.error("头条API创建广告组异常");
+        }
+        Integer code = data.getInteger("code");
+        String message = data.getString("message");
+        if(null == code||!code.equals(0)){
+            log.error("创建广告组数据异常=>{},parmas:{}",message,param.toJSONString());
+            return Result.error(message);
+        }
+        //广告组id
+        return Result.successMsg("广告组创建成功",data.getJSONObject("data").getLong("campaign_id"));
+    }
+
+
+
+
+
+    //创建计划
+    public static Result createAdvertiserPlan(CtopOauthToken token, String landingType, ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
+
+        JSONObject params = new JSONObject();
+        //广告主ID
+        params.put("advertiser_id", byteDanceAdvertisePlan.getAccountId());
+        //广告组ID
+        params.put("campaign_id", byteDanceAdvertisePlan.getCampaignId());
+        //广告计划名称,长度为1-100个字符,其中1个中文字符算2位。名称不可重复,否则会报错
+        params.put("name", byteDanceAdvertisePlan.getName());
+        //计划状态 默认值: "enable"开启状态 允许值: "enable"开启,"disable"关闭
+        params.put("operation", byteDanceAdvertisePlan.getOperation() == null ? "enable" : byteDanceAdvertisePlan.getOperation());
+        // 投放范围  "DEFAULT"默认, "UNION"穿山甲
+        params.put("delivery_range", byteDanceAdvertisePlan.getDeliveryRange() == null ? "DEFAULT" : byteDanceAdvertisePlan.getDeliveryRange());
+        //投放形式(穿山甲视频创意类型) 当delivery_range为"UNION"时必填
+        // 允许值: "ORIGINAL_VIDEO"原生, "REWARDED_VIDEO"激励视频,"SPLASH_VIDEO"开屏
+        params.put("union_video_type", byteDanceAdvertisePlan.getUnionVideoType() == null ? "ORIGINAL_VIDEO" : byteDanceAdvertisePlan.getUnionVideoType());
+
+        //投放内容
+        //推广目的为应用推广(landing_type=APP)时投放目标参数
+        if ("APP".equals(landingType)) {
+            //下载方式  可选值:DOWNLOAD_URL下载链接,QUICK_APP_URL快应用+下载链接,EXTERNAL_URL落地页链接
+            params.put("download_type", byteDanceAdvertisePlan.getDownloadType());
+            //下载链接
+            // 类型为下载链接
+            if ("DOWNLOAD_URL".equals(byteDanceAdvertisePlan.getDownloadType())){
+                params.put("download_url", byteDanceAdvertisePlan.getDownloadUrl());
+                //下载的应用类型,当download_type为DOWNLOAD_URL时必填
+                //允许值: "APP_ANDROID"Android APP, "APP_IOS"IOS APP
+                params.put("app_type", byteDanceAdvertisePlan.getAppType());
+
+            }
+            // 类型为 快应用+下载链接
+            if ("QUICK_APP_URL".equals(byteDanceAdvertisePlan.getDownloadType())){
+                params.put("quick_app_url", byteDanceAdvertisePlan.getDownloadUrl());
+            }
+            // 类型为下载链接
+            if ("EXTERNAL_URL".equals(byteDanceAdvertisePlan.getDownloadType())){
+                params.put("external_url", byteDanceAdvertisePlan.getDownloadUrl());
+            }
+
+            params.put("package", byteDanceAdvertisePlan.getToutiaoPackage());
+            params.put("app_type",byteDanceAdvertisePlan.getAppType());
+        }
+
+
+// TODO 优化目标
+//  convert_id  转化目标
+
+
+        //直达链接(点击唤起APP)
+        params.put("open_url", byteDanceAdvertisePlan.getOpenUrl());
+
+        //搜索快投功能,允许值:HAS_OPEN:启用,DISABLED:不启用 TODO
+        params.put("feed_delivery_search", "搜索快投");
+
+        //用户定向
+
+        //允许值: "CITY"省市, "COUNTY"区县, "BUSINESS_DISTRICT"商圈,"NONE"不限
+        params.put("district", byteDanceAdvertisePlan.getScheduleType());
+        //性别 允许值: "GENDER_FEMALE", "GENDER_MALE", "NONE"
+        params.put("gender", byteDanceAdvertisePlan.getGender());
+
+        //允许值: "AGE_BETWEEN_18_23", "AGE_BETWEEN_24_30","AGE_BETWEEN_31_40", "AGE_BETWEEN_41_49", "AGE_ABOVE_50"
+        //年龄不限 不传该字段
+        //params.put("age", byteDanceAdvertisePlan.getAge());
+       //自定义人群 不限 不传该字段
+        // 定向人群包列表(自定义人群)
+        //params.put("retargeting_tags_include", );
+        //排除人群包列表(自定义人群)
+        //params.put("retargeting_tags_exclude", );
+
+        //媒体定向
+        //params.put("superior_popularity_type", byteDanceAdvertisePlan.getSuperiorPopularityType());
+        //平台
+        //params.put("platform", byteDanceAdvertisePlan.getPlatform());
+        //网络
+        //params.put("ac", byteDanceAdvertisePlan.getAc());
+
+        //过滤已安装  当推广目标为安卓应用下载时可填 0表示不限,1表示过滤,2表示定向。默认为不限
+        params.put("hide_if_exists", byteDanceAdvertisePlan.getHideIfExists());
+        //过滤已转化用户 NO_EXCLUDE-不过滤;AD-广告计划(默认);CAMPAIGN-广告组; ADVERTISER-广告账户; APP-APP; CUSTOMER-公司账户
+        params.put("hide_if_converted", byteDanceAdvertisePlan.getHideIfConverted());
+        //是否启用智能放量 0、1。缺省为 0
+        params.put("auto_extend_enabled", byteDanceAdvertisePlan.getAutoExtendEnabled());
+
+
+
+        //预算与出价
+        //投放场景 允许值: 常规投放"SMART_BID_CUSTOM", 放量投放"SMART_BID_CONSERVATIVE"
+        params.put("smart_bid_type", "投放场景");
+
+        //预算 出价方式为CPC、CPM、CPV时,不少于100元;出价方式为OCPM、OCPC时,不少于300元
+        params.put("budget", byteDanceAdvertisePlan.getBudget());
+        //投放时间类型 允许值: "SCHEDULE_FROM_NOW"从今天起长期投放, "SCHEDULE_START_END"设置开始和结束日期
+        params.put("schedule_type", byteDanceAdvertisePlan.getScheduleType());
+        //投放时段,默认全时段投放
+        params.put("schedule_time", byteDanceAdvertisePlan.getScheduleTime());
+        //付费方式(计划出价类型) 决定投放目标的类型,比如CPC表示点击量,OCPM表示转化量
+        params.put("pricing", byteDanceAdvertisePlan.getPricing());
+
+        //目标转化出价/预期成本, 当pricing为"OCPM"、"OCPC"出价方式时必填)
+        //pricing为"OCPC"时取值范围:0.1-10000元;
+        //pricing为"OCPM"时取值范围:0.1-10000元;
+        //出价不能大于预算否则会报错
+        params.put("cpa_bid", byteDanceAdvertisePlan.getCpaBid());
+
+
+        //第三方检测链接 TODO
+
+
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create"), params);
+        Integer code = jsonObject.getInteger("code");
+        if (null ==  code || !code.equals(0)) {
+            log.error("广告计划创建失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            Result.error(jsonObject.getString("message"));
+
+        }
+        byteDanceAdvertisePlan.setId(jsonObject.getJSONObject("data").getLong("ad_id"));
+        return Result.successMsg("广告计划创建成功",byteDanceAdvertisePlan);
+    }
+
+
+
+
+
+    /**
+     * 创建广告创意
+     * @param
+     * @param adId
+     * @param data
+     * @return
+     */
+    public Result creativeCreate(CtopOauthToken token, Long adId, JSONObject data) {
+        Map<String, Object> resultMap = new HashMap<>();
+        //广告主ID
+        data.put("advertiser_id", token.getAccountId());
+        //广告计划ID
+        data.put("ad_id", adId);
+        //广告 投放位置 三选一
+        if (!data.getString("smart_inventory").isEmpty()){
+            //优选广告位,0表示不使用优选,1表示使用
+            data.put("smart_inventory", data.getString("smart_inventory"));
+        }
+        if (!data.getString("inventory_type").isEmpty()){
+            //广告位置(按媒体指定位置)
+            data.put("inventory_type", data.getString("inventory_type"));
+        }
+        if (!data.getString("scene_inventory").isEmpty()){
+            //场景广告位
+            data.put("scene_inventory", data.getString("scene_inventory"));
+        }
+        //监测链接
+        //data.put("action_track_url", data.getString("action_track_url"));
+        //创意方式,当值为"STATIC_ASSEMBLE"表示程序化创意,其他情况不传字段
+        data.put("creative_material_mode", data.getString("creative_material_mode"));
+
+        //TODO创意内容
+
+        //素材信息
+        data.put("image_list", data.getJSONArray("image_list"));
+        //标题信息
+        data.put("image_list", data.getJSONArray("image_list"));
+
+        //TODO 来源
+
+        //创意分类
+        data.put("third_industry_id", data.getString("third_industry_id"));
+        //创意标签 创意标签。最多20个标签,且每个标签长度不超过10个字符
+        data.put("ad_keywords", data.getString("ad_keywords"));
+
+
+        JSONObject result = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath+PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2"),
+                data);
+
+        Integer code = result.getInteger("code");
+        String message = result.getString("message");
+        if (null == code || code != 0) {
+            return Result.error("广告计划("+adId+"):创建创意信息异常--->>>"+message);
+        }
+        return Result.successMsg("广告计划("+adId+"):"+"创意创建成功",null);
+    }
+
+
+
+    /**
+     *
+     * @description: 创意详细信息
+     *
+     * @param token
+     * @param advertiserId 广告主id
+     * @param adId 计划ID
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     * @time: 2021/4/19 15:23
+     */
+    public static Result creativeRead(CtopOauthToken token,String advertiserId,String adId) {
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id",advertiserId);
+        param.put("ad_id",adId);
+        JSONObject data = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath+PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_read"),
+                param);
+        if(data == null){
+            log.error("获取创意详细信息异常=>param:{}",param.toJSONString());
+            return Result.error("获取创意详细信息异常");
+        }
+        Integer code = data.getInteger("code");
+        String message = data.getString("message");
+        if(null == code||!code.equals(0)){
+            log.error("获取创意详细信息异常=>{},parmas:{}",message,param.toJSONString());
+            return Result.error(message);
+        }
+        return Result.successMsg("获取创意详细信息成功",data.getJSONObject("data"));
+    }
+
+
+
+    /**
+     *
+     * @description: 获取创意列表信息
+     *
+     * @param token
+     * @param pageNumber
+     * @param byteDanceSearchVoList 创意入参信息
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getAdvertiserCreativeByPageNumber(CtopOauthToken token, Integer pageNumber, List<ByteDanceSearchVo> byteDanceSearchVoList) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        if (null != byteDanceSearchVoList){
+            params.put("filtering", byteDanceSearchVoList);
+        }
+        params.put("page", pageNumber + "");
+        params.put("page_size",100);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_get"),params);
+        Integer code = jsonObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告主广告创意信息接口异常");
+        }
+        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
+        if (null == data || data.isEmpty()) {
+            log.info("广告主广告创意信息不存在==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("广告主广告创意信息不存在");
+        }
+        return Result.successMsg("获取广告主创意列表成功。",data);
+    }
+
+
+    /**
+     *
+     * @description: 获取计划审核建议
+     *
+     * @param token
+     * @param advertiserId 广告主ID
+     * @param adIds 广告计划 ID,最多传10个广告计划ID
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getRejectReason(CtopOauthToken token, String advertiserId, List<String> adIds) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", advertiserId);
+        params.put("ad_ids", adIds);
+
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create_reasion"),params);
+        Integer code = jsonObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.info("获取广告主计划审核建议接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告主计划审核建议接口异常");
+        }
+        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
+        if (null == data || data.isEmpty()) {
+            log.info("获取广告主计划审核建议不存在==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告主计划审核建议不存在");
+        }
+        return Result.successMsg("获取广告主计划审核建议成功。",data);
+    }
+
+
+    /**
+     *
+     * @description: 更新计划出价
+     *
+     * @param token
+     * @param advertiserId 广告主ID
+     * @param listMap  ad_id 广告计划ID
+     *                 bid 出价,单位“元”,
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result updatePlanBid(CtopOauthToken token,String advertiserId,List<Map<String,Object>> listMap) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", advertiserId);
+        params.put("data", listMap);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_bid"), params);
+        int code = jsonObject.getInteger("code");
+        Map<String, Object> resultMap = new HashMap<>();
+        if (code != 0) {
+            log.info("修改计划出价接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("修改计划出价接口异常");
+        }
+        return Result.successMsg("修改计划出价成功",jsonObject.getString("data"));
+    }
+
+
+    /**
+     *
+     * @description: 修改计划预算
+     *
+     * @param token
+     * @param advertiserId 广告主ID
+     * @param listMap ad_id 广告计划ID
+     *                budget 预算,单位:元。
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result updatePlanBudget(CtopOauthToken token,String advertiserId,List<Map<String,Object>> listMap) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", advertiserId);
+        params.put("data", listMap);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget_plan"), params);
+        int code = jsonObject.getInteger("code");
+        Map<String, Object> resultMap = new HashMap<>();
+        if (code != 0) {
+            log.info("修改计划预算接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("修改计划预算接口异常");
+        }
+        return Result.successMsg("修改计划预算成功",jsonObject.getString("data"));
+    }
+
+
+    /**
+     *
+     * @description: 更新计划状态
+     *
+     * @param token
+     * @param adIds 计划ID集合,限制1~100. 广告计划id需属于广告主,否则会报错!
+     * @param optStatus 操作, "enable"表示启用计划, "delete"表示删除计划, "disable"表示暂停计划。
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result updPlanStatus(CtopOauthToken token, List<String> adIds, String optStatus) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        params.put("ad_ids", adIds);
+        params.put("opt_status", optStatus);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_status"),
+                params);
+        Integer code = jsonObject.getInteger("code");
+        Map<String, Object> resultMap = new HashMap<>();
+        if (code != 0) {
+            log.error("广告计划更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("广告计划更新状态接口异常");
+        }
+        return Result.successMsg("广告组状态修改成功",jsonObject.getString("data"));
+    }
+
+
+    /**
+     *
+     * @description: 获取广告计划
+     *
+     * @param token
+     * @param planSearchVoList 广告计划 入参
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getPlanList(CtopOauthToken token, List<PlanSearchVo> planSearchVoList) {
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        params.put("filtering", planSearchVoList);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get_plan"),
+                params);
+        Integer code = jsonObject.getInteger("code");
+        Map<String, Object> resultMap = new HashMap<>();
+        if (code != 0) {
+            log.error("获取广告计划接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告计划接口异常");
+        }
+        return Result.successMsg("获取广告计划成功",jsonObject.getString("data"));
+    }
+
+
+    /**
+     *
+     * @description: 广告组更新状态
+     *
+     * @param token
+     * @param campaignIds 广告组ID,不超过100个,且广告组ID属于广告主ID否则会报错;
+     * @param optStatus 操作, "enable"表示启用, "delete"表示删除, "disable"表示暂停;
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result updateCampaignStatus(CtopOauthToken token,List<String> campaignIds, String optStatus) {
+        JSONObject params = new JSONObject();
+        //广告主id
+        params.put("advertiser_id", token.getAccountId());
+        params.put("campaign_ids", campaignIds);
+        params.put("opt_status", optStatus);
+        JSONObject jsonObject = HttpUtils.bytedancePostRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update_status"), params);
+        Integer code = jsonObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.info("广告组更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("广告组更新状态接口异常");
+        }
+        JSONObject data = jsonObject.getJSONObject("data");
+        if (null == data) {
+            log.info("广告组更新状态操作异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("广告组更新状态操作异常");
+        }
+        return Result.successMsg("广告组更新状态成功。",jsonObject.getString("data"));
+    }
+
+
+    /**
+     *
+     * @description: 获取广告组
+     *
+     * @param token
+     * @param adGroupSearchVoList 广告组 入参
+     * @param page
+     * @param pageSize
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    public static Result getCampaignGroupList(CtopOauthToken token,List<AdGroupSearchVo> adGroupSearchVoList,int page,int pageSize) {
+
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", token.getAccountId());
+        params.put("filtering", adGroupSearchVoList);
+        params.put("page", page);
+        params.put("page_size", pageSize);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get"),
+                params);
+        Integer code = jsonObject.getInteger("code");
+        if (null == code || !code.equals(0)) {
+            log.error("获取广告组信息接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error(jsonObject.getString("message"));
+        }
+        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
+        if (null == data || data.isEmpty()) {
+            log.info("获取广告组信息为空==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            return Result.error("获取广告组信息为空");
+        }
+        return Result.successMsg("获取广告组信息成功",data);
+    }
+
+
+}

+ 5 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/entity/ByteDanceAdvertisePlan.java

@@ -119,7 +119,7 @@ public class ByteDanceAdvertisePlan {
     // 广告计划审核不通过原因
     private String auditRejectReason;
 
-    // ocpc广告转化出价
+    // ocpc广告转化出价 目标转化出价/预期成本
     private BigDecimal cpaBid;
 
     // 深度优化出价
@@ -183,6 +183,8 @@ public class ByteDanceAdvertisePlan {
     private Object businessIds;
     @TableField(exist=false)
     private String locationType;
+
+    //媒体定向
     @TableField(exist=false)
     private Object superiorPopularityType;
     @TableField(exist=false)
@@ -191,6 +193,8 @@ public class ByteDanceAdvertisePlan {
     private Object excludeFlowPackage;
     @TableField(exist=false)
     private Object deviceType;
+
+    //是否启用智能放量 0、1。缺省为 0
     @TableField(exist=false)
     private Object autoExtendEnabled;
     @TableField(exist=false)

+ 0 - 10
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceAdvertisePlanService.java

@@ -1,6 +1,5 @@
 package org.jeecg.modules.bytedance.advertise.service;
 
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.bytedance.advertise.entity.ByteDanceAdvertisePlan;
 import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
@@ -20,20 +19,11 @@ public interface IByteDanceAdvertisePlanService extends IService<ByteDanceAdvert
     //获取广告计划  https://ad.oceanengine.com/open_api/2/ad/get/
     Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate);
 
-    //创建广告计划  https://ad.oceanengine.com/open_api/2/ad/create/
-    Map<String, Object> createAdvertiserPlan(CtopOauthToken token, String landingType, ByteDanceAdvertisePlan byteDanceAdvertisePlan);
 
     //修改广告计划  https://ad.oceanengine.com/open_api/2/ad/update/
     Map<String, Object> updateAdvertiserPlan(CtopOauthToken token,String landingType, ByteDanceAdvertisePlan byteDanceAdvertisePlan);
 
-    //更新计划状态  https://ad.oceanengine.com/open_api/2/ad/update/status/
-    Map<String, Object> updateAdvertiserPlanStatus(CtopOauthToken token, JSONArray adIds, String optStatus);
 
-    //更新计划预算  https://ad.oceanengine.com/open_api/2/ad/update/budget/
-    Map<String, Object> updateAdvertiserPlanBudget(CtopOauthToken token, JSONArray adIds, JSONArray budgets);
-
-    //更新计划出价  https://ad.oceanengine.com/open_api/2/ad/update/bid/
-    Map<String, Object> updateAdvertiserPlanBid(CtopOauthToken token, JSONArray adIds,JSONArray bids);
 
     //获取计划审核建议  https://ad.oceanengine.com/open_api/2/ad/reject_reason/
     Map<String, Object> getAdvertiserPlanRejectReason(CtopOauthToken token, Long advertiserId, List<Long> adIds);

+ 0 - 6
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceAdvertiserDataService.java

@@ -22,18 +22,12 @@ public interface IByteDanceAdvertiserDataService {
 
     Map<String, Object> getAdvertiserBudget(String accountId);
 
-    Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds);
-
     Map<String, Object> advertiserPlanUpdateStatus(CtopOauthToken token, String adIds, String optStatus);
 
     Map<String, Object> advertiserPlanUpdateBid(CtopOauthToken token, String adIds, String bids);
 
     Map<String, Object> advertiserPlanUpdateBudget(CtopOauthToken token, String adIds, String budgets);
 
-    Map<String, Object> advertiserCustomAudienceSelect(String accountId);
-
-    Map<String, Object> getAdvertiserCampaignList(String accountId);
-
     Map<String, Object> flowPackageGet(String accountId);
 
     void getMaterialList(CtopOauthToken token);

+ 0 - 2
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceCampaignService.java

@@ -14,9 +14,7 @@ import java.util.Map;
  * @Version: V1.0
  */
 public interface IByteDanceCampaignService extends IService<ByteDanceCampaign> {
-    Map<String,Object> createCampaign(Long accountId, String campaignName, String operation, String budgetMode, String budget, String landingType, String uniqueFk);
     Map<String,Object>updateCampaign(CtopOauthToken token, Long campaignId, String campaignName, String modifyTime, Integer budget);
-    Map<String, Object> updateCampaignStatus(Long accountId, String campaignIds, String optStatus);
     Map<String, Object> getAdvertiserCampaign(CtopOauthToken token, String ids, String date);
     Map<String, Object> updateCampaign(BytedanceCampaignEditVo editVo);
 }

+ 0 - 2
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IByteDanceCreativeService.java

@@ -16,11 +16,9 @@ import java.util.Map;
  */
 public interface IByteDanceCreativeService extends IService<ByteDanceCreative> {
 
-    Map<String, Object> creativeCreate(String accountId, Long campaignId, JSONObject data);
 
     Map<String, Object> getAdvertiserCreative(CtopOauthToken token, String ids, String date);
 
-    Map<String, Object> advertiserCreativeUpdateStatus(CtopOauthToken cTopOauthToken,Long accountId, String creativeIds, String optStatus);
 
     void replaceBatch(List<ByteDanceCreative> creatives);
 

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

@@ -35,110 +35,6 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         return resultMap;
     }
 
-    @Override
-    public Map<String, Object> createAdvertiserPlan(CtopOauthToken token, String landingType, ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
-
-        Map<String, Object> resultMap = new HashMap<>();
-        //拼接访问参数
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", byteDanceAdvertisePlan.getAccountId());
-        params.put("campaign_id", byteDanceAdvertisePlan.getCampaignId());
-        params.put("name", byteDanceAdvertisePlan.getName());
-        params.put("operation", byteDanceAdvertisePlan.getOperation() == null ? "enable" : byteDanceAdvertisePlan.getOperation());
-        params.put("delivery_range", byteDanceAdvertisePlan.getDeliveryRange() == null ? "DEFAULT" : byteDanceAdvertisePlan.getDeliveryRange());
-        params.put("union_video_type", byteDanceAdvertisePlan.getUnionVideoType() == null ? "ORIGINAL_VIDEO" : byteDanceAdvertisePlan.getUnionVideoType());
-        params.put("budget_mode", byteDanceAdvertisePlan.getBudgetMode());
-        params.put("budget", byteDanceAdvertisePlan.getBudget());
-        params.put("schedule_type", byteDanceAdvertisePlan.getScheduleType());
-        params.put("start_time", byteDanceAdvertisePlan.getStartTime());
-        params.put("end_time", byteDanceAdvertisePlan.getEndTime());
-        //广告投放时段
-        if(!"".equals(byteDanceAdvertisePlan.getScheduleTime())){
-            params.put("schedule_time",byteDanceAdvertisePlan.getScheduleTime());
-        }
-        params.put("pricing", byteDanceAdvertisePlan.getPricing());
-        params.put("bid", byteDanceAdvertisePlan.getBid());
-        params.put("cpa_bid", byteDanceAdvertisePlan.getCpaBid());
-        params.put("flow_control_mode", byteDanceAdvertisePlan.getFlowControlMode());
-        if ("PRICING_OCPM".equals(byteDanceAdvertisePlan.getPricing())) {
-            if(byteDanceAdvertisePlan.getConvertId()!=null){
-                //查询必填参数convert_id
-                params.put("convert_id", byteDanceAdvertisePlan.getConvertId());
-            }else{
-                int convertId=getConvertIdByExternalAction(byteDanceAdvertisePlan.getExternalAction());
-                params.put("convert_id",convertId);
-                byteDanceAdvertisePlan.setConvertId((long) convertId);
-            }
-        }
-        params.put("deep_bid_type", byteDanceAdvertisePlan.getDeepBidType());
-        params.put("deep_cpabid", byteDanceAdvertisePlan.getDeepCpaBid());
-        params.put("hide_if_converted", byteDanceAdvertisePlan.getHideIfConverted());
-        params.put("hide_if_exists", byteDanceAdvertisePlan.getHideIfExists() == null ? 0 : byteDanceAdvertisePlan.getHideIfExists());
-        params.put("converted_time_duration", byteDanceAdvertisePlan.getConvertedTimeDuration());
-        params.put("luban_roi_goal",byteDanceAdvertisePlan.getLubanRoiGoal());
-        params.put("roi_goal",byteDanceAdvertisePlan.getRoiGoal());
-        //params.put("unique_fk",byteDanceAdvertisePlan.getUniqueFk")==null?"":byteDanceAdvertisePlan.getString("uniqueFk"));
-        //params.put("smart_bid_type",byteDanceAdvertisePlan.getSmartBidType")==null?"":byteDanceAdvertisePlan.getString("smartBidType"));
-        params.put("adjust_cpa", 0);
-        //暂时不需要定向包id
-        //params.put("audience_package_id",byteDanceAdvertisePlan.getLong("audiencePackageId"));
-        if("YES".equals(byteDanceAdvertisePlan.getUseOpenUrl())){
-            params.put("open_url", byteDanceAdvertisePlan.getOpenUrl());
-        }
-        //判断推广目的
-        if ("LINK".equals(landingType)) {
-            params.put("external_url", byteDanceAdvertisePlan.getExternalUrl());
-        }
-        if ("APP".equals(landingType)) {
-            params.put("download_type", byteDanceAdvertisePlan.getDownloadType());
-            params.put("download_url", byteDanceAdvertisePlan.getDownloadUrl());
-            params.put("package", byteDanceAdvertisePlan.getToutiaoPackage());
-            params.put("app_type",byteDanceAdvertisePlan.getAppType());
-        }
-
-        //公共参数--受众相关
-        params.put("retargeting_tags_include", byteDanceAdvertisePlan.getRetargetingTags());
-        params.put("retargeting_tags_exclude", byteDanceAdvertisePlan.getRetargetingTagsExclude());
-        params.put("gender", byteDanceAdvertisePlan.getGender());
-        params.put("age", byteDanceAdvertisePlan.getAge());
-        params.put("carrier", byteDanceAdvertisePlan.getCarrier());
-        params.put("ac", byteDanceAdvertisePlan.getAc());
-        params.put("device_brand", byteDanceAdvertisePlan.getDeviceBrand());
-        params.put("article_category", byteDanceAdvertisePlan.getArticleCategory());
-        params.put("activate_type", byteDanceAdvertisePlan.getActivateType());
-        params.put("city", byteDanceAdvertisePlan.getCity());
-        params.put("business_ids", byteDanceAdvertisePlan.getBusinessIds());
-        params.put("location_type", byteDanceAdvertisePlan.getLocationType());
-        params.put("superior_popularity_type", byteDanceAdvertisePlan.getSuperiorPopularityType());
-        params.put("flow_package", byteDanceAdvertisePlan.getFlowPackage());
-        params.put("exclude_flow_package", byteDanceAdvertisePlan.getExcludeFlowPackage());
-        params.put("device_type", byteDanceAdvertisePlan.getDeviceType());
-        params.put("auto_extend_enabled", byteDanceAdvertisePlan.getAutoExtendEnabled());
-        params.put("launch_price", byteDanceAdvertisePlan.getLaunchPrice());
-        params.put("interest_action_mode", byteDanceAdvertisePlan.getInterestActionMode());
-        params.put("action_scene", byteDanceAdvertisePlan.getActionScene());
-        params.put("action_days", byteDanceAdvertisePlan.getActionDays());
-        params.put("action_categories", byteDanceAdvertisePlan.getActionCategories());
-        params.put("action_words", byteDanceAdvertisePlan.getActionWords());
-        params.put("interest_categories", byteDanceAdvertisePlan.getInterestWords());
-        params.put("interest_words", byteDanceAdvertisePlan.getGeolocation());
-
-        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create"), params, headers));
-        if (jsonObject.getInteger("code") == 0) {
-            resultMap.put("code", 0);
-            byteDanceAdvertisePlan.setId(jsonObject.getJSONObject("data").getLong("ad_id"));
-            resultMap.put("data",byteDanceAdvertisePlan);
-        } else {
-            log.error("广告计划创建失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code",-200);
-            resultMap.put("message", jsonObject.getString("message"));
-        }
-        return resultMap;
-    }
 
     @Override
     public Map<String, Object> updateAdvertiserPlan(CtopOauthToken token, String landingType, ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
@@ -212,113 +108,6 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         return resultMap;
     }
 
-    @Override
-    public Map<String, Object> updateAdvertiserPlanStatus(CtopOauthToken token, JSONArray adIds, String optStatus) {
-
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-        switch (optStatus) {
-            case "AD_STATUS_DISABLE":
-                optStatus = "disable";
-                break;
-            case "AD_STATUS_ENABLE":
-                optStatus = "enable";
-                break;
-            case "AD_STATUS_DELETE":
-                optStatus = "delete";
-                break;
-        }
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", token.getAccountId());
-        params.put("ad_ids", adIds.toJSONString());
-        params.put("opt_status", optStatus);
-        String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_status"), params, headers);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        int code = jsonObject.getInteger("code");
-        Map<String, Object> resultMap = new HashMap<>();
-        if (code != 0) {
-            log.error("广告计划更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", jsonObject.getString("message"));
-            return resultMap;
-        }
-        resultMap.put("code", 0);
-        resultMap.put("message", "广告组状态修改成功");
-        return resultMap;
-    }
-
-    @Override
-    public Map<String, Object> updateAdvertiserPlanBudget(CtopOauthToken token, JSONArray adIds, JSONArray budgets) {
-        JSONArray data = new JSONArray();
-        if (adIds.size() > 0) {
-            for (int i = 0; i < adIds.size(); i++) {
-                JSONObject object = new JSONObject();
-                Long adId = Long.valueOf(adIds.get(i).toString());
-                Long budget = Long.valueOf(budgets.get(i).toString());
-                object.put("ad_id", adId);
-                object.put("budget", budget);
-                data.add(object);
-            }
-        }
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", token.getAccountId());
-        params.put("data", data.toJSONString());
-        String result = HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_budget"), params, headers);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Map<String, Object> resultMap = new HashMap<>();
-        int code = jsonObject.getInteger("code");
-        if (code!=0) {
-            log.info("修改计划预算接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", jsonObject.getString("message"));
-            return resultMap;
-        }
-        resultMap.put("code", 0);
-        resultMap.put("message", "修改计划预算成功");
-        return resultMap;
-    }
-
-    @Override
-    public Map<String, Object> updateAdvertiserPlanBid(CtopOauthToken token, JSONArray adIds, JSONArray bids) {
-        JSONArray data = new JSONArray();
-        if (adIds.size() > 0) {
-            for (int i = 0; i < adIds.size(); i++) {
-                JSONObject object = new JSONObject();
-                Long adId = Long.valueOf(adIds.get(i).toString());
-                Long bid = Long.valueOf(bids.get(i).toString());
-                object.put("ad_id", adId);
-                object.put("bid", bid);
-                data.add(object);
-            }
-        }
-        //2: 根据token以及用户id获取用户信息数据
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", token.getAccountId());
-        params.put("data", data.toJSONString());
-        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update_bid"), params, headers));
-        int code = jsonObject.getInteger("code");
-        Map<String, Object> resultMap = new HashMap<>();
-        if (code != 0) {
-            log.info("修改计划出价接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", jsonObject.getString("message"));
-            return resultMap;
-        }
-        resultMap.put("code", 0);
-        resultMap.put("message", "修改计划出价成功");
-        return resultMap;
-    }
-
-    @Override
     public Map<String, Object> getAdvertiserPlanRejectReason(CtopOauthToken token, Long advertiserId, List<Long> adIds) {
 
         Map<String, Object> resultMap = new HashMap<>();

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

@@ -285,46 +285,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         return resultMap;
     }
 
-    @Override
-    public Map<String, Object> getAdvertiserCreativeMaterial(String accountId, String creativeIds) {
-        Map<String, Object> resultMap = new HashMap<>();
-        CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
-        //2: 根据token以及用户id获取用户信息数据
-        String url = bytedanceApiUrl + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_material_get");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
-        TreeMap<String, Object> params = new TreeMap<>();
-        params.put("advertiser_id", cTopOauthToken.getAccountId());
-        if (null != creativeIds && !"".equals(creativeIds.trim())) {
-            params.put("creative_ids", "[" + creativeIds + "]");
-        }
-        String result = HttpUtils.httpGetRequest(url, headers, params);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
-
-        if (null == code || !code.equals(0)) {
-            log.error("获取广告主创意素材信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", "获取广告主创意素材信息接口异常");
-            return resultMap;
-        }
-        JSONArray data = jsonObject.getJSONArray("data");
-        if (null == data || data.isEmpty()) {
-            resultMap.put("code", 0);
-            resultMap.put("message", "获取广告主预算信息完成");
-            return resultMap;
-        }
-        for (int i = 0; i < data.size(); i++) {
-            JSONObject dataObject = data.getJSONObject(i);
-            ByteDanceCreativeMaterial material = new ByteDanceCreativeMaterial(dataObject, accountId);
-            creativeMaterialService.saveOrUpdate(material);
-        }
-        resultMap.put("code", 0);
-        resultMap.put("message", "获取广告主预算信息完成");
-        return resultMap;
-    }
 
 
     private void getCreativeByPage(CtopOauthToken token, String date, int pageNum) {
@@ -513,92 +474,8 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         return resultMap;
     }
 
-    /**
-     * 查询人群包信息
-     *
-     * @return
-     */
-    @Override
-    public Map<String, Object> advertiserCustomAudienceSelect(String accountId) {
-        Map<String, Object> resultMap = new HashMap<>();
-        if (null == accountId || "".equals(accountId.trim())) {
-            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_PARAM_ERROR);
-            return resultMap;
-        }
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-        if (null == token) {
-            ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_PARAM_ERROR);
-            return resultMap;
-        }
-        String url = bytedanceApiUrl + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_dmp_custom_audience_select");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        TreeMap<String, Object> params = new TreeMap<>();
-        params.put("select_type", "0");
-        params.put("advertiser_id", token.getAccountId() + "");
-        params.put("limit", "100");
-        params.put("offset", "0");
-        String result = HttpUtils.httpGetRequest(url, headers, params);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
-        String message = jsonObject.getString("message");
-        if (null == code || !code.equals(0)) {
-            log.info("获取人群包信息接口异常==》accountId:{},message:{}", accountId, message);
-            resultMap.put("success", false);
-            resultMap.put("message", message);
-            resultMap.put("code", -1);
-            return resultMap;
-        }
-        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("custom_audience_list");
-        if (null == data || data.isEmpty()) {
-            log.info("人群包信息不存在==》accountId:{},message:{}", accountId, message);
-            resultMap.put("success", false);
-            resultMap.put("message", "人群包信息不存在");
-            resultMap.put("code", -1);
-            return resultMap;
-        }
-        resultMap.put("success", true);
-        resultMap.put("message", "人群包信息获取成功");
-        resultMap.put("data", data);
-        resultMap.put("code", 0);
-        return resultMap;
-    }
-
-    @Override
-    public Map<String, Object> getAdvertiserCampaignList(String accountId) {
-        Map<String, Object> resultMap = new HashMap<>();
-        CtopOauthToken cTopOauthToken = tokenService.getOauthTokenByAccountId(accountId);
-        String url = bytedanceApiUrl + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_get");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", cTopOauthToken.getAccessToken());
 
-        TreeMap<String, Object> params = new TreeMap<>();
-        params.put("advertiser_id", cTopOauthToken.getAccountId());
-        params.put("page", 1);
-        String result = HttpUtils.httpGetRequest(url, headers, params);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
 
-        if (null == code || !code.equals(0)) {
-            log.error("获取广告组信息接口异常==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
-            resultMap.put("code", code);
-            resultMap.put("message", jsonObject.getString("message"));
-            return resultMap;
-        }
-        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.isEmpty()) {
-            log.info("获取广告组信息为空==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
-            resultMap.put("code", code);
-            resultMap.put("message", "获取广告组信息为空");
-            return resultMap;
-        }
-        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
-        resultMap.put("data", data);
-        return resultMap;
-    }
 
     /**
      * 获取流量包数据接口

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

@@ -31,57 +31,6 @@ public class ByteDanceCampaignServiceImpl extends ServiceImpl<ByteDanceCampaignM
     private ByteDanceCampaignMapper campaignMapper;
     @Autowired
     private ICtopOauthTokenService tokenService;
-    /**
-     * 每个广告主账号下最多可允许创建500个广告组,如超出需要先删除一部分广告组后才可继续创建。
-     * @param accountId
-     * @param campaignName
-     * @param operation
-     * @param budgetMode
-     * @param budget
-     * @param landingType
-     * @param uniqueFk
-     * @return
-     */
-    @Override
-    public Map<String, Object> createCampaign(Long accountId, String campaignName, String operation, String budgetMode, String budget, String landingType, String uniqueFk) {
-        Map<String,Object>result = new HashMap<>();
-        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-        // 请求地址
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_create");
-        // 请求参数
-        JSONObject param = new JSONObject();
-        param.put("advertiser_id",token.getAccountId());
-        param.put("campaign_name",campaignName);
-        if(null!=operation&&!"".equals(operation.trim())){
-            param.put("operation",operation);
-        }
-        param.put("budget_mode", budgetMode);
-        if(null != budget&&!"".equals(budget.trim())){
-            param.put("budget",budget);
-        }
-        param.put("landing_type", landingType);
-        if(null != uniqueFk&&!"".equals(uniqueFk.trim())){
-            param.put("unique_fk",uniqueFk);
-        }
-        JSONObject data = HttpUtils.bytedancePostRequest(token.getAccessToken(),url,param);
-        if(data == null){
-            log.error("创建广告组异常=>param:{}",param.toJSONString());
-            ResultMapUtils.setResultMap(result, StatusCode.BYTEDACNE_API_GROUP_CREATE_ERROR);
-            return result;
-        }
-        Integer code = data.getInteger("code");
-        String message = data.getString("message");
-        if(null == code||!code.equals(0)){
-            log.error("获取广告组数据异常=>{},parmas:{}",message,param.toJSONString());
-            ResultMapUtils.setResultMap(result,-1,message,false);
-            return result;
-        }
-        Long campaignId = data.getJSONObject("data").getLong("campaign_id");
-        this.getAdvertiserCampaign(token,null,null);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
-        result.put("campaign_id",campaignId);
-        return result;
-    }
 
     @Override
     public Map<String, Object> updateCampaign(CtopOauthToken token, Long campaignId, String campaignName,String budgetMode, Integer budget) {
@@ -199,51 +148,6 @@ public class ByteDanceCampaignServiceImpl extends ServiceImpl<ByteDanceCampaignM
         getAdvertiserCampaignByPageNumber(token, pageNumber + 1, ids, date);
     }
 
-    @Override
-    public Map<String, Object> updateCampaignStatus(Long accountId, String campaignIds, String optStatus) {
-        Map<String, Object> resultMap = new HashMap<>();
-        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-        this.getAdvertiserCampaign(token,null,null);
-        JSONArray ids = new JSONArray();
-        String[] getIds = campaignIds.split(StringUtils.COMMA);
-        if (null != getIds && getIds.length > 0) {
-            for (int i = 0; i < getIds.length; i++) {
-                ids.add(Long.parseLong(getIds[i]));
-            }
-        }
-        //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_campaign_update_status");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
 
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", token.getAccountId());
-        params.put("campaign_ids", ids);
-        params.put("opt_status", optStatus);
-        String result = HttpUtils.httpPostRequest(url, params, headers);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
 
-        if (null == code || !code.equals(0)) {
-            log.info("广告组更新状态接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", "广告组更新0状态接口异常");
-            resultMap.put("success", false);
-            return resultMap;
-        }
-        JSONObject data = jsonObject.getJSONObject("data");
-        if (null == data) {
-            log.info("广告组更新状态异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", "广告组操作异常");
-            resultMap.put("success", false);
-            return resultMap;
-        }
-        this.getAdvertiserCampaign(token,null,null);
-        resultMap.put("code", 0);
-        resultMap.put("message", "操作成功");
-        resultMap.put("success", true);
-        return resultMap;
-    }
 }

+ 7 - 138
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceCreativeServiceImpl.java

@@ -12,7 +12,10 @@ import org.jeecg.modules.bytedance.advertise.service.IByteDanceAdvertisePlanServ
 import org.jeecg.modules.bytedance.advertise.service.IByteDanceCreativeService;
 import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
 import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
-import org.jeecg.modules.bytedance.common.utils.*;
+import org.jeecg.modules.bytedance.common.utils.HttpUtils;
+import org.jeecg.modules.bytedance.common.utils.PropertiesUtils;
+import org.jeecg.modules.bytedance.common.utils.ResultMapUtils;
+import org.jeecg.modules.bytedance.common.utils.StatusCode;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -20,7 +23,6 @@ import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
 
 /**
  * @Description: 今日头条创意信息
@@ -38,61 +40,6 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
     @Autowired
     private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
 
-    /**
-     * 更改创意状态
-     * @param accountId
-     * @param creativeIds
-     * @param optStatus
-     * @return
-     */
-    @Override
-    public Map<String, Object> advertiserCreativeUpdateStatus(CtopOauthToken cTopOauthToken,Long accountId, String creativeIds, String optStatus) {
-        Map<String, Object> resultMap = new HashMap<>();
-        JSONArray ids = new JSONArray();
-        String[] getCreativeIds = creativeIds.split(StringUtils.COMMA);
-        if (getCreativeIds.length > 0) {
-            for (int i = 0; i < getCreativeIds.length; i++) {
-                ids.add(Long.parseLong(getCreativeIds[i]));
-            }
-        }
-        //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_update_status");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", cTopOauthToken.getAccessToken());
-
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", cTopOauthToken.getAccountId());
-        params.put("creative_ids", ids.toJSONString());
-        params.put("opt_status", optStatus);
-        String result = HttpUtils.httpPostRequest(url, params, headers);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
-        String message = jsonObject.getString("message");
-        if (null == code || !code.equals(0)) {
-            log.info("修改创意状态接口异常==》accountId:{},message:{}", accountId, message);
-            resultMap.put("success", false);
-            resultMap.put("code", -1);
-            resultMap.put("message", message);
-            return resultMap;
-        }
-        JSONObject data = jsonObject.getJSONObject("data");
-        if (null == data) {
-            log.info("修改创意状态异常==》accountId:{},message:{}", accountId, message);
-            resultMap.put("success", false);
-            resultMap.put("code", -1);
-            resultMap.put("message", message);
-            return resultMap;
-        }
-        JSONArray returnCreativeIds = data.getJSONArray("creative_ids");
-        if (null != returnCreativeIds && !returnCreativeIds.isEmpty()) {
-            getAdvertiserCreative(cTopOauthToken, creativeIds, null);
-        }
-        resultMap.put("success", true);
-        resultMap.put("code", 0);
-        resultMap.put("message", "广告创意状态修改成功");
-        return resultMap;
-    }
 
     @Override
     public void replaceBatch(List<ByteDanceCreative> creatives) {
@@ -109,92 +56,14 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
     @Override
     public Map<String, Object> getAdvertiserCreative(CtopOauthToken token, String ids, String date) {
         Map<String, Object> resultMap = new HashMap<>();
-        getAdvertiserCreativeByPageNumber(token, 1, ids, date);
+       // getAdvertiserCreativeByPageNumber(token, 1, ids, date);
         resultMap.put("code", 0);
         resultMap.put("message", "获取广告主广告创意信息完成");
         return resultMap;
     }
 
-    public void getAdvertiserCreativeByPageNumber(CtopOauthToken token, Integer pageNumber, String ids, String date) {
-        //2: 根据token以及用户id获取用户信息数据
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_get");
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        TreeMap<String, Object> params = new TreeMap<>();
-        JSONObject filtering = new JSONObject();
-        if (null != ids && !"".equals(ids.trim())) {
-            String[] idsArray = ids.split(StringUtils.COMMA);
-            JSONArray filterIdsArray = new JSONArray();
-            for (int i = 0; i < idsArray.length; i++) {
-                Long id = Long.parseLong(idsArray[i]);
-                filterIdsArray.add(id);
-            }
-            filtering.put("ids", filterIdsArray);
-        }
-        if (null != date && !"".equals(date)) {
-            filtering.put("creative_create_time", date);
-        }
-        params.put("filtering", filtering.toJSONString());
-        params.put("advertiser_id", token.getAccountId());
-        params.put("page", pageNumber + "");
-        params.put("page_size",100);
-        String result = HttpUtils.httpGetRequest(url, headers, params);
-        JSONObject jsonObject = JSONObject.parseObject(result);
-        Integer code = jsonObject.getInteger("code");
-
-        if (null == code || !code.equals(0)) {
-            log.info("获取广告主广告创意信息接口异常==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            return;
-        }
-        JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.isEmpty()) {
-            log.info("广告主广告创意信息不存在==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            return;
-        }
-        for (int i = 0; i < data.size(); i++) {
-            JSONObject dataObject = data.getJSONObject(i);
-            ByteDanceCreative creative = new ByteDanceCreative(dataObject, token);
-            this.saveOrUpdate(creative);
-        }
-        getAdvertiserCreativeByPageNumber(token, pageNumber + 1, ids, date);
-    }
 
     /**
-     * 创建创意
-     * @param accountId
-     * @param adId
-     * @param data
-     * @return
-     */
-    @Override
-    public Map<String, Object> creativeCreate(String accountId, Long adId, JSONObject data) {
-        Map<String, Object> resultMap = new HashMap<>();
-        //1:获取token
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-        data.put("advertiser_id", token.getAccountId());
-        data.put("ad_id", adId);
-        String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2");
-        JSONObject result = HttpUtils.bytedancePostRequest(token.getAccessToken(),url,data);
-        Integer code = result.getInteger("code");
-        String message = result.getString("message");
-        if (null == code || code != 0) {
-            log.info("广告创意创建失败,accountId:{},message:{}", accountId, message);
-            resultMap.put("success", false);
-            resultMap.put("code", -1);
-            resultMap.put("message", "广告计划("+adId+"):"+message);
-            return resultMap;
-        }
-        Thread thread = new Thread(()->getAdvertiserCreative(token, null, null));
-        thread.start();
-
-        resultMap.put("success", true);
-        resultMap.put("code", 0);
-        resultMap.put("message", "广告计划("+adId+"):"+"创意创建成功");
-        return resultMap;
-    }
-    /**
      * 获取创意详细信息
      * @return
      */
@@ -636,10 +505,10 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         //拼接参数
         JSONObject params  = initParams(data);
         JSONArray array = new JSONArray();
-        for(int i=0;i<planIds.size();i++){
+        /*for(int i=0;i<planIds.size();i++){
             Map<String,Object> getData = creativeCreate(accountId+"",planIds.getLong(i),params);
             array.add(getData);
-        }
+        }*/
         Thread thread = new Thread(()->getAdvertiserCreative(token,null, DateUtils.formatDate()));
         thread.start();
         result.put("data",array);

+ 25 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/AdGroupSearchVo.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.bytedance.advertise.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author zianY
+ *获取广告组 入参
+ */
+@Data
+public class AdGroupSearchVo implements Serializable {
+    //广告组ID过滤,数组,不超过100个
+    private String[] ids;
+    //广告组name过滤,长度为1-30个字符,其中1个中文字符算2位
+    private String campaign_name;
+    //广告组推广目的过滤
+    private String landing_type;
+    //广告组状态过滤,默认为返回“所有不包含已删除”,如果要返回所有包含已删除有对应枚举表示
+    private String status;
+    //广告组创建时间,格式yyyy-mm-dd,表示过滤出当天创建的广告组
+    private String campaign_create_time;
+
+
+}

+ 33 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/ByteDanceSearchVo.java

@@ -0,0 +1,33 @@
+package org.jeecg.modules.bytedance.advertise.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author zianY
+ *获取创意里列表 入参
+ */
+@Data
+public class ByteDanceSearchVo implements Serializable {
+    //按照campaign_id过滤
+    private String campaign_id;
+    //按照ad_id过滤
+    private String ad_id;
+    //按照creative_id过滤,最多传100个。创意ID需属于当前广告主,否则会报错
+    private String creative_ids;
+    //按照creative_title过滤,支持模糊搜索。支持的最大长度为30
+    private String creative_title;
+    //按照广告组推广目的过滤
+    private String landing_type;
+    //按照广告计划出价方式过滤
+    private String pricing;
+    //按照创意状态过滤,默认为返回“所有不包含已删除”,如果要返回所有包含已删除有对应枚举表示
+    private String status;
+    //按照创意素材类型过滤
+    private String image_mode;
+    //广告创意创建时间,格式yyyy-MM-dd,表示过滤出当天创建的广告创意
+    private String creative_create_time;
+    //广告创意更新时间,格式yyyy-MM-dd,表示过滤出当天更新的广告创意
+    private String creative_modify_time;
+}

+ 28 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/vo/PlanSearchVo.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.bytedance.advertise.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author zianY
+ *获取广告计划 入参
+ */
+@Data
+public class PlanSearchVo implements Serializable {
+    //按广告计划ID过滤,
+    private String ids;
+    //按广告计划name过滤
+    private String ad_name;
+    //按出价方式过滤
+    private String[] pricing_list;
+    //按计划状态过滤,默认为返回“所有不包含已删除”,如果要返回所有包含已删除有对应枚举表示
+    private String status;
+    //按广告组id过滤
+    private String campaign_id;
+    //广告计划创建时间,格式"yyyy-mm-dd",表示过滤出当天创建的广告计划
+    private String ad_create_time;
+    //广告计划更新时间,格式"yyyy-mm-dd",表示过滤出当天更新的广告计划
+    private String ad_modify_time;
+
+}

+ 34 - 2
jeecg-boot-bytedance/src/main/resources/bytedance_config.properties

@@ -13,21 +13,53 @@ bytedance_auth_url=https://ad.oceanengine.com/openapi
 bytedance_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/bytedance
 bytedance_v2_advertiser_info=/2/advertiser/public_info/
 bytedance_v2_ad_get=/2/ad/get/
+
+
+#创建广告计划
 bytedance_v2_ad_create=/2/ad/create/
+#获取广告计划
+bytedance_v2_ad_get_plan=/2/ad/get/
+#获取计划审核建议
+bytedance_v2_ad_create_reasion=/2/ad/reject_reason/
+#更新计划状态
 bytedance_v2_ad_update_status=/2/ad/update/status/
+
+#更新计划出价
 bytedance_v2_ad_update_bid=/2/ad/update/bid/
-bytedance_v2_ad_update_budget=/2/ad/update/budget/
+
+bytedance_v2_ad_update_budget_plan=/2/ad/update/budget/
+
+#获取账户日预算
+bytedance_v2_ad_get_budget=/2/advertiser/update/budget/
+#更新广告主账号设置的预算类型与预算
+bytedance_v2_ad_update_budget=/2/advertiser/update/budget/
+#查询广告主下存在的的人群包列表和信息
+bytedance_v2_dmp_custom_audience_select=/2/dmp/custom_audience/select/
+#获取创意审核建议
+bytedance_v2_create_reject_reason=/2/creative/reject_reason/
+#获取广告组
 bytedance_v2_campaign_get=/2/campaign/get/
+#创建广告组
 bytedance_v2_campaign_create=/2/campaign/create/
+
+#广告组更新状态
 bytedance_v2_campaign_update_status=/2/campaign/update/status/
+
 bytedance_v2_campaign_update=/2/campaign/update/
-bytedance_v2_dmp_custom_audience_select=/2/dmp/custom_audience/select/
 bytedance_v2_file_video_ad=/2/file/video/ad/
 bytedance_v2_file_image_ad=/2/file/image/ad/
+
+#更改创意状态
 bytedance_v2_creative_update_status=/2/creative/update/status/
+#获取创意素材信息
 bytedance_v2_creative_material_get=/2/creative/material/read/
+#创意详细信息
+bytedance_v2_creative_read=/2/creative/read_v2/
+#创建广告创意
 bytedance_v2_creative_create_v2=/2/creative/create_v2/
+#获取创意列表
 bytedance_v2_creative_get=/2/creative/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/