|
@@ -78,7 +78,6 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (!Check.isNull(nowCost) && nowCost.compareTo(new BigDecimal(0)) != 0) {
|
|
|
BigDecimal yesterdayHourCost = hourlyAccountMapper.getCost(accountId, maxHour, anotherDay);
|
|
|
if (!Check.isNull(yesterdayHourCost) && yesterdayHourCost.compareTo(new BigDecimal(0)) != 0) {
|
|
@@ -89,15 +88,18 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void sendYesterdayMessage(Long accountId, String authName, Integer maxHour, BigDecimal nowCost, Long projectId, String projectName) {
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void sendYesterdayMessage(Long accountId, String authName, Integer maxHour, BigDecimal nowCost, Long projectId, String projectName) {
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
text.append("较昨日同时段消耗预警").append("<br/>")
|
|
|
.append("您的项目:" + projectName + "下的,").append("<br/>")
|
|
@@ -105,39 +107,13 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
|
|
|
.append("相较于昨日 " + maxHour + "时").append("<br/>")
|
|
|
.append("出现消耗暴涨,").append("消耗金额为:" + nowCost).append("<br/>")
|
|
|
.append("请您及时查看!");
|
|
|
-
|
|
|
-
|
|
|
- QueryWrapper<MailLog> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("account_id", accountId);
|
|
|
- queryWrapper.eq("hour", maxHour);
|
|
|
- queryWrapper.eq("mail_type", 3);
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- queryWrapper.last("limit 1");
|
|
|
- MailLog checkMailLog = mailLogMapper.selectOne(queryWrapper);
|
|
|
- if (Check.isNull(checkMailLog)) {
|
|
|
- List<String> mailList = mailLogMapper.selectMailList(projectId);
|
|
|
- String subject = "快手-较昨日同时段账户消耗预警";
|
|
|
- try {
|
|
|
- SendMailUtil.sendMail(mailList, subject, text.toString());
|
|
|
- MailLog mailLog = new MailLog();
|
|
|
- mailLog.setAccountId(accountId);
|
|
|
- mailLog.setMailType(3);
|
|
|
- mailLog.setHour(maxHour);
|
|
|
- mailLog.setContent(text.toString());
|
|
|
- mailLog.setSendEmil(JSON.toJSONString(mailList));
|
|
|
- mailLog.setSubject(subject);
|
|
|
- mailLogMapper.insert(mailLog);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
|
|
|
corpWexinUtils.sendMessage(wexinIds, text.toString());
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
private void sendMessage(Long accountId, String authName, Integer hour, BigDecimal amount, Long projectId, String projectName) {
|
|
|
-
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
text.append("较上时段消耗预警").append("<br/>")
|
|
|
.append("您的项目:" + projectName + " 下的").append("<br/>")
|
|
@@ -145,31 +121,6 @@ public class AccountWarningServiceImpl implements IAccountWarningService {
|
|
|
.append(hour + " 时").append("相较于 " + (hour - 1) + " 时").append("<br/>")
|
|
|
.append("出现消耗暴涨,").append("消耗金额为:" + amount).append("<br/>")
|
|
|
.append("请您及时查看!");
|
|
|
-
|
|
|
- QueryWrapper<MailLog> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("account_id", accountId);
|
|
|
- queryWrapper.eq("hour", hour);
|
|
|
- queryWrapper.eq("mail_type", 2);
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- queryWrapper.last("limit 1");
|
|
|
- MailLog checkMailLog = mailLogMapper.selectOne(queryWrapper);
|
|
|
- if (Check.isNull(checkMailLog)) {
|
|
|
- List<String> mailList = mailLogMapper.selectMailList(projectId);
|
|
|
- String subject = "快手-账户消耗预警";
|
|
|
- try {
|
|
|
- SendMailUtil.sendMail(mailList, subject, text.toString());
|
|
|
- MailLog mailLog = new MailLog();
|
|
|
- mailLog.setAccountId(accountId);
|
|
|
- mailLog.setMailType(2);
|
|
|
- mailLog.setHour(hour);
|
|
|
- mailLog.setContent(text.toString());
|
|
|
- mailLog.setSendEmil(JSON.toJSONString(mailList));
|
|
|
- mailLog.setSubject(subject);
|
|
|
- mailLogMapper.insert(mailLog);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
List<JSONObject> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
|
|
|
corpWexinUtils.sendMessage(wexinIds, text.toString());
|
|
|
|