LoginInfo.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * *************************************************
  3. * Copyright (c) 2018 QMTH. All Rights Reserved.
  4. * Created by Deason on 2018-07-31 14:32:47.
  5. * *************************************************
  6. */
  7. package cn.com.qmth.examcloud.app.model;
  8. import java.io.Serializable;
  9. import java.util.Calendar;
  10. import java.util.Date;
  11. /**
  12. * 用户登录信息
  13. *
  14. * @author: fengdesheng
  15. * @since: 2018/7/16
  16. */
  17. public class LoginInfo implements Serializable {
  18. private static final long serialVersionUID = 1L;
  19. private Long userId;
  20. private String userName;
  21. private String account;
  22. private String password;
  23. private String accountType;
  24. private Long rootOrgId;
  25. private String domain;
  26. private String key;
  27. private String token;
  28. private String appToken;
  29. private String deviceId;
  30. private Date createTime;
  31. private String smsCode;
  32. private Boolean noSession;
  33. public LoginInfo(String account, String password, String accountType, Long rootOrgId, String domain, String key, String token, String deviceId) {
  34. this.account = account;
  35. this.password = password;
  36. this.accountType = accountType;
  37. this.rootOrgId = rootOrgId;
  38. this.domain = domain;
  39. this.key = key;
  40. this.token = token;
  41. this.deviceId = deviceId;
  42. this.createTime = new Date();
  43. }
  44. public LoginInfo(String account, String password, String accountType, Long rootOrgId, String domain, String deviceId, String smsCode) {
  45. this.account = account;
  46. this.password = password;
  47. this.accountType = accountType;
  48. this.rootOrgId = rootOrgId;
  49. this.domain = domain;
  50. this.deviceId = deviceId;
  51. this.createTime = new Date();
  52. this.smsCode = smsCode;
  53. }
  54. public LoginInfo() {
  55. this.createTime = new Date();
  56. }
  57. public boolean hasExpired(int seconds) {
  58. if (createTime == null) {
  59. return true;
  60. }
  61. Calendar c = Calendar.getInstance();
  62. c.setTime(createTime);
  63. c.add(Calendar.SECOND, seconds - 60);
  64. //System.out.println(DateUtils.format(c.getTime()));
  65. //判断是否在n小时内
  66. if (c.getTime().after(new Date())) {
  67. return false;
  68. }
  69. return true;
  70. }
  71. public Long getUserId() {
  72. return userId;
  73. }
  74. public void setUserId(Long userId) {
  75. this.userId = userId;
  76. }
  77. public String getUserName() {
  78. return userName;
  79. }
  80. public void setUserName(String userName) {
  81. this.userName = userName;
  82. }
  83. public String getAccount() {
  84. return account;
  85. }
  86. public void setAccount(String account) {
  87. this.account = account;
  88. }
  89. public String getPassword() {
  90. return password;
  91. }
  92. public void setPassword(String password) {
  93. this.password = password;
  94. }
  95. public String getAccountType() {
  96. return accountType;
  97. }
  98. public void setAccountType(String accountType) {
  99. this.accountType = accountType;
  100. }
  101. public Long getRootOrgId() {
  102. return rootOrgId;
  103. }
  104. public void setRootOrgId(Long rootOrgId) {
  105. this.rootOrgId = rootOrgId;
  106. }
  107. public String getDomain() {
  108. return domain;
  109. }
  110. public void setDomain(String domain) {
  111. this.domain = domain;
  112. }
  113. public String getKey() {
  114. return key;
  115. }
  116. public void setKey(String key) {
  117. this.key = key;
  118. }
  119. public String getToken() {
  120. return token;
  121. }
  122. public void setToken(String token) {
  123. this.token = token;
  124. }
  125. public String getAppToken() {
  126. return appToken;
  127. }
  128. public void setAppToken(String appToken) {
  129. this.appToken = appToken;
  130. }
  131. public String getDeviceId() {
  132. return deviceId;
  133. }
  134. public void setDeviceId(String deviceId) {
  135. this.deviceId = deviceId;
  136. }
  137. public Date getCreateTime() {
  138. return createTime;
  139. }
  140. public void setCreateTime(Date createTime) {
  141. this.createTime = createTime;
  142. }
  143. public String getSmsCode() {
  144. return smsCode;
  145. }
  146. public void setSmsCode(String smsCode) {
  147. this.smsCode = smsCode;
  148. }
  149. public Boolean getNoSession() {
  150. return noSession;
  151. }
  152. public void setNoSession(Boolean noSession) {
  153. this.noSession = noSession;
  154. }
  155. }