排序数字校验

pull/9/head
RuoYi 2018-05-31 11:46:53 +08:00
parent e78dc2983f
commit e335336064
31 changed files with 173 additions and 215 deletions

View File

@ -27,7 +27,12 @@ http://webapplayers.com/inspinia_admin-v2.7.1
13. 在线构建器拖动表单元素生成相应的HTML代码。 13. 在线构建器拖动表单元素生成相应的HTML代码。
14. 连接池监视监视当期系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。 14. 连接池监视监视当期系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 系统演示 [www.ruoyi.club](http://www.ruoyi.club) ## 在线体验
> admin/admin123
地址http://www.ruoyi.club
## 演示图
![登录界面](https://static.oschina.net/uploads/space/2018/0524/212432_qg6h_1438828.png) ![登录界面](https://static.oschina.net/uploads/space/2018/0524/212432_qg6h_1438828.png)

View File

@ -160,7 +160,7 @@ insert into sys_menu values('12', '登录日志', '2', '2', '/monitor/logininfo
insert into sys_menu values('13', '在线用户', '2', '3', '/monitor/online', 'C', '0', 'monitor:online:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '在线用户菜单'); insert into sys_menu values('13', '在线用户', '2', '3', '/monitor/online', 'C', '0', 'monitor:online:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '在线用户菜单');
insert into sys_menu values('14', '定时任务', '2', '4', '/monitor/job', 'C', '0', 'monitor:job:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '定时任务菜单'); insert into sys_menu values('14', '定时任务', '2', '4', '/monitor/job', 'C', '0', 'monitor:job:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '定时任务菜单');
insert into sys_menu values('15', '数据监控', '2', '5', '/monitor/data', 'C', '0', 'monitor:data:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '数据监控菜单'); insert into sys_menu values('15', '数据监控', '2', '5', '/monitor/data', 'C', '0', 'monitor:data:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '数据监控菜单');
insert into sys_menu values('16', '系统接口API', '2', '6', '/swagger-ui.html', 'C', '0', 'onitor:api:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统API菜单'); insert into sys_menu values('16', '系统接口', '2', '6', '/swagger-ui.html', 'C', '0', 'onitor:api:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统API菜单');
insert into sys_menu values('17', '表单构建', '3', '1', '/tool/build', 'C', '0', 'tool:build:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '表单构建菜单'); insert into sys_menu values('17', '表单构建', '3', '1', '/tool/build', 'C', '0', 'tool:build:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '表单构建菜单');
insert into sys_menu values('18', '代码生成', '3', '2', '/tool/gen', 'C', '0', 'tool:gen:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '代码生成菜单'); insert into sys_menu values('18', '代码生成', '3', '2', '/tool/gen', 'C', '0', 'tool:gen:view', '#', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '代码生成菜单');
-- 用户管理按钮 -- 用户管理按钮
@ -374,7 +374,7 @@ create table sys_oper_log (
dept_name varchar(50) default '' comment '部门名称', dept_name varchar(50) default '' comment '部门名称',
oper_url varchar(255) default '' comment '请求URL', oper_url varchar(255) default '' comment '请求URL',
oper_ip varchar(30) default '' comment '主机地址', oper_ip varchar(30) default '' comment '主机地址',
oper_location varchar(255) default '' comment '操作地点', oper_location varchar(255) default '' comment '操作地点',
oper_param varchar(255) default '' comment '请求参数', oper_param varchar(255) default '' comment '请求参数',
status int(1) default 0 comment '操作状态 0正常 1异常', status int(1) default 0 comment '操作状态 0正常 1异常',
error_msg varchar(2000) default '' comment '错误消息', error_msg varchar(2000) default '' comment '错误消息',
@ -475,15 +475,15 @@ insert into sys_config values(2, '用户管理-账号初始密码', 'sys.use
-- ---------------------------- -- ----------------------------
drop table if exists sys_logininfor; drop table if exists sys_logininfor;
create table sys_logininfor ( create table sys_logininfor (
info_id int(11) not null auto_increment comment '访问ID', info_id int(11) not null auto_increment comment '访问ID',
login_name varchar(50) default '' comment '登录账号', login_name varchar(50) default '' comment '登录账号',
ipaddr varchar(50) default '' comment '登录IP地址', ipaddr varchar(50) default '' comment '登录IP地址',
login_location varchar(255) default '' comment '登录地点', login_location varchar(255) default '' comment '登录地点',
browser varchar(50) default '' comment '浏览器类型', browser varchar(50) default '' comment '浏览器类型',
os varchar(50) default '' comment '操作系统', os varchar(50) default '' comment '操作系统',
status int(1) default 0 comment '登录状态 0成功 1失败', status int(1) default 0 comment '登录状态 0成功 1失败',
msg varchar(255) default '' comment '提示消息', msg varchar(255) default '' comment '提示消息',
login_time datetime comment '访问时间', login_time datetime comment '访问时间',
primary key (info_id) primary key (info_id)
) engine=innodb auto_increment=100 default charset=utf8 comment = '系统访问记录'; ) engine=innodb auto_increment=100 default charset=utf8 comment = '系统访问记录';
@ -497,7 +497,7 @@ create table sys_user_online (
login_name varchar(50) default '' comment '登录账号', login_name varchar(50) default '' comment '登录账号',
dept_name varchar(50) default '' comment '部门名称', dept_name varchar(50) default '' comment '部门名称',
ipaddr varchar(50) default '' comment '登录IP地址', ipaddr varchar(50) default '' comment '登录IP地址',
login_location varchar(255) default '' comment '登录地点', login_location varchar(255) default '' comment '登录地点',
browser varchar(50) default '' comment '浏览器类型', browser varchar(50) default '' comment '浏览器类型',
os varchar(50) default '' comment '操作系统', os varchar(50) default '' comment '操作系统',
status varchar(10) default '' comment '在线状态on_line在线off_line离线', status varchar(10) default '' comment '在线状态on_line在线off_line离线',

View File

@ -5,8 +5,12 @@ package com.ruoyi.common.constant;
* *
* @author ruoyi * @author ruoyi
*/ */
public class CommonConstant public class Constants
{ {
/**
* UTF-8
*/
public static final String UTF8 = "UTF-8";
/** /**
* *

View File

@ -1,46 +1,42 @@
package com.ruoyi.common.utils; package com.ruoyi.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
*
* @author ruoyi
*/ */
public class AddressUtils { public class AddressUtils
public static String getAddresses(String content, String encodingString) throws UnsupportedEncodingException { {
/** 根据IP查询地址 http://ip.taobao.com/service/getIpInfo.phpip=111.111.111.111*/ private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
String urlStr = "http://ip.taobao.com/service/getIpInfo.php";
String returnStr = getResult(urlStr, content, encodingString); public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php";
if (returnStr != null) {
returnStr = decodeUnicode(returnStr);
String[] temp = returnStr.split(",");
if (temp.length < 3) {
return "0";
}
return returnStr;
}
return null;
}
/** /**
* *
*
* @param urlStr * @param urlStr
* @param content * @param content
* @param encoding * @param encoding
* @return * @return
*/ */
private static String getResult(String urlStr, String content, String encoding) { private static String sendPost(String content, String encoding)
{
URL url = null; URL url = null;
HttpURLConnection connection = null; HttpURLConnection connection = null;
try { try
url = new URL(urlStr); {
url = new URL(IP_URL);
connection = (HttpURLConnection) url.openConnection(); connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(2000); connection.setConnectTimeout(2000);
connection.setReadTimeout(2000); connection.setReadTimeout(2000);
@ -56,120 +52,45 @@ public class AddressUtils {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), encoding)); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), encoding));
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
String line = ""; String line = "";
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null)
{
buffer.append(line); buffer.append(line);
} }
reader.close(); reader.close();
return buffer.toString(); return buffer.toString();
} catch (IOException e) { }
System.out.println("温馨提醒:您的主机已经断网,请您检查主机的网络连接"); catch (IOException e)
System.out.println("根据IP获取所在位置----------错误消息:"+e.getMessage()); {
} finally { log.error("温馨提醒:您的主机已经断网,请您检查主机的网络连接");
if (connection != null) { log.error("根据IP获取所在位置----------错误消息:" + e.getMessage());
}
finally
{
if (connection != null)
{
connection.disconnect(); connection.disconnect();
} }
} }
return null; return null;
} }
/** public static String getRealAddressByIP(String ip)
* {
* @param theString
* @return
*/
public static String decodeUnicode(String theString) {
char aChar;
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len);
for (int x = 0; x < len;) {
aChar = theString.charAt(x++);
if (aChar == '\\') {
aChar = theString.charAt(x++);
if (aChar == 'u') {
int value = 0;
for (int i = 0; i < 4; i++) {
aChar = theString.charAt(x++);
switch (aChar) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
value = (value << 4) + aChar - '0';
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
value = (value << 4) + 10 + aChar - 'a';
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
value = (value << 4) + 10 + aChar - 'A';
break;
default:
throw new IllegalArgumentException("Malformed encoding.");
}
}
outBuffer.append((char) value);
} else {
if (aChar == 't') {
aChar = '\t';
} else if (aChar == 'r') {
aChar = '\r';
} else if (aChar == 'n') {
aChar = '\n';
} else if (aChar == 'f') {
aChar = '\f';
}
outBuffer.append(aChar);
}
} else {
outBuffer.append(aChar);
}
}
return outBuffer.toString();
}
public static String getRealAddressByIP(String ip) {
String address = ""; String address = "";
try { try
{
address = sendPost("ip=" + ip, Constants.UTF8);
address = getAddresses("ip=" + ip, "utf-8"); JSONObject json = JSONObject.parseObject(address);
JSONObject object = json.getObject("data", JSONObject.class);
////把JSON文本parse成JSONObject,通俗就是把json文本转为json对象
JSONObject json= JSONObject.parseObject(address);
//通过其get的方法来获取data的value由于返回的是object对象而data的value本身又是json字符串所以我们可以进行强转
JSONObject object = (JSONObject)json.get("data");
String country=object.getString("country");
String region = object.getString("region"); String region = object.getString("region");
String city = object.getString("city"); String city = object.getString("city");
address = country+""+region + "" + city; address = region + " " + city;
} catch (Exception e) { }
catch (Exception e)
{
log.error("根据IP获取所在位置----------错误消息:" + e.getMessage());
} }
return address; return address;
} }
public static void main(String[] args) {
try {
System.out.println(getAddresses("ip=111.85.32.37","utf-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(getRealAddressByIP("111.85.32.37"));
}
} }

View File

@ -38,6 +38,6 @@ public class IpUtils
ip = request.getRemoteAddr(); ip = request.getRemoteAddr();
} }
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
} }
} }

