|
@@ -2,12 +2,17 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
-import cn.com.ctop.common.module.utils.*;
|
|
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
|
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
|
+import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
|
|
+import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
|
|
import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
|
|
import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
|
|
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
|
|
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -226,7 +231,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId) {
|
|
|
|
|
|
+ public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount, Long accountExploreId) {
|
|
KuaishouGroupSpeedExploreLog groupSpeedExploreLog = new KuaishouGroupSpeedExploreLog();
|
|
KuaishouGroupSpeedExploreLog groupSpeedExploreLog = new KuaishouGroupSpeedExploreLog();
|
|
groupSpeedExploreLog.setAccountExploreId(accountExploreId);
|
|
groupSpeedExploreLog.setAccountExploreId(accountExploreId);
|
|
groupSpeedExploreLog.setAccountId(accountId);
|
|
groupSpeedExploreLog.setAccountId(accountId);
|
|
@@ -247,7 +252,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
|
|
String message = resultJson.getString("message");
|
|
String message = resultJson.getString("message");
|
|
groupSpeedExploreLog.setStatus(code);
|
|
groupSpeedExploreLog.setStatus(code);
|
|
groupSpeedExploreLog.setMessage(message);
|
|
groupSpeedExploreLog.setMessage(message);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
groupSpeedExploreLog.setStatus(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getCode());
|
|
groupSpeedExploreLog.setStatus(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getCode());
|
|
groupSpeedExploreLog.setMessage(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getDesc());
|
|
groupSpeedExploreLog.setMessage(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getDesc());
|
|
}
|
|
}
|
|
@@ -264,5 +269,46 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
|
|
//1:查询此账户下设置了加速探索的组
|
|
//1:查询此账户下设置了加速探索的组
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result<Object> adUnitExploreSupport(JSONObject data) {
|
|
|
|
+ try {
|
|
|
|
+ Long accountId = data.getLong("accountId");
|
|
|
|
+ if (Check.isNull(accountId)) {
|
|
|
|
+ return Result.error("请选择广告主");
|
|
|
|
+ }
|
|
|
|
+ JSONArray supportUnitIds = data.getJSONArray("supportUnitIds");
|
|
|
|
+ if (Check.isNull(supportUnitIds)) {
|
|
|
|
+ return Result.error("请填写辅助探索广告组集");
|
|
|
|
+ }
|
|
|
|
+ Long unitId = data.getLong("unitId");
|
|
|
|
+ if (Check.isNull(unitId)) {
|
|
|
|
+ return Result.error("请填写要设置辅助探索的广告组");
|
|
|
|
+ }
|
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
|
+ String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_UNIT_EXPLORE_SUPPORT;
|
|
|
|
+ Map<String, String> header = new HashMap<>();
|
|
|
|
+ header.put("Access-Token", token.getAccessToken());
|
|
|
|
+ header.put("Content-Type", "application/json");
|
|
|
|
+ JSONObject params = new JSONObject();
|
|
|
|
+ params.put("advertiser_id", accountId);
|
|
|
|
+ params.put("support_unit_ids", supportUnitIds);
|
|
|
|
+ params.put("unit_id", unitId);
|
|
|
|
+ String result = HttpUtils.httpPostRequest(url, params, header);
|
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+ if (!Check.isNull(resultJson)) {
|
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ return Result.ok(resultJson.getJSONObject("data"));
|
|
|
|
+ } else {
|
|
|
|
+ log.info("辅助探索失败,accountId:{},返回信息:{}", accountId, resultJson);
|
|
|
|
+ return Result.error("辅助探索失败," + resultJson.getString("message"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("辅助探索失败", e);
|
|
|
|
+ }
|
|
|
|
+ return Result.error("辅助探索失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|