| | |
| | | import com.zy.common.utils.Http; |
| | | import com.zy.system.entity.*; |
| | | import com.zy.system.service.*; |
| | | import com.zy.system.timer.LicenseTimer; |
| | | import com.zy.system.timer.LoadingConfigTimer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | private RolePermissionService rolePermissionService; |
| | | @Autowired |
| | | private LoadingConfigTimer loadingConfigTimer; |
| | | |
| | | @Autowired |
| | | private LicenseTimer licenseTimer; |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | cors(response); |
| | | if (handler instanceof org.springframework.web.servlet.resource.ResourceHttpRequestHandler) { |
| | | return true; |
| | | } |
| | | if (!licenseTimer.getSystemSupport()) { |
| | | Http.response(response, BaseRes.NO_ACTIVATION); |
| | | return false; |
| | | } |
| | | // super账号 |
| | | String token = request.getHeader("token"); |
| | |
| | | User user = userService.selectById(userLogin.getUserId()); |
| | | // String deToken = Cools.deTokn(token, user.getPassword()); |
| | | // long timestamp = Long.parseLong(deToken.substring(0, 13)); |
| | | // 15分钟后过期 |
| | | if (System.currentTimeMillis() - userLogin.getCreateTime().getTime() > 900000){ |
| | | // 45分钟后过期 |
| | | if (System.currentTimeMillis() - userLogin.getCreateTime().getTime() > 2700000){ |
| | | Http.response(response, BaseRes.DENIED); |
| | | return false; |
| | | } |