|
@@ -8,18 +8,68 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
|
import cn.com.ctop.common.module.service.IMaterialCutFrameService;
|
|
|
import cn.com.ctop.common.module.service.IOauthConfigService;
|
|
|
import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
-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.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.kuaishou.modules.batch.entity.vo.ConvertVo;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.mapper.*;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
|
+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.material.entity.KuaishouResult;
|
|
|
import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
|
|
|
-import cn.com.ctop.kuaishou.modules.report.entity.*;
|
|
|
+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.mapper.KuaishouReportDailyAccountMapper;
|
|
|
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
|
|
|
-import cn.com.ctop.kuaishou.modules.report.service.*;
|
|
|
+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 com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -54,7 +104,11 @@ import java.io.IOException;
|
|
|
import java.lang.reflect.ParameterizedType;
|
|
|
import java.lang.reflect.Type;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
@@ -165,6 +219,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
}
|
|
|
JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
|
if (null == details || details.size() <= 0) {
|
|
|
+ log.error("快手时报返回详情为空,accountId:{}", token.getAccountId());
|
|
|
return;
|
|
|
}
|
|
|
List<KuaishouReportHourlyAccount> addList = new ArrayList<>();
|
|
@@ -181,6 +236,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
addList.add(kuaishouReportHourlyAccount);
|
|
|
}
|
|
|
hourlyAccountService.replaceBatch(addList);
|
|
|
+ log.info("获取账户时报数据完成,accountId:{}", token.getAccountId());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -222,9 +278,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
|
|
|
return;
|
|
|
}
|
|
|
- Boolean doGet = true;
|
|
|
- if (details.size() < page_size) {
|
|
|
- doGet = false;
|
|
|
+ Boolean toGet = false;
|
|
|
+ if (details.size() >= page_size) {
|
|
|
+ toGet = true;
|
|
|
}
|
|
|
|
|
|
List<KuaiShouVideoGet> videoGetList = new ArrayList<>();
|
|
@@ -270,16 +326,17 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
if (!Check.isNull(videoGetList)) {
|
|
|
videoGetService.replaceBatch(videoGetList);
|
|
|
}
|
|
|
- if (doGet) {
|
|
|
+
|
|
|
+ if (toGet) {
|
|
|
getVideoListByPage(token, startDate, endDate, page + 1);
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void getCut(String token, Long accountId, String signature, String photo_id) {
|
|
|
cutExecutorService.submit(new Runnable() {
|
|
|
@Override
|
|
@@ -290,6 +347,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public void getAdvertiserReportDaily(CtopOauthToken token, Date startDate, Date endDate, String reportDims) {
|
|
|
try {
|
|
@@ -978,7 +1036,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- if (code == 400001 && "/rest/openapi/v2/ad_unit/create调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
|
|
|
+ if (code == 400001 && resultJson.getString("message").equals("/rest/openapi/v2/ad_unit/create调用已超日限,次日可恢复调用")) {
|
|
|
String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
String key = advertiserId + "_" + nowDate + "unit_create_overrun";
|
|
|
redisUtil.set(key, 1, 60 * 60 * 24);
|
|
@@ -1197,6 +1255,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IRuleKuaiShouPlanService ruleKuaiShouPlanService;
|
|
|
+
|
|
|
private void getGroupListByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
|
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
|
|
|
JSONObject param = new JSONObject();
|
|
@@ -1227,128 +1288,163 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
return;
|
|
|
}
|
|
|
addGroup(token.getAccountId(), details);
|
|
|
+ // ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
|
|
|
getGroupListByPage(token, startDate, endDate, page + 1);
|
|
|
}
|
|
|
|
|
|
static ExecutorService executorBidTypeService = Executors.newFixedThreadPool(20);
|
|
|
static ExecutorService executorMaxBidService = Executors.newFixedThreadPool(5);
|
|
|
|
|
|
- private void addGroup(Long advertiserId, JSONArray details) {
|
|
|
- JSONObject json = warningOperationService.getBidTypeAndMaxBid(advertiserId);
|
|
|
- Long maxBid = json.getLong("maxBid");// 最高出价
|
|
|
- String bidTypeStr = json.getString("bidType"); // 出价方式
|
|
|
- JSONArray bidTypeArr = JSONArray.parseArray(bidTypeStr);
|
|
|
- String ocpxActionTypeStr = json.getString("ocpxActionType"); // 优化目标
|
|
|
- JSONArray ocpxArr = JSONArray.parseArray(ocpxActionTypeStr);
|
|
|
- if (!Check.isNull(details)) {
|
|
|
- List<KuaiShouGroup> groups = new ArrayList<>();
|
|
|
- for (int i = 0; i < details.size(); i++) {
|
|
|
- JSONObject detail = JSONObject.parseObject(details.get(i).toString());
|
|
|
- if (!Check.isNull(detail)) {
|
|
|
- Integer bid_type = detail.getInteger("bid_type");
|
|
|
- Long bid = detail.getLong("bid");
|
|
|
- Long cpa_bid = detail.getLong("cpa_bid");
|
|
|
- Long day_budget = detail.getLong("day_budget");
|
|
|
- Integer ocpx_action_type = detail.getInteger("ocpx_action_type");
|
|
|
- Long unitId = detail.getLong("unit_id");
|
|
|
- String unit_name = detail.getString("unit_name");
|
|
|
- Integer status = detail.getInteger("status");
|
|
|
- Integer put_status = detail.getInteger("put_status");
|
|
|
- if (put_status == 1) { // 组状态为 投放中的
|
|
|
- if (status != 15) { // 广告组状态为非暂停
|
|
|
- Boolean bidTypeTrueOrFalse = false;
|
|
|
- for (int j = 0; j < bidTypeArr.size(); j++) {
|
|
|
- Integer bidType = (Integer) bidTypeArr.get(j);
|
|
|
- if (bidType.equals(bid_type)) {
|
|
|
- bidTypeTrueOrFalse = true;
|
|
|
- break;
|
|
|
+ private void addGroup(Long accountId, JSONArray details) {
|
|
|
+ JSONObject project = warningOperationService.getBidTypeAndMaxBid(accountId);
|
|
|
+ if (Check.isNull(project) || Check.isNull(details)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 最高出价
|
|
|
+ Long maxBid = project.getLong("maxBid");
|
|
|
+
|
|
|
+ //优化目标集
|
|
|
+ List<Integer> bidList = null;
|
|
|
+ String bidTypeStr = project.getString("bidType");
|
|
|
+ if (!Check.isNull(bidTypeStr)) {
|
|
|
+ bidList = JSONArray.parseArray(bidTypeStr, Integer.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ //转化目标map
|
|
|
+ Map<Integer, Long> ocpxMap = new HashMap<>();
|
|
|
+ String ocpxTypeStr = project.getString("ocpxActionType");
|
|
|
+ if (!Check.isNull(ocpxTypeStr)) {
|
|
|
+ JSONArray ocpxArr = JSONArray.parseArray(ocpxTypeStr);
|
|
|
+ for (int i = 0; i < ocpxArr.size(); i++) {
|
|
|
+ JSONObject obj = ocpxArr.getJSONObject(i);
|
|
|
+ ocpxMap.put(obj.getInteger("ocpxCode"), obj.getLong("maxValue"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //深度转化目标map
|
|
|
+ Map<Integer, Long> deepMap = new HashMap<>();
|
|
|
+ String deepTypeStr = project.getString("deepConversionType");
|
|
|
+ if (!Check.isNull(deepTypeStr)) {
|
|
|
+ JSONArray deepArr = JSONArray.parseArray(deepTypeStr);
|
|
|
+ for (int i = 0; i < deepArr.size(); i++) {
|
|
|
+ JSONObject obj = deepArr.getJSONObject(i);
|
|
|
+ ocpxMap.put(obj.getInteger("deepCode"), obj.getLong("deepValue"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<KuaiShouGroup> groups = new ArrayList<>();
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
+ JSONObject detail = JSONObject.parseObject(details.get(i).toString());
|
|
|
+ if (!Check.isNull(detail)) {
|
|
|
+ //优化目标
|
|
|
+ Integer bidType = detail.getInteger("bid_type");
|
|
|
+ //优化出价(只有单击时,才有值)
|
|
|
+ Long bid = detail.getLong("bid");
|
|
|
+ //转化目标
|
|
|
+ Integer ocpxActionType = detail.getInteger("ocpx_action_type");
|
|
|
+ //转化目标出价
|
|
|
+ Long cpaBid = detail.getLong("cpa_bid");
|
|
|
+ //深度转化目标
|
|
|
+ Integer deepConversionType = detail.getInteger("deep_conversion_type");
|
|
|
+ //深度转化目标出价
|
|
|
+ Long deepConversionBid = detail.getLong("deep_conversion_bid");
|
|
|
+ //单日预算
|
|
|
+ Long dayBudget = detail.getLong("day_budget");
|
|
|
+ //组ID
|
|
|
+ Long unitId = detail.getLong("unit_id");
|
|
|
+ //组名称
|
|
|
+ String unitName = detail.getString("unit_name");
|
|
|
+ //状态
|
|
|
+ Integer status = detail.getInteger("status");
|
|
|
+ //投放状态
|
|
|
+ Integer putStatus = detail.getInteger("put_status");
|
|
|
+ if (putStatus == 1 && status != 15) { // 组状态为 投放中的 and 广告组状态为非暂停
|
|
|
+ Boolean typeFalg = true;
|
|
|
+ Boolean bidFalg = true;
|
|
|
+
|
|
|
+ //优化目标
|
|
|
+ if (!bidList.isEmpty()) {
|
|
|
+ if (!bidList.contains(bidType)) {
|
|
|
+ //项目不包含该优化目标,则关停
|
|
|
+ typeFalg = false;
|
|
|
+ } else if (bidType == 2 && bid > maxBid) {
|
|
|
+ //若优化目标为2点击数,并且广告组出价大于项目设置最大出价,则关停
|
|
|
+ bidFalg = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //转化目标
|
|
|
+ if (!Check.isNull(ocpxActionType) && ocpxActionType != 0) {
|
|
|
+ //!=0是设置过转化目标
|
|
|
+ if (!Check.isNullMap(ocpxMap)) {
|
|
|
+ Long ocpxBid = ocpxMap.get(ocpxActionType);
|
|
|
+ if (Check.isNull(ocpxBid)) {
|
|
|
+ if (ocpxActionType == 2 && dayBudget != 0 && dayBudget <= 500 * 1000) {
|
|
|
+ // 转化目标为2行为数,并且预算小于等于500且不是不限,则允许启动
|
|
|
+ typeFalg = true;
|
|
|
+ }else{
|
|
|
+ //通过key未获取值,说明不包含该目标,进行关停
|
|
|
+ typeFalg = false;
|
|
|
}
|
|
|
- }
|
|
|
- Boolean ocpxTrueOrFalse = false;
|
|
|
- if (ocpx_action_type == 0) {
|
|
|
- ocpxTrueOrFalse = true;
|
|
|
} else {
|
|
|
- for (int j = 0; j < ocpxArr.size(); j++) {
|
|
|
- Integer ocpxActionType = (Integer) ocpxArr.get(j);
|
|
|
- if (ocpxActionType.equals(ocpx_action_type)) {
|
|
|
- ocpxTrueOrFalse = true;
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (cpaBid > ocpxBid) {
|
|
|
+ //组转化出价 大于 项目设置最大转化出价,则关停
|
|
|
+ bidFalg = false;
|
|
|
}
|
|
|
}
|
|
|
+ }else if (ocpxActionType == 2 && (dayBudget == 0 || dayBudget > 500 * 1000)) {
|
|
|
+ // 转化目标为2行为数,并且预算大于500 或者不限,则关停
|
|
|
+ typeFalg = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- if (!bidTypeTrueOrFalse || !ocpxTrueOrFalse) { // 出价方式设置非法
|
|
|
- if (day_budget > 500 * 1000 || day_budget == 0) { // 预算大于500 或者不限制预算 需要发送通知 并且进行暂停操作
|
|
|
- executorBidTypeService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- warningOperationService.kuaiShouWarningOperation(json.getLong("projectId"), json.getString("projectName"), advertiserId, unitId, unit_name);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- if (bid > maxBid || cpa_bid > maxBid) {
|
|
|
- executorMaxBidService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- warningOperationService.kuaiShouBidWarningOperation(json.getLong("projectId"), json.getString("projectName"), advertiserId, unitId, unit_name);
|
|
|
- }
|
|
|
- });
|
|
|
+ //转化目标
|
|
|
+ if (!Check.isNull(deepConversionType) && deepConversionType != 0 && !deepMap.isEmpty()) {
|
|
|
+ Long deepBid = deepMap.get(deepConversionType);
|
|
|
+ if (Check.isNull(deepBid)) {
|
|
|
+ //通过key未获取值,说明不包含该目标,进行关停
|
|
|
+ typeFalg = false;
|
|
|
+ } else {
|
|
|
+ if (deepConversionBid > deepBid) {
|
|
|
+ //组深度转化出价 大于 项目设置最大转化出价,则关停
|
|
|
+ bidFalg = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- KuaiShouGroup group = new KuaiShouGroup();
|
|
|
- group.setId("" + advertiserId + unitId);
|
|
|
- group.setAccountId(advertiserId);
|
|
|
- group.setCampaignId(detail.getLong("campaign_id"));
|
|
|
- group.setUnitId(unitId);
|
|
|
- group.setUnitName(unit_name);
|
|
|
- group.setStatus(status);
|
|
|
- group.setPutStatus(put_status);
|
|
|
- group.setStudyStatus(detail.getInteger("study_status"));
|
|
|
- group.setCreateChannel(detail.getInteger("create_channel"));
|
|
|
- group.setReviewDetail(detail.getString("review_detail"));
|
|
|
- group.setBidType(bid_type);
|
|
|
- group.setBid(bid);
|
|
|
- group.setStudyStatus(detail.getInteger("study_status"));
|
|
|
- group.setCpaBid(cpa_bid);
|
|
|
- group.setOcpxActionType(ocpx_action_type);
|
|
|
- group.setDeepConversionType(detail.getInteger("deep_conversion_type"));
|
|
|
- group.setDeepConversionBid(detail.getLong("deep_conversion_bid"));
|
|
|
- group.setDayBudget(day_budget);
|
|
|
- group.setSpeed(detail.getInteger("speed"));
|
|
|
- group.setBeginTime(detail.getString("begin_time"));
|
|
|
- group.setEndTime(detail.getString("end_time"));
|
|
|
- group.setScheduleTime(detail.getString("schedule_time"));
|
|
|
- group.setSceneId(detail.getJSONArray("scene_id") + "");
|
|
|
- group.setShowMode(detail.getInteger("show_mode"));
|
|
|
- group.setUnitType(detail.getInteger("unit_type"));
|
|
|
- group.setUrlType(detail.getInteger("url_type"));
|
|
|
- group.setUrl(detail.getString("url"));
|
|
|
- group.setSchemaUri(detail.getString("schema_uri"));
|
|
|
- group.setAppId(detail.getLong("app_id"));
|
|
|
- group.setAppIconUrl(detail.getString("app_icon_url"));
|
|
|
- group.setGroupCreateTime(detail.getString("create_time"));
|
|
|
- group.setGroupUpdateTime(detail.getString("update_time"));
|
|
|
- group.setConvertId(detail.getLong("convert_id"));
|
|
|
- group.setUseAppMarket(detail.getInteger("use_app_market"));
|
|
|
- group.setAppStore(detail.getJSONArray("app_store") + "");
|
|
|
- group.setCreateTime(new Date());
|
|
|
- group.setUpdateTime(new Date());
|
|
|
- groups.add(group);
|
|
|
- // 添加应用信息
|
|
|
- }
|
|
|
- }
|
|
|
- if (!Check.isNull(groups)) {
|
|
|
- try {
|
|
|
- Thread.sleep(200L);
|
|
|
- groupMapper.replaceBatch(groups);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if (!typeFalg) { // 出价方式设置非法
|
|
|
+ executorBidTypeService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ warningOperationService.kuaiShouWarningOperation(project.getLong("projectId"), project.getString("projectName"), accountId, unitId, unitName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!bidFalg) {
|
|
|
+ executorMaxBidService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ warningOperationService.kuaiShouBidWarningOperation(project.getLong("projectId"), project.getString("projectName"), accountId, unitId, unitName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ KuaiShouGroup group = JSONObject.parseObject(detail.toJSONString(), KuaiShouGroup.class);
|
|
|
+ group.setId("" + accountId + unitId);
|
|
|
+ group.setAccountId(accountId);
|
|
|
+ group.setGroupCreateTime(detail.getString("create_time"));
|
|
|
+ group.setGroupUpdateTime(detail.getString("update_time"));
|
|
|
+ group.setCreateTime(new Date());
|
|
|
+ group.setUpdateTime(new Date());
|
|
|
+ groups.add(group);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!Check.isNull(groups)) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(200L);
|
|
|
+ groupMapper.replaceBatch(groups);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1901,13 +1997,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
|
if (!Check.isNullMap(dataJson)) {
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
- returnJson.put("isAdWatch5times", dataJson.getInteger("is_ad_watch_5_times"));
|
|
|
- returnJson.put("isAdWatch20times", dataJson.getInteger("is_ad_watch_20_times"));
|
|
|
- returnJson.put("isAdWatch10Times", dataJson.getInteger("is_ad_watch_10_times"));
|
|
|
- returnJson.put("isSevenDayRoi", dataJson.getInteger("is_seven_day_roi"));
|
|
|
- returnJson.put("isAppointJumpClick", dataJson.getInteger("is_appoint_jump_click"));
|
|
|
- returnJson.put("isEventWeekPayTimes", dataJson.getInteger("is_event_week_pay_times"));
|
|
|
- returnJson.put("isAppointForm", dataJson.getInteger("is_appoint_form"));
|
|
|
returnJson.put("isActivate", dataJson.getInteger("is_activate"));
|
|
|
returnJson.put("isFormSubmit", dataJson.getInteger("is_form_submit"));
|
|
|
returnJson.put("isCreditGrant", dataJson.getInteger("is_credit_grant"));
|
|
@@ -1919,10 +2008,16 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
returnJson.put("isOrderSubmit", dataJson.getInteger("is_order_submit"));
|
|
|
returnJson.put("isAddWechat", dataJson.getInteger("is_add_wechat"));
|
|
|
returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
|
|
|
- returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
|
|
|
returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
|
|
|
+ returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
|
|
|
returnJson.put("isOrderPaied", dataJson.getInteger("is_order_paied"));
|
|
|
+ returnJson.put("isEventWeekPayTimes", dataJson.getInteger("is_event_week_pay_times"));
|
|
|
returnJson.put("isKeyAction", dataJson.getInteger("is_key_action"));
|
|
|
+ returnJson.put("isAppointForm", dataJson.getInteger("is_appoint_form"));
|
|
|
+ returnJson.put("isSevenDayRoi", dataJson.getInteger("is_seven_day_roi"));
|
|
|
+ returnJson.put("isAdWatch10Times", dataJson.getInteger("is_ad_watch_10_times"));
|
|
|
+ returnJson.put("isAdWatch20Times", dataJson.getInteger("is_ad_watch_20_times"));
|
|
|
+ returnJson.put("isAdWatch5Times", dataJson.getInteger("is_ad_watch_5_times"));
|
|
|
|
|
|
JSONArray deep_conversion_types = dataJson.getJSONArray("deep_conversion_types");
|
|
|
JSONArray deepConversionTypes = new JSONArray();
|
|
@@ -2080,15 +2175,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
if (code == 0) {
|
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
|
if (!Check.isNull(dataJson)) {
|
|
|
- JSONArray addCreativeIds = dataJson.getJSONArray("add_creative_ids");
|
|
|
- if (!Check.isNull(addCreativeIds)) {
|
|
|
+ JSONArray add_creative_ids = dataJson.getJSONArray("add_creative_ids");
|
|
|
+ if (!Check.isNull(add_creative_ids)) {
|
|
|
Thread thread = new Thread() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try {
|
|
|
Thread.sleep(100);
|
|
|
- getCreativeByCreativeIds(accessToken, advertiserId, addCreativeIds);
|
|
|
- createLandPageAndUnit(requestJson, addCreativeIds);
|
|
|
+ getCreativeByCreativeIds(accessToken, advertiserId, add_creative_ids);
|
|
|
+ createLandPageAndUnit(requestJson, add_creative_ids);
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -2102,8 +2197,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
returnMap.put("code", 0);
|
|
|
returnMap.put("message", "success");
|
|
|
returnMap.put("success", true);
|
|
|
- returnMap.put("count", addCreativeIds.size());
|
|
|
- returnMap.put("ids",addCreativeIds);
|
|
|
+ returnMap.put("count", add_creative_ids.size());
|
|
|
+ returnMap.put("ids", add_creative_ids);
|
|
|
}
|
|
|
} else {
|
|
|
if (code == 500000 && count <= 4) {
|
|
@@ -2868,6 +2963,97 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
private IKuaiShouVideoGetService videoGetService;
|
|
|
static ExecutorService suZhaoService = Executors.newFixedThreadPool(15);
|
|
|
|
|
|
+ /* @Override
|
|
|
+ public void getSuZaoList(String token, Long accountId, int page, String startDate, String endDate) {
|
|
|
+ String url = "https://ad.e.kuaishou.com/rest/openapi/v1/ad_creator/video/list";
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
+ headers.put("Access-Token", token);
|
|
|
+ Map<String, Object> param = new HashMap<String, Object>();
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
+ param.put("page", page);
|
|
|
+ param.put("page_size", 200);
|
|
|
+ if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
|
|
|
+ param.put("start_date", startDate);
|
|
|
+ param.put("end_date", endDate);
|
|
|
+ }
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
+ System.err.println(resultJson);
|
|
|
+ if (Check.isNull(resultJson)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
+ String message = resultJson.getString("message");
|
|
|
+ if (null == code || code != 0) {
|
|
|
+ log.error("获取快手素造列表数据异常:{},accountId:{}", message, accountId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject dataJson = resultJson.getJSONObject("data");
|
|
|
+ if (Check.isNull(dataJson)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONArray details = dataJson.getJSONArray("details");
|
|
|
+ if (Check.isNull(details)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<KuaiShouVideoGet> videoGetList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
+ JSONObject detailJson = details.getJSONObject(i);
|
|
|
+ if (Check.isNull(detailJson)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
|
|
|
+ String photo_id = detailJson.getString("photo_id");
|
|
|
+ videoGet.setId(accountId + photo_id);
|
|
|
+ videoGet.setAccountId(accountId);
|
|
|
+ videoGet.setCoverUrl(detailJson.getString("cover_url"));
|
|
|
+ videoGet.setPhotoId(photo_id);
|
|
|
+ videoGet.setPhotoName(detailJson.getString("photo_name"));
|
|
|
+ videoGet.setStatDate(detailJson.getDate("upload_time"));
|
|
|
+ String signature = detailJson.getString("signature");
|
|
|
+ videoGet.setSignature(signature);
|
|
|
+ Integer source = detailJson.getInteger("source");
|
|
|
+ if (source == 2) {
|
|
|
+ videoGet.setChannelType(1);
|
|
|
+ } else {
|
|
|
+ videoGet.setChannelType(0);
|
|
|
+ }
|
|
|
+ Integer new_status = detailJson.getInteger("new_status");
|
|
|
+ if (new_status == 1) {
|
|
|
+ videoGet.setStatus(0);
|
|
|
+ } else {
|
|
|
+ videoGet.setStatus(1);
|
|
|
+ }
|
|
|
+ videoGet.setUrl(detailJson.getString("url"));
|
|
|
+ Integer width = detailJson.getInteger("width");
|
|
|
+ videoGet.setWidth(width);
|
|
|
+ Integer height = detailJson.getInteger("height");
|
|
|
+ videoGet.setHeight(height);
|
|
|
+ Integer type = MaterialEnum.getTypeBySize(width, height);
|
|
|
+ if (!Check.isNull(type)) {
|
|
|
+ videoGet.setMaterialType(type);
|
|
|
+ }
|
|
|
+ videoGetList.add(videoGet);
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ videoGetService.getKeyFrame(token, accountId, signature, photo_id);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
+ }
|
|
|
+ if (!Check.isNull(videoGetList)) {
|
|
|
+ videoGetService.replaceBatch(videoGetList);
|
|
|
+ }
|
|
|
+
|
|
|
+ getSuZaoList(token, accountId, page + 1, startDate, endDate);
|
|
|
+
|
|
|
+ }*/
|
|
|
+
|
|
|
@Autowired
|
|
|
private IMaterialCutFrameService cutFrameService;
|
|
|
private static ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
@@ -2884,6 +3070,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("advertiser_id", accountId);
|
|
|
param.put("page_size", 200);
|
|
|
+
|
|
|
+ /* Map<String, Object> deleteMap = new HashMap<>();
|
|
|
+ deleteMap.put("account_id", accountId);
|
|
|
+ deleteMap.put("campaign_id", campaignId);
|
|
|
+ creativeService.removeByMap(deleteMap);*/
|
|
|
QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
|
|
|
groupQueryWrapper.eq("account_id", accountId);
|
|
|
groupQueryWrapper.eq("campaign_id", campaignId);
|
|
@@ -2998,6 +3189,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
e.printStackTrace();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3182,11 +3375,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
appList.setAppId(dataJson.getLong("app_id"));
|
|
|
appList.setAppVersion(dataJson.getString("app_version"));
|
|
|
appList.setAppName(dataJson.getString("app_name"));
|
|
|
- appList.setAppPrivacyUrl(dataJson.getString("app_privacy_url"));
|
|
|
appList.setAppIconUrl(dataJson.getString("app_icon_url"));
|
|
|
appList.setImageToken(dataJson.getString("image_token"));
|
|
|
appList.setPackageName(dataJson.getString("package_name"));
|
|
|
appList.setReturnTime(DateUtils.timeStamp2Date(dataJson.getTimestamp("update_time")));
|
|
|
+ appList.setAppPrivacyUrl(dataJson.getString("app_privacy_url"));
|
|
|
addList.add(appList);
|
|
|
}
|
|
|
}
|