|
|
@@ -100,12 +100,20 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
log.info("此账户已进行授权失效通知,此次通知跳过。accountId:{}", accountId);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ JSONObject accountInfo = projectListMapper.getAccountInfo(accountId);
|
|
|
+ if (Check.isNull(accountInfo)) {
|
|
|
+ log.info("此账户未授权或暂停投放,此次通知跳过。accountId:{}", accountId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String userName = accountInfo.getString("userName");
|
|
|
+ String projectName = accountInfo.getString("projectName");
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
- text.append("您的账户ID:");
|
|
|
- text.append(accountId);
|
|
|
- text.append("<br/>");
|
|
|
- text.append("当前授权已失效,无法进行预警和拉取投放数据。");
|
|
|
- text.append("<br/>");
|
|
|
+ text.append("您的账户ID:").append(accountId).append("<br/>");
|
|
|
+ text.append("所属项目:").append(projectName).append("<br/>");
|
|
|
+ text.append("所属运营:").append(userName).append("<br/>");
|
|
|
+ text.append("当前授权已失效,无法进行预警和拉取投放数据。").append("<br/>");
|
|
|
text.append("请及时前往有腾重新进行授权!");
|
|
|
List<JSONObject> list = projectListMapper.getLeaderByAccountId(accountId);
|
|
|
for (JSONObject object : list) {
|
|
|
@@ -263,18 +271,18 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ String status = null;
|
|
|
if (!typeFalg || !bidFalg) {
|
|
|
- this.updProjectStatus(token, accountId, projectId, "DISABLE");
|
|
|
+ status = this.updProjectStatus(token, accountId, projectId, "DISABLE");
|
|
|
}
|
|
|
|
|
|
if (!typeFalg) { // 出价方式设置非法
|
|
|
- String text = getProjectBidTypeText(json.getString("projectName"), accountId, projectId, projectName, null, null, msgType.toString());
|
|
|
+ String text = getProjectBidTypeText(json.getString("projectName"), accountId, projectId, projectName, null, null, msgType.toString(), status);
|
|
|
sendMsg(accountId, text);
|
|
|
}
|
|
|
|
|
|
if (!bidFalg) {
|
|
|
- String text = getProjectOverBidMessage(json.getString("projectName"), accountId, projectId, projectName, null, null, msgBid.toString());
|
|
|
+ String text = getProjectOverBidMessage(json.getString("projectName"), accountId, projectId, projectName, null, null, msgBid.toString(), status);
|
|
|
sendMsg(accountId, text);
|
|
|
}
|
|
|
}
|
|
|
@@ -344,7 +352,7 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public synchronized void updProjectStatus(String token, Long accountId, Long projectId, String disable) {
|
|
|
+ public synchronized String updProjectStatus(String token, Long accountId, Long projectId, String disable) {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("advertiser_id", accountId);
|
|
|
JSONObject data = new JSONObject();
|
|
|
@@ -361,12 +369,13 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
String redisKey = "warning_" + accountId + "_" + projectId;
|
|
|
redisUtil.set(redisKey, projectId, 10 * 60);
|
|
|
projectListMapper.addLog(accountId, projectId, "stop");
|
|
|
+ return "关停成功";
|
|
|
} else {
|
|
|
log.error("预警关停计划失败,accountId:{},projectId:{}, result:{}", accountId, projectId, object);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- System.err.println(object);
|
|
|
+ return "关停失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -394,7 +403,7 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
|
|
|
|
|
|
//转化方式错误消息生成
|
|
|
- private String getProjectBidTypeText(String projectName, Long advertiserId, Long unitId, String unit_name, Long adId, String adName, String msgType) {
|
|
|
+ private String getProjectBidTypeText(String projectName, Long advertiserId, Long unitId, String unit_name, Long adId, String adName, String msgType, String status) {
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
text.append("出价方式错误预警").append("<br/>")
|
|
|
.append("您本地的项目:").append(projectName).append("<br/>")
|
|
|
@@ -404,12 +413,13 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
if (!Check.isNull(adId)) {
|
|
|
text.append("广告id:").append(adId).append("<br/>").append("广告名称:").append(adName).append("<br/>");
|
|
|
}
|
|
|
+ text.append("关停项目说明:").append(status).append("<br/>");
|
|
|
text.append("错误说明:").append("<br/>").append(msgType).append("<br/>").append("请您及时查看并处理!");
|
|
|
return text.toString();
|
|
|
}
|
|
|
|
|
|
//出价过高预警消息生成
|
|
|
- private String getProjectOverBidMessage(String projectName, Long accountId, Long planId, String planName, Long adId, String adName, String msgBid) {
|
|
|
+ private String getProjectOverBidMessage(String projectName, Long accountId, Long planId, String planName, Long adId, String adName, String msgBid, String status) {
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
text.append("出价过高预警").append("<br/>")
|
|
|
.append("您本地的项目:").append(projectName).append("<br/>")
|
|
|
@@ -422,7 +432,11 @@ public class BytedanceProjectServiceImpl implements IBytedanceProjectService {
|
|
|
if (!msgBid.contains("出价为空")) {
|
|
|
text.append("出价过高说明:").append("<br/>");
|
|
|
}
|
|
|
+ text.append("关停项目说明:").append(status).append("<br/>");
|
|
|
text.append(msgBid).append("<br/>").append("请您及时查看并处理!");
|
|
|
+
|
|
|
return text.toString();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|