package com.zy.system.timer;
|
|
import com.zy.system.entity.license.LicenseVerify;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
public class LicenseTimer {
|
|
private static boolean SYSTEM_SUPPORT = false;//系统激活状态,默认关闭
|
|
private static int LICENSE_DAYS = 0;//许可证天数
|
|
//每天晚上11点更新系统激活状态
|
@Scheduled(cron = "0 0 23 * * ? ")
|
public void timer() {
|
// System.out.println(SYSTEM_SUPPORT);
|
//验证许可证是否有效
|
LicenseVerify licenseVerify = new LicenseVerify();
|
boolean verify = licenseVerify.verify();
|
setSystemSupport(verify);//更新系统激活状态
|
}
|
|
public boolean getSystemSupport() {
|
return SYSTEM_SUPPORT;
|
}
|
|
public void setSystemSupport(boolean systemSupport) {
|
SYSTEM_SUPPORT = systemSupport;
|
}
|
|
public int getLicenseDays() {
|
return LICENSE_DAYS;
|
}
|
|
public void setLicenseDays(int licenseDays) {
|
LICENSE_DAYS = licenseDays;
|
}
|
|
}
|