排序数字校验

This commit is contained in:
RuoYi
2018-05-31 11:46:53 +08:00
parent e78dc2983f
commit e335336064
31 changed files with 173 additions and 215 deletions

View File

@ -93,7 +93,7 @@ public class LogAspect
// 请求的地址
String ip = ShiroUtils.getIp();
operLog.setOperIp(ip);
//操作地点
// 操作地点
operLog.setOperLocation(AddressUtils.getRealAddressByIP(ip));
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());

View File

@ -15,7 +15,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration
public class ResourcesConfig extends WebMvcConfigurerAdapter
{
/**
* 首页地址
*/
@ -38,7 +37,7 @@ public class ResourcesConfig extends WebMvcConfigurerAdapter
{
registry.addResourceHandler("/profile/**").addResourceLocations("file:" + RuoYiConfig.getProfile());
/**swagger配置*/
/** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}

View File

@ -262,6 +262,7 @@ public class ShiroConfig
filterChainDefinitionMap.put("/main", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/system/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/monitor/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/tool/**", "onlineSession,syncOnlineSession");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;

View File

@ -14,40 +14,46 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger2的接口配置
*
* @author ruoyi
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/** 系统基础配置*/
public class SwaggerConfig
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoYiConfig;
/**
* 创建API
* @return
*/
@Bean
public Docket createRestApi() {
public Docket createRestApi()
{
return new Docket(DocumentationType.SWAGGER_2)
//详细定制
// 详细定制
.apiInfo(apiInfo())
.select()
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.*.*.controller"))
//扫描所有
.apis(RequestHandlerSelectors.any())
// 指定当前包路径
.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.system.post.controller"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
/**
* 添加摘要信息
*/
private ApiInfo apiInfo()
{
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
.title("系统接口列表")
.description("API接口测试平台\",\n" +
" \"提供后台所有Restful接口\",")
.title("标题:若依管理系统_接口文档")
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
.termsOfServiceUrl("http://localhost/swagger-ui.html")
.contact(new Contact(ruoYiConfig.getName(), "https://gitee.com/y_project/RuoYi", "1403014932@qq.com"))
.version("1.1.0")
.contact(new Contact(ruoYiConfig.getName(), null, null))
.version("版本号:" + ruoYiConfig.getVersion())
.build();
}
}

View File

@ -3,7 +3,7 @@ package com.ruoyi.framework.shiro.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import com.ruoyi.common.constant.CommonConstant;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.user.CaptchaException;
@ -41,20 +41,20 @@ public class LoginService
// 验证码校验
if (!StringUtils.isEmpty(ServletUtils.getStrAttribute(ShiroConstants.CURRENT_CAPTCHA)))
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
throw new CaptchaException();
}
// 用户名或密码为空 错误
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("not.null"));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"));
throw new UserNotExistsException();
}
// 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
throw new UserPasswordNotMatchException();
}
@ -62,7 +62,7 @@ public class LoginService
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"));
throw new UserPasswordNotMatchException();
}
@ -81,7 +81,7 @@ public class LoginService
if (user == null || UserStatus.DELETED.getCode() == user.getStatus())
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.not.exists"));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists"));
throw new UserNotExistsException();
}
@ -89,10 +89,10 @@ public class LoginService
if (UserStatus.DISABLE.getCode() == user.getStatus())
{
SystemLogUtils.log(username, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark()));
SystemLogUtils.log(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark()));
throw new UserBlockedException(user.getRemark());
}
SystemLogUtils.log(username, CommonConstant.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
SystemLogUtils.log(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"));
recordLoginInfo(user);
return user;
}

View File

@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CommonConstant;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
import com.ruoyi.common.utils.MessageUtils;
@ -52,13 +52,13 @@ public class PasswordService
}
if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue())
{
SystemLogUtils.log(loginName, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount));
SystemLogUtils.log(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount));
throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue());
}
if (!matches(user, password))
{
SystemLogUtils.log(loginName, CommonConstant.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount, password));
SystemLogUtils.log(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount, password));
loginRecordCache.put(loginName, retryCount);
throw new UserPasswordNotMatchException();
}

View File

@ -6,7 +6,7 @@ import org.apache.shiro.session.SessionException;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.CommonConstant;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SystemLogUtils;
@ -51,7 +51,7 @@ public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter
{
String loginName = user.getLoginName();
// 记录用户退出日志
SystemLogUtils.log(loginName, CommonConstant.LOGOUT, MessageUtils.message("user.logout.success"));
SystemLogUtils.log(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"));
}
// 退出登录
subject.logout();

View File

@ -1,7 +1,7 @@
package com.ruoyi.framework.web.page;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.constant.CommonConstant;
import com.ruoyi.common.constant.Constants;
/**
* 表格数据处理
@ -16,10 +16,10 @@ public class TableSupport
public static PageDomain getPageDomain()
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getIntParameter(CommonConstant.PAGENUM));
pageDomain.setPageSize(ServletUtils.getIntParameter(CommonConstant.PAGESIZE));
pageDomain.setOrderByColumn(ServletUtils.getStrParameter(CommonConstant.ORDERBYCOLUMN));
pageDomain.setIsAsc(ServletUtils.getStrParameter(CommonConstant.ISASC));
pageDomain.setPageNum(ServletUtils.getIntParameter(Constants.PAGENUM));
pageDomain.setPageSize(ServletUtils.getIntParameter(Constants.PAGESIZE));
pageDomain.setOrderByColumn(ServletUtils.getStrParameter(Constants.ORDERBYCOLUMN));
pageDomain.setIsAsc(ServletUtils.getStrParameter(Constants.ISASC));
return pageDomain;
}