View File

@ -2,7 +2,7 @@ package com.ruoyi.common.utils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.CommonConstant; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.project.monitor.logininfor.domain.Logininfor; import com.ruoyi.project.monitor.logininfor.domain.Logininfor;
@ -40,13 +40,13 @@ public class SystemLogUtils
sys_user_logger.info(s.toString(), args); sys_user_logger.info(s.toString(), args);
if (CommonConstant.LOGIN_SUCCESS.equals(status) || CommonConstant.LOGOUT.equals(status)) if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status))
{ {
saveOpLog(username, msg, CommonConstant.SUCCESS); saveOpLog(username, msg, Constants.SUCCESS);
} }
else if (CommonConstant.LOGIN_FAIL.equals(status)) else if (Constants.LOGIN_FAIL.equals(status))
{ {
saveOpLog(username, msg, CommonConstant.FAIL); saveOpLog(username, msg, Constants.FAIL);
} }
} }

View File

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

View File

@ -15,7 +15,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Configuration @Configuration
public class ResourcesConfig extends WebMvcConfigurerAdapter public class ResourcesConfig extends WebMvcConfigurerAdapter
{ {
/** /**
* *
*/ */
@ -38,7 +37,7 @@ public class ResourcesConfig extends WebMvcConfigurerAdapter
{ {
registry.addResourceHandler("/profile/**").addResourceLocations("file:" + RuoYiConfig.getProfile()); registry.addResourceHandler("/profile/**").addResourceLocations("file:" + RuoYiConfig.getProfile());
/**swagger配置*/ /** swagger配置 */
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); 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("/main", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/system/**", "onlineSession,syncOnlineSession"); filterChainDefinitionMap.put("/system/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/monitor/**", "onlineSession,syncOnlineSession"); filterChainDefinitionMap.put("/monitor/**", "onlineSession,syncOnlineSession");
filterChainDefinitionMap.put("/tool/**", "onlineSession,syncOnlineSession");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean; return shiroFilterFactoryBean;

View File

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

View File

@ -3,7 +3,7 @@ package com.ruoyi.framework.shiro.service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; 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.ShiroConstants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaException;
@ -41,20 +41,20 @@ public class LoginService
// 验证码校验 // 验证码校验
if (!StringUtils.isEmpty(ServletUtils.getStrAttribute(ShiroConstants.CURRENT_CAPTCHA))) 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(); throw new CaptchaException();
} }
// 用户名或密码为空 错误 // 用户名或密码为空 错误
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) 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(); throw new UserNotExistsException();
} }
// 密码如果不在指定范围内 错误 // 密码如果不在指定范围内 错误
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_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(); throw new UserPasswordNotMatchException();
} }
@ -62,7 +62,7 @@ public class LoginService
if (username.length() < UserConstants.USERNAME_MIN_LENGTH if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_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(); throw new UserPasswordNotMatchException();
} }
@ -81,7 +81,7 @@ public class LoginService
if (user == null || UserStatus.DELETED.getCode() == user.getStatus()) 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(); throw new UserNotExistsException();
} }
@ -89,10 +89,10 @@ public class LoginService
if (UserStatus.DISABLE.getCode() == user.getStatus()) 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()); 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); recordLoginInfo(user);
return 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; 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.UserPasswordNotMatchException;
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.MessageUtils;
@ -52,13 +52,13 @@ public class PasswordService
} }
if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue()) 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()); throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue());
} }
if (!matches(user, password)) 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); loginRecordCache.put(loginName, retryCount);
throw new UserPasswordNotMatchException(); throw new UserPasswordNotMatchException();
} }

View File

@ -6,7 +6,7 @@ import org.apache.shiro.session.SessionException;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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.MessageUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SystemLogUtils; 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(); 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(); subject.logout();

View File

@ -1,7 +1,7 @@
package com.ruoyi.framework.web.page; package com.ruoyi.framework.web.page;
import com.ruoyi.common.utils.ServletUtils; 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() public static PageDomain getPageDomain()
{ {
PageDomain pageDomain = new PageDomain(); PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getIntParameter(CommonConstant.PAGENUM)); pageDomain.setPageNum(ServletUtils.getIntParameter(Constants.PAGENUM));
pageDomain.setPageSize(ServletUtils.getIntParameter(CommonConstant.PAGESIZE)); pageDomain.setPageSize(ServletUtils.getIntParameter(Constants.PAGESIZE));
pageDomain.setOrderByColumn(ServletUtils.getStrParameter(CommonConstant.ORDERBYCOLUMN)); pageDomain.setOrderByColumn(ServletUtils.getStrParameter(Constants.ORDERBYCOLUMN));
pageDomain.setIsAsc(ServletUtils.getStrParameter(CommonConstant.ISASC)); pageDomain.setIsAsc(ServletUtils.getStrParameter(Constants.ISASC));
return pageDomain; return pageDomain;
} }

View File

@ -1,7 +1,6 @@
package com.ruoyi.project.monitor.logininfor.domain; package com.ruoyi.project.monitor.logininfor.domain;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date; import java.util.Date;
/** /**
@ -20,8 +19,8 @@ public class Logininfor extends BaseEntity
private String status; private String status;
/** 登录IP地址 */ /** 登录IP地址 */
private String ipaddr; private String ipaddr;
/**登录地点*/ /** 登录地点 */
private String loginLocation; private String loginLocation;
/** 浏览器类型 */ /** 浏览器类型 */
private String browser; private String browser;
/** 操作系统 */ /** 操作系统 */
@ -71,11 +70,13 @@ public class Logininfor extends BaseEntity
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public String getLoginLocation() { public String getLoginLocation()
{
return loginLocation; return loginLocation;
} }
public void setLoginLocation(String loginLocation) { public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation; this.loginLocation = loginLocation;
} }
@ -123,7 +124,8 @@ public class Logininfor extends BaseEntity
public String toString() public String toString()
{ {
return "Logininfor [infoId=" + infoId + ", loginName=" + loginName + ", status=" + status + ", ipaddr=" + ipaddr return "Logininfor [infoId=" + infoId + ", loginName=" + loginName + ", status=" + status + ", ipaddr=" + ipaddr
+ ",loginLocation="+loginLocation+", browser=" + browser + ", os=" + os + ", msg=" + msg + ", loginTime=" + loginTime + "]"; + ",loginLocation=" + loginLocation + ", browser=" + browser + ", os=" + os + ", msg=" + msg
+ ", loginTime=" + loginTime + "]";
} }
} }

View File

@ -3,7 +3,6 @@ package com.ruoyi.project.monitor.online.domain;
import com.ruoyi.common.utils.AddressUtils; import com.ruoyi.common.utils.AddressUtils;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;
import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus; import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus;
import java.util.Date; import java.util.Date;
/** /**
@ -26,7 +25,7 @@ public class UserOnline extends BaseEntity
/** 登录IP地址 */ /** 登录IP地址 */
private String ipaddr; private String ipaddr;
/**登录地址*/ /** 登录地址 */
private String longinLocation; private String longinLocation;
/** 浏览器类型 */ /** 浏览器类型 */
@ -111,11 +110,13 @@ public class UserOnline extends BaseEntity
this.ipaddr = ipaddr; this.ipaddr = ipaddr;
} }
public String getLonginLocation() { public String getLonginLocation()
{
return longinLocation; return longinLocation;
} }
public void setLonginLocation(String longinLocation) { public void setLonginLocation(String longinLocation)
{
this.longinLocation = longinLocation; this.longinLocation = longinLocation;
} }

