| | |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.RedisUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.SysUserOnline; |
| | |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return PageUtils.buildDataInfo(userOnlineList); |
| | | return TableDataInfo.build(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.common.core.mybatisplus.core; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.page.PagePlus; |
| | |
| | | * @param page 分页对象 |
| | | * @param queryWrapper 查询条件 |
| | | * @return V对象 |
| | | * @deprecated 3.6.0 移除 请使用 {@link ServicePlusImpl#pageVo(IPage, Wrapper)} |
| | | */ |
| | | @Deprecated |
| | | PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper); |
| | | |
| | | /** |
| | | * @param convertor 自定义转换器 |
| | | */ |
| | | /** |
| | | * @param convertor 自定义转换器 |
| | | * @deprecated 3.6.0 移除 请使用 {@link ServicePlusImpl#pageVo(IPage, Wrapper)} |
| | | */ |
| | | @Deprecated |
| | | default PagePlus<T, V> pageVo(PagePlus<T, V> page, Wrapper<T> queryWrapper, |
| | | Function<Collection<T>, List<V>> convertor) { |
| | | PagePlus<T, V> result = getBaseMapper().selectPage(page, queryWrapper); |
| | | return result.setRecordsVo(convertor.apply(result.getRecords())); |
| | | } |
| | | |
| | | /** |
| | | * @deprecated 3.6.0 移除 请使用 {@link ServicePlusImpl#pageVo(IPage, Wrapper)} |
| | | */ |
| | | @Deprecated |
| | | default PagePlus<T, V> pageVo(PagePlus<T, V> page) { |
| | | return pageVo(page, Wrappers.emptyWrapper()); |
| | | } |
| | | |
| | | /** |
| | | * @param convertor 自定义转换器 |
| | | * @deprecated 3.6.0 移除 请使用 {@link ServicePlusImpl#pageVo(IPage, Wrapper)} |
| | | */ |
| | | @Deprecated |
| | | default PagePlus<T, V> pageVo(PagePlus<T, V> page, Function<Collection<T>, List<V>> convertor) { |
| | | return pageVo(page, Wrappers.emptyWrapper(), convertor); |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaException() { |
| | | super("user.jcaptcha.error", null); |
| | | super("user.jcaptcha.error"); |
| | | } |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaExpireException() { |
| | | super("user.jcaptcha.expire", null); |
| | | super("user.jcaptcha.expire"); |
| | | } |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordNotMatchException() { |
| | | super("user.password.not.match", null); |
| | | super("user.password.not.match"); |
| | | } |
| | | } |
| | |
| | | import com.xxl.job.admin.core.util.FtlUtil; |
| | | import com.xxl.job.admin.core.util.I18nUtil; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.servlet.AsyncHandlerInterceptor; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | |
| | | import javax.servlet.http.Cookie; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | * @author xuxueli 2015-12-12 18:09:04 |
| | | */ |
| | | @Component |
| | | public class CookieInterceptor extends HandlerInterceptorAdapter { |
| | | public class CookieInterceptor implements AsyncHandlerInterceptor { |
| | | |
| | | @Override |
| | | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, |
| | |
| | | if (modelAndView != null) { |
| | | modelAndView.addObject("I18nUtil", FtlUtil.generateStaticModel(I18nUtil.class.getName())); |
| | | } |
| | | |
| | | super.postHandle(request, response, handler, modelAndView); |
| | | |
| | | AsyncHandlerInterceptor.super.postHandle(request, response, handler, modelAndView); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.xxl.job.admin.service.LoginService; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | import org.springframework.web.servlet.AsyncHandlerInterceptor; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | * @author xuxueli 2015-12-12 18:09:04 |
| | | */ |
| | | @Component |
| | | public class PermissionInterceptor extends HandlerInterceptorAdapter { |
| | | public class PermissionInterceptor implements AsyncHandlerInterceptor { |
| | | |
| | | @Resource |
| | | private LoginService loginService; |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | |
| | | |
| | | if (!(handler instanceof HandlerMethod)) { |
| | | return super.preHandle(request, response, handler); |
| | | return AsyncHandlerInterceptor.super.preHandle(request, response, handler); |
| | | } |
| | | |
| | | // if need login |
| | |
| | | request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser); |
| | | } |
| | | |
| | | return super.preHandle(request, response, handler); |
| | | return AsyncHandlerInterceptor.super.preHandle(request, response, handler); |
| | | } |
| | | |
| | | |
| | | } |