Browse Source

增加报警

xueyiming 8 months ago
parent
commit
2eb3bbf7d1

+ 6 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

@@ -311,14 +311,17 @@ public class XxlJobService {
         PushMessageCallbackExample example = new PushMessageCallbackExample();
         example.createCriteria().andCreateTimeBetween(new Date(startTimestamp), new Date(endTimestamp));
         long nowCount = pushMessageCallbackMapper.countByExample(example);
-        if(nowCount == 0){
+        if (nowCount == 0) {
             LarkRobotUtil.sendMessage("最近一小时回调消息为0");
         }
         PushMessageCallbackExample ytdExample = new PushMessageCallbackExample();
         ytdExample.createCriteria().andCreateTimeBetween(new Date(ytdStartTimestamp), new Date(ytdEndTimestamp));
         long ydtCount = pushMessageCallbackMapper.countByExample(example);
-        if(nowCount + 1000 < ydtCount){
-            LarkRobotUtil.sendMessage("最近一小时回调消息量:" + nowCount + "\n" + "昨日消息回调量:" + ydtCount);
+        if (nowCount + 1000 < ydtCount) {
+            double res = ((double) nowCount - ydtCount) * 100 / ydtCount;
+            LarkRobotUtil.sendMessage("最近一小时回调消息量:" + nowCount + "\n"
+                    + "昨日消息回调量:" + ydtCount + "\n"
+                    + "百分比为:" + String.format("%.2f", res) + "%");
         }
         return ReturnT.SUCCESS;
     }