ソースを参照

转化目标接口调整

yumeng 3 年 前
コミット
c9ddd6fd6b

+ 60 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -578,6 +578,66 @@ public class BatchController {
 
         return result;
 
+
+    }
+
+    @PostMapping(value = "/conversionInfos")
+    public Result<JSONObject> conversionInfos(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONObject>();
+        try {
+
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            Integer sceneCategory = requestJson.getInteger("sceneCategory");
+            Integer campaignType = requestJson.getInteger("campaignType");
+            JSONArray sceneIds = requestJson.getJSONArray("sceneIds");
+            Long appId = requestJson.getLong("appId");
+
+            JSONObject deepConversionJson = iKuaishouInterfaceService.conversionInfos(accountId, token.getAccessToken(), sceneCategory, campaignType, sceneIds, appId);
+            if (Check.isNull(deepConversionJson)) {
+                throw new Exception("深度类型数据返回为空");
+            }
+            result.setSuccess(true);
+            result.setResult(deepConversionJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+@PostMapping(value = "/deepTypes")
+    public Result<JSONObject> deepTypes(@RequestBody JSONObject requestJson) {
+        Result result = new Result<JSONObject>();
+        try {
+
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(token)) {
+                throw new Exception("未获取授权信息");
+            }
+            Integer sceneCategory = requestJson.getInteger("sceneCategory");
+            Integer campaignType = requestJson.getInteger("campaignType");
+            JSONArray sceneIds = requestJson.getJSONArray("sceneIds");
+            Long appId = requestJson.getLong("appId");
+            Integer ocpxActionType = requestJson.getInteger("ocpxActionType");
+
+            JSONObject deepConversionJson = iKuaishouInterfaceService.deepTypes(accountId, token.getAccessToken(), sceneCategory, campaignType, sceneIds, appId,ocpxActionType);
+            if (Check.isNull(deepConversionJson)) {
+                throw new Exception("深度类型数据返回为空");
+            }
+            result.setSuccess(true);
+            result.setResult(deepConversionJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
     }
 
 

+ 26 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -181,6 +181,31 @@ public interface IKuaishouInterfaceService {
      */
     JSONObject getDeepConversionInfosV2(Long advertiserId, String accessToken, Integer campaignType, Long appId);
 
+    /**
+     * 获取浅度转化目标
+     *
+     * @param advertiserId
+     * @param accessToken
+     * @param campaignType
+     * @param appId
+     * @return
+     */
+    JSONObject conversionInfos(Long advertiserId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId);
+
+    /**
+     * 深度转化出价
+     *
+     * @param accountId
+     * @param accessToken
+     * @param sceneCategory
+     * @param campaignType
+     * @param sceneIds
+     * @param appId
+     * @param ocpxActionType
+     * @return
+     */
+    JSONObject deepTypes(Long accountId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId, Integer ocpxActionType);
+
 
     /**
      * 创建广告创意
@@ -469,6 +494,7 @@ public interface IKuaishouInterfaceService {
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
 
     JSONArray getAppNames(Long accountId, String accessToken, JSONArray appIds);
+
 }
 
 

+ 88 - 62
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -10,68 +10,18 @@ import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IMessageTemplate;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.JsonUtil;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouDirectionalPackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
-import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouPopulationGroupService;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyFlows;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.ai.service.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyFlowsService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
-import cn.com.ctop.kuaishou.modules.batch.service.IWarningOperationService;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
-import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
+import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -106,11 +56,7 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -2077,6 +2023,86 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    @Override
+    public JSONObject conversionInfos(Long advertiserId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/gw/dsp/v1/ocpx/ocpxTypes";
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", advertiserId);
+        if (!Check.isNull(campaignType)) {
+            param.put("campaign_type", campaignType);
+        }
+        if (!Check.isNull(appId)) {
+            param.put("app_id", appId);
+        }
+        if (!Check.isNull(sceneCategory)) {
+            param.put("scene_category", sceneCategory);
+        }
+
+        if (!Check.isNull(sceneIds)) {
+            param.put("scene_ids", sceneIds);
+        }
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject returnJson = new JSONObject();
+        try {
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            returnJson = JSONObject.parseObject(result);
+            if (Check.isNull(returnJson)) {
+                returnJson.put("code", -1);
+                returnJson.put("message", "返回信息为空");
+            }
+
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", "系统错误");
+
+        }
+        return returnJson;
+
+    }
+
+    @Override
+    public JSONObject deepTypes(Long accountId, String accessToken, Integer sceneCategory, Integer campaignType, JSONArray sceneIds, Long appId, Integer ocpxActionType) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/gw/dsp/v1/ocpx/deepTypes";
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        if (!Check.isNull(campaignType)) {
+            param.put("campaign_type", campaignType);
+        }
+        if (!Check.isNull(appId)) {
+            param.put("app_id", appId);
+        }
+        if (!Check.isNull(sceneCategory)) {
+            param.put("scene_category", sceneCategory);
+        }
+        if (!Check.isNull(sceneIds)) {
+            param.put("scene_ids", sceneIds);
+        }
+        if (!Check.isNull(ocpxActionType)) {
+            param.put("ocpx_action_type", ocpxActionType);
+        }
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject returnJson = new JSONObject();
+        try {
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+            returnJson = JSONObject.parseObject(result);
+            if (Check.isNull(returnJson)) {
+                returnJson.put("code", -1);
+                returnJson.put("message", "返回信息为空");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", "系统错误");
+
+        }
+        return returnJson;
+    }
+
 
     /**
      * 创建广告创意