自动化立体仓库 - WMS系统
#
zjj
2025-04-21 02284de3ccd91f3af53c0c2b111199fda38cb79c
src/main/java/com/zy/common/properties/SystemProperties.java
@@ -1,8 +1,10 @@
package com.zy.common.properties;
import com.core.common.AesUtils;
import com.core.common.DateUtils;
import java.io.*;
import java.util.Date;
/**
 * Created by vincent on 2020/8/1
@@ -13,7 +15,8 @@
    public static final String SALT = "123456789qwertyu";
    // 系统激活状态 (默认未激活)
    public static boolean SYSTEM_ACTIVATION = Boolean.FALSE;
//    public static boolean SYSTEM_ACTIVATION = Boolean.FALSE;
    public static boolean SYSTEM_ACTIVATION = Boolean.TRUE;
    public static String getActivationCode(String fileName){
        StringBuilder activationCode = new StringBuilder();
@@ -26,6 +29,8 @@
            }
            f.close();
            buf.close();
        } catch (FileNotFoundException ignore) {
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("读取WMS系统激活码失败!!!\n读取路径 " + fileName);
@@ -42,6 +47,8 @@
            }
            boolean newFile = file.createNewFile();// 创建新文件
            if (newFile) {
                String sets = "attrib +H \"" + file.getAbsolutePath() + "\"";
                Runtime.getRuntime().exec(sets);
                BufferedWriter out = new BufferedWriter(new FileWriter(file, true));
                out.write(code); // \r\n即为换行
                out.flush(); // 把缓存区内容压入文件
@@ -57,8 +64,11 @@
    // 生成激活码
    public static void main(String[] args) {
        String code = AesUtils.encrypt("20200801152500", SystemProperties.SALT);
        System.out.println(code);
        String timeStr = "2021-08-01 17:48:35";
        Date exprTime = DateUtils.convert(timeStr);
        String code = AesUtils.encrypt(DateUtils.convert(exprTime, DateUtils.yyyyMMddHHmmss), SystemProperties.SALT);
        System.out.println("激活码:"+code);
        System.out.println("有效期至:"+timeStr);
//        saveActivationCode(SysOsType.Windows.getActivationCodePath(), code);
//        String activationCode = getActivationCode(OSinfo.getOSname().getActivationCodePath());
//        String decrypt = AesUtils.decrypt(activationCode, "123456789qwertyu");