瀏覽代碼

单词拼写

徐玉祥 4 年之前
父節點
當前提交
9bffe370f9

+ 2 - 2
guns-base-support/guns-core/src/main/java/cn/stylefeng/guns/core/factory/PageFactory.java

@ -25,7 +25,7 @@ Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
package cn.stylefeng.guns.core.factory;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletRequest;
@ -60,7 +60,7 @@ public class PageFactory {
        int pageSize = 20;
        int pageNo = 1;
        HttpServletRequest request = HttpServeletUtil.getRequest();
        HttpServletRequest request = HttpServletUtil.getRequest();
        //每页条数
        String pageSizeString = request.getParameter(PAGE_SIZE_PARAM_NAME);

+ 2 - 2
guns-base-support/guns-core/src/main/java/cn/stylefeng/guns/core/util/HttpServeletUtil.java

@ -33,12 +33,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * HttpServelet工具类,获取当前request和response
 * HttpServlet工具类,获取当前request和response
 *
 * @author xuyuxiang
 * @date 2020/3/30 15:09
 */
public class HttpServeletUtil {
public class HttpServletUtil {
    /**
     * 获取当前请求的request对象

+ 1 - 1
guns-base-support/guns-core/src/main/java/cn/stylefeng/guns/core/util/PoiUtil.java

@ -62,7 +62,7 @@ public class PoiUtil {
     */
    public static void exportExcelWithStream(String excelName, Class pojoClass, Collection data) {
        try {
            HttpServletResponse response = HttpServeletUtil.getResponse();
            HttpServletResponse response = HttpServletUtil.getResponse();
            String fileName = URLEncoder.encode(excelName, "UTF-8");
            response.reset();
            response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");

+ 2 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/core/aop/PermissionAop.java

@ -32,7 +32,7 @@ import cn.stylefeng.guns.core.context.login.LoginContextHolder;
import cn.stylefeng.guns.core.enums.LogicTypeEnum;
import cn.stylefeng.guns.core.exception.PermissionException;
import cn.stylefeng.guns.core.exception.enums.PermissionExceptionEnum;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import cn.stylefeng.guns.sys.core.log.LogManager;
import org.apache.tomcat.util.buf.StringUtils;
import org.aspectj.lang.JoinPoint;
@ -91,7 +91,7 @@ public class PermissionAop {
            //如果不需要特别的角色,则判断用户所属角色是否有当前访问的url的权限
            if (requireRoles.length == 0) {
                HttpServletRequest request = HttpServeletUtil.getRequest();
                HttpServletRequest request = HttpServletUtil.getRequest();
                boolean flag = LoginContextHolder.me().hasPermission(request.getRequestURI());
                if (!flag) {
                    this.executeNoPermissionExceptionLog(joinPoint, new PermissionException(PermissionExceptionEnum.NO_PERMISSION));

+ 3 - 3
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/core/log/LogManager.java

@ -29,7 +29,7 @@ import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.context.constant.ConstantContextHolder;
import cn.stylefeng.guns.core.exception.ServiceException;
import cn.stylefeng.guns.core.exception.enums.ServerExceptionEnum;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import cn.stylefeng.guns.core.util.IpAddressUtil;
import cn.stylefeng.guns.core.util.UaUtil;
import cn.stylefeng.guns.sys.core.log.factory.LogFactory;
@ -142,7 +142,7 @@ public class LogManager {
     * @date 2020/3/19 14:44
     */
    private SysVisLog genBaseSysVisLog() {
        HttpServletRequest request = HttpServeletUtil.getRequest();
        HttpServletRequest request = HttpServletUtil.getRequest();
        if (ObjectUtil.isNotNull(request)) {
            String ip = IpAddressUtil.getIp(request);
            String address = IpAddressUtil.getAddress(request);
@ -161,7 +161,7 @@ public class LogManager {
     * @date 2020/3/19 14:44
     */
    private SysOpLog genBaseSysOpLog() {
        HttpServletRequest request = HttpServeletUtil.getRequest();
        HttpServletRequest request = HttpServletUtil.getRequest();
        if (ObjectUtil.isNotNull(request)) {
            String ip = IpAddressUtil.getIp(request);
            String address = IpAddressUtil.getAddress(request);

+ 2 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/core/mybatis/sqlfilter/DemoProfileSqlInterceptor.java

@ -27,7 +27,7 @@ package cn.stylefeng.guns.sys.core.mybatis.sqlfilter;
import cn.stylefeng.guns.core.consts.SpringSecurityConstant;
import cn.stylefeng.guns.core.context.constant.ConstantContextHolder;
import cn.stylefeng.guns.core.exception.DemoException;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.MappedStatement;
@ -70,7 +70,7 @@ public class DemoProfileSqlInterceptor implements Interceptor {
            //放开不进行安全过滤的接口
            for (String notAuthResource : SpringSecurityConstant.NONE_SECURITY_URL_PATTERNS) {
                AntPathMatcher antPathMatcher = new AntPathMatcher();
                if (antPathMatcher.match(notAuthResource, HttpServeletUtil.getRequest().getRequestURI())) {
                if (antPathMatcher.match(notAuthResource, HttpServletUtil.getRequest().getRequestURI())) {
                    return invocation.proceed();
                }
            }

+ 2 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/modular/auth/factory/LoginUserFactory.java

@ -34,7 +34,7 @@ import cn.stylefeng.guns.core.exception.ServiceException;
import cn.stylefeng.guns.core.exception.enums.ServerExceptionEnum;
import cn.stylefeng.guns.core.pojo.login.LoginEmpInfo;
import cn.stylefeng.guns.core.pojo.login.SysLoginUser;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import cn.stylefeng.guns.core.util.IpAddressUtil;
import cn.stylefeng.guns.core.util.UaUtil;
import cn.stylefeng.guns.sys.modular.app.service.SysAppService;
@ -71,7 +71,7 @@ public class LoginUserFactory {
     * @date 2020/3/13 15:01
     */
    public static void fillLoginUserInfo(SysLoginUser sysLoginUser) {
        HttpServletRequest request = HttpServeletUtil.getRequest();
        HttpServletRequest request = HttpServletUtil.getRequest();
        if (ObjectUtil.isNotNull(request)) {
            sysLoginUser.setLastLoginIp(IpAddressUtil.getIp(request));
            sysLoginUser.setLastLoginTime(DateTime.now().toString());

+ 3 - 3
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/modular/auth/service/impl/AuthServiceImpl.java

@ -35,7 +35,7 @@ import cn.stylefeng.guns.core.exception.ServiceException;
import cn.stylefeng.guns.core.exception.enums.AuthExceptionEnum;
import cn.stylefeng.guns.core.exception.enums.ServerExceptionEnum;
import cn.stylefeng.guns.core.pojo.login.SysLoginUser;
import cn.stylefeng.guns.core.util.HttpServeletUtil;
import cn.stylefeng.guns.core.util.HttpServletUtil;
import cn.stylefeng.guns.core.util.IpAddressUtil;
import cn.stylefeng.guns.sys.core.cache.UserCache;
import cn.stylefeng.guns.sys.core.enums.LogSuccessStatusEnum;
@ -150,7 +150,7 @@ public class AuthServiceImpl implements AuthService, UserDetailsService {
    @Override
    public void logout() {
        HttpServletRequest request = HttpServeletUtil.getRequest();
        HttpServletRequest request = HttpServletUtil.getRequest();
        if (ObjectUtil.isNotNull(request)) {
@ -263,7 +263,7 @@ public class AuthServiceImpl implements AuthService, UserDetailsService {
        this.cacheLoginUser(jwtPayLoad, sysLoginUser);
        //设置最后登录ip和时间
        sysUser.setLastLoginIp(IpAddressUtil.getIp(HttpServeletUtil.getRequest()));
        sysUser.setLastLoginIp(IpAddressUtil.getIp(HttpServletUtil.getRequest()));
        sysUser.setLastLoginTime(DateTime.now());
        //更新用户登录信息