skyouc
2024-12-21 c635d78b479510ebe2556a420948effcd30a0731
zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/license/timer/LicenseTimer.java
@@ -1,39 +1,39 @@
package com.zy.asrs.wms.system.license.timer;
import com.zy.asrs.wms.system.license.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;
    }
}
package com.zy.asrs.wms.system.license.timer;
import com.zy.asrs.wms.system.license.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;
    }
}