lsh
2025-10-20 dfd8616e659669797ab8bf02422251bf4b89ed89
src/main/java/com/zy/core/MainProcess.java
@@ -22,6 +22,7 @@
    private MainServiceImpl mainService;
    // 所属线程
    private Thread thread;
    private Thread licenseThread;
    // 频率
    private int[] autoZ = new int[]{0,0,0,0,0,0,0};
@@ -29,7 +30,13 @@
     * =====>>  开始工作
     */
    public void start(){
        thread = new Thread(() -> {
        thread = new Thread(this::mainThread);
        thread.start();
        licenseThread = new Thread(this::licenseThreadRun);
        licenseThread.start();
    }
    private void mainThread(){
            try{
                Thread.sleep(200);
                log.info("++++++++ 开始验证许可证 ++++++++");
@@ -64,13 +71,28 @@
                    e.printStackTrace();
                }
            }
        });
        thread.start();
    }
    private void licenseThreadRun(){
        while (true) {
            try{
                Thread.sleep(60*60*1000L);
                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) {}
        }
    }
    @PreDestroy
    public void shutDown(){
        if (thread != null) thread.interrupt();
        if (licenseThread != null) licenseThread.interrupt();
    }
}