123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /*
- * *************************************************
- * Copyright (c) 2018 QMTH. All Rights Reserved.
- * Created by Deason on 2018-07-31 14:32:47.
- * *************************************************
- */
- package cn.com.qmth.examcloud.app.model;
- import java.io.Serializable;
- import java.util.Calendar;
- import java.util.Date;
- /* 用户登录信息 */
- public class UserToken implements Serializable {
- private static final long serialVersionUID = 1L;
- private String account;
- private String password;
- private String accountType;
- private Long rootOrgId;
- private String domain;
- private String key;
- private String token;
- private Date createTime;
- public UserToken(String account, String password, String accountType, Long rootOrgId, String domain, String key, String token) {
- this.account = account;
- this.password = password;
- this.accountType = accountType;
- this.rootOrgId = rootOrgId;
- this.domain = domain;
- this.key = key;
- this.token = token;
- this.createTime = new Date();
- }
- public UserToken() {
- }
- public boolean hasExpired(int seconds) {
- if (createTime == null) {
- return true;
- }
- Calendar c = Calendar.getInstance();
- c.setTime(createTime);
- c.add(Calendar.SECOND, seconds);
- //System.out.println(DateUtils.format(c.getTime()));
- //判断是否在n小时内
- if (c.getTime().after(new Date())) {
- return false;
- }
- return true;
- }
- public String getAccount() {
- return account;
- }
- public void setAccount(String account) {
- this.account = account;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getAccountType() {
- return accountType;
- }
- public void setAccountType(String accountType) {
- this.accountType = accountType;
- }
- public Long getRootOrgId() {
- return rootOrgId;
- }
- public void setRootOrgId(Long rootOrgId) {
- this.rootOrgId = rootOrgId;
- }
- public String getDomain() {
- return domain;
- }
- public void setDomain(String domain) {
- this.domain = domain;
- }
- public String getKey() {
- return key;
- }
- public void setKey(String key) {
- this.key = key;
- }
- public String getToken() {
- return token;
- }
- public void setToken(String token) {
- this.token = token;
- }
- public Date getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
- }
|