| | |
| | | package com.zy.system.timer; |
| | | |
| | | import com.zy.common.properties.SchedulerProperties; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 定时任务读取配置信息 |
| | |
| | | /** |
| | | * token有效期时间 |
| | | */ |
| | | private Integer tokenExpire = 1000 * 30 * 60; |
| | | private Integer tokenExpire = 100000 * 30 * 60; |
| | | /** |
| | | * token数量限制 |
| | | */ |
| | |
| | | * 删除天数 |
| | | */ |
| | | private Integer logDeleteDays = 360; |
| | | /** |
| | | * 托盘码是否管理 |
| | | */ |
| | | private Boolean zpalletManage = false; |
| | | |
| | | // erp上报 |
| | | private Boolean erpReport = false; |
| | | |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private SchedulerProperties schedulerProperties; |
| | | |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | public void timer() { |
| | | if (!schedulerProperties.isEnabled()) { |
| | | return; |
| | | } |
| | | tokenExpire = configService.getVal("tokenExpire", Integer.class, tokenExpire); |
| | | tokenNumber = configService.getVal("tokenNumber", Integer.class, tokenNumber); |
| | | logDeleteDays = configService.getVal("logDeleteDays", Integer.class, logDeleteDays); |
| | | erpReport = configService.getVal("erpReport", Boolean.class, erpReport); |
| | | zpalletManage = configService.getVal("zpalletManage", Boolean.class, zpalletManage); |
| | | |
| | | } |
| | | |