|
@@ -193,7 +193,7 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- //检查 发送3次以后拒绝发送
|
|
|
|
|
|
+ //检查过滤账户和项目 flag为1 过滤掉
|
|
private boolean checkThreeRejections(Long accountId) {
|
|
private boolean checkThreeRejections(Long accountId) {
|
|
Long projectId = projectListMapper.getProjectId(accountId);
|
|
Long projectId = projectListMapper.getProjectId(accountId);
|
|
List<Long> ids = projectListMapper.getSpecialProject();
|
|
List<Long> ids = projectListMapper.getSpecialProject();
|
|
@@ -201,9 +201,14 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
//过滤标记 都不发送
|
|
//过滤标记 都不发送
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- List<Long> accountIds = projectListMapper.getBytedanceRefusalSend();
|
|
|
|
- if (!Check.isNull(accountIds)) {
|
|
|
|
- return !accountIds.contains(accountId);
|
|
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //检查广告ID 发送2次以后拒绝发送
|
|
|
|
+ private boolean checkAdSendCounts(Long accountId, Long adId) {
|
|
|
|
+ List<Long> adIds = projectListMapper.getBytedanceRefusalSend(accountId);
|
|
|
|
+ if (!Check.isNull(adIds)) {
|
|
|
|
+ return !adIds.contains(adId);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -267,6 +272,7 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
//深度转化目标出价
|
|
//深度转化目标出价
|
|
String deepConversionBid = detail.getJSONObject("delivery_setting").getString("deep_cpabid");
|
|
String deepConversionBid = detail.getJSONObject("delivery_setting").getString("deep_cpabid");
|
|
|
|
|
|
|
|
+ String pricing = detail.getString("pricing");
|
|
List<JSONObject> advertiserList = new ArrayList<>();
|
|
List<JSONObject> advertiserList = new ArrayList<>();
|
|
if (Check.isNull(cpaBid) && Check.isNull(deepConversionBid)) {
|
|
if (Check.isNull(cpaBid) && Check.isNull(deepConversionBid)) {
|
|
this.checkAdvertiserList(oauthToken, projectId, date, 1, advertiserList);
|
|
this.checkAdvertiserList(oauthToken, projectId, date, 1, advertiserList);
|
|
@@ -275,13 +281,27 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
String statusFirst = adObj.getString("status_first");
|
|
String statusFirst = adObj.getString("status_first");
|
|
//一级状态:PROMOTION_STATUS_ENABLE 投放中
|
|
//一级状态:PROMOTION_STATUS_ENABLE 投放中
|
|
if ("PROMOTION_STATUS_ENABLE".equals(statusFirst)) {
|
|
if ("PROMOTION_STATUS_ENABLE".equals(statusFirst)) {
|
|
- checkLogic("ad", detail, ocpxMap, textMap, deepMap, adObj.getString("cpa_bid"),
|
|
|
|
|
|
+ if (!checkAdSendCounts(detail.getLong("advertiser_id"), adObj.getLong("promotion_id"))) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String bid = adObj.getString("cpa_bid");
|
|
|
|
+ if ("PRICING_CPM".equals(pricing)) {
|
|
|
|
+ bid = adObj.getString("bid");
|
|
|
|
+ }
|
|
|
|
+ checkLogic("ad", detail, ocpxMap, textMap, deepMap, bid,
|
|
adObj.getString("deep_cpabid"), json.getString("projectName"), adObj);
|
|
adObj.getString("deep_cpabid"), json.getString("projectName"), adObj);
|
|
} else if ("PROMOTION_STATUS_DISABLE".equals(statusFirst)) {
|
|
} else if ("PROMOTION_STATUS_DISABLE".equals(statusFirst)) {
|
|
String statusSecond = adObj.getString("status_second");
|
|
String statusSecond = adObj.getString("status_second");
|
|
//除了广告二级状态 已暂停的状态,其他状态都需要预警
|
|
//除了广告二级状态 已暂停的状态,其他状态都需要预警
|
|
if (!"DISABLE_BY_QUOTA".equals(statusSecond)) {
|
|
if (!"DISABLE_BY_QUOTA".equals(statusSecond)) {
|
|
- checkLogic("ad", detail, ocpxMap, textMap, deepMap, adObj.getString("cpa_bid"),
|
|
|
|
|
|
+ if (!checkAdSendCounts(detail.getLong("advertiser_id"), adObj.getLong("promotion_id"))) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String bid = adObj.getString("cpa_bid");
|
|
|
|
+ if ("PRICING_CPM".equals(pricing)) {
|
|
|
|
+ bid = adObj.getString("bid");
|
|
|
|
+ }
|
|
|
|
+ checkLogic("ad", detail, ocpxMap, textMap, deepMap, bid,
|
|
adObj.getString("deep_cpabid"), json.getString("projectName"), adObj);
|
|
adObj.getString("deep_cpabid"), json.getString("projectName"), adObj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -302,6 +322,9 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
Long projectId = detail.getLong("project_id");
|
|
Long projectId = detail.getLong("project_id");
|
|
//广告项目名称
|
|
//广告项目名称
|
|
String projectName = detail.getString("name");
|
|
String projectName = detail.getString("name");
|
|
|
|
+ //广告ID
|
|
|
|
+ Long adId = adObj.getLong("promotion_id");
|
|
|
|
+
|
|
JSONObject data = new JSONObject();
|
|
JSONObject data = new JSONObject();
|
|
//转化目标
|
|
//转化目标
|
|
String ocpxActionType = detail.getJSONObject("optimize_goal").getString("external_action");
|
|
String ocpxActionType = detail.getJSONObject("optimize_goal").getString("external_action");
|
|
@@ -330,9 +353,9 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
} else {
|
|
} else {
|
|
//未查询到转化出价,说明出价不一致,触发出价关停。
|
|
//未查询到转化出价,说明出价不一致,触发出价关停。
|
|
if (!Check.isNull(cpaBid)) {
|
|
if (!Check.isNull(cpaBid)) {
|
|
- /* bidFalg = false;
|
|
|
|
|
|
+ bidFalg = false;
|
|
msgBid.append("[").append(octypeName).append("]目标出价为空");
|
|
msgBid.append("[").append(octypeName).append("]目标出价为空");
|
|
- } else {*/
|
|
|
|
|
|
+ } else {
|
|
BigDecimal cpa = new BigDecimal(cpaBid).multiply(new BigDecimal("1000"));
|
|
BigDecimal cpa = new BigDecimal(cpaBid).multiply(new BigDecimal("1000"));
|
|
BigDecimal ocpx = new BigDecimal(ocpxBid);//本地设置
|
|
BigDecimal ocpx = new BigDecimal(ocpxBid);//本地设置
|
|
if (cpa.compareTo(ocpx) == 1) {
|
|
if (cpa.compareTo(ocpx) == 1) {
|
|
@@ -377,16 +400,16 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
}
|
|
}
|
|
|
|
|
|
if (!typeFalg) { // 出价方式设置非法
|
|
if (!typeFalg) { // 出价方式设置非法
|
|
- String text = getProjectBidTypeText(localProject, accountId, projectId, projectName, adObj.getLong("promotion_id"), adObj.getString("promotion_name"), msgType.toString());
|
|
|
|
- sendMsg(accountId, projectId, text);
|
|
|
|
|
|
+ String text = getProjectBidTypeText(localProject, accountId, projectId, projectName, adId, adObj.getString("promotion_name"), msgType.toString());
|
|
|
|
+ sendMsg(accountId, projectId,adId, text);
|
|
}
|
|
}
|
|
if (!bidFalg) {
|
|
if (!bidFalg) {
|
|
- String text = getProjectOverBidMessage(localProject, accountId, projectId, projectName, adObj.getLong("promotion_id"), adObj.getString("promotion_name"), msgBid.toString());
|
|
|
|
- sendMsg(accountId, projectId, text);
|
|
|
|
|
|
+ String text = getProjectOverBidMessage(localProject, accountId, projectId, projectName, adId, adObj.getString("promotion_name"), msgBid.toString());
|
|
|
|
+ sendMsg(accountId, projectId,adId, text);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void sendMsg(Long accountId, Long projectId, String text) {
|
|
|
|
|
|
+ private void sendMsg(Long accountId, Long projectId,Long adId, String text) {
|
|
try {
|
|
try {
|
|
MediaSendAlarmRecord record = new MediaSendAlarmRecord(accountId, "1", text);
|
|
MediaSendAlarmRecord record = new MediaSendAlarmRecord(accountId, "1", text);
|
|
record.setProjectId(projectId);
|
|
record.setProjectId(projectId);
|
|
@@ -402,9 +425,9 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
projectListMapper.insertSendRecord(record);
|
|
projectListMapper.insertSendRecord(record);
|
|
//当前已发送次数
|
|
//当前已发送次数
|
|
|
|
|
|
- Integer i = projectListMapper.getrefusalAccountCounts(accountId);
|
|
|
|
|
|
+ Integer i = projectListMapper.getrefusalAccountCounts(accountId,adId);
|
|
//更新计数
|
|
//更新计数
|
|
- projectListMapper.insertSendAccountId(accountId, (Check.isNull(i) ? 0 : i) + 1);
|
|
|
|
|
|
+ projectListMapper.insertSendAccountId(accountId, adId,(Check.isNull(i) ? 0 : i) + 1);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|