*
L
3 天以前 1bc0b18a88ed90fa19e0c050d7befecb2a16bb8a
*
3个文件已修改
34 ■■■■■ 已修改文件
src/main/java/com/zy/core/MainProcess.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/controller/LicenseCreatorController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/MainProcess.java
@@ -22,6 +22,7 @@
    private MainServiceImpl mainService;
    // 所属线程
    private Thread thread;
    private Thread threadVerify;
    // 频率
    private int[] autoZ = new int[]{0,0,0,0,0,0,0};
@@ -66,11 +67,40 @@
            }
        });
        thread.start();
        threadVerify = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    // 间隔
                    Thread.sleep(60000);
                    // 系统运行状态判断
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
                    try{
                        log.info("++++++++ 开始验证许可证 ++++++++");
                        if (!mainService.licenseVerify()){
                            SystemProperties.WCS_RUNNING_STATUS.set(Boolean.FALSE);
                            log.info("++++++++ 验证许可证失败 ++++++++");
                        } else {
                            SystemProperties.WCS_RUNNING_STATUS.set(Boolean.TRUE);
                            log.info("++++++++ 验证许可证成功 ++++++++");
                        }
                    } catch (Exception e) {}
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        threadVerify.start();
    }
    @PreDestroy
    public void shutDown(){
        if (thread != null) thread.interrupt();
        if (threadVerify != null) threadVerify.interrupt();
    }
}
src/main/java/com/zy/system/controller/LicenseCreatorController.java
@@ -3,6 +3,7 @@
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.core.properties.SystemProperties;
import com.zy.system.entity.license.*;
import de.schlichtherle.license.LicenseContent;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +76,7 @@
        LicenseVerify licenseVerify = new LicenseVerify();
        LicenseContent verifyInfo = licenseVerify.getVerifyInfo();
        if (verifyInfo == null) {
            SystemProperties.WCS_RUNNING_STATUS.set(Boolean.FALSE);
            return R.error();
        }
src/main/resources/application.yml
@@ -9,7 +9,7 @@
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://127.0.0.1:50751;databasename=gdhmasrs
#    url: jdbc:sqlserver://127.0.0.1:50948;databasename=gdhmasrs
#    url: jdbc:sqlserver://127.0.0.1:62316;databasename=gdhmasrs
    username: sa
    password: sa@123
  mvc: