|
@@ -8,6 +8,7 @@ import com.tzld.longarticle.recommend.server.common.enums.AccountBusinessTypeEnu
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.FeishuRobotIdEnum;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
|
+import com.tzld.longarticle.recommend.server.mapper.crawler.PushMessageCallbackMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.AccountTypeFansDTO;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.NotPublishPlan;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
@@ -24,7 +25,10 @@ import com.tzld.longarticle.recommend.server.repository.crawler.LongArticlesVide
|
|
|
import com.tzld.longarticle.recommend.server.repository.longArticle.GetOffVideoArticleRepository;
|
|
|
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;
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
@@ -36,10 +40,14 @@ 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;
|
|
|
|
|
|
+import static com.tzld.longarticle.recommend.server.common.constant.TimeConstant.MILLISECOND_DAY;
|
|
|
+import static com.tzld.longarticle.recommend.server.common.constant.TimeConstant.MILLISECOND_HOUR;
|
|
|
+
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class XxlJobService {
|
|
@@ -60,6 +68,8 @@ public class XxlJobService {
|
|
|
private LongArticlesReadRateRepository longArticlesReadRateRepository;
|
|
|
@Autowired
|
|
|
private LongArticlesRootSourceIdRepository longArticlesRootSourceIdRepository;
|
|
|
+ @Autowired
|
|
|
+ private PushMessageCallbackMapper pushMessageCallbackMapper;
|
|
|
|
|
|
@ApolloJsonValue("${touliu.account.ghIds:[\"gh_93e00e187787\", \"gh_ac43e43b253b\", \"gh_68e7fdc09fe4\",\"gh_77f36c109fb1\", \"gh_b181786a6c8c\", \"gh_1ee2e1b39ccf\"]}")
|
|
|
private List<String> touliuAccountGhIds;
|
|
@@ -292,4 +302,30 @@ public class XxlJobService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @XxlJob("alertPushMessageJob")
|
|
|
+ public ReturnT<String> alertPushMessageJob(String param) {
|
|
|
+ long endTimestamp = System.currentTimeMillis();
|
|
|
+ long startTimestamp = endTimestamp - MILLISECOND_HOUR;
|
|
|
+ long ytdStartTimestamp = startTimestamp - MILLISECOND_DAY;
|
|
|
+ long ytdEndTimestamp = endTimestamp - MILLISECOND_DAY;
|
|
|
+ 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) {
|
|
|
+ if (ydtCount == 0) {
|
|
|
+ ydtCount = 1L;
|
|
|
+ }
|
|
|
+ double res = ((double) nowCount - ydtCount) * 100 / ydtCount;
|
|
|
+ LarkRobotUtil.sendMessage("最近一小时回调消息量:" + nowCount + "\n"
|
|
|
+ + "昨日消息回调量:" + ydtCount + "\n"
|
|
|
+ + "百分比为:" + String.format("%.2f", res) + "%");
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
}
|