View File

@ -1,7 +1,6 @@
package com.ruoyi.project.monitor.operlog.domain; package com.ruoyi.project.monitor.operlog.domain;
import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Date; import java.util.Date;
/** /**
@ -30,8 +29,8 @@ public class OperLog extends BaseEntity
private String operUrl; private String operUrl;
/** 操作地址 */ /** 操作地址 */
private String operIp; private String operIp;
/** 操作地点*/ /** 操作地点 */
private String operLocation; private String operLocation;
/** 请求参数 */ /** 请求参数 */
private String operParam; private String operParam;
/** 状态0正常 1异常 */ /** 状态0正常 1异常 */
@ -131,11 +130,13 @@ public class OperLog extends BaseEntity
this.operIp = operIp; this.operIp = operIp;
} }
public String getOperLocation() { public String getOperLocation()
{
return operLocation; return operLocation;
} }
public void setOperLocation(String operLocation) { public void setOperLocation(String operLocation)
{
this.operLocation = operLocation; this.operLocation = operLocation;
} }
@ -184,8 +185,8 @@ public class OperLog extends BaseEntity
{ {
return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method
+ ", channel=" + channel + ", loginName=" + loginName + ", deptName=" + deptName + ", operUrl=" + ", channel=" + channel + ", loginName=" + loginName + ", deptName=" + deptName + ", operUrl="
+ operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam + ", status=" + status + ", errorMsg=" + operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam
+ errorMsg + ", operTime=" + operTime + "]"; + ", status=" + status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]";
} }
} }

