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 initAccountSpecialSettings(String param) { try { coreService.initAccountSpecialSettings(); } catch (Exception e) { LarkRobotUtil.sendMessage("例外设置异常,请及时查看,@薛一鸣"); log.error("initAccountSpecialSettings error", e); } return ReturnT.SUCCESS; } @XxlJob("initPlanAccountJob") public ReturnT initPlanAccount(String param) { try { coreService.initPlanAccount(); } catch (Exception e) { LarkRobotUtil.sendMessage("长文系统初始化异常,请及时查看,@薛一鸣"); log.error("initPlanAccountJob error", e); } return ReturnT.SUCCESS; } @XxlJob("matchPlanAccountJob") public ReturnT matchPlanAccount(String param) { try { coreService.matchContent(); } catch (Exception e) { LarkRobotUtil.sendMessage("长文系统匹配异常,请及时查看,@薛一鸣"); log.error("matchPlanAccountJob error", e); } return ReturnT.SUCCESS; } @XxlJob("corePlanAccountJob") public ReturnT corePlanAccount(String param) { try { coreService.core(); } catch (Exception e) { LarkRobotUtil.sendMessage("长文系统核心流程异常,请及时查看,@薛一鸣"); log.error("corePlanAccountJob error", e); } return ReturnT.SUCCESS; } @XxlJob("getPushStatusJob") public ReturnT getPushStatus(String param) { try { coreService.getPushStatus(); } catch (Exception e) { LarkRobotUtil.sendMessage("长文系统获取结果异常,请及时查看,@薛一鸣"); log.error("getPushStatusJob error", e); } return ReturnT.SUCCESS; } @XxlJob("getEffectiveVideoJob") public ReturnT getEffectiveVideo(String param) { try { coverService.getEffectiveVideo(); } catch (Exception e) { LarkRobotUtil.sendMessage("长文系统查询可用视频失败"); log.error("getEffectiveVideo error", e); } return ReturnT.SUCCESS; } @XxlJob("updateRemainingCountJob") public ReturnT 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; } }