123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package com.tzld.piaoquan.longarticle.job;
- import com.tzld.piaoquan.longarticle.dao.mapper.crawler.ArticleUseGroupMapper;
- import com.tzld.piaoquan.longarticle.model.po.crawler.ArticleUseGroup;
- import com.tzld.piaoquan.longarticle.model.po.crawler.ArticleUseGroupExample;
- import com.tzld.piaoquan.longarticle.service.local.CoreService;
- import com.tzld.piaoquan.longarticle.service.local.CoverService;
- import com.tzld.piaoquan.longarticle.utils.DateUtil;
- import com.tzld.piaoquan.longarticle.utils.LarkRobotUtil;
- import com.xxl.job.core.biz.model.ReturnT;
- import com.xxl.job.core.handler.annotation.XxlJob;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.redis.core.RedisTemplate;
- import org.springframework.stereotype.Component;
- @Slf4j
- @Component
- public class PlanAccountJob {
- @Autowired
- private CoreService coreService;
- @Autowired
- private CoverService coverService;
- @Autowired
- private ArticleUseGroupMapper articleUseGroupMapper;
- @XxlJob("initAccountSpecialSettingsJob")
- public ReturnT<String> initAccountSpecialSettings(String param) {
- try {
- coreService.initAccountSpecialSettings();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("例外设置异常,请及时查看,@薛一鸣");
- log.error("initAccountSpecialSettings error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("initPlanAccountJob")
- public ReturnT<String> initPlanAccount(String param) {
- try {
- coreService.initPlanAccount();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("长文系统初始化异常,请及时查看,@薛一鸣");
- log.error("initPlanAccountJob error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("matchPlanAccountJob")
- public ReturnT<String> matchPlanAccount(String param) {
- try {
- coreService.matchContent();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("长文系统匹配异常,请及时查看,@薛一鸣");
- log.error("matchPlanAccountJob error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("corePlanAccountJob")
- public ReturnT<String> corePlanAccount(String param) {
- try {
- coreService.core();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("长文系统核心流程异常,请及时查看,@薛一鸣");
- log.error("corePlanAccountJob error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("getPushStatusJob")
- public ReturnT<String> getPushStatus(String param) {
- try {
- coreService.getPushStatus();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("长文系统获取结果异常,请及时查看,@薛一鸣");
- log.error("getPushStatusJob error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("getEffectiveVideoJob")
- public ReturnT<String> getEffectiveVideo(String param) {
- try {
- coverService.getEffectiveVideo();
- } catch (Exception e) {
- LarkRobotUtil.sendMessage("长文系统查询可用视频失败");
- log.error("getEffectiveVideo error", e);
- }
- return ReturnT.SUCCESS;
- }
- @XxlJob("updateRemainingCountJob")
- public ReturnT<String> updateRemainingCount(String param) {
- try {
- int dayOfMonth = DateUtil.getDayOfMonth();
- if (dayOfMonth == 1) {
- ArticleUseGroup articleUseGroup = new ArticleUseGroup();
- articleUseGroup.setRemainingCount(4);
- ArticleUseGroupExample example = new ArticleUseGroupExample();
- example.createCriteria().andIdGreaterThan(0L);
- articleUseGroupMapper.updateByExampleSelective(articleUseGroup, example);
- }
- } catch (Exception e) {
- log.error("updateRemainingCount error", e);
- }
- return ReturnT.SUCCESS;
- }
- }
|