View File

@ -12,6 +12,8 @@ import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.config.GenConfig; import com.ruoyi.framework.config.GenConfig;
@ -116,13 +118,13 @@ public class GenServiceImpl implements IGenService
{ {
// 渲染模板 // 渲染模板
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
Template tpl = Velocity.getTemplate(template, "UTF-8"); Template tpl = Velocity.getTemplate(template, Constants.UTF8);
tpl.merge(context, sw); tpl.merge(context, sw);
try try
{ {
// 添加到zip // 添加到zip
zip.putNextEntry(new ZipEntry(GenUtils.getFileName(template, table, moduleName))); zip.putNextEntry(new ZipEntry(GenUtils.getFileName(template, table, moduleName)));
IOUtils.write(sw.toString(), zip, "UTF-8"); IOUtils.write(sw.toString(), zip, Constants.UTF8);
IOUtils.closeQuietly(sw); IOUtils.closeQuietly(sw);
zip.closeEntry(); zip.closeEntry();
} }

View File

@ -3,7 +3,7 @@ package com.ruoyi.project.tool.gen.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import com.ruoyi.common.constant.CommonConstant; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.CommonMap; import com.ruoyi.common.constant.CommonMap;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -105,7 +105,7 @@ public class GenUtils
*/ */
public static String tableToJava(String tableName) public static String tableToJava(String tableName)
{ {
if (CommonConstant.AUTO_REOMVE_PRE.equals(GenConfig.getAutoRemovePre())) if (Constants.AUTO_REOMVE_PRE.equals(GenConfig.getAutoRemovePre()))
{ {
tableName = tableName.substring(tableName.indexOf("_") + 1); tableName = tableName.substring(tableName.indexOf("_") + 1);
} }

View File

@ -3,6 +3,8 @@ package com.ruoyi.project.tool.gen.util;
import java.util.Properties; import java.util.Properties;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import com.ruoyi.common.constant.Constants;
/** /**
* VelocityEngine * VelocityEngine
* *
@ -21,8 +23,8 @@ public class VelocityInitializer
// 加载classpath目录下的vm文件 // 加载classpath目录下的vm文件
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 定义字符集 // 定义字符集
p.setProperty(Velocity.ENCODING_DEFAULT, "UTF-8"); p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8);
p.setProperty(Velocity.OUTPUT_ENCODING, "UTF-8"); p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8);
// 初始化Velocity引擎指定配置Properties // 初始化Velocity引擎指定配置Properties
Velocity.init(p); Velocity.init(p);
} }

View File

@ -5,15 +5,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.project.monitor.logininfor.mapper.LogininforMapper"> <mapper namespace="com.ruoyi.project.monitor.logininfor.mapper.LogininforMapper">
<resultMap type="Logininfor" id="LogininforResult"> <resultMap type="Logininfor" id="LogininforResult">
<id property="infoId" column="info_id" /> <id property="infoId" column="info_id" />
<result property="loginName" column="login_name" /> <result property="loginName" column="login_name" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="ipaddr" column="ipaddr" /> <result property="ipaddr" column="ipaddr" />
<result property="loginLocation" column="login_location" /> <result property="loginLocation" column="login_location" />
<result property="browser" column="browser" /> <result property="browser" column="browser" />
<result property="os" column="os" /> <result property="os" column="os" />
<result property="msg" column="msg" /> <result property="msg" column="msg" />
<result property="loginTime" column="login_time" /> <result property="loginTime" column="login_time" />
</resultMap> </resultMap>
<insert id="insertLogininfor" parameterType="Logininfor"> <insert id="insertLogininfor" parameterType="Logininfor">

View File

@ -9,13 +9,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="loginName" column="login_name" /> <result property="loginName" column="login_name" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="ipaddr" column="ipaddr" /> <result property="ipaddr" column="ipaddr" />
<result property="longinLocation" column="login_location" /> <result property="longinLocation" column="login_location" />
<result property="browser" column="browser" /> <result property="browser" column="browser" />
<result property="os" column="os" /> <result property="os" column="os" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="startTimestamp" column="start_timestsamp" /> <result property="startTimestamp" column="start_timestsamp" />
<result property="lastAccessTime" column="last_access_time" /> <result property="lastAccessTime" column="last_access_time" />
<result property="expireTime" column="expire_time" /> <result property="expireTime" column="expire_time" />
<association property="session" javaType="OnlineSession" resultMap="OnlineSessionResult" /> <association property="session" javaType="OnlineSession" resultMap="OnlineSessionResult" />
</resultMap> </resultMap>

View File

@ -12,9 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="channel" column="channel" /> <result property="channel" column="channel" />
<result property="loginName" column="login_name" /> <result property="loginName" column="login_name" />
<result property="deptName" column="dept_name" /> <result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" /> <result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" /> <result property="operIp" column="oper_ip" />
<result property="operLocation" column="oper_location" /> <result property="operLocation" column="oper_location" />
<result property="operParam" column="oper_param" /> <result property="operParam" column="oper_param" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="errorMsg" column="error_msg" /> <result property="errorMsg" column="error_msg" />

View File

@ -119,7 +119,7 @@ $(function(){
search: true, // 是否显示搜索框功能 search: true, // 是否显示搜索框功能
singleSelect: false, // 是否禁止多选 singleSelect: false, // 是否禁止多选
iconSize: 'outline', // 图标大小undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 iconSize: 'outline', // 图标大小undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮
toolbar: '#toolbar', // 指定工作栏 toolbar: '#toolbar', // 指定工作栏
sidePagination: "server", // 启用服务端分页 sidePagination: "server", // 启用服务端分页
showRefresh: true, // 是否显示刷新按钮 showRefresh: true, // 是否显示刷新按钮
showColumns: true, // 是否显示隐藏某列下拉框 showColumns: true, // 是否显示隐藏某列下拉框

View File

@ -6,6 +6,10 @@ $("#form-dict-add").validate({
dictValue:{ dictValue:{
required:true, required:true,
}, },
dictSort:{
required:true,
digits:true
},
}, },
submitHandler:function(form){ submitHandler:function(form){
add(); add();

View File

@ -6,6 +6,10 @@ $("#form-dict-edit").validate({
dictValue:{ dictValue:{
required:true, required:true,
}, },
dictSort:{
required:true,
digits:true
},
}, },
submitHandler:function(form){ submitHandler:function(form){
update(); update();

View File

@ -8,6 +8,7 @@ $("#form-post-add").validate({
}, },
postSort:{ postSort:{
required:true, required:true,
digits:true
}, },
}, },
submitHandler:function(form){ submitHandler:function(form){

View File

@ -8,6 +8,7 @@ $("#form-post-edit").validate({
}, },
postSort:{ postSort:{
required:true, required:true,
digits:true
}, },
}, },
submitHandler:function(form){ submitHandler:function(form){

View File

@ -40,6 +40,7 @@ $("#form-role-add").validate({
}, },
roleSort:{ roleSort:{
required:true, required:true,
digits:true
}, },
}, },
messages: { messages: {

View File

@ -43,6 +43,7 @@ $("#form-role-edit").validate({
}, },
roleSort:{ roleSort:{
required:true, required:true,
digits:true
}, },
}, },
messages: { messages: {

View File

@ -10,9 +10,11 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
public class RuoYiApplicationTests { public class RuoYiApplicationTests
{
@Test @Test
public void contextLoads() { public void contextLoads()
{
} }
} }