liujiaji 6397d906b5 src_app 移除
src_app_fresh 添加
2018-06-11 13:40:56 +08:00

31 lines
844 B
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.base.tool;
import java.util.Calendar;
import java.util.Date;
import cn.config.model.GlobalConfigure;
import com.base.constant.RestfullConstant;
public class ExpireTool {
public static long getExpireTime() {
String tokenHoldTimeStr = GlobalConfigure.getInstance().getProperty(
(String) RestfullConstant.baseProperty.get("TOKENHOLDTIME"
.toUpperCase()));
if (tokenHoldTimeStr == null)
tokenHoldTimeStr = "-1";
Integer tokenHoldTime = Integer.parseInt(tokenHoldTimeStr);
// 如果设置holdTime小于0则给他5分组有效时间
if (tokenHoldTime <= 0) {
tokenHoldTime = 5 * 60;
}
// 计算token失效时间
Calendar expireTime = Calendar.getInstance();
expireTime.setTime(new Date());
expireTime.add(Calendar.SECOND, tokenHoldTime);
return expireTime.getTime().getTime();
}
}