自动化立体仓库 - WMS系统
1
zhang
昨天 e01fce2ebdd2bdba72682aa314656b57e68f211c
src/main/java/com/zy/system/controller/LicenseCreatorController.java
@@ -1,8 +1,12 @@
package com.zy.system.controller;
import com.core.annotations.ManagerAuth;
import com.core.common.AesUtils;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.common.properties.OSinfo;
import com.zy.common.properties.SystemProperties;
import com.zy.system.entity.license.*;
import de.schlichtherle.license.LicenseContent;
import org.springframework.beans.factory.annotation.Autowired;
@@ -69,22 +73,26 @@
     */
    @RequestMapping(value = "/getLicenseDays")
    public R getLicenseDays() {
        if (true){
            return R.ok().add(0);
        }
        LicenseVerify licenseVerify = new LicenseVerify();
        LicenseContent verifyInfo = licenseVerify.getVerifyInfo();
        if (verifyInfo == null) {
            return R.error();
        }
        Date start = new Date();
        Date end = verifyInfo.getNotAfter();
        Long starTime = start.getTime();
        Long endTime = end.getTime();
        Long num = endTime - starTime;//时间戳相差的毫秒数
        int day = (int) (num / 24 / 60 / 60 / 1000);
        return R.ok().add(day);
        // 获取激活码
        String activationCode = SystemProperties.getActivationCode(OSinfo.getOSname().getActivationCodePath());
        if (!Cools.isEmpty(activationCode)) {
            // 获取有效期
            String timeStr = AesUtils.decrypt(activationCode, SystemProperties.SALT);
            if (null == timeStr) {
                return R.error();
            }
            Date exprTime = DateUtils.convert(timeStr, DateUtils.yyyyMMddHHmmss);
            if (new Date().getTime() < exprTime.getTime()) {
                Date start = new Date();
                Long starTime = start.getTime();
                Long endTime = exprTime.getTime();
                Long num = endTime - starTime;//时间戳相差的毫秒数
                int day = (int) (num / 24 / 60 / 60 / 1000);
                return R.ok().add(day);
            }
        }
        return R.error();
    }
    @RequestMapping(value = "/updateLicense")