|
@@ -26,6 +26,7 @@ import com.tzld.longarticle.recommend.server.repository.longArticle.GetOffVideoA
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticlesMatchVideoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticlesReadRateRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.model.PushMessageCallback;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.model.PushMessageCallbackExample;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.LarkRobotUtil;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
|
|
@@ -39,6 +40,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.time.LocalTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -299,7 +301,22 @@ public class XxlJobService {
|
|
|
|
|
|
@XxlJob("alertPushMessageJob")
|
|
|
public ReturnT<String> alertPushMessageJob(String param) {
|
|
|
- LarkRobotUtil.sendMessage("测试报警");
|
|
|
+ long endTimestamp = System.currentTimeMillis();
|
|
|
+ long startTimestamp = endTimestamp - 1000 * 60 * 60;
|
|
|
+ long ytdStartTimestamp = startTimestamp - 1000 * 60 * 60 * 24;
|
|
|
+ long ytdEndTimestamp = endTimestamp - 1000 * 60 * 60 * 24;
|
|
|
+ PushMessageCallbackExample example = new PushMessageCallbackExample();
|
|
|
+ example.createCriteria().andCreateTimeBetween(new Date(startTimestamp), new Date(endTimestamp));
|
|
|
+ long nowCount = pushMessageCallbackMapper.countByExample(example);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
}
|