diff --git a/pom.xml b/pom.xml index 3fbb5d49..f043943c 100644 --- a/pom.xml +++ b/pom.xml @@ -86,12 +86,6 @@ true - - - net.sourceforge.nekohtml - nekohtml - - mysql diff --git a/sql/ruoyi.html b/sql/ruoyi.html index a26cd448..915fa1fb 100644 --- a/sql/ruoyi.html +++ b/sql/ruoyi.html @@ -1032,7 +1032,7 @@ varchar(50) default '' t statusstatus varchar(10) default '' 在线状态on_line在线off_line离线 -t start_timestsampstart_timestsamp +<text x='792' y='543' text-anchor='end' class='colType'>t</text> <use id='nn' x='662' y='552' xlink:href='#nn'/><a xlink:href='#sys_user_online.start_timestamp'><text id='ry.sys_user_online.start_timestamp' x='678' y='561'>start_timestamp</text><title>start_timestamp * timestamp default CURRENT_TIMESTAMP session创建时间 d last_access_timelast_access_time @@ -2811,7 +2811,7 @@ varchar(1) * - start_timestsamp + start_timestsamp timestamp DEFAULT CURRENT_TIMESTAMP session创建时间 diff --git a/sql/ruoyi.pdm b/sql/ruoyi.pdm index 9576ec40..1ec5eeec 100644 --- a/sql/ruoyi.pdm +++ b/sql/ruoyi.pdm @@ -3655,8 +3655,8 @@ TableComment 0 新宋体,8,N 0CAF2F1F-459F-4F78-9075-D95F924A4FF7 -start_timestsamp -start_timestsamp +start_timestamp +start_timestamp 1524449375 Administrator 1524449375 diff --git a/sql/ry_20180808.sql b/sql/ry_20180823.sql similarity index 89% rename from sql/ry_20180808.sql rename to sql/ry_20180823.sql index 2f17a922..f57a8ca7 100644 --- a/sql/ry_20180808.sql +++ b/sql/ry_20180823.sql @@ -130,12 +130,12 @@ create table sys_menu ( menu_id int(11) not null auto_increment comment '菜单ID', menu_name varchar(50) not null comment '菜单名称', parent_id int(11) default 0 comment '父菜单ID', - order_num int(4) default null comment '显示顺序', - url varchar(200) default '' comment '请求地址', + order_num int(4) default 0 comment '显示顺序', + url varchar(200) default '#' comment '请求地址', menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', - visible char(1) not null comment '菜单状态(0显示 1隐藏)', + visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', perms varchar(100) default '' comment '权限标识', - icon varchar(100) default '' comment '菜单图标', + icon varchar(100) default '#' comment '菜单图标', create_by varchar(64) default '' comment '创建者', create_time datetime comment '创建时间', update_by varchar(64) default '' comment '更新者', @@ -374,16 +374,16 @@ drop table if exists sys_oper_log; create table sys_oper_log ( oper_id int(11) not null auto_increment comment '日志主键', title varchar(50) default '' comment '模块标题', - action varchar(100) default '' comment '功能请求', + business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)', method varchar(100) default '' comment '方法名称', - channel varchar(20) default '' comment '来源渠道(manage后台用户 mobile手机端用户 other其它)', + operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)', oper_name varchar(50) default '' comment '操作人员', dept_name varchar(50) default '' comment '部门名称', oper_url varchar(255) default '' comment '请求URL', oper_ip varchar(30) default '' comment '主机地址', oper_location varchar(255) default '' comment '操作地点', oper_param varchar(255) default '' comment '请求参数', - status char(1) default '0' comment '操作状态(0正常 1异常)', + status int(1) default 0 comment '操作状态(0正常 1异常)', error_msg varchar(2000) default '' comment '错误消息', oper_time datetime comment '操作时间', primary key (oper_id) @@ -431,8 +431,8 @@ create table sys_dict_data dict_label varchar(100) default '' comment '字典标签', dict_value varchar(100) default '' comment '字典键值', dict_type varchar(100) default '' comment '字典类型', - css_class varchar(500) default '' comment '样式属性', - list_class varchar(500) default '' comment '回显样式', + css_class varchar(500) default '' comment '样式属性(其他样式扩展)', + list_class varchar(500) default '' comment '表格回显样式', is_default char(1) default 'N' comment '是否默认(Y是 N否)', status char(1) default '0' comment '状态(0正常 1停用)', create_by varchar(64) default '' comment '创建者', @@ -444,31 +444,31 @@ create table sys_dict_data ) engine=innodb auto_increment=100 default charset=utf8 comment = '字典数据表'; -insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男'); -insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女'); -insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知'); -insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单'); -insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单'); -insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是'); -insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否'); -insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知'); -insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告'); -insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', 'radio radio-info radio-inline', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', 'radio radio-danger radio-inline', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态'); -insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(18, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(19, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(20, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(21, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(22, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(23, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); -insert into sys_dict_data values(24, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); -insert into sys_dict_data values(25, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别男'); +insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别女'); +insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '性别未知'); +insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '显示菜单'); +insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '隐藏菜单'); +insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); +insert into sys_dict_data values(10, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认是'); +insert into sys_dict_data values(11, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统默认否'); +insert into sys_dict_data values(12, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知'); +insert into sys_dict_data values(13, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '公告'); +insert into sys_dict_data values(14, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(15, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '关闭状态'); +insert into sys_dict_data values(16, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(17, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(18, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(19, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(20, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(21, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(22, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(23, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '新增操作'); +insert into sys_dict_data values(24, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '正常状态'); +insert into sys_dict_data values(25, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '停用状态'); -- ---------------------------- @@ -524,7 +524,7 @@ create table sys_user_online ( browser varchar(50) default '' comment '浏览器类型', os varchar(50) default '' comment '操作系统', status varchar(10) default '' comment '在线状态on_line在线off_line离线', - start_timestsamp datetime comment 'session创建时间', + start_timestamp datetime comment 'session创建时间', last_access_time datetime comment 'session最后访问时间', expire_time int(5) default 0 comment '超时时间,单位为分钟', primary key (sessionId) diff --git a/src/main/java/com/ruoyi/common/utils/AddressUtils.java b/src/main/java/com/ruoyi/common/utils/AddressUtils.java index 27399593..5179f97b 100644 --- a/src/main/java/com/ruoyi/common/utils/AddressUtils.java +++ b/src/main/java/com/ruoyi/common/utils/AddressUtils.java @@ -19,22 +19,20 @@ public class AddressUtils public static String getRealAddressByIP(String ip) { - String address = ""; - try + String address = "XX XX"; + if (RuoYiConfig.isAddressEnabled()) { - if (RuoYiConfig.isAddressEnabled()) + String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip); + if (StringUtils.isEmpty(rspStr)) { - address = HttpUtils.sendPost(IP_URL, "ip=" + ip); - JSONObject json = JSONObject.parseObject(address); - JSONObject object = json.getObject("data", JSONObject.class); - String region = object.getString("region"); - String city = object.getString("city"); - address = region + " " + city; + log.error("获取地理位置异常 {}", ip); + return address; } - } - catch (Exception e) - { - log.error("获取地理位置异常:", e); + JSONObject obj = JSONObject.parseObject(rspStr); + JSONObject data = obj.getObject("data", JSONObject.class); + String region = data.getString("region"); + String city = data.getString("city"); + address = region + " " + city; } return address; } diff --git a/src/main/java/com/ruoyi/common/utils/SystemLogUtils.java b/src/main/java/com/ruoyi/common/utils/SystemLogUtils.java deleted file mode 100644 index 86e2e77c..00000000 --- a/src/main/java/com/ruoyi/common/utils/SystemLogUtils.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ruoyi.common.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.security.ShiroUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.project.monitor.logininfor.domain.Logininfor; -import com.ruoyi.project.monitor.logininfor.service.LogininforServiceImpl; - -import eu.bitwalker.useragentutils.UserAgent; - -/** - * 记录用户日志信息 - * - * @author ruoyi - */ -@Deprecated // 加入异步功能之后,该类已无意义 -public class SystemLogUtils { - - private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); - - /** - * 记录格式 [ip][用户名][操作][错误消息] - *

- * 注意操作如下: loginError 登录失败 loginSuccess 登录成功 passwordError 密码错误 - * changePassword 修改密码 changeStatus 修改状态 - * - * @param username - * @param op - * @param msg - * @param args - */ - public static void log(String username, String status, String msg, Object... args) { - StringBuilder s = new StringBuilder(); - s.append(LogUtils.getBlock(ShiroUtils.getIp())); - s.append(AddressUtils.getRealAddressByIP(ShiroUtils.getIp())); - s.append(LogUtils.getBlock(username)); - s.append(LogUtils.getBlock(status)); - s.append(LogUtils.getBlock(msg)); - - sys_user_logger.info(s.toString(), args); - - if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) { - saveOpLog(username, msg, Constants.SUCCESS); - } else if (Constants.LOGIN_FAIL.equals(status)) { - saveOpLog(username, msg, Constants.FAIL); - } - } - - public static void saveOpLog(String username, String message, String status) { - UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); - // 获取客户端操作系统 - String os = userAgent.getOperatingSystem().getName(); - // 获取客户端浏览器 - String browser = userAgent.getBrowser().getName(); - LogininforServiceImpl logininforService = SpringUtils.getBean(LogininforServiceImpl.class); - Logininfor logininfor = new Logininfor(); - logininfor.setLoginName(username); - logininfor.setStatus(status); - logininfor.setIpaddr(ShiroUtils.getIp()); - logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ShiroUtils.getIp())); - logininfor.setBrowser(browser); - logininfor.setOs(os); - logininfor.setMsg(message); - logininforService.insertLogininfor(logininfor); - } -} diff --git a/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index d168e9f7..a5e49599 100644 --- a/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -2,6 +2,7 @@ package com.ruoyi.common.utils.poi; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; @@ -53,22 +54,46 @@ public class ExcelUtil this.clazz = clazz; } + /** + * 对excel表单默认第一个索引名转换成list + * + * @param input 输入流 + * @return 转换后集合 + */ + public List importExcel(InputStream input) throws Exception + { + return importExcel(StringUtils.EMPTY, input); + } + + /** + * 对excel表单指定表格索引名转换成list + * + * @param sheetName 表格索引名 + * @param input 输入流 + * @return 转换后集合 + */ public List importExcel(String sheetName, InputStream input) throws Exception { List list = new ArrayList(); Workbook workbook = WorkbookFactory.create(input); - Sheet sheet = workbook.getSheet(sheetName); + Sheet sheet = null; if (StringUtils.isNotEmpty(sheetName)) { // 如果指定sheet名,则取指定sheet中的内容. sheet = workbook.getSheet(sheetName); } - if (sheet == null) + else { // 如果传入的sheet名不存在则默认指向第1个sheet. sheet = workbook.getSheetAt(0); } + + if (sheet == null) + { + throw new IOException("文件sheet不存在"); + } + int rows = sheet.getPhysicalNumberOfRows(); if (rows > 0) @@ -117,7 +142,7 @@ public class ExcelUtil // 如果不存在实例则新建. entity = (entity == null ? clazz.newInstance() : entity); // 从map中得到对应列的field. - Field field = fieldsMap.get(j); + Field field = fieldsMap.get(j + 1); // 取得类型,并根据对象类型设置值. Class fieldType = field.getType(); if (String.class == fieldType) diff --git a/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java b/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java index bfc64db3..6b3611c1 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java +++ b/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java @@ -39,13 +39,11 @@ public class DsAspect Method method = signature.getMethod(); - if (method.isAnnotationPresent(Ds.class)) + Ds dataSource = method.getAnnotation(Ds.class); + + if (StringUtils.isNotNull(dataSource)) { - Ds dataSource = method.getAnnotation(Ds.class); - if (StringUtils.isNotNull(dataSource) && StringUtils.isNotEmpty(dataSource.name())) - { - DynamicDataSourceContextHolder.setDB(dataSource.name()); - } + DynamicDataSourceContextHolder.setDateSoureType(dataSource.value().name()); } try @@ -54,7 +52,8 @@ public class DsAspect } finally { - DynamicDataSourceContextHolder.clearDB(); + // 销毁数据源 在执行方法之后 + DynamicDataSourceContextHolder.clearDateSoureType(); } } } diff --git a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 6ce675e8..677f40b9 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -2,7 +2,6 @@ package com.ruoyi.framework.aspectj; import java.lang.reflect.Method; import java.util.Map; - import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.AfterReturning; @@ -15,13 +14,12 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.stereotype.Component; - import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessStatus; +import com.ruoyi.framework.aspectj.lang.enums.BusinessStatus; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.project.monitor.operlog.domain.OperLog; @@ -35,128 +33,144 @@ import com.ruoyi.project.system.user.domain.User; @Aspect @Component @EnableAsync -public class LogAspect { - private static final Logger log = LoggerFactory.getLogger(LogAspect.class); +public class LogAspect +{ + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); - // 配置织入点 - @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.Log)") - public void logPointCut() { - } + // 配置织入点 + @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.Log)") + public void logPointCut() + { + } - /** - * 前置通知 用于拦截操作 - * - * @param joinPoint - * 切点 - */ - @AfterReturning(pointcut = "logPointCut()") - public void doBefore(JoinPoint joinPoint) { - handleLog(joinPoint, null); - } + /** + * 前置通知 用于拦截操作 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "logPointCut()") + public void doBefore(JoinPoint joinPoint) + { + handleLog(joinPoint, null); + } - /** - * 拦截异常操作 - * - * @param joinPoint - * @param e - */ - @AfterThrowing(value = "logPointCut()", throwing = "e") - public void doAfter(JoinPoint joinPoint, Exception e) { - handleLog(joinPoint, e); - } + /** + * 拦截异常操作 + * + * @param joinPoint + * @param e + */ + @AfterThrowing(value = "logPointCut()", throwing = "e") + public void doAfter(JoinPoint joinPoint, Exception e) + { + handleLog(joinPoint, e); + } - @Async - protected void handleLog(final JoinPoint joinPoint, final Exception e) { - try { - // 获得注解 - Log controllerLog = getAnnotationLog(joinPoint); - if (controllerLog == null) { - return; - } + @Async + protected void handleLog(final JoinPoint joinPoint, final Exception e) + { + try + { + // 获得注解 + Log controllerLog = getAnnotationLog(joinPoint); + if (controllerLog == null) + { + return; + } - // 获取当前的用户 - User currentUser = ShiroUtils.getUser(); + // 获取当前的用户 + User currentUser = ShiroUtils.getUser(); - // *========数据库日志=========*// - OperLog operLog = new OperLog(); - operLog.setStatus(BusinessStatus.SUCCESS); - // 请求的地址 - String ip = ShiroUtils.getIp(); - operLog.setOperIp(ip); + // *========数据库日志=========*// + OperLog operLog = new OperLog(); + operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); + // 请求的地址 + String ip = ShiroUtils.getIp(); + operLog.setOperIp(ip); - operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); - if (currentUser != null) { - operLog.setOperName(currentUser.getLoginName()); - if (StringUtils.isNotNull(currentUser.getDept()) && StringUtils.isNotEmpty(currentUser.getDept().getDeptName())) { - operLog.setDeptName(currentUser.getDept().getDeptName()); - } - } + operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); + if (currentUser != null) + { + operLog.setOperName(currentUser.getLoginName()); + if (StringUtils.isNotNull(currentUser.getDept()) + && StringUtils.isNotEmpty(currentUser.getDept().getDeptName())) + { + operLog.setDeptName(currentUser.getDept().getDeptName()); + } + } - if (e != null) { - operLog.setStatus(BusinessStatus.FAIL); - operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); - } - // 设置方法名称 - String className = joinPoint.getTarget().getClass().getName(); - String methodName = joinPoint.getSignature().getName(); - operLog.setMethod(className + "." + methodName + "()"); - // 处理设置注解上的参数 - getControllerMethodDescription(controllerLog, operLog); - // 保存数据库 - AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); - } catch (Exception exp) { - // 记录本地异常日志 - log.error("==前置通知异常=="); - log.error("异常信息:{}", exp.getMessage()); - exp.printStackTrace(); - } - } + if (e != null) + { + operLog.setStatus(BusinessStatus.FAIL.ordinal()); + operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); + } + // 设置方法名称 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + operLog.setMethod(className + "." + methodName + "()"); + // 处理设置注解上的参数 + getControllerMethodDescription(controllerLog, operLog); + // 保存数据库 + AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); + } + catch (Exception exp) + { + // 记录本地异常日志 + log.error("==前置通知异常=="); + log.error("异常信息:{}", exp.getMessage()); + exp.printStackTrace(); + } + } - /** - * 获取注解中对方法的描述信息 用于Controller层注解 - * - * @param joinPoint - * 切点 - * @return 方法描述 - * @throws Exception - */ - public void getControllerMethodDescription(Log log, OperLog operLog) throws Exception { - // 设置action动作 - operLog.setAction(log.action()); - // 设置标题 - operLog.setTitle(log.title()); - // 设置channel - operLog.setChannel(log.channel()); - // 是否需要保存request,参数和值 - if (log.isSaveRequestData()) { - // 获取参数的信息,传入到数据库中。 - setRequestValue(operLog); - } - } + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param joinPoint 切点 + * @return 方法描述 + * @throws Exception + */ + public void getControllerMethodDescription(Log log, OperLog operLog) throws Exception + { + // 设置action动作 + operLog.setBusinessType(log.businessType().ordinal()); + // 设置标题 + operLog.setTitle(log.title()); + // 设置操作人类别 + operLog.setOperatorType(log.operatorType().ordinal()); + // 是否需要保存request,参数和值 + if (log.isSaveRequestData()) + { + // 获取参数的信息,传入到数据库中。 + setRequestValue(operLog); + } + } - /** - * 获取请求的参数,放到log中 - * - * @param operLog - * @param request - */ - private void setRequestValue(OperLog operLog) { - Map map = ServletUtils.getRequest().getParameterMap(); - String params = JSONObject.toJSONString(map); - operLog.setOperParam(StringUtils.substring(params, 0, 255)); - } + /** + * 获取请求的参数,放到log中 + * + * @param operLog + * @param request + */ + private void setRequestValue(OperLog operLog) + { + Map map = ServletUtils.getRequest().getParameterMap(); + String params = JSONObject.toJSONString(map); + operLog.setOperParam(StringUtils.substring(params, 0, 255)); + } - /** - * 是否存在注解,如果存在就获取 - */ - private Log getAnnotationLog(JoinPoint joinPoint) throws Exception { - Signature signature = joinPoint.getSignature(); - MethodSignature methodSignature = (MethodSignature) signature; - Method method = methodSignature.getMethod(); + /** + * 是否存在注解,如果存在就获取 + */ + private Log getAnnotationLog(JoinPoint joinPoint) throws Exception + { + Signature signature = joinPoint.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method method = methodSignature.getMethod(); - if (method != null) { - return method.getAnnotation(Log.class); - } - return null; - } + if (method != null) + { + return method.getAnnotation(Log.class); + } + return null; + } } diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java index 784f27a2..5dd04439 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java @@ -4,7 +4,8 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; + +import com.ruoyi.framework.aspectj.lang.enums.DataSourceType; /** * 自定义多数据源切换注解 @@ -16,7 +17,7 @@ import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; public @interface Ds { /** - * 切换数据源值 + * 切换数据源名称 */ - String name() default DataSourceName.MASTER; + public DataSourceType value() default DataSourceType.MASTER; } diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Log.java b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Log.java index 70337d4d..4437affd 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Log.java +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Log.java @@ -5,7 +5,8 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import com.ruoyi.framework.aspectj.lang.constant.OperatorType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.OperatorType; /** * 自定义操作日志记录注解 @@ -22,10 +23,10 @@ public @interface Log String title() default ""; /** 功能 */ - String action() default ""; + BusinessType businessType() default BusinessType.OTHER; - /** 渠道 */ - String channel() default OperatorType.MANAGE; + /** 操作人类别 */ + OperatorType operatorType() default OperatorType.MANAGE; /** 是否保存请求的参数 */ boolean isSaveRequestData() default true; diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessStatus.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessStatus.java deleted file mode 100644 index 6f9b8b15..00000000 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessStatus.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ruoyi.framework.aspectj.lang.constant; - -/** - * 操作状态 - * - * @author ruoyi - * - */ -public class BusinessStatus -{ - /** 其它 */ - public static final String OTHER = "-1"; - - /** 成功 */ - public static final String SUCCESS = "0"; - - /** 失败 */ - public static final String FAIL = "1"; -} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java deleted file mode 100644 index 2990630d..00000000 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/BusinessType.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ruoyi.framework.aspectj.lang.constant; - -/** - * 业务操作类型 - * - * @author ruoyi - * - */ -public class BusinessType -{ - /** 其它 */ - public static final String OTHER = "0"; - /** 新增 */ - public static final String INSERT = "1"; - /** 修改 */ - public static final String UPDATE = "2"; - /** 删除 */ - public static final String DELETE = "3"; - /** 授权 */ - public static final String GRANT = "4"; - /** 导出 */ - public static final String EXPORT = "5"; - /** 导入 */ - public static final String IMPORT = "6"; - /** 强退 */ - public static final String FORCE = "7"; - /** 生成代码 */ - public static final String GENCODE = "8"; -} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java deleted file mode 100644 index cffeb1e0..00000000 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.framework.aspectj.lang.constant; - -/** - * 多数据源别名 - * - * @author ruoyi - * - */ -public class DataSourceName -{ - /** 主库 */ - public static final String MASTER = "master"; - - /** 从库 */ - public static final String SLAVE = "slave"; -} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/OperatorType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/OperatorType.java deleted file mode 100644 index 8e470258..00000000 --- a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/OperatorType.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ruoyi.framework.aspectj.lang.constant; - -/** - * 操作人类别 - * - * @author ruoyi - * - */ -public class OperatorType -{ - /** 其它 */ - public static final String OTHER = "0"; - - /** 后台用户 */ - public static final String MANAGE = "1"; - - /** 渠道用户 */ - public static final String CHANNEL = "2"; - - /** 手机端用户 */ - public static final String MOBILE = "3"; -} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessStatus.java b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessStatus.java new file mode 100644 index 00000000..2e1c7af9 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessStatus.java @@ -0,0 +1,20 @@ +package com.ruoyi.framework.aspectj.lang.enums; + +/** + * 操作状态 + * + * @author ruoyi + * + */ +public enum BusinessStatus +{ + /** + * 成功 + */ + SUCCESS, + + /** + * 失败 + */ + FAIL, +} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessType.java new file mode 100644 index 00000000..dbc027ed --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/BusinessType.java @@ -0,0 +1,55 @@ +package com.ruoyi.framework.aspectj.lang.enums; + +/** + * 业务操作类型 + * + * @author ruoyi + * + */ +public enum BusinessType +{ + /** + * 其它 + */ + OTHER, + + /** + * 新增 + */ + INSERT, + + /** + * 修改 + */ + UPDATE, + + /** + * 删除 + */ + DELETE, + + /** + * 授权 + */ + GRANT, + + /** + * 导出 + */ + EXPORT, + + /** + * 导入 + */ + IMPORT, + + /** + * 强退 + */ + FORCE, + + /** + * 生成代码 + */ + GENCODE, +} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/enums/DataSourceType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/DataSourceType.java new file mode 100644 index 00000000..103cd806 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/DataSourceType.java @@ -0,0 +1,19 @@ +package com.ruoyi.framework.aspectj.lang.enums; + +/** + * 数据源 + * + * @author ruoyi + */ +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/enums/OperatorType.java b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/OperatorType.java new file mode 100644 index 00000000..a325d688 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/enums/OperatorType.java @@ -0,0 +1,26 @@ +package com.ruoyi.framework.aspectj.lang.enums; + +/** + * 操作人类别 + * + * @author ruoyi + * + */ +public enum OperatorType +{ + /** + * 其它 + */ + OTHER, + + /** + * 后台用户 + */ + + MANAGE, + + /** + * 手机端用户 + */ + MOBILE +} diff --git a/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/src/main/java/com/ruoyi/framework/config/DruidConfig.java index 86f2eab1..1fac0617 100644 --- a/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ b/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; -import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; +import com.ruoyi.framework.aspectj.lang.enums.DataSourceType; import com.ruoyi.framework.datasource.DynamicDataSource; /** @@ -29,7 +29,7 @@ public class DruidConfig @Bean @ConfigurationProperties("spring.datasource.druid.slave") - @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "open", havingValue = "true") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") public DataSource slaveDataSource() { return DruidDataSourceBuilder.create().build(); @@ -40,8 +40,8 @@ public class DruidConfig public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource) { Map targetDataSources = new HashMap<>(); - targetDataSources.put(DataSourceName.MASTER, masterDataSource); - targetDataSources.put(DataSourceName.SLAVE, slaveDataSource); + targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); + targetDataSources.put(DataSourceType.SLAVE.name(), slaveDataSource); return new DynamicDataSource(masterDataSource, targetDataSources); } } diff --git a/src/main/java/com/ruoyi/framework/config/ScheduleConfig.java b/src/main/java/com/ruoyi/framework/config/ScheduleConfig.java index ff611dbc..57746331 100644 --- a/src/main/java/com/ruoyi/framework/config/ScheduleConfig.java +++ b/src/main/java/com/ruoyi/framework/config/ScheduleConfig.java @@ -38,6 +38,8 @@ public class ScheduleConfig prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); + // sqlserver 启用 + //prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); prop.put("org.quartz.jobStore.misfireThreshold", "12000"); prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); factory.setQuartzProperties(prop); diff --git a/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java index f1c97cf0..29d9578c 100644 --- a/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java +++ b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java @@ -21,7 +21,7 @@ public class DynamicDataSource extends AbstractRoutingDataSource @Override protected Object determineCurrentLookupKey() { - return DynamicDataSourceContextHolder.getDB(); + return DynamicDataSourceContextHolder.getDateSoureType(); } } \ No newline at end of file diff --git a/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java index 0d6d7e88..6f701202 100644 --- a/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java +++ b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java @@ -4,7 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * 当前线程数据源 + * 数据源切换处理 * * @author ruoyi */ @@ -12,29 +12,33 @@ public class DynamicDataSourceContextHolder { public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); /** - * 设置数据源名 + * 设置数据源的变量 */ - public static void setDB(String dbType) + public static void setDateSoureType(String dsType) { - log.info("切换到{}数据源", dbType); - CONTEXT_HOLDER.set(dbType); + log.info("切换到{}数据源", dsType); + CONTEXT_HOLDER.set(dsType); } /** - * 获取数据源名 + * 获得数据源的变量 */ - public static String getDB() + public static String getDateSoureType() { return CONTEXT_HOLDER.get(); } /** - * 清理数据源名 + * 清空数据源变量 */ - public static void clearDB() + public static void clearDateSoureType() { CONTEXT_HOLDER.remove(); } diff --git a/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/src/main/java/com/ruoyi/framework/manager/AsyncManager.java index c56dd776..0a015a6b 100644 --- a/src/main/java/com/ruoyi/framework/manager/AsyncManager.java +++ b/src/main/java/com/ruoyi/framework/manager/AsyncManager.java @@ -9,18 +9,35 @@ import java.util.concurrent.TimeUnit; * * @author liuhulu */ -public class AsyncManager { - // 操作延迟 - private final int OPERATE_DELAY_TIME = 10; - // 异步操作此案城池 - private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5); - // 单例 - private static AsyncManager me = new AsyncManager(); - public static AsyncManager me() { - return me; - } - // 执行任务 - public void execute(TimerTask task) { - executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); - } +public class AsyncManager +{ + /** + * 操作延迟10毫秒 + */ + private final int OPERATE_DELAY_TIME = 10; + + /** + * 异步操作任务调度线程池 + */ + private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5); + + /** + * 单例模式 + */ + private static AsyncManager me = new AsyncManager(); + + public static AsyncManager me() + { + return me; + } + + /** + * 执行任务 + * + * @param 任务task + */ + public void execute(TimerTask task) + { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } } diff --git a/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java index 282ca626..8bac132f 100644 --- a/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java +++ b/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java @@ -1,10 +1,8 @@ package com.ruoyi.framework.manager.factory; import java.util.TimerTask; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.AddressUtils; import com.ruoyi.common.utils.LogUtils; @@ -18,7 +16,6 @@ import com.ruoyi.project.monitor.online.domain.UserOnline; import com.ruoyi.project.monitor.online.service.IUserOnlineService; import com.ruoyi.project.monitor.operlog.domain.OperLog; import com.ruoyi.project.monitor.operlog.service.IOperLogService; - import eu.bitwalker.useragentutils.UserAgent; /** @@ -27,99 +24,112 @@ import eu.bitwalker.useragentutils.UserAgent; * @author liuhulu * */ -public class AsyncFactory { - private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); +public class AsyncFactory +{ + private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); - /** - * 同步session到数据库 - * - * @param operLog - * @return - */ - public static TimerTask syncSessionToDb(final OnlineSession session) { - return new TimerTask() { - @Override - public void run() { - UserOnline online = new UserOnline(); - online.setSessionId(String.valueOf(session.getId())); - online.setDeptName(session.getDeptName()); - online.setLoginName(session.getLoginName()); - online.setStartTimestamp(session.getStartTimestamp()); - online.setLastAccessTime(session.getLastAccessTime()); - online.setExpireTime(session.getTimeout()); - online.setIpaddr(session.getHost()); - online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost())); - online.setBrowser(session.getBrowser()); - online.setOs(session.getOs()); - online.setStatus(session.getStatus()); - online.setSession(session); - SpringUtils.getBean(IUserOnlineService.class).saveOnline(online); + /** + * 同步session到数据库 + * + * @param session 在线用户会话 + * @return 任务task + */ + public static TimerTask syncSessionToDb(final OnlineSession session) + { + return new TimerTask() + { + @Override + public void run() + { + UserOnline online = new UserOnline(); + online.setSessionId(String.valueOf(session.getId())); + online.setDeptName(session.getDeptName()); + online.setLoginName(session.getLoginName()); + online.setStartTimestamp(session.getStartTimestamp()); + online.setLastAccessTime(session.getLastAccessTime()); + online.setExpireTime(session.getTimeout()); + online.setIpaddr(session.getHost()); + online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost())); + online.setBrowser(session.getBrowser()); + online.setOs(session.getOs()); + online.setStatus(session.getStatus()); + online.setSession(session); + SpringUtils.getBean(IUserOnlineService.class).saveOnline(online); - } - }; - } - /** - * 记录 操作log - * - * @param rc - * @return - */ - public static TimerTask recordOper(final OperLog operLog) { - return new TimerTask() { - @Override - public void run() { - // 远程查询操作地点 - operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); - SpringUtils.getBean(IOperLogService.class).insertOperlog(operLog); - } - }; - } + } + }; + } - /** - * 记录登陆信息 - * - * @param username - * @param status - * @param message - * @param userAgent - * @param args - * @return - */ - public static TimerTask recordLogininfor(final String username, final String status, final String message, final Object... args) { - final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); - return new TimerTask() { - @Override - public void run() { - StringBuilder s = new StringBuilder(); - s.append(LogUtils.getBlock(ShiroUtils.getIp())); - s.append(AddressUtils.getRealAddressByIP(ShiroUtils.getIp())); - s.append(LogUtils.getBlock(username)); - s.append(LogUtils.getBlock(status)); - s.append(LogUtils.getBlock(message)); - // 打印信息到日志 - sys_user_logger.info(s.toString(), args); - // 获取客户端操作系统 - String os = userAgent.getOperatingSystem().getName(); - // 获取客户端浏览器 - String browser = userAgent.getBrowser().getName(); - // 封装对象 - Logininfor logininfor = new Logininfor(); - logininfor.setLoginName(username); - logininfor.setIpaddr(ShiroUtils.getIp()); - logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ShiroUtils.getIp())); - logininfor.setBrowser(browser); - logininfor.setOs(os); - logininfor.setMsg(message); - // 日志状态 - if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) { - logininfor.setStatus(Constants.SUCCESS); - } else if (Constants.LOGIN_FAIL.equals(status)) { - logininfor.setStatus(Constants.FAIL); - } - // 插入数据 - SpringUtils.getBean(LogininforServiceImpl.class).insertLogininfor(logininfor); - } - }; - } + /** + * 操作日志记录 + * + * @param operLog 操作日志信息 + * @return 任务task + */ + public static TimerTask recordOper(final OperLog operLog) + { + return new TimerTask() + { + @Override + public void run() + { + // 远程查询操作地点 + operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); + SpringUtils.getBean(IOperLogService.class).insertOperlog(operLog); + } + }; + } + /** + * 记录登陆信息 + * + * @param username 用户名 + * @param status 状态 + * @param message 消息 + * @param args 列表 + * @return 任务task + */ + public static TimerTask recordLogininfor(final String username, final String status, final String message, final Object... args) + { + final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + final String ip = ShiroUtils.getIp(); + return new TimerTask() + { + @Override + public void run() + { + StringBuilder s = new StringBuilder(); + s.append(LogUtils.getBlock(ip)); + s.append(AddressUtils.getRealAddressByIP(ip)); + s.append(LogUtils.getBlock(username)); + s.append(LogUtils.getBlock(status)); + s.append(LogUtils.getBlock(message)); + // 打印信息到日志 + sys_user_logger.info(s.toString(), args); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + // 封装对象 + Logininfor logininfor = new Logininfor(); + logininfor.setLoginName(username); + logininfor.setIpaddr(ip); + logininfor.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + logininfor.setBrowser(browser); + logininfor.setOs(os); + logininfor.setMsg(message); + // 日志状态 + if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) + { + logininfor.setStatus(Constants.SUCCESS); + } + else if (Constants.LOGIN_FAIL.equals(status)) + { + logininfor.setStatus(Constants.FAIL); + } + // 插入数据 + SpringUtils.getBean(LogininforServiceImpl.class).insertLogininfor(logininfor); + } + }; + } } diff --git a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java index 7f66793f..0151562e 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java +++ b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java @@ -3,7 +3,6 @@ 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.Constants; import com.ruoyi.common.constant.ShiroConstants; import com.ruoyi.common.constant.UserConstants; @@ -27,101 +26,104 @@ import com.ruoyi.project.system.user.service.IUserService; * @author ruoyi */ @Component -public class LoginService { - @Autowired - private PasswordService passwordService; +public class LoginService +{ + @Autowired + private PasswordService passwordService; - @Autowired - private IUserService userService; + @Autowired + private IUserService userService; - /** - * 登录 - */ - public User login(String username, String password) { - // 验证码校验 - if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA))) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.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)) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.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) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); - // SystemLogUtils.log(username, Constants.LOGIN_FAIL, - // MessageUtils.message("user.password.not.match")); - throw new UserPasswordNotMatchException(); - } + /** + * 登录 + */ + public User login(String username, String password) + { + // 验证码校验 + if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA))) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + // 用户名或密码为空 错误 + if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); + throw new UserNotExistsException(); + } + // 密码如果不在指定范围内 错误 + if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } - // 用户名不在指定范围内 错误 - if (username.length() < UserConstants.USERNAME_MIN_LENGTH || username.length() > UserConstants.USERNAME_MAX_LENGTH) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); - // SystemLogUtils.log(username, Constants.LOGIN_FAIL, - // MessageUtils.message("user.password.not.match")); - throw new UserPasswordNotMatchException(); - } + // 用户名不在指定范围内 错误 + if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } - // 查询用户信息 - User user = userService.selectUserByLoginName(username); + // 查询用户信息 + User user = userService.selectUserByLoginName(username); - if (user == null && maybeMobilePhoneNumber(username)) { - user = userService.selectUserByPhoneNumber(username); - } + if (user == null && maybeMobilePhoneNumber(username)) + { + user = userService.selectUserByPhoneNumber(username); + } - if (user == null && maybeEmail(username)) { - user = userService.selectUserByEmail(username); - } + if (user == null && maybeEmail(username)) + { + user = userService.selectUserByEmail(username); + } - if (user == null || UserStatus.DELETED.getCode().equals(user.getDelFlag())) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists"))); - // SystemLogUtils.log(username, Constants.LOGIN_FAIL, - // MessageUtils.message("user.not.exists")); - throw new UserNotExistsException(); - } + if (user == null || UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists"))); + throw new UserNotExistsException(); + } - passwordService.validate(user, password); + passwordService.validate(user, password); - if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.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()); - } - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); - // SystemLogUtils.log(username, Constants.LOGIN_SUCCESS, - // MessageUtils.message("user.login.success")); - recordLoginInfo(user); - return user; - } + if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark()))); + throw new UserBlockedException(user.getRemark()); + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + recordLoginInfo(user); + return user; + } - private boolean maybeEmail(String username) { - if (!username.matches(UserConstants.EMAIL_PATTERN)) { - return false; - } - return true; - } + private boolean maybeEmail(String username) + { + if (!username.matches(UserConstants.EMAIL_PATTERN)) + { + return false; + } + return true; + } - private boolean maybeMobilePhoneNumber(String username) { - if (!username.matches(UserConstants.MOBILE_PHONE_NUMBER_PATTERN)) { - return false; - } - return true; - } + private boolean maybeMobilePhoneNumber(String username) + { + if (!username.matches(UserConstants.MOBILE_PHONE_NUMBER_PATTERN)) + { + return false; + } + return true; + } - /** - * 记录登录信息 - */ - public void recordLoginInfo(User user) { - user.setLoginIp(ShiroUtils.getIp()); - user.setLoginDate(DateUtils.getNowDate()); - userService.updateUserInfo(user); - } + /** + * 记录登录信息 + */ + public void recordLoginInfo(User user) + { + user.setLoginIp(ShiroUtils.getIp()); + user.setLoginDate(DateUtils.getNowDate()); + userService.updateUserInfo(user); + } } diff --git a/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java b/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java index cbf51200..8e8bfa77 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java +++ b/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java @@ -1,16 +1,13 @@ package com.ruoyi.framework.shiro.service; import java.util.concurrent.atomic.AtomicInteger; - import javax.annotation.PostConstruct; - import org.apache.shiro.cache.Cache; import org.apache.shiro.cache.CacheManager; import org.apache.shiro.crypto.hash.Md5Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; - import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.user.UserPasswordNotMatchException; import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; @@ -25,66 +22,70 @@ import com.ruoyi.project.system.user.domain.User; * @author ruoyi */ @Component -public class PasswordService { +public class PasswordService +{ - @Autowired - private CacheManager cacheManager; + @Autowired + private CacheManager cacheManager; - private Cache loginRecordCache; + private Cache loginRecordCache; - @Value(value = "${user.password.maxRetryCount}") - private String maxRetryCount; + @Value(value = "${user.password.maxRetryCount}") + private String maxRetryCount; - @PostConstruct - public void init() { - loginRecordCache = cacheManager.getCache("loginRecordCache"); - } + @PostConstruct + public void init() + { + loginRecordCache = cacheManager.getCache("loginRecordCache"); + } - public void validate(User user, String password) { - String loginName = user.getLoginName(); + public void validate(User user, String password) + { + String loginName = user.getLoginName(); - AtomicInteger retryCount = loginRecordCache.get(loginName); + AtomicInteger retryCount = loginRecordCache.get(loginName); - if (retryCount == null) { - retryCount = new AtomicInteger(0); - loginRecordCache.put(loginName, retryCount); - } - if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue()) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.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 (retryCount == null) + { + retryCount = new AtomicInteger(0); + loginRecordCache.put(loginName, retryCount); + } + if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue()) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount))); + throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue()); + } - if (!matches(user, password)) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.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(); - } else { - clearLoginRecordCache(loginName); - } - } + if (!matches(user, password)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount, password))); + loginRecordCache.put(loginName, retryCount); + throw new UserPasswordNotMatchException(); + } + else + { + clearLoginRecordCache(loginName); + } + } - public boolean matches(User user, String newPassword) { - return user.getPassword().equals(encryptPassword(user.getLoginName(), newPassword, user.getSalt())); - } + public boolean matches(User user, String newPassword) + { + return user.getPassword().equals(encryptPassword(user.getLoginName(), newPassword, user.getSalt())); + } - public void clearLoginRecordCache(String username) { - loginRecordCache.remove(username); - } + public void clearLoginRecordCache(String username) + { + loginRecordCache.remove(username); + } - public String encryptPassword(String username, String password, String salt) { - return new Md5Hash(username + password + salt).toHex().toString(); - } + public String encryptPassword(String username, String password, String salt) + { + return new Md5Hash(username + password + salt).toHex().toString(); + } - public static void main(String[] args) { - // System.out.println(new PasswordService().encryptPassword("admin", - // "admin123", "111111")); - // System.out.println(new PasswordService().encryptPassword("ry", - // "admin123", "222222")); - } + public static void main(String[] args) + { + System.out.println(new PasswordService().encryptPassword("admin", "admin123", "111111")); + System.out.println(new PasswordService().encryptPassword("ry", "admin123", "222222")); + } } diff --git a/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java b/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java index f0015d64..181a7aed 100644 --- a/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java +++ b/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java @@ -2,12 +2,10 @@ package com.ruoyi.framework.shiro.session; import java.io.Serializable; import java.util.Date; - import org.apache.shiro.session.Session; import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; - import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.project.monitor.online.domain.OnlineSession; @@ -19,90 +17,101 @@ import com.ruoyi.project.monitor.online.service.IUserOnlineService; * * @author ruoyi */ -public class OnlineSessionDAO extends EnterpriseCacheSessionDAO { - /** - * 同步session到数据库的周期 单位为毫秒(默认1分钟) - */ - @Value("${shiro.session.dbSyncPeriod}") - private int dbSyncPeriod; +public class OnlineSessionDAO extends EnterpriseCacheSessionDAO +{ + /** + * 同步session到数据库的周期 单位为毫秒(默认1分钟) + */ + @Value("${shiro.session.dbSyncPeriod}") + private int dbSyncPeriod; - /** - * 上次同步数据库的时间戳 - */ - private static final String LAST_SYNC_DB_TIMESTAMP = OnlineSessionDAO.class.getName() + "LAST_SYNC_DB_TIMESTAMP"; + /** + * 上次同步数据库的时间戳 + */ + private static final String LAST_SYNC_DB_TIMESTAMP = OnlineSessionDAO.class.getName() + "LAST_SYNC_DB_TIMESTAMP"; - @Autowired - private IUserOnlineService onlineService; + @Autowired + private IUserOnlineService onlineService; - @Autowired - private OnlineSessionFactory onlineSessionFactory; + @Autowired + private OnlineSessionFactory onlineSessionFactory; - public OnlineSessionDAO() { - super(); - } + public OnlineSessionDAO() + { + super(); + } - public OnlineSessionDAO(long expireTime) { - super(); - } + public OnlineSessionDAO(long expireTime) + { + super(); + } - /** - * 根据会话ID获取会话 - * - * @param sessionId - * 会话ID - * @return ShiroSession - */ - @Override - protected Session doReadSession(Serializable sessionId) { - UserOnline userOnline = onlineService.selectOnlineById(String.valueOf(sessionId)); - if (userOnline == null) { - return null; - } - return onlineSessionFactory.createSession(userOnline); - } + /** + * 根据会话ID获取会话 + * + * @param sessionId 会话ID + * @return ShiroSession + */ + @Override + protected Session doReadSession(Serializable sessionId) + { + UserOnline userOnline = onlineService.selectOnlineById(String.valueOf(sessionId)); + if (userOnline == null) + { + return null; + } + return onlineSessionFactory.createSession(userOnline); + } - /** - * 更新会话;如更新会话最后访问时间/停止会话/设置超时时间/设置移除属性等会调用 - */ - public void syncToDb(OnlineSession onlineSession) { - Date lastSyncTimestamp = (Date) onlineSession.getAttribute(LAST_SYNC_DB_TIMESTAMP); - if (lastSyncTimestamp != null) { - boolean needSync = true; - long deltaTime = onlineSession.getLastAccessTime().getTime() - lastSyncTimestamp.getTime(); - if (deltaTime < dbSyncPeriod * 60 * 1000) { - // 时间差不足 无需同步 - needSync = false; - } - boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L; + /** + * 更新会话;如更新会话最后访问时间/停止会话/设置超时时间/设置移除属性等会调用 + */ + public void syncToDb(OnlineSession onlineSession) + { + Date lastSyncTimestamp = (Date) onlineSession.getAttribute(LAST_SYNC_DB_TIMESTAMP); + if (lastSyncTimestamp != null) + { + boolean needSync = true; + long deltaTime = onlineSession.getLastAccessTime().getTime() - lastSyncTimestamp.getTime(); + if (deltaTime < dbSyncPeriod * 60 * 1000) + { + // 时间差不足 无需同步 + needSync = false; + } + boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L; - // session 数据变更了 同步 - if (isGuest == false && onlineSession.isAttributeChanged()) { - needSync = true; - } + // session 数据变更了 同步 + if (isGuest == false && onlineSession.isAttributeChanged()) + { + needSync = true; + } - if (needSync == false) { - return; - } - } - onlineSession.setAttribute(LAST_SYNC_DB_TIMESTAMP, onlineSession.getLastAccessTime()); - // 更新完后 重置标识 - if (onlineSession.isAttributeChanged()) { - onlineSession.resetAttributeChanged(); - } - // onlineService.saveOnline(UserOnline.fromOnlineSession(onlineSession)); - AsyncManager.me().execute(AsyncFactory.syncSessionToDb(onlineSession)); - } + if (needSync == false) + { + return; + } + } + onlineSession.setAttribute(LAST_SYNC_DB_TIMESTAMP, onlineSession.getLastAccessTime()); + // 更新完后 重置标识 + if (onlineSession.isAttributeChanged()) + { + onlineSession.resetAttributeChanged(); + } + AsyncManager.me().execute(AsyncFactory.syncSessionToDb(onlineSession)); + } - /** - * 当会话过期/停止(如用户退出时)属性等会调用 - */ - @Override - protected void doDelete(Session session) { - OnlineSession onlineSession = (OnlineSession) session; - if (null == onlineSession) { - return; - } - onlineSession.setStatus(OnlineSession.OnlineStatus.off_line); - onlineService.deleteOnlineById(String.valueOf(onlineSession.getId())); - } + /** + * 当会话过期/停止(如用户退出时)属性等会调用 + */ + @Override + protected void doDelete(Session session) + { + OnlineSession onlineSession = (OnlineSession) session; + if (null == onlineSession) + { + return; + } + onlineSession.setStatus(OnlineSession.OnlineStatus.off_line); + onlineService.deleteOnlineById(String.valueOf(onlineSession.getId())); + } } diff --git a/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java b/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java index 3407a30b..505c6cd8 100644 --- a/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java +++ b/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java @@ -2,12 +2,10 @@ package com.ruoyi.framework.shiro.web.filter; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; - 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.Constants; import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.StringUtils; @@ -21,58 +19,69 @@ import com.ruoyi.project.system.user.domain.User; * * @author ruoyi */ -public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter { - private static final Logger log = LoggerFactory.getLogger(LogoutFilter.class); +public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter +{ + private static final Logger log = LoggerFactory.getLogger(LogoutFilter.class); - /** - * 退出后重定向的地址 - */ - private String loginUrl; + /** + * 退出后重定向的地址 + */ + private String loginUrl; - public String getLoginUrl() { - return loginUrl; - } + public String getLoginUrl() + { + return loginUrl; + } - public void setLoginUrl(String loginUrl) { - this.loginUrl = loginUrl; - } + public void setLoginUrl(String loginUrl) + { + this.loginUrl = loginUrl; + } - @Override - protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception { - try { - Subject subject = getSubject(request, response); - String redirectUrl = getRedirectUrl(request, response, subject); - try { - User user = ShiroUtils.getUser(); - if (StringUtils.isNotNull(user)) { - String loginName = user.getLoginName(); - // 记录用户退出日志 - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"))); - // SystemLogUtils.log(loginName, Constants.LOGOUT, - // MessageUtils.message("user.logout.success")); - } - // 退出登录 - subject.logout(); - } catch (SessionException ise) { - log.error("logout fail.", ise); - } - issueRedirect(request, response, redirectUrl); - } catch (Exception e) { - log.error("Encountered session exception during logout. This can generally safely be ignored.", e); - } - return false; - } + @Override + protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception + { + try + { + Subject subject = getSubject(request, response); + String redirectUrl = getRedirectUrl(request, response, subject); + try + { + User user = ShiroUtils.getUser(); + if (StringUtils.isNotNull(user)) + { + String loginName = user.getLoginName(); + // 记录用户退出日志 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"))); + } + // 退出登录 + subject.logout(); + } + catch (SessionException ise) + { + log.error("logout fail.", ise); + } + issueRedirect(request, response, redirectUrl); + } + catch (Exception e) + { + log.error("Encountered session exception during logout. This can generally safely be ignored.", e); + } + return false; + } - /** - * 退出跳转URL - */ - @Override - protected String getRedirectUrl(ServletRequest request, ServletResponse response, Subject subject) { - String url = getLoginUrl(); - if (StringUtils.isNotEmpty(url)) { - return url; - } - return super.getRedirectUrl(request, response, subject); - } + /** + * 退出跳转URL + */ + @Override + protected String getRedirectUrl(ServletRequest request, ServletResponse response, Subject subject) + { + String url = getLoginUrl(); + if (StringUtils.isNotEmpty(url)) + { + return url; + } + return super.getRedirectUrl(request, response, subject); + } } diff --git a/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java b/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java index 010822f8..01d2925c 100644 --- a/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java +++ b/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.Date; import java.util.Map; import com.fasterxml.jackson.annotation.JsonFormat; +import com.google.common.collect.Maps; /** * Entity基类 @@ -99,6 +100,10 @@ public class BaseEntity implements Serializable public Map getParams() { + if (params == null) + { + params = Maps.newHashMap(); + } return params; } @@ -106,5 +111,4 @@ public class BaseEntity implements Serializable { this.params = params; } - -} +} \ No newline at end of file diff --git a/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java b/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java index 6a9d6ee1..c75e78b0 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java +++ b/src/main/java/com/ruoyi/project/monitor/job/controller/JobController.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -50,7 +50,7 @@ public class JobController extends BaseController return getDataTable(list); } - @Log(title = "定时任务", action = BusinessType.EXPORT) + @Log(title = "定时任务", businessType = BusinessType.EXPORT) @RequiresPermissions("monitor:job:export") @PostMapping("/export") @ResponseBody @@ -68,7 +68,7 @@ public class JobController extends BaseController } } - @Log(title = "定时任务", action = BusinessType.DELETE) + @Log(title = "定时任务", businessType = BusinessType.DELETE) @RequiresPermissions("monitor:job:remove") @PostMapping("/remove") @ResponseBody @@ -89,7 +89,7 @@ public class JobController extends BaseController /** * 任务调度状态修改 */ - @Log(title = "定时任务", action = BusinessType.UPDATE) + @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:changeStatus") @PostMapping("/changeStatus") @ResponseBody @@ -101,7 +101,7 @@ public class JobController extends BaseController /** * 任务调度立即执行一次 */ - @Log(title = "定时任务", action = BusinessType.UPDATE) + @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:changeStatus") @PostMapping("/run") @ResponseBody @@ -122,7 +122,7 @@ public class JobController extends BaseController /** * 新增保存调度 */ - @Log(title = "定时任务", action = BusinessType.INSERT) + @Log(title = "定时任务", businessType = BusinessType.INSERT) @RequiresPermissions("monitor:job:add") @PostMapping("/add") @ResponseBody @@ -144,7 +144,7 @@ public class JobController extends BaseController /** * 修改保存调度 */ - @Log(title = "定时任务", action = BusinessType.UPDATE) + @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:edit") @PostMapping("/edit") @ResponseBody diff --git a/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java b/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java index 562ff7e8..60c72462 100644 --- a/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java +++ b/src/main/java/com/ruoyi/project/monitor/job/controller/JobLogController.java @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -48,7 +48,7 @@ public class JobLogController extends BaseController return getDataTable(list); } - @Log(title = "调度日志", action = BusinessType.EXPORT) + @Log(title = "调度日志", businessType = BusinessType.EXPORT) @RequiresPermissions("monitor:job:export") @PostMapping("/export") @ResponseBody @@ -66,7 +66,7 @@ public class JobLogController extends BaseController } } - @Log(title = "调度日志", action = BusinessType.DELETE) + @Log(title = "调度日志", businessType = BusinessType.DELETE) @RequiresPermissions("monitor:job:remove") @PostMapping("/remove") @ResponseBody diff --git a/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java b/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java index b6bd5268..d3debdc4 100644 --- a/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java +++ b/src/main/java/com/ruoyi/project/monitor/logininfor/controller/LogininforController.java @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -48,7 +48,7 @@ public class LogininforController extends BaseController return getDataTable(list); } - @Log(title = "登陆日志", action = BusinessType.EXPORT) + @Log(title = "登陆日志", businessType = BusinessType.EXPORT) @RequiresPermissions("monitor:logininfor:export") @PostMapping("/export") @ResponseBody @@ -67,7 +67,7 @@ public class LogininforController extends BaseController } @RequiresPermissions("monitor:logininfor:remove") - @Log(title = "登陆日志", action = BusinessType.DELETE) + @Log(title = "登陆日志", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) diff --git a/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java b/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java index 40455699..c31c530c 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java +++ b/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.security.ShiroUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; @@ -55,7 +55,7 @@ public class UserOnlineController extends BaseController } @RequiresPermissions("monitor:online:batchForceLogout") - @Log(title = "在线用户", action = BusinessType.FORCE) + @Log(title = "在线用户", businessType = BusinessType.FORCE) @PostMapping("/batchForceLogout") @ResponseBody public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids) @@ -84,7 +84,7 @@ public class UserOnlineController extends BaseController } @RequiresPermissions("monitor:online:forceLogout") - @Log(title = "在线用户", action = BusinessType.FORCE) + @Log(title = "在线用户", businessType = BusinessType.FORCE) @PostMapping("/forceLogout") @ResponseBody public AjaxResult forceLogout(String sessionId) diff --git a/src/main/java/com/ruoyi/project/monitor/online/domain/UserOnline.java b/src/main/java/com/ruoyi/project/monitor/online/domain/UserOnline.java index 5bea9c41..8dba3d4f 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/domain/UserOnline.java +++ b/src/main/java/com/ruoyi/project/monitor/online/domain/UserOnline.java @@ -1,8 +1,6 @@ package com.ruoyi.project.monitor.online.domain; import java.util.Date; - -import com.ruoyi.common.utils.AddressUtils; import com.ruoyi.framework.web.domain.BaseEntity; import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus; @@ -11,164 +9,172 @@ import com.ruoyi.project.monitor.online.domain.OnlineSession.OnlineStatus; * * @author ruoyi */ -public class UserOnline extends BaseEntity { - private static final long serialVersionUID = 1L; - /** 用户会话id */ - private String sessionId; +public class UserOnline extends BaseEntity +{ + private static final long serialVersionUID = 1L; + /** 用户会话id */ + private String sessionId; - /** 部门名称 */ - private String deptName; + /** 部门名称 */ + private String deptName; - /** 登录名称 */ - private String loginName; + /** 登录名称 */ + private String loginName; - /** 登录IP地址 */ - private String ipaddr; + /** 登录IP地址 */ + private String ipaddr; - /** 登录地址 */ - private String longinLocation; + /** 登录地址 */ + private String longinLocation; - /** 浏览器类型 */ - private String browser; + /** 浏览器类型 */ + private String browser; - /** 操作系统 */ - private String os; + /** 操作系统 */ + private String os; - /** session创建时间 */ - private Date startTimestamp; + /** session创建时间 */ + private Date startTimestamp; - /** session最后访问时间 */ - private Date lastAccessTime; + /** session最后访问时间 */ + private Date lastAccessTime; - /** 超时时间,单位为分钟 */ - private Long expireTime; + /** 超时时间,单位为分钟 */ + private Long expireTime; - /** 在线状态 */ - private OnlineStatus status = OnlineStatus.on_line; + /** 在线状态 */ + private OnlineStatus status = OnlineStatus.on_line; - /** 备份的当前用户会话 */ - private OnlineSession session; + /** 备份的当前用户会话 */ + private OnlineSession session; - /** - * 设置session对象 - */ - @Deprecated - public static final UserOnline fromOnlineSession(OnlineSession session) { - UserOnline online = new UserOnline(); - online.setSessionId(String.valueOf(session.getId())); - online.setDeptName(session.getDeptName()); - online.setLoginName(session.getLoginName()); - online.setStartTimestamp(session.getStartTimestamp()); - online.setLastAccessTime(session.getLastAccessTime()); - online.setExpireTime(session.getTimeout()); - online.setIpaddr(session.getHost()); - online.setLonginLocation(AddressUtils.getRealAddressByIP(session.getHost())); - online.setBrowser(session.getBrowser()); - online.setOs(session.getOs()); - online.setStatus(session.getStatus()); - online.setSession(session); - return online; - } + public String getSessionId() + { + return sessionId; + } - public String getSessionId() { - return sessionId; - } + public void setSessionId(String sessionId) + { + this.sessionId = sessionId; + } - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } + public String getDeptName() + { + return deptName; + } - public String getDeptName() { - return deptName; - } + public void setDeptName(String deptName) + { + this.deptName = deptName; + } - public void setDeptName(String deptName) { - this.deptName = deptName; - } + public String getLoginName() + { + return loginName; + } - public String getLoginName() { - return loginName; - } + public void setLoginName(String loginName) + { + this.loginName = loginName; + } - public void setLoginName(String loginName) { - this.loginName = loginName; - } + public String getIpaddr() + { + return ipaddr; + } - public String getIpaddr() { - return ipaddr; - } + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } - public void setIpaddr(String ipaddr) { - this.ipaddr = ipaddr; - } + public String getLonginLocation() + { + return longinLocation; + } - public String getLonginLocation() { - return longinLocation; - } + public void setLonginLocation(String longinLocation) + { + this.longinLocation = longinLocation; + } - public void setLonginLocation(String longinLocation) { - this.longinLocation = longinLocation; - } + public String getBrowser() + { + return browser; + } - public String getBrowser() { - return browser; - } + public void setBrowser(String browser) + { + this.browser = browser; + } - public void setBrowser(String browser) { - this.browser = browser; - } + public String getOs() + { + return os; + } - public String getOs() { - return os; - } + public void setOs(String os) + { + this.os = os; + } - public void setOs(String os) { - this.os = os; - } + public Date getStartTimestamp() + { + return startTimestamp; + } - public Date getStartTimestamp() { - return startTimestamp; - } + public void setStartTimestamp(Date startTimestamp) + { + this.startTimestamp = startTimestamp; + } - public void setStartTimestamp(Date startTimestamp) { - this.startTimestamp = startTimestamp; - } + public Date getLastAccessTime() + { + return lastAccessTime; + } - public Date getLastAccessTime() { - return lastAccessTime; - } + public void setLastAccessTime(Date lastAccessTime) + { + this.lastAccessTime = lastAccessTime; + } - public void setLastAccessTime(Date lastAccessTime) { - this.lastAccessTime = lastAccessTime; - } + public Long getExpireTime() + { + return expireTime; + } - public Long getExpireTime() { - return expireTime; - } + public void setExpireTime(Long expireTime) + { + this.expireTime = expireTime; + } - public void setExpireTime(Long expireTime) { - this.expireTime = expireTime; - } + public OnlineStatus getStatus() + { + return status; + } - public OnlineStatus getStatus() { - return status; - } + public void setStatus(OnlineStatus status) + { + this.status = status; + } - public void setStatus(OnlineStatus status) { - this.status = status; - } + public OnlineSession getSession() + { + return session; + } - public OnlineSession getSession() { - return session; - } + public void setSession(OnlineSession session) + { + this.session = session; + } - public void setSession(OnlineSession session) { - this.session = session; - } - - @Override - public String toString() { - return "UserOnline [sessionId=" + sessionId + ", deptName=" + deptName + ", loginName=" + loginName + ", ipaddr=" + ipaddr + ", browser=" + browser + ", os=" + os + ", startTimestamp=" + startTimestamp + ", lastAccessTime=" + lastAccessTime + ", expireTime=" + expireTime + ", status=" + status + ", session=" + session + "]"; - } + @Override + public String toString() + { + return "UserOnline [sessionId=" + sessionId + ", deptName=" + deptName + ", loginName=" + loginName + + ", ipaddr=" + ipaddr + ", browser=" + browser + ", os=" + os + ", startTimestamp=" + startTimestamp + + ", lastAccessTime=" + lastAccessTime + ", expireTime=" + expireTime + ", status=" + status + + ", session=" + session + "]"; + } } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java index 6e292925..62bc47ab 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -50,7 +50,7 @@ public class OperlogController extends BaseController return getDataTable(list); } - @Log(title = "操作日志", action = BusinessType.EXPORT) + @Log(title = "操作日志", businessType = BusinessType.EXPORT) @RequiresPermissions("monitor:operlog:export") @PostMapping("/export") @ResponseBody diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java index 6bba8a09..16485848 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java @@ -21,17 +21,17 @@ public class OperLog extends BaseEntity @Excel(name = "操作模块") private String title; - /** 操作类型 */ - @Excel(name = "操作类型") - private String action; + /** 操作业务类型 */ + @Excel(name = "业务类型") + private Integer businessType; /** 请求方法 */ @Excel(name = "请求方法") private String method; - /** 来源渠道 */ - @Excel(name = "来源渠道") - private String channel; + /** 操作人类别 */ + @Excel(name = "操作类别") + private Integer operatorType; /** 操作人员 */ @Excel(name = "操作人员") @@ -59,7 +59,7 @@ public class OperLog extends BaseEntity /** 状态0正常 1异常 */ @Excel(name = "状态") - private String status; + private Integer status; /** 错误消息 */ @Excel(name = "错误消息") @@ -89,14 +89,14 @@ public class OperLog extends BaseEntity this.title = title; } - public String getAction() + public Integer getBusinessType() { - return action; + return businessType; } - public void setAction(String action) + public void setBusinessType(Integer businessType) { - this.action = action; + this.businessType = businessType; } public String getMethod() @@ -109,14 +109,14 @@ public class OperLog extends BaseEntity this.method = method; } - public String getChannel() + public Integer getOperatorType() { - return channel; + return operatorType; } - public void setChannel(String channel) + public void setOperatorType(Integer operatorType) { - this.channel = channel; + this.operatorType = operatorType; } public String getOperName() @@ -179,12 +179,12 @@ public class OperLog extends BaseEntity this.operParam = operParam; } - public String getStatus() + public Integer getStatus() { return status; } - public void setStatus(String status) + public void setStatus(Integer status) { this.status = status; } @@ -212,10 +212,10 @@ public class OperLog extends BaseEntity @Override public String toString() { - return "OperLog [operId=" + operId + ", title=" + title + ", action=" + action + ", method=" + method - + ", channel=" + channel + ", operName=" + operName + ", deptName=" + deptName + ", operUrl=" + operUrl - + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + operParam + ", status=" - + status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]"; + return "OperLog [operId=" + operId + ", title=" + title + ", businessType=" + businessType + ", method=" + + method + ", operatorType=" + operatorType + ", operName=" + operName + ", deptName=" + deptName + + ", operUrl=" + operUrl + ", operIp=" + operIp + ", operLocation=" + operLocation + ", operParam=" + + operParam + ", status=" + status + ", errorMsg=" + errorMsg + ", operTime=" + operTime + "]"; } } diff --git a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java index 000bbdde..da22fe26 100644 --- a/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java +++ b/src/main/java/com/ruoyi/project/system/config/controller/ConfigController.java @@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -54,7 +53,7 @@ public class ConfigController extends BaseController return getDataTable(list); } - @Log(title = "参数管理", action = BusinessType.EXPORT) + @Log(title = "参数管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:config:export") @PostMapping("/export") @ResponseBody @@ -85,7 +84,7 @@ public class ConfigController extends BaseController * 新增保存参数配置 */ @RequiresPermissions("system:config:add") - @Log(title = "参数管理", action = BusinessType.INSERT) + @Log(title = "参数管理", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(Config config) @@ -107,7 +106,7 @@ public class ConfigController extends BaseController * 修改保存参数配置 */ @RequiresPermissions("system:config:edit") - @Log(title = "参数管理", action = BusinessType.UPDATE) + @Log(title = "参数管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(Config config) @@ -119,7 +118,7 @@ public class ConfigController extends BaseController * 删除参数配置 */ @RequiresPermissions("system:config:remove") - @Log(title = "参数管理", action = BusinessType.DELETE) + @Log(title = "参数管理", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) @@ -134,12 +133,7 @@ public class ConfigController extends BaseController @ResponseBody public String checkConfigKeyUnique(Config config) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(config)) - { - uniqueFlag = configService.checkConfigKeyUnique(config); - } - return uniqueFlag; + return configService.checkConfigKeyUnique(config); } } diff --git a/src/main/java/com/ruoyi/project/system/config/domain/Config.java b/src/main/java/com/ruoyi/project/system/config/domain/Config.java index bc7f806e..219b3c79 100644 --- a/src/main/java/com/ruoyi/project/system/config/domain/Config.java +++ b/src/main/java/com/ruoyi/project/system/config/domain/Config.java @@ -82,4 +82,10 @@ public class Config extends BaseEntity this.configType = configType; } + public String toString() + { + return "Config [configId=" + configId + ", configName=" + configName + ", configKey=" + configKey + + ", configValue=" + configValue + ", configType=" + configType + "]"; + } + } diff --git a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java index 83c1cad8..4edbde52 100644 --- a/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java +++ b/src/main/java/com/ruoyi/project/system/dept/controller/DeptController.java @@ -11,9 +11,8 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.project.system.dept.domain.Dept; @@ -62,7 +61,7 @@ public class DeptController extends BaseController /** * 新增保存部门 */ - @Log(title = "部门管理", action = BusinessType.INSERT) + @Log(title = "部门管理", businessType = BusinessType.INSERT) @RequiresPermissions("system:dept:add") @PostMapping("/add") @ResponseBody @@ -84,7 +83,7 @@ public class DeptController extends BaseController /** * 保存 */ - @Log(title = "部门管理", action = BusinessType.UPDATE) + @Log(title = "部门管理", businessType = BusinessType.UPDATE) @RequiresPermissions("system:dept:edit") @PostMapping("/edit") @ResponseBody @@ -96,7 +95,7 @@ public class DeptController extends BaseController /** * 删除 */ - @Log(title = "部门管理", action = BusinessType.DELETE) + @Log(title = "部门管理", businessType = BusinessType.DELETE) @RequiresPermissions("system:dept:remove") @PostMapping("/remove/{deptId}") @ResponseBody @@ -120,12 +119,7 @@ public class DeptController extends BaseController @ResponseBody public String checkDeptNameUnique(Dept dept) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(dept)) - { - uniqueFlag = deptService.checkDeptNameUnique(dept); - } - return uniqueFlag; + return deptService.checkDeptNameUnique(dept); } /** diff --git a/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java b/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java index 4bf7c5bc..5d0c3747 100644 --- a/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java +++ b/src/main/java/com/ruoyi/project/system/dict/controller/DictDataController.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -50,7 +50,7 @@ public class DictDataController extends BaseController return getDataTable(list); } - @Log(title = "字典数据", action = BusinessType.EXPORT) + @Log(title = "字典数据", businessType = BusinessType.EXPORT) @RequiresPermissions("system:dict:export") @PostMapping("/export") @ResponseBody @@ -81,7 +81,7 @@ public class DictDataController extends BaseController /** * 新增保存字典类型 */ - @Log(title = "字典数据", action = BusinessType.INSERT) + @Log(title = "字典数据", businessType = BusinessType.INSERT) @RequiresPermissions("system:dict:add") @PostMapping("/add") @ResponseBody @@ -103,7 +103,7 @@ public class DictDataController extends BaseController /** * 修改保存字典类型 */ - @Log(title = "字典数据", action = BusinessType.UPDATE) + @Log(title = "字典数据", businessType = BusinessType.UPDATE) @RequiresPermissions("system:dict:edit") @PostMapping("/edit") @ResponseBody @@ -112,7 +112,7 @@ public class DictDataController extends BaseController return toAjax(dictDataService.updateDictData(dict)); } - @Log(title = "字典数据", action = BusinessType.DELETE) + @Log(title = "字典数据", businessType = BusinessType.DELETE) @RequiresPermissions("system:dict:remove") @PostMapping("/remove") @ResponseBody diff --git a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java index 4be5be02..5fd2ef57 100644 --- a/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java +++ b/src/main/java/com/ruoyi/project/system/dict/controller/DictTypeController.java @@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -51,7 +50,7 @@ public class DictTypeController extends BaseController return getDataTable(list); } - @Log(title = "字典类型", action = BusinessType.EXPORT) + @Log(title = "字典类型", businessType = BusinessType.EXPORT) @RequiresPermissions("system:dict:export") @PostMapping("/export") @ResponseBody @@ -81,7 +80,7 @@ public class DictTypeController extends BaseController /** * 新增保存字典类型 */ - @Log(title = "字典类型", action = BusinessType.INSERT) + @Log(title = "字典类型", businessType = BusinessType.INSERT) @RequiresPermissions("system:dict:add") @PostMapping("/add") @ResponseBody @@ -103,7 +102,7 @@ public class DictTypeController extends BaseController /** * 修改保存字典类型 */ - @Log(title = "字典类型", action = BusinessType.UPDATE) + @Log(title = "字典类型", businessType = BusinessType.UPDATE) @RequiresPermissions("system:dict:edit") @PostMapping("/edit") @ResponseBody @@ -112,7 +111,7 @@ public class DictTypeController extends BaseController return toAjax(dictTypeService.updateDictType(dict)); } - @Log(title = "字典类型", action = BusinessType.DELETE) + @Log(title = "字典类型", businessType = BusinessType.DELETE) @RequiresPermissions("system:dict:remove") @PostMapping("/remove") @ResponseBody @@ -147,11 +146,6 @@ public class DictTypeController extends BaseController @ResponseBody public String checkDictTypeUnique(DictType dictType) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(dictType)) - { - uniqueFlag = dictTypeService.checkDictTypeUnique(dictType); - } - return uniqueFlag; + return dictTypeService.checkDictTypeUnique(dictType); } } diff --git a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java index 44e36800..bf69afc1 100644 --- a/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java +++ b/src/main/java/com/ruoyi/project/system/menu/controller/MenuController.java @@ -11,9 +11,8 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.project.system.menu.domain.Menu; @@ -54,7 +53,7 @@ public class MenuController extends BaseController /** * 删除菜单 */ - @Log(title = "菜单管理", action = BusinessType.DELETE) + @Log(title = "菜单管理", businessType = BusinessType.DELETE) @RequiresPermissions("system:menu:remove") @PostMapping("/remove/{menuId}") @ResponseBody @@ -95,7 +94,7 @@ public class MenuController extends BaseController /** * 新增保存菜单 */ - @Log(title = "菜单管理", action = BusinessType.INSERT) + @Log(title = "菜单管理", businessType = BusinessType.INSERT) @RequiresPermissions("system:menu:add") @PostMapping("/add") @ResponseBody @@ -117,7 +116,7 @@ public class MenuController extends BaseController /** * 修改保存菜单 */ - @Log(title = "菜单管理", action = BusinessType.UPDATE) + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) @RequiresPermissions("system:menu:edit") @PostMapping("/edit") @ResponseBody @@ -142,12 +141,7 @@ public class MenuController extends BaseController @ResponseBody public String checkMenuNameUnique(Menu menu) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(menu)) - { - uniqueFlag = menuService.checkMenuNameUnique(menu); - } - return uniqueFlag; + return menuService.checkMenuNameUnique(menu); } /** diff --git a/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java b/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java index bbda522c..987f5a8d 100644 --- a/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java +++ b/src/main/java/com/ruoyi/project/system/notice/controller/NoticeController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -65,7 +65,7 @@ public class NoticeController extends BaseController * 新增保存公告 */ @RequiresPermissions("system:notice:add") - @Log(title = "通知公告", action = BusinessType.INSERT) + @Log(title = "通知公告", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(Notice notice) @@ -87,7 +87,7 @@ public class NoticeController extends BaseController * 修改保存公告 */ @RequiresPermissions("system:notice:edit") - @Log(title = "通知公告", action = BusinessType.UPDATE) + @Log(title = "通知公告", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(Notice notice) @@ -99,7 +99,7 @@ public class NoticeController extends BaseController * 删除公告 */ @RequiresPermissions("system:notice:remove") - @Log(title = "通知公告", action = BusinessType.DELETE) + @Log(title = "通知公告", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) diff --git a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java index f2bbb617..bef02036 100644 --- a/src/main/java/com/ruoyi/project/system/post/controller/PostController.java +++ b/src/main/java/com/ruoyi/project/system/post/controller/PostController.java @@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -51,7 +50,7 @@ public class PostController extends BaseController return getDataTable(list); } - @Log(title = "岗位管理", action = BusinessType.EXPORT) + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:post:export") @PostMapping("/export") @ResponseBody @@ -70,7 +69,7 @@ public class PostController extends BaseController } @RequiresPermissions("system:post:remove") - @Log(title = "岗位管理", action = BusinessType.DELETE) + @Log(title = "岗位管理", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) @@ -98,7 +97,7 @@ public class PostController extends BaseController * 新增保存岗位 */ @RequiresPermissions("system:post:add") - @Log(title = "岗位管理", action = BusinessType.INSERT) + @Log(title = "岗位管理", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(Post post) @@ -120,7 +119,7 @@ public class PostController extends BaseController * 修改保存岗位 */ @RequiresPermissions("system:post:edit") - @Log(title = "岗位管理", action = BusinessType.UPDATE) + @Log(title = "岗位管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(Post post) @@ -135,12 +134,7 @@ public class PostController extends BaseController @ResponseBody public String checkPostNameUnique(Post post) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(post)) - { - uniqueFlag = postService.checkPostNameUnique(post); - } - return uniqueFlag; + return postService.checkPostNameUnique(post); } /** @@ -150,12 +144,7 @@ public class PostController extends BaseController @ResponseBody public String checkPostCodeUnique(Post post) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(post)) - { - uniqueFlag = postService.checkPostCodeUnique(post); - } - return uniqueFlag; + return postService.checkPostCodeUnique(post); } } diff --git a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java index dee0e7cc..d77969e7 100644 --- a/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java +++ b/src/main/java/com/ruoyi/project/system/role/controller/RoleController.java @@ -11,10 +11,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -53,7 +52,7 @@ public class RoleController extends BaseController return getDataTable(list); } - @Log(title = "角色管理", action = BusinessType.EXPORT) + @Log(title = "角色管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:role:export") @PostMapping("/export") @ResponseBody @@ -84,7 +83,7 @@ public class RoleController extends BaseController * 新增保存角色 */ @RequiresPermissions("system:role:add") - @Log(title = "角色管理", action = BusinessType.INSERT) + @Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping("/add") @Transactional(rollbackFor = Exception.class) @ResponseBody @@ -108,7 +107,7 @@ public class RoleController extends BaseController * 修改保存角色 */ @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", action = BusinessType.UPDATE) + @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") @Transactional(rollbackFor = Exception.class) @ResponseBody @@ -118,7 +117,7 @@ public class RoleController extends BaseController } @RequiresPermissions("system:role:remove") - @Log(title = "角色管理", action = BusinessType.DELETE) + @Log(title = "角色管理", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) @@ -140,12 +139,7 @@ public class RoleController extends BaseController @ResponseBody public String checkRoleNameUnique(Role role) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(role)) - { - uniqueFlag = roleService.checkRoleNameUnique(role); - } - return uniqueFlag; + return roleService.checkRoleNameUnique(role); } /** @@ -155,12 +149,7 @@ public class RoleController extends BaseController @ResponseBody public String checkRoleKeyUnique(Role role) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(role)) - { - uniqueFlag = roleService.checkRoleKeyUnique(role); - } - return uniqueFlag; + return roleService.checkRoleKeyUnique(role); } /** diff --git a/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java b/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java index 2aa0b781..47746014 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.service.DictService; @@ -75,7 +75,7 @@ public class ProfileController extends BaseController return prefix + "/resetPwd"; } - @Log(title = "重置密码", action = BusinessType.UPDATE) + @Log(title = "重置密码", businessType = BusinessType.UPDATE) @PostMapping("/resetPwd") @ResponseBody public AjaxResult resetPwd(User user) @@ -112,7 +112,7 @@ public class ProfileController extends BaseController /** * 修改用户 */ - @Log(title = "个人信息", action = BusinessType.UPDATE) + @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PostMapping("/update") @ResponseBody public AjaxResult update(User user) @@ -128,7 +128,7 @@ public class ProfileController extends BaseController /** * 保存头像 */ - @Log(title = "个人信息", action = BusinessType.UPDATE) + @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PostMapping("/updateAvatar") @ResponseBody public AjaxResult updateAvatar(User user, @RequestParam("avatarfile") MultipartFile file) diff --git a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java index 0aecd2e4..d8363405 100644 --- a/src/main/java/com/ruoyi/project/system/user/controller/UserController.java +++ b/src/main/java/com/ruoyi/project/system/user/controller/UserController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; @@ -60,7 +60,7 @@ public class UserController extends BaseController return getDataTable(list); } - @Log(title = "用户管理", action = BusinessType.EXPORT) + @Log(title = "用户管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:user:export") @PostMapping("/export") @ResponseBody @@ -93,7 +93,7 @@ public class UserController extends BaseController * 新增保存用户 */ @RequiresPermissions("system:user:add") - @Log(title = "用户管理", action = BusinessType.INSERT) + @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping("/add") @Transactional(rollbackFor = Exception.class) @ResponseBody @@ -122,7 +122,7 @@ public class UserController extends BaseController * 修改保存用户 */ @RequiresPermissions("system:user:edit") - @Log(title = "用户管理", action = BusinessType.UPDATE) + @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") @Transactional(rollbackFor = Exception.class) @ResponseBody @@ -136,7 +136,7 @@ public class UserController extends BaseController } @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", action = BusinessType.UPDATE) + @Log(title = "重置密码", businessType = BusinessType.UPDATE) @GetMapping("/resetPwd/{userId}") public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) { @@ -145,7 +145,7 @@ public class UserController extends BaseController } @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", action = BusinessType.UPDATE) + @Log(title = "重置密码", businessType = BusinessType.UPDATE) @PostMapping("/resetPwd") @ResponseBody public AjaxResult resetPwd(User user) @@ -154,7 +154,7 @@ public class UserController extends BaseController } @RequiresPermissions("system:user:remove") - @Log(title = "用户管理", action = BusinessType.DELETE) + @Log(title = "用户管理", businessType = BusinessType.DELETE) @PostMapping("/remove") @ResponseBody public AjaxResult remove(String ids) @@ -176,12 +176,7 @@ public class UserController extends BaseController @ResponseBody public String checkLoginNameUnique(User user) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(user)) - { - uniqueFlag = userService.checkLoginNameUnique(user.getLoginName()); - } - return uniqueFlag; + return userService.checkLoginNameUnique(user.getLoginName()); } /** @@ -191,12 +186,7 @@ public class UserController extends BaseController @ResponseBody public String checkPhoneUnique(User user) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(user)) - { - uniqueFlag = userService.checkPhoneUnique(user); - } - return uniqueFlag; + return userService.checkPhoneUnique(user); } /** @@ -206,11 +196,6 @@ public class UserController extends BaseController @ResponseBody public String checkEmailUnique(User user) { - String uniqueFlag = "0"; - if (StringUtils.isNotNull(user)) - { - uniqueFlag = userService.checkEmailUnique(user); - } - return uniqueFlag; + return userService.checkEmailUnique(user); } } \ No newline at end of file diff --git a/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java b/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java index d9f2090d..2bd42380 100644 --- a/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java +++ b/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.support.Convert; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.page.TableDataInfo; import com.ruoyi.project.tool.gen.domain.TableInfo; @@ -55,7 +55,7 @@ public class GenController extends BaseController * 生成代码 */ @RequiresPermissions("tool:gen:code") - @Log(title = "代码生成", action = BusinessType.GENCODE) + @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") public void genCode(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException { @@ -72,7 +72,7 @@ public class GenController extends BaseController * 批量生成代码 */ @RequiresPermissions("tool:gen:code") - @Log(title = "代码生成", action = BusinessType.GENCODE) + @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") @ResponseBody public void batchGenCode(HttpServletResponse response, String tables) throws IOException diff --git a/src/main/resources/application-druid.yml b/src/main/resources/application-druid.yml index f5dda0f4..da7a23d5 100644 --- a/src/main/resources/application-druid.yml +++ b/src/main/resources/application-druid.yml @@ -1,18 +1,21 @@ -#数据源配置 +# 数据源配置 spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.jdbc.Driver druid: - master: #主库 + # 主库数据源 + master: url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true username: root password: password - #slave: #从库 - # open: true - # url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true - # username: root - # password: password + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: # 初始连接数 initial-size: 10 # 最大连接池数量 diff --git a/src/main/resources/mybatis/monitor/JobLogMapper.xml b/src/main/resources/mybatis/monitor/JobLogMapper.xml index 64710cca..11b64f6c 100644 --- a/src/main/resources/mybatis/monitor/JobLogMapper.xml +++ b/src/main/resources/mybatis/monitor/JobLogMapper.xml @@ -32,10 +32,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND method_name like concat('%', #{methodName}, '%') - + and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') - + and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') diff --git a/src/main/resources/mybatis/monitor/LogininforMapper.xml b/src/main/resources/mybatis/monitor/LogininforMapper.xml index 4ccf013f..c45fcca4 100644 --- a/src/main/resources/mybatis/monitor/LogininforMapper.xml +++ b/src/main/resources/mybatis/monitor/LogininforMapper.xml @@ -33,10 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND login_name like concat('%', #{loginName}, '%') - + and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') - + and date_format(login_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') diff --git a/src/main/resources/mybatis/monitor/OnlineMapper.xml b/src/main/resources/mybatis/monitor/OnlineMapper.xml index c0b94fe1..81d2de7d 100644 --- a/src/main/resources/mybatis/monitor/OnlineMapper.xml +++ b/src/main/resources/mybatis/monitor/OnlineMapper.xml @@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select sessionId,login_name,dept_name,ipaddr,login_location,browser,os,status,status,start_timestsamp,last_access_time,expire_time + select sessionId,login_name,dept_name,ipaddr,login_location,browser,os,status,status,start_timestamp,last_access_time,expire_time from sys_user_online @@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestsamp, last_access_time, expire_time) + replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time) values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{longinLocation}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime}) diff --git a/src/main/resources/mybatis/monitor/OperLogMapper.xml b/src/main/resources/mybatis/monitor/OperLogMapper.xml index a4639894..4033bd86 100644 --- a/src/main/resources/mybatis/monitor/OperLogMapper.xml +++ b/src/main/resources/mybatis/monitor/OperLogMapper.xml @@ -7,10 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - + + @@ -23,14 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - oper_id, title, action, method, channel, oper_name, dept_name, oper_url, oper_ip,oper_location,oper_param,status,error_msg,oper_time + oper_id, title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip,oper_location,oper_param,status,error_msg,oper_time from sys_oper_log - insert into sys_oper_log(title, action, method, channel, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time) - values (#{title}, #{action}, #{method}, #{channel}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate()) + insert into sys_oper_log(title, business_type, method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, status, error_msg, oper_time) + values (#{title}, #{businessType}, #{method}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate()) diff --git a/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css index fc6840d4..18d304ca 100644 --- a/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css +++ b/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.css @@ -4,7 +4,7 @@ .bootstrap-tree-table .treetable-table{border:0 !important;margin-bottom:0} .bootstrap-tree-table .treetable-table tbody {display:block;height:auto;overflow-y:auto;} .bootstrap-tree-table .treetable-table thead, .treetable-table tbody tr {display:table;width:100%;table-layout:fixed;} -.bootstrap-tree-table .treetable-thead th{line-height:40px;border: 0 !important;background:#f3f3f4 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:2px solid #e7eaec !important;text-align: center;} +.bootstrap-tree-table .treetable-thead th{line-height:24px;border: 0 !important;border-radius: 4px;border-left:0px solid #e7eaec !important;border-bottom:1px solid #ccc!important;text-align: center;} .bootstrap-tree-table .treetable-thead tr :first-child{border-left:0 !important} -.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec !important;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} +.bootstrap-tree-table .treetable-tbody td{border: 0 !important;border-left:0px solid #e7eaec !important;border-bottom:1px solid #e7eaec!important;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} .bootstrap-tree-table .treetable-tbody tr :first-child{border-left:0 !important} \ No newline at end of file diff --git a/src/main/resources/static/ajax/libs/layer/layim/layim.css b/src/main/resources/static/ajax/libs/layer/layim/layim.css deleted file mode 100644 index a568a035..00000000 --- a/src/main/resources/static/ajax/libs/layer/layim/layim.css +++ /dev/null @@ -1,158 +0,0 @@ -/* - - @Name: layim WebIM 1.0.0 - @Author:贤心(子涵修改) - @Date: 2014-04-25 - @Blog: http://sentsin.com - - */ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,input,button,textarea,p,blockquote,th,td,form{margin:0; padding:0;} -input,button,textarea,select,optgroup,option{font-family:inherit; font-size:inherit; font-style:inherit; font-weight:inherit; outline: 0;} -li{list-style:none;} -.xxim_icon, .xxim_main i, .layim_chatbox i{position:absolute;} -.loading{background:url(loading.gif) no-repeat center center;} -.layim_chatbox a, .layim_chatbox a:hover{color:#343434; text-decoration:none; } -.layim_zero{position:absolute; width:0; height:0; border-style:dashed; border-color:transparent; overflow:hidden;} - -.xxim_main{position:fixed; right:1px; bottom:1px; width:230px; border:1px solid #BEBEBE; background-color:#fff; font-size:12px; box-shadow: 0 0 10px rgba(0,0,0,.2); z-index:99999999} -.layim_chatbox textarea{resize:none;} -.xxim_main em, .xxim_main i, .layim_chatbox em, .layim_chatbox i{font-style:normal; font-weight:400;} -.xxim_main h5{font-size:100%; font-weight:400;} - -/* 搜索栏 */ -.xxim_search{position:relative; padding-left:40px; height:40px; border-bottom:1px solid #DCDCDC; background-color:#fff;} -.xxim_search i{left:10px; top:12px; width:16px; height:16px;font-size: 16px;color:#999;} -.xxim_search input{border:none; background:none; width: 180px; margin-top:10px; line-height:20px;} -.xxim_search span{display:none; position:absolute; right:10px; top:10px; height:18px; line-height:18px;width:18px;text-align: center;background-color:#AFAFAF; color:#fff; cursor:pointer; border-radius:2px; font-size:12px; font-weight:900;} -.xxim_search span:hover{background-color:#FCBE00;} - -/* 主面板tab */ -.xxim_tabs{height:45px; border-bottom:1px solid #DBDBDB; background-color:#F4F4F4; font-size:0;} -.xxim_tabs span{position:relative; display:inline-block; *display:inline; *zoom:1; vertical-align:top; width:76px; height:45px; border-right:1px solid #DBDBDB; cursor:pointer; font-size:12px;} -.xxim_tabs span i{top:12px; left:50%; width:20px; margin-left:-10px; height:20px;font-size:20px;color:#ccc;} -.xxim_tabs .xxim_tabnow{height:46px; background-color:#fff;} -.xxim_tabs .xxim_tabnow i{color:#1ab394;} -.xxim_tabs .xxim_latechat{border-right:none;} -.xxim_tabs .xxim_tabfriend i{width:14px; margin-left:-7px;} - -/* 主面板列表 */ -.xxim_list{display:none; height:350px; padding:5px 0; overflow:hidden;} -.xxim_list:hover{ overflow-y:auto;} -.xxim_list h5{position:relative; padding-left:32px; height:26px; line-height:26px; cursor:pointer; color:#000; font-size:0;} -.xxim_list h5 span{display:inline-block; *display:inline; *zoom:1; vertical-align:top; max-width:140px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap; font-size:12px;} -.xxim_list h5 i{left:15px; top:8px; width:10px; height:10px;font-size:10px;color:#666;} -.xxim_list h5 *{font-size:12px;} -.xxim_list .xxim_chatlist{display:none;} -.xxim_list .xxim_liston h5 i{width:8px; height:7px;} -.xxim_list .xxim_liston .xxim_chatlist{display:block;} -.xxim_chatlist {} -.xxim_chatlist li{position:relative; height:40px; line-height:30px; padding:5px 10px; font-size:0; cursor:pointer;} -.xxim_chatlist li:hover{background-color:#F2F4F8} -.xxim_chatlist li *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;} -.xxim_chatlist li span{padding-left:10px; max-width:120px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap;} -.xxim_chatlist li img{width:30px; height:30px;} -.xxim_chatlist li .xxim_time{position:absolute; right:10px; color:#999;} -.xxim_list .xxim_errormsg{text-align:center; margin:50px 0; color:#999;} -.xxim_searchmain{position:absolute; width:230px; height:491px; left:0; top:41px; z-index:10; background-color:#fff;} - -/* 主面板底部 */ -.xxim_bottom{height:34px; border-top:1px solid #D0DCF3; background-color:#F2F4F8;} -.xxim_expend{border-left:1px solid #D0DCF3; border-bottom:1px solid #D0DCF3;} -.xxim_bottom li{position:relative; width:50px; height:32px; line-height:32px; float:left; border-right:1px solid #D0DCF3; cursor:pointer;} -.xxim_bottom li i{ top:9px;} -.xxim_bottom .xxim_hide{border-right:none;} -.xxim_bottom .xxim_online{width:72px; padding-left:35px;} -.xxim_online i{left:13px; width:14px; height:14px;font-size:14px;color:#FFA00A;} -.xxim_setonline{display:none; position:absolute; left:-79px; bottom:-1px; border:1px solid #DCDCDC; background-color:#fff;} -.xxim_setonline span{position:relative; display:block; width:32px;width: 77px; padding:0 10px 0 35px;} -.xxim_setonline span:hover{background-color:#F2F4F8;} -.xxim_offline .xxim_nowstate, .xxim_setoffline i{color:#999;} -.xxim_mymsg i{left:18px; width:14px; height:14px;font-size: 14px;} -.xxim_mymsg a{position:absolute; left:0; top:0; width:50px; height:32px;} -.xxim_seter i{left:18px; width:14px; height:14px;font-size: 14px;} -.xxim_hide i{left:18px; width:14px; height:14px;font-size: 14px;} -.xxim_show i{} -.xxim_bottom .xxim_on{position:absolute; left:-17px; top:50%; width:16px;text-align: center;color:#999;line-height: 97px; height:97px; margin-top:-49px;border:solid 1px #BEBEBE;border-right: none; background:#F2F4F8;} -.xxim_bottom .xxim_off{} - -/* 聊天窗口 */ -.layim_chatbox{width:620px; border:1px solid #BEBEBE; background-color:#fff; font-size:12px; box-shadow: 0 0 10px rgba(0,0,0,.2);} -.layim_chatbox h6{position:relative; height:40px; border-bottom:1px solid #D9D9D9; background-color:#FCFDFA} -.layim_move{position:absolute; height:40px; width: 620px; z-index:0;} -.layim_face{position:absolute; bottom:-1px; left:10px; width:64px; height:64px;padding:1px;background: #fff; border:1px solid #ccc;} -.layim_face img{width:60px; height:60px;} -.layim_names{position:absolute; left:90px; max-width:300px; line-height:40px; color:#000; overflow:hidden; text-overflow: ellipsis; white-space:nowrap; font-size:14px;} -.layim_rightbtn{position:absolute; right:15px; top:12px; font-size:20px;} -.layim_rightbtn i{position:relative; width:16px; height:16px; display:inline-block; *display:inline; *zoom:1; vertical-align:top; cursor:pointer; transition: all .3s;text-align: center;line-height: 16px;} -.layim_rightbtn .layim_close{background: #FFA00A;color:#fff;} -.layim_rightbtn .layim_close:hover{-webkit-transform: rotate(180deg); -moz-transform: rotate(180deg);} -.layim_rightbtn .layer_setmin{margin-right:5px;color:#999;font-size:14px;font-weight: 700;} -.layim_chat, .layim_chatmore,.layim_groups{height:450px; overflow:hidden;} -.layim_chatmore{display:none; float:left; width:135px; border-right:1px solid #BEBEBE; background-color:#F2F2F2} -.layim_chatlist li, .layim_groups li{position:relative; height:30px; line-height:30px; padding:0 10px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap; cursor:pointer;} -.layim_chatlist li{padding:0 20px 0 10px;} -.layim_chatlist li:hover{background-color:#E3E3E3;} -.layim_chatlist li span{display:inline-block; *display:inline; *zoom:1; vertical-align:top; width:90px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap;} -.layim_chatlist li em{display:none; position:absolute; top:6px; right:10px; height:18px; line-height:18px;width:18px;text-align: center;font-size:14px;font-weight:900; border-radius:3px;} -.layim_chatlist li em:hover{background-color: #FCBE00; color:#fff;} -.layim_chatlist .layim_chatnow,.layim_chatlist .layim_chatnow:hover{/*border-top:1px solid #D9D9D9; border-bottom:1px solid #D9D9D9;*/ background-color:#fff;} -.layim_chat{} -.layim_chatarea{height:280px;} -.layim_chatview{display:none; height:280px; overflow:hidden;} -.layim_chatmore:hover, .layim_groups:hover, .layim_chatview:hover{overflow-y:auto;} -.layim_chatview li{margin-bottom:10px; clear:both; *zoom:1;} -.layim_chatview li:after{content:'\20'; clear:both; *zoom:1; display:block; height:0;} - -.layim_chatthis{display:block;} -.layim_chatuser{float:left; padding:15px; font-size:0;} -.layim_chatuser *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; line-height:30px; font-size:12px; padding-right:10px;} -.layim_chatuser img{width:30px; height:30px;padding-right: 0;margin-right: 15px;} -.layim_chatuser .layim_chatname{max-width:230px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap;} -.layim_chatuser .layim_chattime{color:#999; padding-left:10px;} -.layim_chatsay{position:relative; float:left; margin:0 15px; padding:10px; line-height:20px; background-color:#F3F3F3; border-radius:3px; clear:both;} -.layim_chatsay .layim_zero{left:5px; top:-8px; border-width:8px; border-right-style:solid; border-right-color:#F3F3F3;} -.layim_chateme .layim_chatuser{float:right;} -.layim_chateme .layim_chatuser *{padding-right:0; padding-left:10px;} -.layim_chateme .layim_chatuser img{margin-left:15px;padding-left: 0;} -.layim_chateme .layim_chatsay .layim_zero{left:auto; right:10px;} -.layim_chateme .layim_chatuser .layim_chattime{padding-left:0; padding-right:10px;} -.layim_chateme .layim_chatsay{float:right; background-color:#EBFBE3} -.layim_chateme .layim_zero{border-right-color:#EBFBE3;} -.layim_groups{display:none; float:right; width:130px; border-left:1px solid #D9D9D9; background-color:#fff;} -.layim_groups ul{display:none;} -.layim_groups ul.layim_groupthis{display:block;} -.layim_groups li *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; margin-right:10px;} -.layim_groups li img{width:20px; height:20px; margin-top:5px;} -.layim_groups li span{max-width:80px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap;} -.layim_groups li:hover{background-color:#F3F3F3;} -.layim_groups .layim_errors{text-align:center; color:#999;} -.layim_tool{position:relative; height:35px; line-height:35px; padding-left:10px; background-color:#F3F3F3;} -.layim_tool i{position:relative; top:10px; display:inline-block; *display:inline; *zoom:1; vertical-align:top; width:16px; height:16px; margin-right:10px; cursor:pointer;font-size:16px;color:#999;font-weight: 700;} -.layim_tool i:hover{color:#FFA00A;} -.layim_tool .layim_seechatlog{position:absolute; right:15px;} -.layim_tool .layim_seechatlog i{} -.layim_write{display:block; border:none; width:98%; height:90px; line-height:20px; margin:5px auto 0;} -.layim_send{position:relative; height:40px; background-color:#F3F3F3;} -.layim_sendbtn{position:absolute; height:26px; line-height:26px; right:10px; top:8px; padding:0 40px 0 20px; background-color:#FFA00A; color:#fff; border-radius:3px; cursor:pointer;} -.layim_enter{position:absolute; right:0; border-left:1px solid #FFB94F; width:24px; height:26px;} -.layim_enter:hover{background-color:#E68A00; border-radius:0 3px 3px 0;} -.layim_enter .layim_zero{left:7px; top:11px; border-width:5px; border-top-style:solid; border-top-color:#FFE0B3;} -.layim_sendtype{display:none; position:absolute; right:10px; bottom:37px; border:1px solid #D9D9D9; background-color:#fff; text-align:left;} -.layim_sendtype span{display:block; line-height:24px; padding:0 10px 0 25px; cursor:pointer;} -.layim_sendtype span:hover{background-color:#F3F3F3;} -.layim_sendtype span i{left:5px;} - -.layim_min{display:none; position:absolute; left:-190px; bottom:-1px; width:160px; height:32px; line-height:32px; padding:0 10px; overflow:hidden; text-overflow: ellipsis; white-space:nowrap; border:1px solid #ccc; box-shadow: 0 0 5px rgba(0,0,75,.2); background-color:#FCFDFA; cursor:pointer;} - - - - - - - - - - - - - diff --git a/src/main/resources/static/ajax/libs/layer/layim/layim.js b/src/main/resources/static/ajax/libs/layer/layim/layim.js deleted file mode 100644 index 52f0083f..00000000 --- a/src/main/resources/static/ajax/libs/layer/layim/layim.js +++ /dev/null @@ -1,630 +0,0 @@ -/* - - @Name: layui WebIM 1.0.0 - @Author:贤心 - @Date: 2014-04-25 - @Blog: http://sentsin.com - - */ - -;!function(win, undefined){ - -var config = { - msgurl: 'mailbox.html?msg=', - chatlogurl: 'mailbox.html?user=', - aniTime: 200, - right: -232, - api: { - friend: 'js/plugins/layer/layim/data/friend.json', //好友列表接口 - group: 'js/plugins/layer/layim/data/group.json', //群组列表接口 - chatlog: 'js/plugins/layer/layim/data/chatlog.json', //聊天记录接口 - groups: 'js/plugins/layer/layim/data/groups.json', //群组成员接口 - sendurl: '' //发送消息接口 - }, - user: { //当前用户信息 - name: '游客', - face: 'img/a1.jpg' - }, - - //自动回复内置文案,也可动态读取数据库配置 - autoReplay: [ - '您好,我现在有事不在,一会再和您联系。', - '你没发错吧?', - '洗澡中,请勿打扰,偷窥请购票,个体四十,团体八折,订票电话:一般人我不告诉他!', - '你好,我是主人的美女秘书,有什么事就跟我说吧,等他回来我会转告他的。', - '我正在拉磨,没法招呼您,因为我们家毛驴去动物保护协会把我告了,说我剥夺它休产假的权利。', - '<(@ ̄︶ ̄@)>', - '你要和我说话?你真的要和我说话?你确定自己想说吗?你一定非说不可吗?那你说吧,这是自动回复。', - '主人正在开机自检,键盘鼠标看好机会出去凉快去了,我是他的电冰箱,我打字比较慢,你慢慢说,别急……', - '(*^__^*) 嘻嘻,是贤心吗?' - ], - - - chating: {}, - hosts: (function(){ - var dk = location.href.match(/\:\d+/); - dk = dk ? dk[0] : ''; - return 'http://' + document.domain + dk + '/'; - })(), - json: function(url, data, callback, error){ - return $.ajax({ - type: 'POST', - url: url, - data: data, - dataType: 'json', - success: callback, - error: error - }); - }, - stopMP: function(e){ - e ? e.stopPropagation() : e.cancelBubble = true; - } -}, dom = [$(window), $(document), $('html'), $('body')], xxim = {}; - -//主界面tab -xxim.tabs = function(index){ - var node = xxim.node; - node.tabs.eq(index).addClass('xxim_tabnow').siblings().removeClass('xxim_tabnow'); - node.list.eq(index).show().siblings('.xxim_list').hide(); - if(node.list.eq(index).find('li').length === 0){ - xxim.getDates(index); - } -}; - -//节点 -xxim.renode = function(){ - var node = xxim.node = { - tabs: $('#xxim_tabs>span'), - list: $('.xxim_list'), - online: $('.xxim_online'), - setonline: $('.xxim_setonline'), - onlinetex: $('#xxim_onlinetex'), - xximon: $('#xxim_on'), - layimFooter: $('#xxim_bottom'), - xximHide: $('#xxim_hide'), - xximSearch: $('#xxim_searchkey'), - searchMian: $('#xxim_searchmain'), - closeSearch: $('#xxim_closesearch'), - layimMin: $('#layim_min') - }; -}; - -//主界面缩放 -xxim.expend = function(){ - var node = xxim.node; - if(xxim.layimNode.attr('state') !== '1'){ - xxim.layimNode.stop().animate({right: config.right}, config.aniTime, function(){ - node.xximon.addClass('xxim_off'); - try{ - localStorage.layimState = 1; - }catch(e){} - xxim.layimNode.attr({state: 1}); - node.layimFooter.addClass('xxim_expend').stop().animate({marginLeft: config.right}, config.aniTime/2); - node.xximHide.addClass('xxim_show'); - }); - } else { - xxim.layimNode.stop().animate({right: 1}, config.aniTime, function(){ - node.xximon.removeClass('xxim_off'); - try{ - localStorage.layimState = 2; - }catch(e){} - xxim.layimNode.removeAttr('state'); - node.layimFooter.removeClass('xxim_expend'); - node.xximHide.removeClass('xxim_show'); - }); - node.layimFooter.stop().animate({marginLeft: 0}, config.aniTime); - } -}; - -//初始化窗口格局 -xxim.layinit = function(){ - var node = xxim.node; - - //主界面 - try{ - /* - if(!localStorage.layimState){ - config.aniTime = 0; - localStorage.layimState = 1; - } - */ - if(localStorage.layimState === '1'){ - xxim.layimNode.attr({state: 1}).css({right: config.right}); - node.xximon.addClass('xxim_off'); - node.layimFooter.addClass('xxim_expend').css({marginLeft: config.right}); - node.xximHide.addClass('xxim_show'); - } - }catch(e){ - //layer.msg(e.message, 5, -1); - } -}; - -//聊天窗口 -xxim.popchat = function(param){ - var node = xxim.node, log = {}; - - log.success = function(layero){ - layer.setMove(); - - xxim.chatbox = layero.find('#layim_chatbox'); - log.chatlist = xxim.chatbox.find('.layim_chatmore>ul'); - - log.chatlist.html('

  • '+ param.name +'×
  • ') - xxim.tabchat(param, xxim.chatbox); - - //最小化聊天窗 - xxim.chatbox.find('.layer_setmin').on('click', function(){ - var indexs = layero.attr('times'); - layero.hide(); - node.layimMin.text(xxim.nowchat.name).show(); - }); - - //关闭窗口 - xxim.chatbox.find('.layim_close').on('click', function(){ - var indexs = layero.attr('times'); - layer.close(indexs); - xxim.chatbox = null; - config.chating = {}; - config.chatings = 0; - }); - - //关闭某个聊天 - log.chatlist.on('mouseenter', 'li', function(){ - $(this).find('em').show(); - }).on('mouseleave', 'li', function(){ - $(this).find('em').hide(); - }); - log.chatlist.on('click', 'li em', function(e){ - var parents = $(this).parent(), dataType = parents.attr('type'); - var dataId = parents.attr('data-id'), index = parents.index(); - var chatlist = log.chatlist.find('li'), indexs; - - config.stopMP(e); - - delete config.chating[dataType + dataId]; - config.chatings--; - - parents.remove(); - $('#layim_area'+ dataType + dataId).remove(); - if(dataType === 'group'){ - $('#layim_group'+ dataType + dataId).remove(); - } - - if(parents.hasClass('layim_chatnow')){ - if(index === config.chatings){ - indexs = index - 1; - } else { - indexs = index + 1; - } - xxim.tabchat(config.chating[chatlist.eq(indexs).attr('type') + chatlist.eq(indexs).attr('data-id')]); - } - - if(log.chatlist.find('li').length === 1){ - log.chatlist.parent().hide(); - } - }); - - //聊天选项卡 - log.chatlist.on('click', 'li', function(){ - var othis = $(this), dataType = othis.attr('type'), dataId = othis.attr('data-id'); - xxim.tabchat(config.chating[dataType + dataId]); - }); - - //发送热键切换 - log.sendType = $('#layim_sendtype'), log.sendTypes = log.sendType.find('span'); - $('#layim_enter').on('click', function(e){ - config.stopMP(e); - log.sendType.show(); - }); - log.sendTypes.on('click', function(){ - log.sendTypes.find('i').text('') - $(this).find('i').text('√'); - }); - - xxim.transmit(); - }; - - log.html = '
    ' - +'
    ' - +'' - +' ' - +' '+ param.name +'' - +' ' - +' ' - +' ×' - +' ' - +'
    ' - +'
    ' - +'
      ' - +'
      ' - +'
      ' - +'
      ' - +'
      ' - +'
        ' - +'
        ' - +'
        ' - +' ' - +' ' - +' ' - +' 聊天记录' - +'
        ' - +' ' - +'
        ' - +'
        发送
        ' - +'
        ' - +' 按Enter键发送' - +' 按Ctrl+Enter键发送' - +'
        ' - +'
        ' - +'
        ' - +'
        '; - - if(config.chatings < 1){ - $.layer({ - type: 1, - border: [0], - title: false, - shade: [0], - area: ['620px', '493px'], - move: '.layim_chatbox .layim_move', - moveType: 1, - closeBtn: false, - offset: [(($(window).height() - 493)/2)+'px', ''], - page: { - html: log.html - }, success: function(layero){ - log.success(layero); - } - }) - } else { - log.chatmore = xxim.chatbox.find('#layim_chatmore'); - log.chatarea = xxim.chatbox.find('#layim_chatarea'); - - log.chatmore.show(); - - log.chatmore.find('ul>li').removeClass('layim_chatnow'); - log.chatmore.find('ul').append('
      • '+ param.name +'×
      • '); - - log.chatarea.find('.layim_chatview').removeClass('layim_chatthis'); - log.chatarea.append('
          '); - - xxim.tabchat(param); - } - - //群组 - log.chatgroup = xxim.chatbox.find('#layim_groups'); - if(param.type === 'group'){ - log.chatgroup.find('ul').removeClass('layim_groupthis'); - log.chatgroup.append('
            '); - xxim.getGroups(param); - } - //点击群员切换聊天窗 - log.chatgroup.on('click', 'ul>li', function(){ - xxim.popchatbox($(this)); - }); -}; - -//定位到某个聊天队列 -xxim.tabchat = function(param){ - var node = xxim.node, log = {}, keys = param.type + param.id; - xxim.nowchat = param; - - xxim.chatbox.find('#layim_user'+ keys).addClass('layim_chatnow').siblings().removeClass('layim_chatnow'); - xxim.chatbox.find('#layim_area'+ keys).addClass('layim_chatthis').siblings().removeClass('layim_chatthis'); - xxim.chatbox.find('#layim_group'+ keys).addClass('layim_groupthis').siblings().removeClass('layim_groupthis'); - - xxim.chatbox.find('.layim_face>img').attr('src', param.face); - xxim.chatbox.find('.layim_face, .layim_names').attr('href', param.href); - xxim.chatbox.find('.layim_names').text(param.name); - - xxim.chatbox.find('.layim_seechatlog').attr('href', config.chatlogurl + param.id); - - log.groups = xxim.chatbox.find('.layim_groups'); - if(param.type === 'group'){ - log.groups.show(); - } else { - log.groups.hide(); - } - - $('#layim_write').focus(); - -}; - -//弹出聊天窗 -xxim.popchatbox = function(othis){ - var node = xxim.node, dataId = othis.attr('data-id'), param = { - id: dataId, //用户ID - type: othis.attr('type'), - name: othis.find('.xxim_onename').text(), //用户名 - face: othis.find('.xxim_oneface').attr('src'), //用户头像 - href: 'profile.html?user=' + dataId //用户主页 - }, key = param.type + dataId; - if(!config.chating[key]){ - xxim.popchat(param); - config.chatings++; - } else { - xxim.tabchat(param); - } - config.chating[key] = param; - - var chatbox = $('#layim_chatbox'); - if(chatbox[0]){ - node.layimMin.hide(); - chatbox.parents('.xubox_layer').show(); - } -}; - -//请求群员 -xxim.getGroups = function(param){ - var keys = param.type + param.id, str = '', - groupss = xxim.chatbox.find('#layim_group'+ keys); - groupss.addClass('loading'); - config.json(config.api.groups, {}, function(datas){ - if(datas.status === 1){ - var ii = 0, lens = datas.data.length; - if(lens > 0){ - for(; ii < lens; ii++){ - str += '
          • '+ datas.data[ii].name +'
          • '; - } - } else { - str = '
          • 没有群员
          • '; - } - - } else { - str = '
          • '+ datas.msg +'
          • '; - } - groupss.removeClass('loading'); - groupss.html(str); - }, function(){ - groupss.removeClass('loading'); - groupss.html('
          • 请求异常
          • '); - }); -}; - -//消息传输 -xxim.transmit = function(){ - var node = xxim.node, log = {}; - node.sendbtn = $('#layim_sendbtn'); - node.imwrite = $('#layim_write'); - - //发送 - log.send = function(){ - var data = { - content: node.imwrite.val(), - id: xxim.nowchat.id, - sign_key: '', //密匙 - _: +new Date - }; - - if(data.content.replace(/\s/g, '') === ''){ - layer.tips('说点啥呗!', '#layim_write', 2); - node.imwrite.focus(); - } else { - //此处皆为模拟 - var keys = xxim.nowchat.type + xxim.nowchat.id; - - //聊天模版 - log.html = function(param, type){ - return '
          • ' - +'
            ' - + function(){ - if(type === 'me'){ - return ''+ param.time +'' - +''+ param.name +'' - +''; - } else { - return '' - +''+ param.name +'' - +''+ param.time +''; - } - }() - +'
            ' - +'
            '+ param.content +'
            ' - +'
          • '; - }; - - log.imarea = xxim.chatbox.find('#layim_area'+ keys); - - log.imarea.append(log.html({ - time: '2014-04-26 0:37', - name: config.user.name, - face: config.user.face, - content: data.content - }, 'me')); - node.imwrite.val('').focus(); - log.imarea.scrollTop(log.imarea[0].scrollHeight); - - setTimeout(function(){ - log.imarea.append(log.html({ - time: '2014-04-26 0:38', - name: xxim.nowchat.name, - face: xxim.nowchat.face, - content: config.autoReplay[(Math.random()*config.autoReplay.length) | 0] - })); - log.imarea.scrollTop(log.imarea[0].scrollHeight); - }, 500); - - /* - that.json(config.api.sendurl, data, function(datas){ - - }); - */ - } - - }; - node.sendbtn.on('click', log.send); - - node.imwrite.keyup(function(e){ - if(e.keyCode === 13){ - log.send(); - } - }); -}; - -//事件 -xxim.event = function(){ - var node = xxim.node; - - //主界面tab - node.tabs.eq(0).addClass('xxim_tabnow'); - node.tabs.on('click', function(){ - var othis = $(this), index = othis.index(); - xxim.tabs(index); - }); - - //列表展收 - node.list.on('click', 'h5', function(){ - var othis = $(this), chat = othis.siblings('.xxim_chatlist'), parentss = othis.find("i"); - if(parentss.hasClass('fa-caret-down')){ - chat.hide(); - parentss.attr('class','fa fa-caret-right'); - } else { - chat.show(); - parentss.attr('class','fa fa-caret-down'); - } - }); - - //设置在线隐身 - node.online.on('click', function(e){ - config.stopMP(e); - node.setonline.show(); - }); - node.setonline.find('span').on('click', function(e){ - var index = $(this).index(); - config.stopMP(e); - if(index === 0){ - node.onlinetex.html('在线'); - node.online.removeClass('xxim_offline'); - } else if(index === 1) { - node.onlinetex.html('隐身'); - node.online.addClass('xxim_offline'); - } - node.setonline.hide(); - }); - - node.xximon.on('click', xxim.expend); - node.xximHide.on('click', xxim.expend); - - //搜索 - node.xximSearch.keyup(function(){ - var val = $(this).val().replace(/\s/g, ''); - if(val !== ''){ - node.searchMian.show(); - node.closeSearch.show(); - //此处的搜索ajax参考xxim.getDates - node.list.eq(3).html('
          • 没有符合条件的结果
          • '); - } else { - node.searchMian.hide(); - node.closeSearch.hide(); - } - }); - node.closeSearch.on('click', function(){ - $(this).hide(); - node.searchMian.hide(); - node.xximSearch.val('').focus(); - }); - - //弹出聊天窗 - config.chatings = 0; - node.list.on('click', '.xxim_childnode', function(){ - var othis = $(this); - xxim.popchatbox(othis); - }); - - //点击最小化栏 - node.layimMin.on('click', function(){ - $(this).hide(); - $('#layim_chatbox').parents('.xubox_layer').show(); - }); - - - //document事件 - dom[1].on('click', function(){ - node.setonline.hide(); - $('#layim_sendtype').hide(); - }); -}; - -//请求列表数据 -xxim.getDates = function(index){ - var api = [config.api.friend, config.api.group, config.api.chatlog], - node = xxim.node, myf = node.list.eq(index); - myf.addClass('loading'); - config.json(api[index], {}, function(datas){ - if(datas.status === 1){ - var i = 0, myflen = datas.data.length, str = '', item; - if(myflen > 1){ - if(index !== 2){ - for(; i < myflen; i++){ - str += '
          • ' - +'
            '+ datas.data[i].name +'('+ datas.data[i].nums +')
            ' - +'
              '; - item = datas.data[i].item; - for(var j = 0; j < item.length; j++){ - str += '
            • '+ item[j].name +'
            • '; - } - str += '
          • '; - } - } else { - str += '
          • ' - +'
              '; - for(; i < myflen; i++){ - str += '
            • '+ datas.data[i].name +''+ datas.data[i].time +'
            • '; - } - str += '
          • '; - } - myf.html(str); - } else { - myf.html('
          • 没有任何数据
          • '); - } - myf.removeClass('loading'); - } else { - myf.html('
          • '+ datas.msg +'
          • '); - } - }, function(){ - myf.html('
          • 请求失败
          • '); - myf.removeClass('loading'); - }); -}; - -//渲染骨架 -xxim.view = (function(){ - var xximNode = xxim.layimNode = $('
            ' - +'
            ' - +' ' - +'
            ' - +'
              ' - +'
                ' - +'
                  ' - +'
                    ' - +'
                    ' - +'
                      ' - +'
                    • ' - +'在线' - +'
                      ' - +'在线' - +'隐身' - +'
                      ' - +'
                    • ' - +'
                    • ' - +'
                    • ' - +'' - +'
                      ' - - +'
                      ' - +'
                    • ' - +'
                    • ' - +'
                    • ' - +'
                      ' - +'
                    ' - +'
                    '); - dom[3].append(xximNode); - - xxim.renode(); - xxim.getDates(0); - xxim.event(); - xxim.layinit(); -}()); - -}(window); - diff --git a/src/main/resources/static/ajax/libs/layer/layim/loading.gif b/src/main/resources/static/ajax/libs/layer/layim/loading.gif deleted file mode 100644 index 059b1ac3..00000000 Binary files a/src/main/resources/static/ajax/libs/layer/layim/loading.gif and /dev/null differ diff --git a/src/main/resources/static/css/checkbox.css b/src/main/resources/static/css/checkbox.css deleted file mode 100644 index f61a64e0..00000000 --- a/src/main/resources/static/css/checkbox.css +++ /dev/null @@ -1,251 +0,0 @@ -.checkbox { - padding-left: 20px; -} -.checkbox label { - display: inline-block; - vertical-align: middle; - position: relative; - padding-left: 5px; -} -.checkbox label::before { - content: ""; - display: inline-block; - position: absolute; - width: 17px; - height: 17px; - left: 0; - margin-left: -20px; - border: 1px solid #cccccc; - border-radius: 3px; - background-color: #fff; - -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; - -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; - transition: border 0.15s ease-in-out, color 0.15s ease-in-out; -} -.checkbox label::after { - display: inline-block; - position: absolute; - width: 16px; - height: 16px; - left: 0; - top: 0; - margin-left: -20px; - padding-left: 3px; - padding-top: 1px; - font-size: 11px; - color: #555555; -} -.checkbox input[type="checkbox"], -.checkbox input[type="radio"] { - opacity: 0; - z-index: 1; -} -.checkbox input[type="checkbox"]:focus + label::before, -.checkbox input[type="radio"]:focus + label::before { - outline: thin dotted; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -.checkbox input[type="checkbox"]:checked + label::after, -.checkbox input[type="radio"]:checked + label::after { - font-family: "FontAwesome"; - content: "\f00c"; -} -.checkbox input[type="checkbox"]:disabled + label, -.checkbox input[type="radio"]:disabled + label { - opacity: 0.65; -} -.checkbox input[type="checkbox"]:disabled + label::before, -.checkbox input[type="radio"]:disabled + label::before { - background-color: #eeeeee; - cursor: not-allowed; -} -.checkbox.checkbox-circle label::before { - border-radius: 50%; -} -.checkbox.checkbox-inline { - margin-top: 0; -} - -.checkbox-primary input[type="checkbox"]:checked + label::before, -.checkbox-primary input[type="radio"]:checked + label::before { - background-color: #337ab7; - border-color: #337ab7; -} -.checkbox-primary input[type="checkbox"]:checked + label::after, -.checkbox-primary input[type="radio"]:checked + label::after { - color: #fff; -} - -.checkbox-danger input[type="checkbox"]:checked + label::before, -.checkbox-danger input[type="radio"]:checked + label::before { - background-color: #d9534f; - border-color: #d9534f; -} -.checkbox-danger input[type="checkbox"]:checked + label::after, -.checkbox-danger input[type="radio"]:checked + label::after { - color: #fff; -} - -.checkbox-info input[type="checkbox"]:checked + label::before, -.checkbox-info input[type="radio"]:checked + label::before { - background-color: #5bc0de; - border-color: #5bc0de; -} -.checkbox-info input[type="checkbox"]:checked + label::after, -.checkbox-info input[type="radio"]:checked + label::after { - color: #fff; -} - -.checkbox-warning input[type="checkbox"]:checked + label::before, -.checkbox-warning input[type="radio"]:checked + label::before { - background-color: #f0ad4e; - border-color: #f0ad4e; -} -.checkbox-warning input[type="checkbox"]:checked + label::after, -.checkbox-warning input[type="radio"]:checked + label::after { - color: #fff; -} - -.checkbox-success input[type="checkbox"]:checked + label::before, -.checkbox-success input[type="radio"]:checked + label::before { - background-color: #5cb85c; - border-color: #5cb85c; -} -.checkbox-success input[type="checkbox"]:checked + label::after, -.checkbox-success input[type="radio"]:checked + label::after { - color: #fff; -} - -.radio { - padding-left: 20px; -} -.radio label { - display: inline-block; - vertical-align: middle; - position: relative; - padding-left: 5px; -} -.radio label::before { - content: ""; - display: inline-block; - position: absolute; - width: 17px; - height: 17px; - left: 0; - margin-left: -20px; - border: 1px solid #cccccc; - border-radius: 50%; - background-color: #fff; - -webkit-transition: border 0.15s ease-in-out; - -o-transition: border 0.15s ease-in-out; - transition: border 0.15s ease-in-out; -} -.radio label::after { - display: inline-block; - position: absolute; - content: " "; - width: 11px; - height: 11px; - left: 3px; - top: 3px; - margin-left: -20px; - border-radius: 50%; - background-color: #555555; - -webkit-transform: scale(0, 0); - -ms-transform: scale(0, 0); - -o-transform: scale(0, 0); - transform: scale(0, 0); - -webkit-transition: -webkit-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - -moz-transition: -moz-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - -o-transition: -o-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); - transition: transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); -} -.radio input[type="radio"] { - opacity: 0; - z-index: 1; -} -.radio input[type="radio"]:focus + label::before { - outline: thin dotted; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} -.radio input[type="radio"]:checked + label::after { - -webkit-transform: scale(1, 1); - -ms-transform: scale(1, 1); - -o-transform: scale(1, 1); - transform: scale(1, 1); -} -.radio input[type="radio"]:disabled + label { - opacity: 0.65; -} -.radio input[type="radio"]:disabled + label::before { - cursor: not-allowed; -} -.radio.radio-inline { - margin-top: 0; -} - -.radio-primary input[type="radio"] + label::after { - background-color: #337ab7; -} -.radio-primary input[type="radio"]:checked + label::before { - border-color: #337ab7; -} -.radio-primary input[type="radio"]:checked + label::after { - background-color: #337ab7; -} - -.radio-danger input[type="radio"] + label::after { - background-color: #d9534f; -} -.radio-danger input[type="radio"]:checked + label::before { - border-color: #d9534f; -} -.radio-danger input[type="radio"]:checked + label::after { - background-color: #d9534f; -} - -.radio-info input[type="radio"] + label::after { - background-color: #5bc0de; -} -.radio-info input[type="radio"]:checked + label::before { - border-color: #5bc0de; -} -.radio-info input[type="radio"]:checked + label::after { - background-color: #5bc0de; -} - -.radio-warning input[type="radio"] + label::after { - background-color: #f0ad4e; -} -.radio-warning input[type="radio"]:checked + label::before { - border-color: #f0ad4e; -} -.radio-warning input[type="radio"]:checked + label::after { - background-color: #f0ad4e; -} - -.radio-success input[type="radio"] + label::after { - background-color: #5cb85c; -} -.radio-success input[type="radio"]:checked + label::before { - border-color: #5cb85c; -} -.radio-success input[type="radio"]:checked + label::after { - background-color: #5cb85c; -} - -input[type="checkbox"].styled:checked + label:after, -input[type="radio"].styled:checked + label:after { - font-family: 'FontAwesome'; - content: "\f00c"; -} -input[type="checkbox"] .styled:checked + label::before, -input[type="radio"] .styled:checked + label::before { - color: #fff; -} -input[type="checkbox"] .styled:checked + label::after, -input[type="radio"] .styled:checked + label::after { - color: #fff; -} diff --git a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.eot b/src/main/resources/static/css/fonts/fontawesome-webfont93e3.eot deleted file mode 100644 index a30335d7..00000000 Binary files a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.eot and /dev/null differ diff --git a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.svg b/src/main/resources/static/css/fonts/fontawesome-webfont93e3.svg deleted file mode 100644 index 9b11bce6..00000000 --- a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.svg +++ /dev/null @@ -1,640 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.ttf b/src/main/resources/static/css/fonts/fontawesome-webfont93e3.ttf deleted file mode 100644 index d7994e13..00000000 Binary files a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.ttf and /dev/null differ diff --git a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff b/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff deleted file mode 100644 index 6fd4ede0..00000000 Binary files a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff and /dev/null differ diff --git a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff2 b/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff2 deleted file mode 100644 index 5560193c..00000000 Binary files a/src/main/resources/static/css/fonts/fontawesome-webfont93e3.woff2 and /dev/null differ diff --git a/src/main/resources/static/css/fonts/fontawesome-webfontd41d.eot b/src/main/resources/static/css/fonts/fontawesome-webfontd41d.eot deleted file mode 100644 index a30335d7..00000000 Binary files a/src/main/resources/static/css/fonts/fontawesome-webfontd41d.eot and /dev/null differ diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.eot b/src/main/resources/static/css/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index b93a4953..00000000 Binary files a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.svg b/src/main/resources/static/css/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index f670936e..00000000 --- a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.ttf b/src/main/resources/static/css/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 1413fc60..00000000 Binary files a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff b/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 9e612858..00000000 Binary files a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff2 b/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff2 deleted file mode 100644 index 64539b54..00000000 Binary files a/src/main/resources/static/css/fonts/glyphicons-halflings-regular.woff2 and /dev/null differ diff --git a/src/main/resources/static/css/fonts/glyphicons-halflings-regulard41d.eot b/src/main/resources/static/css/fonts/glyphicons-halflings-regulard41d.eot deleted file mode 100644 index b93a4953..00000000 Binary files a/src/main/resources/static/css/fonts/glyphicons-halflings-regulard41d.eot and /dev/null differ diff --git a/src/main/resources/static/ruoyi/css/ry-ui.css b/src/main/resources/static/ruoyi/css/ry-ui.css index 18449444..b10a2b72 100644 --- a/src/main/resources/static/ruoyi/css/ry-ui.css +++ b/src/main/resources/static/ruoyi/css/ry-ui.css @@ -117,7 +117,7 @@ label.error { position: absolute; right: 18px; - top: 5px; + top: 7px; color: #ef392b; font-size: 12px } @@ -136,6 +136,24 @@ label.error { padding-left: 25px } +.i-checks label.error, .check-box label.error, .radio-box label.error { + right:auto; + width:150px; + left:210px; + top:1px; + max-width: none; +} + +/** 内联复选框&单选框 */ +.check-box,.radio-box { + display:inline-block; + box-sizing:border-box; + cursor:pointer; + position:relative; + padding-right:20px; + padding-top:7px; +} + /** 遮罩层 */ .loaderbox { display: inline-block; @@ -217,48 +235,43 @@ li { padding-left: 10px; } -label{ +label { font-weight: normal; } -.container-div{ +.container-div { padding:10px 35px; height:100%; } -.container-div .row{ +.container-div .row { height: 100%; } -.select-info{ +.select-info,.select-table { width:100%; background: #fff; border-radius: 6px; margin-top:10px; + padding-top: 5px; padding-bottom: 13px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); } -.select-info{ +.select-info { position: relative; } -.select-info .save-btn,.select-info .close-btn{ - width: 20px; - position: absolute; - right: 20px; - top: 15px; - cursor: pointer; -} - -.select-info .save-btn{ - right: 50px; -} - -.select-info .col-sm-6 .control-label{ +.select-info .col-sm-6 .control-label { color:#333; } +@media ( max-width : 768px) { + .select-info { + display: none; + } +} + .select-list li{ float:left; color:#333; @@ -271,6 +284,7 @@ label{ outline: none; height: 30px; width:280px; + padding-left:5px; } .select-list li .submit-btn{ border:0px; @@ -289,17 +303,17 @@ label{ width:280px; } -.select-list .time input{ +.select-list .select-time input{ width:133px; } -.time label,.time span,.time input{ +.select-time label,.select-time span,.select-time input{ float:left; } -.time label{ +.select-time label{ margin-top: 5px; } -.time span{ +.select-time span{ display: block; margin: 5px 5px; } @@ -328,9 +342,10 @@ label{ .table-striped .bootstrap-table{ border:0px!important; } -.table-striped .table, .fixed-table-container, .table-striped .table, .table-striped .table, .table-striped .table>thead>tr>th, .table-striped .table>tbody>tr>th, .table-striped .table>tfoot>tr>th, .table-striped .table>thead>tr>td, .table-striped .table>tbody>tr>td, .table-striped .table>tfoot>tr>td{ - background-color: transparent!important; - border: 0px; +.table-striped .table, .fixed-table-container, table, .table-striped .table, .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{ + border-bottom: 1px solid #e7eaec!important; + background-color: transparent!important; + border: 0px; } .table-striped .table>thead>tr>th, .table-striped .table>tbody>tr>th{ border-bottom: 1px solid #ccc!important; diff --git a/src/main/resources/static/ruoyi/css/ry-ui.min.css b/src/main/resources/static/ruoyi/css/ry-ui.min.css index abbcf574..25496198 100644 --- a/src/main/resources/static/ruoyi/css/ry-ui.min.css +++ b/src/main/resources/static/ruoyi/css/ry-ui.min.css @@ -2,4 +2,4 @@ * ruoyi.css * Author: Ruoyi */ -.box{position:relative;border-radius:3px;background:#fff;border-top:3px solid #d2d6de;margin-bottom:20px;width:100%;box-shadow:0 1px 1px rgba(0,0,0,0.1)}.box-header:before,.box-body:before,.box-footer:before,.box-header:after,.box-body:after,.box-footer:after{content:" ";display:table}.box-header:after,.box-body:after,.box-footer:after{clear:both}.btn-box-tool{padding:5px;font-size:12px;background:transparent;color:#97a0b3}.open .btn-box-tool,.btn-box-tool:hover{color:#606c84}.box-main{margin:0;border:0;padding-top:2px;border-radius:0;box-shadow:none}.box-main>.box-header{border-bottom:1px solid #eee;padding:12px 10px 2px 15px}.box-header .box-title{display:inline-block;font-size:18px;margin:0;line-height:1}.box-main>.box-header .box-title{font-size:16px;margin-bottom:13px;float:left}.box-main>.box-header .box-title .fa{font-size:14px;padding-right:3px;margin-top:-2px}.box-main>.box-header .box-tools{position:relative;top:-5px;right:0}.box-main>.box-header .box-tools .btn{padding:3px 10px 5px 10px;font-size:14px;margin-bottom:2px}.box-main>.box-header .box-tools .btn-box-tool{padding:4px 2px}.box-main form>.box-footer,.nav-main form>.box-footer{background:#fafafa}.box-main form>.box-footer .row,.nav-main form>.box-footer .row{margin:5px 0 5px -25px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#1ab394;border-color:#1ab394;padding:1px 10px;color:#fff}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{margin-right:5px;color:rgba(255,255,255,0.7)}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#fff}.select2-container .select2-selection--single .select2-selection__rendered{padding-right:10px}label.error{position:absolute;right:18px;top:5px;color:#ef392b;font-size:12px}.Validform_error,input.error,select.error{background-color:#fbe2e2;border-color:#c66161;color:#c00}.Validform_wrong,.Validform_right,.Validform_warning{display:inline-block;height:20px;font-size:12px;vertical-align:middle;padding-left:25px}.loaderbox{display:inline-block;min-width:125px;padding:10px;margin:0 auto;color:#000!important;font-size:13px;font-weight:400;text-align:center;vertical-align:middle;border:1px solid #ddd;background-color:#eee;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 1px 8px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 8px rgba(0,0,0,0.1);box-shadow:0 1px 8px rgba(0,0,0,0.1)}.loaderbox .loading-activity{float:left;width:18px;height:18px;border:solid 2px transparent;border-top-color:#000;border-left-color:#000;border-radius:10px;-webkit-animation:pace-spinner 400ms linear infinite;-moz-animation:pace-spinner 400ms linear infinite;-ms-animation:pace-spinner 400ms linear infinite;-o-animation:pace-spinner 400ms linear infinite;animation:pace-spinner 400ms linear infinite}@media(max-width:767px){.loading-activity{width:18px;height:18px}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}li{list-style:none}.time-input{display:block;width:100%;padding-left:10px}label{font-weight:normal}.container-div{padding:10px 35px;height:100%}.container-div .row{height:100%}.select-info{width:100%;background:#fff;border-radius:6px;margin-top:10px;padding-bottom:13px;box-shadow:1px 1px 3px rgba(0,0,0,.2)}.select-info{position:relative}.select-info .save-btn,.select-info .close-btn{width:20px;position:absolute;right:20px;top:15px;cursor:pointer}.select-info .save-btn{right:50px}.select-info .col-sm-6 .control-label{color:#333}.select-list li{float:left;color:#333;margin:5px 15px 5px 0}.select-list li input{border:1px solid #ddd;border-radius:4px;background:transparent;outline:0;height:30px;width:280px}.select-list li .submit-btn{border:0;border-radius:4px;background:transparent;outline:0;width:40px;height:23px}.select-list li select{border:1px solid #ddd;border-radius:4px;background:transparent;outline:0;height:30px;width:280px}.select-list .time input{width:133px}.time label,.time span,.time input{float:left}.time label{margin-top:5px}.time span{display:block;margin:5px 5px}.search-btn{background-color:#1ab394;border-color:#1ab394;color:#FFF;margin-bottom:5px;display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;border-radius:3px;vertical-align:middle;cursor:pointer}.table-striped{min-height:75%}.table-striped .bootstrap-table{border:0!important}.table-striped .table,.fixed-table-container,.table-striped .table,.table-striped .table,.table-striped .table>thead>tr>th,.table-striped .table>tbody>tr>th,.table-striped .table>tfoot>tr>th,.table-striped .table>thead>tr>td,.table-striped .table>tbody>tr>td,.table-striped .table>tfoot>tr>td{background-color:transparent!important;border:0}.table-striped .table>thead>tr>th,.table-striped .table>tbody>tr>th{border-bottom:1px solid #ccc!important;border-top:0!important}.table-striped .table>thead:first-child>tr:first-child>th{color:#333}.table-bordered td,.table-bordered th{border:1px solid #ddd!important} \ No newline at end of file +.box{position:relative;border-radius:3px;background:#fff;border-top:3px solid #d2d6de;margin-bottom:20px;width:100%;box-shadow:0 1px 1px rgba(0,0,0,0.1)}.box-header:before,.box-body:before,.box-footer:before,.box-header:after,.box-body:after,.box-footer:after{content:" ";display:table}.box-header:after,.box-body:after,.box-footer:after{clear:both}.btn-box-tool{padding:5px;font-size:12px;background:transparent;color:#97a0b3}.open .btn-box-tool,.btn-box-tool:hover{color:#606c84}.box-main{margin:0;border:0;padding-top:2px;border-radius:0;box-shadow:none}.box-main>.box-header{border-bottom:1px solid #eee;padding:12px 10px 2px 15px}.box-header .box-title{display:inline-block;font-size:18px;margin:0;line-height:1}.box-main>.box-header .box-title{font-size:16px;margin-bottom:13px;float:left}.box-main>.box-header .box-title .fa{font-size:14px;padding-right:3px;margin-top:-2px}.box-main>.box-header .box-tools{position:relative;top:-5px;right:0}.box-main>.box-header .box-tools .btn{padding:3px 10px 5px 10px;font-size:14px;margin-bottom:2px}.box-main>.box-header .box-tools .btn-box-tool{padding:4px 2px}.box-main form>.box-footer,.nav-main form>.box-footer{background:#fafafa}.box-main form>.box-footer .row,.nav-main form>.box-footer .row{margin:5px 0 5px -25px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#1ab394;border-color:#1ab394;padding:1px 10px;color:#fff}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{margin-right:5px;color:rgba(255,255,255,0.7)}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#fff}.select2-container .select2-selection--single .select2-selection__rendered{padding-right:10px}label.error{position:absolute;right:18px;top:7px;color:#ef392b;font-size:12px}.Validform_error,input.error,select.error{background-color:#fbe2e2;border-color:#c66161;color:#c00}.Validform_wrong,.Validform_right,.Validform_warning{display:inline-block;height:20px;font-size:12px;vertical-align:middle;padding-left:25px}.i-checks label.error,.check-box label.error,.radio-box label.error{right:auto;width:150px;left:210px;top:1px;max-width:none}.check-box,.radio-box{display:inline-block;box-sizing:border-box;cursor:pointer;position:relative;padding-right:20px;padding-top:7px}.loaderbox{display:inline-block;min-width:125px;padding:10px;margin:0 auto;color:#000!important;font-size:13px;font-weight:400;text-align:center;vertical-align:middle;border:1px solid #ddd;background-color:#eee;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 1px 8px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 8px rgba(0,0,0,0.1);box-shadow:0 1px 8px rgba(0,0,0,0.1)}.loaderbox .loading-activity{float:left;width:18px;height:18px;border:solid 2px transparent;border-top-color:#000;border-left-color:#000;border-radius:10px;-webkit-animation:pace-spinner 400ms linear infinite;-moz-animation:pace-spinner 400ms linear infinite;-ms-animation:pace-spinner 400ms linear infinite;-o-animation:pace-spinner 400ms linear infinite;animation:pace-spinner 400ms linear infinite}@media(max-width:767px){.loading-activity{width:18px;height:18px}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0deg);transform:rotate(0deg)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}ul{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0)}li{list-style:none}.time-input{display:block;width:100%;padding-left:10px}label{font-weight:normal}.container-div{padding:10px 35px;height:100%}.container-div .row{height:100%}.select-info,.select-table{width:100%;background:#fff;border-radius:6px;margin-top:10px;padding-top:5px;padding-bottom:13px;box-shadow:1px 1px 3px rgba(0,0,0,.2)}.select-info{position:relative}.select-info .col-sm-6 .control-label{color:#333}@media(max-width :768px){.select-info{display:none}}.select-list li{float:left;color:#333;margin:5px 15px 5px 0}.select-list li input{border:1px solid #ddd;border-radius:4px;background:transparent;outline:0;height:30px;width:280px;padding-left:5px}.select-list li .submit-btn{border:0;border-radius:4px;background:transparent;outline:0;width:40px;height:23px}.select-list li select{border:1px solid #ddd;border-radius:4px;background:transparent;outline:0;height:30px;width:280px}.select-list .select-time input{width:133px}.select-time label,.select-time span,.select-time input{float:left}.select-time label{margin-top:5px}.select-time span{display:block;margin:5px 5px}.search-btn{background-color:#1ab394;border-color:#1ab394;color:#FFF;margin-bottom:5px;display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;border-radius:3px;vertical-align:middle;cursor:pointer}.table-striped{min-height:75%}.table-striped .bootstrap-table{border:0!important}.table-striped .table,.fixed-table-container,table,.table-striped .table,.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{border-bottom:1px solid #e7eaec!important;background-color:transparent!important;border:0}.table-striped .table>thead>tr>th,.table-striped .table>tbody>tr>th{border-bottom:1px solid #ccc!important;border-top:0!important}.table-striped .table>thead:first-child>tr:first-child>th{color:#333}.table-bordered td,.table-bordered th{border:1px solid #ddd!important} \ No newline at end of file diff --git a/src/main/resources/static/ruoyi/js/common.js b/src/main/resources/static/ruoyi/js/common.js index 466925e2..79a14978 100644 --- a/src/main/resources/static/ruoyi/js/common.js +++ b/src/main/resources/static/ruoyi/js/common.js @@ -18,7 +18,13 @@ $(function(){ radioClass: "iradio_square-green", }) } - if ($(".time").length > 0) { + if ($(".radio-box").length > 0) { + $(".radio-box").iCheck({ + checkboxClass: "icheckbox_square-green", + radioClass: "iradio_square-green", + }) + } + if ($(".select-time").length > 0) { layui.use('laydate', function() { var laydate = layui.laydate; laydate.render({ elem: '#startTime', theme: 'molv' }); diff --git a/src/main/resources/static/ruoyi/js/ry-ui.js b/src/main/resources/static/ruoyi/js/ry-ui.js index 8ae64710..8940936b 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.js @@ -159,6 +159,11 @@ }, // 表单封装处理 form: { + // 表单重置 + reset: function(formId) { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + $("#" + currentId)[0].reset(); + }, // 获取选中复选框项 selectCheckeds: function(name) { var checkeds = ""; @@ -375,7 +380,7 @@ }); }, // 批量删除信息 - batRemove: function() { + removeAll: function() { var rows = $.common.isEmpty($.table._option.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.id); if (rows.length == 0) { $.modal.alertWarning("请至少选择一条记录"); @@ -441,6 +446,16 @@ $.modal.closeLoading(); } }, + // 校验封装处理 + validate: { + // 判断返回标识是否唯一 false 不存在 true 存在 + unique: function (value) { + if (value == "0") { + return true; + } + return false; + } + }, // 通用方法封装处理 common: { // 判断字符串是否为空 diff --git a/src/main/resources/static/ruoyi/js/ry-ui.min.js b/src/main/resources/static/ruoyi/js/ry-ui.min.js index 9e91c4eb..c822da45 100644 --- a/src/main/resources/static/ruoyi/js/ry-ui.min.js +++ b/src/main/resources/static/ruoyi/js/ry-ui.min.js @@ -2,4 +2,4 @@ * ruoyi.js * Author: Ruoyi */ -(function($){$.extend({table:{_option:{},_params:{},init:function(options){$.table._option=options;$.table._params=$.common.isEmpty(options.queryParams)?$.table.queryParams:options.queryParams;_sortOrder=$.common.isEmpty(options.sortOrder)?"asc":options.sortOrder;_sortName=$.common.isEmpty(options.sortName)?"":options.sortName;$("#bootstrap-table").bootstrapTable({url:options.url,contentType:"application/x-www-form-urlencoded",method:"post",cache:false,sortable:true,sortStable:true,sortName:_sortName,sortOrder:_sortOrder,pagination:$.common.visible(options.pagination),pageNumber:1,pageSize:10,pageList:[10,25,50],iconSize:"outline",toolbar:"#toolbar",sidePagination:"server",search:$.common.visible(options.search),showRefresh:$.common.visible(options.showRefresh),showColumns:$.common.visible(options.showColumns),showToggle:$.common.visible(options.showToggle),showExport:$.common.visible(options.showExport),queryParams:$.table._params,columns:options.columns,responseHandler:$.table.responseHandler})},queryParams:function(params){return{pageSize:params.limit,pageNum:params.offset/params.limit+1,searchValue:params.search,orderByColumn:params.sort,isAsc:params.order}},responseHandler:function(res){if(res.code==0){return{rows:res.rows,total:res.total}}else{$.modal.alertWarning(res.msg);return{rows:[],total:0}}},search:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;var params=$("#bootstrap-table").bootstrapTable("getOptions");params.queryParams=function(params){var search={};$.each($("#"+currentId).serializeArray(),function(i,field){search[field.name]=field.value});search.pageSize=params.limit;search.pageNum=params.offset/params.limit+1;search.searchValue=params.search;search.orderByColumn=params.sort;search.isAsc=params.order;return search};$("#bootstrap-table").bootstrapTable("refresh",params)},exportExcel:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;$.modal.loading("正在导出数据,请稍后...");$.post($.table._option.exportUrl,$("#"+currentId).serializeArray(),function(result){if(result.code==web_status.SUCCESS){window.location.href=ctx+"common/download?fileName="+result.msg+"&delete="+true}else{$.modal.alertError(result.msg)}$.modal.closeLoading()})},refresh:function(){$("#bootstrap-table").bootstrapTable("refresh",{url:$.table._option.url,silent:true})},selectColumns:function(column){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[column]})},selectFirstColumns:function(){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[$.table._option.columns[1].field]})},selectDictLabel:function(_datas,_value){var actions=[];$.each(_datas,function(index,dict){if(dict.dictValue==_value){actions.push(""+dict.dictLabel+"");return false}});return actions.join("")}},treeTable:{_option:{},_treeTable:{},init:function(options){$.table._option=options;var treeTable=$("#bootstrap-table").bootstrapTreeTable({code:options.id,parentCode:options.parentId,type:"get",url:options.url,ajaxParams:{},expandColumn:"0",striped:false,bordered:true,expandAll:$.common.visible(options.expandAll),columns:options.columns});$.treeTable._treeTable=treeTable},search:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;var params={};$.each($("#"+currentId).serializeArray(),function(i,field){params[field.name]=field.value});$.treeTable._treeTable.bootstrapTreeTable("refresh",params)},refresh:function(){$.treeTable._treeTable.bootstrapTreeTable("refresh")},},form:{selectCheckeds:function(name){var checkeds="";$('input:checkbox[name="'+name+'"]:checked').each(function(i){if(0==i){checkeds=$(this).val()}else{checkeds+=(","+$(this).val())}});return checkeds},selectSelects:function(name){var selects="";$("#"+name+" option:selected").each(function(i){if(0==i){selects=$(this).val()}else{selects+=(","+$(this).val())}});return selects}},modal:{icon:function(type){var icon="";if(type==modal_status.WARNING){icon=0}else{if(type==modal_status.SUCCESS){icon=1}else{if(type==modal_status.FAIL){icon=2}else{icon=3}}}return icon},msg:function(content,type){if(type!=undefined){layer.msg(content,{icon:$.modal.icon(type),time:1000,shift:5})}else{layer.msg(content)}},msgError:function(content){$.modal.msg(content,modal_status.FAIL)},msgSuccess:function(content){$.modal.msg(content,modal_status.SUCCESS)},msgWarning:function(content){$.modal.msg(content,modal_status.WARNING)},alert:function(content,type){layer.alert(content,{icon:$.modal.icon(type),title:"系统提示",btn:["确认"],btnclass:["btn btn-primary"],})},msgReload:function(msg,type){layer.msg(msg,{icon:$.modal.icon(type),time:500,shade:[0.1,"#8F8F8F"]},function(){$.modal.reload()})},alertError:function(content){$.modal.alert(content,modal_status.FAIL)},alertSuccess:function(content){$.modal.alert(content,modal_status.SUCCESS)},alertWarning:function(content){$.modal.alert(content,modal_status.WARNING)},close:function(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index)},confirm:function(content,callBack){layer.confirm(content,{icon:3,title:"系统提示",btn:["确认","取消"],btnclass:["btn btn-primary","btn btn-danger"],},function(index){layer.close(index);callBack(true)})},open:function(title,url,width,height){if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){width="auto";height="auto"}if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url})},openFull:function(title,url,width,height){if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){width="auto";height="auto"}if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}var index=layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url});layer.full(index)},loading:function(message){$.blockUI({message:'
                    '+message+"
                    "})},closeLoading:function(){setTimeout(function(){$.unblockUI()},50)},reload:function(){parent.location.reload()}},operate:{submit:function(url,type,dataType,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:type,dataType:dataType,data:data,success:function(result){$.operate.ajaxSuccess(result)}};$.ajax(config)},post:function(url,data){$.operate.submit(url,"post","json",data)},remove:function(id){$.modal.confirm("确定删除该条"+$.table._option.modalName+"信息吗?",function(){var url=$.common.isEmpty(id)?$.table._option.removeUrl:$.table._option.removeUrl.replace("{id}",id);var data={"ids":id};$.operate.submit(url,"post","json",data)})},batRemove:function(){var rows=$.common.isEmpty($.table._option.id)?$.table.selectFirstColumns():$.table.selectColumns($.table._option.id);if(rows.length==0){$.modal.alertWarning("请至少选择一条记录");return}$.modal.confirm("确认要删除选中的"+rows.length+"条数据吗?",function(){var url=$.table._option.removeUrl;var data={"ids":rows.join()};$.operate.submit(url,"post","json",data)})},add:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.open("添加"+$.table._option.modalName,url)},edit:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.open("修改"+$.table._option.modalName,url)},addFull:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.openFull("添加"+$.table._option.modalName,url)},editFull:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.openFull("修改"+$.table._option.modalName,url)},save:function(url,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:"post",dataType:"json",data:data,success:function(result){$.operate.saveSuccess(result)}};$.ajax(config)},ajaxSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgSuccess(result.msg);$.table.refresh()}else{$.modal.alertError(result.msg)}$.modal.closeLoading()},saveSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgReload("保存成功,正在刷新数据请稍后……",modal_status.SUCCESS)}else{$.modal.alertError(result.msg)}$.modal.closeLoading()}},common:{isEmpty:function(value){if(value==null||this.trim(value)==""){return true}return false},visible:function(value){if($.common.isEmpty(value)||value==true){return true}return false},trim:function(value){if(value==null){return""}return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g,"")},random:function(min,max){return Math.floor((Math.random()*max)+min)}}})})(jQuery);web_status={SUCCESS:0,FAIL:500};modal_status={SUCCESS:"success",FAIL:"error",WARNING:"warning"}; \ No newline at end of file +(function($){$.extend({table:{_option:{},_params:{},init:function(options){$.table._option=options;$.table._params=$.common.isEmpty(options.queryParams)?$.table.queryParams:options.queryParams;_sortOrder=$.common.isEmpty(options.sortOrder)?"asc":options.sortOrder;_sortName=$.common.isEmpty(options.sortName)?"":options.sortName;$("#bootstrap-table").bootstrapTable({url:options.url,contentType:"application/x-www-form-urlencoded",method:"post",cache:false,sortable:true,sortStable:true,sortName:_sortName,sortOrder:_sortOrder,pagination:$.common.visible(options.pagination),pageNumber:1,pageSize:10,pageList:[10,25,50],iconSize:"outline",toolbar:"#toolbar",sidePagination:"server",search:$.common.visible(options.search),showRefresh:$.common.visible(options.showRefresh),showColumns:$.common.visible(options.showColumns),showToggle:$.common.visible(options.showToggle),showExport:$.common.visible(options.showExport),queryParams:$.table._params,columns:options.columns,responseHandler:$.table.responseHandler})},queryParams:function(params){return{pageSize:params.limit,pageNum:params.offset/params.limit+1,searchValue:params.search,orderByColumn:params.sort,isAsc:params.order}},responseHandler:function(res){if(res.code==0){return{rows:res.rows,total:res.total}}else{$.modal.alertWarning(res.msg);return{rows:[],total:0}}},search:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;var params=$("#bootstrap-table").bootstrapTable("getOptions");params.queryParams=function(params){var search={};$.each($("#"+currentId).serializeArray(),function(i,field){search[field.name]=field.value});search.pageSize=params.limit;search.pageNum=params.offset/params.limit+1;search.searchValue=params.search;search.orderByColumn=params.sort;search.isAsc=params.order;return search};$("#bootstrap-table").bootstrapTable("refresh",params)},exportExcel:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;$.modal.loading("正在导出数据,请稍后...");$.post($.table._option.exportUrl,$("#"+currentId).serializeArray(),function(result){if(result.code==web_status.SUCCESS){window.location.href=ctx+"common/download?fileName="+result.msg+"&delete="+true}else{$.modal.alertError(result.msg)}$.modal.closeLoading()})},refresh:function(){$("#bootstrap-table").bootstrapTable("refresh",{url:$.table._option.url,silent:true})},selectColumns:function(column){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[column]})},selectFirstColumns:function(){return $.map($("#bootstrap-table").bootstrapTable("getSelections"),function(row){return row[$.table._option.columns[1].field]})},selectDictLabel:function(_datas,_value){var actions=[];$.each(_datas,function(index,dict){if(dict.dictValue==_value){actions.push(""+dict.dictLabel+"");return false}});return actions.join("")}},treeTable:{_option:{},_treeTable:{},init:function(options){$.table._option=options;var treeTable=$("#bootstrap-table").bootstrapTreeTable({code:options.id,parentCode:options.parentId,type:"get",url:options.url,ajaxParams:{},expandColumn:"0",striped:false,bordered:true,expandAll:$.common.visible(options.expandAll),columns:options.columns});$.treeTable._treeTable=treeTable},search:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;var params={};$.each($("#"+currentId).serializeArray(),function(i,field){params[field.name]=field.value});$.treeTable._treeTable.bootstrapTreeTable("refresh",params)},refresh:function(){$.treeTable._treeTable.bootstrapTreeTable("refresh")},},form:{reset:function(formId){var currentId=$.common.isEmpty(formId)?$("form").attr("id"):formId;$("#"+currentId)[0].reset()},selectCheckeds:function(name){var checkeds="";$('input:checkbox[name="'+name+'"]:checked').each(function(i){if(0==i){checkeds=$(this).val()}else{checkeds+=(","+$(this).val())}});return checkeds},selectSelects:function(name){var selects="";$("#"+name+" option:selected").each(function(i){if(0==i){selects=$(this).val()}else{selects+=(","+$(this).val())}});return selects}},modal:{icon:function(type){var icon="";if(type==modal_status.WARNING){icon=0}else{if(type==modal_status.SUCCESS){icon=1}else{if(type==modal_status.FAIL){icon=2}else{icon=3}}}return icon},msg:function(content,type){if(type!=undefined){layer.msg(content,{icon:$.modal.icon(type),time:1000,shift:5})}else{layer.msg(content)}},msgError:function(content){$.modal.msg(content,modal_status.FAIL)},msgSuccess:function(content){$.modal.msg(content,modal_status.SUCCESS)},msgWarning:function(content){$.modal.msg(content,modal_status.WARNING)},alert:function(content,type){layer.alert(content,{icon:$.modal.icon(type),title:"系统提示",btn:["确认"],btnclass:["btn btn-primary"],})},msgReload:function(msg,type){layer.msg(msg,{icon:$.modal.icon(type),time:500,shade:[0.1,"#8F8F8F"]},function(){$.modal.reload()})},alertError:function(content){$.modal.alert(content,modal_status.FAIL)},alertSuccess:function(content){$.modal.alert(content,modal_status.SUCCESS)},alertWarning:function(content){$.modal.alert(content,modal_status.WARNING)},close:function(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index)},confirm:function(content,callBack){layer.confirm(content,{icon:3,title:"系统提示",btn:["确认","取消"],btnclass:["btn btn-primary","btn btn-danger"],},function(index){layer.close(index);callBack(true)})},open:function(title,url,width,height){if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){width="auto";height="auto"}if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url})},openFull:function(title,url,width,height){if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){width="auto";height="auto"}if($.common.isEmpty(title)){title=false}if($.common.isEmpty(url)){url="404.html"}if($.common.isEmpty(width)){width=800}if($.common.isEmpty(height)){height=($(window).height()-50)}var index=layer.open({type:2,area:[width+"px",height+"px"],fix:false,maxmin:true,shade:0.3,title:title,content:url});layer.full(index)},loading:function(message){$.blockUI({message:'
                    '+message+"
                    "})},closeLoading:function(){setTimeout(function(){$.unblockUI()},50)},reload:function(){parent.location.reload()}},operate:{submit:function(url,type,dataType,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:type,dataType:dataType,data:data,success:function(result){$.operate.ajaxSuccess(result)}};$.ajax(config)},post:function(url,data){$.operate.submit(url,"post","json",data)},remove:function(id){$.modal.confirm("确定删除该条"+$.table._option.modalName+"信息吗?",function(){var url=$.common.isEmpty(id)?$.table._option.removeUrl:$.table._option.removeUrl.replace("{id}",id);var data={"ids":id};$.operate.submit(url,"post","json",data)})},removeAll:function(){var rows=$.common.isEmpty($.table._option.id)?$.table.selectFirstColumns():$.table.selectColumns($.table._option.id);if(rows.length==0){$.modal.alertWarning("请至少选择一条记录");return}$.modal.confirm("确认要删除选中的"+rows.length+"条数据吗?",function(){var url=$.table._option.removeUrl;var data={"ids":rows.join()};$.operate.submit(url,"post","json",data)})},add:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.open("添加"+$.table._option.modalName,url)},edit:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.open("修改"+$.table._option.modalName,url)},addFull:function(id){var url=$.common.isEmpty(id)?$.table._option.createUrl:$.table._option.createUrl.replace("{id}",id);$.modal.openFull("添加"+$.table._option.modalName,url)},editFull:function(id){var url=$.table._option.updateUrl.replace("{id}",id);$.modal.openFull("修改"+$.table._option.modalName,url)},save:function(url,data){$.modal.loading("正在处理中,请稍后...");var config={url:url,type:"post",dataType:"json",data:data,success:function(result){$.operate.saveSuccess(result)}};$.ajax(config)},ajaxSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgSuccess(result.msg);$.table.refresh()}else{$.modal.alertError(result.msg)}$.modal.closeLoading()},saveSuccess:function(result){if(result.code==web_status.SUCCESS){$.modal.msgReload("保存成功,正在刷新数据请稍后……",modal_status.SUCCESS)}else{$.modal.alertError(result.msg)}$.modal.closeLoading()}},validate:{unique:function(value){if(value=="0"){return true}return false}},common:{isEmpty:function(value){if(value==null||this.trim(value)==""){return true}return false},visible:function(value){if($.common.isEmpty(value)||value==true){return true}return false},trim:function(value){if(value==null){return""}return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g,"")},random:function(min,max){return Math.floor((Math.random()*max)+min)}}})})(jQuery);web_status={SUCCESS:0,FAIL:500};modal_status={SUCCESS:"success",FAIL:"error",WARNING:"warning"}; \ No newline at end of file diff --git a/src/main/resources/templates/include.html b/src/main/resources/templates/include.html index a9fb90a6..b786648a 100644 --- a/src/main/resources/templates/include.html +++ b/src/main/resources/templates/include.html @@ -12,8 +12,8 @@ - +
                    @@ -36,6 +36,7 @@ + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index bfc46acb..c6c3d726 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -86,9 +86,9 @@
                    - @@ -32,7 +33,7 @@ 新增 -
                    +
                    @@ -102,10 +103,10 @@ url: prefix + "/remove/" + id, success : function(result) { if (result.code == web_status.SUCCESS) { - $.modal.alertSuccess(result.msg); + $.modal.msgSuccess(result.msg); $.treeTable.refresh(); } else { - $.modal.alertError(result.msg); + $.modal.msgError(result.msg); } } }); diff --git a/src/main/resources/templates/system/dept/edit.html b/src/main/resources/templates/system/dept/edit.html index 1d2437b5..9c235156 100644 --- a/src/main/resources/templates/system/dept/edit.html +++ b/src/main/resources/templates/system/dept/edit.html @@ -45,10 +45,10 @@
                    -
                    -
                    - - +
                    +
                    + +
                    @@ -74,15 +74,14 @@ dataType: "json", data: { "deptId": function() { - return $("input[name='deptId']").val(); + return $.common.trim($("#deptId").val()); }, "deptName": function() { - return $("input[name='deptName']").val(); + return $.common.trim($("#deptName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -90,6 +89,12 @@ required:true, digits:true }, + email:{ + email:true, + }, + phone:{ + isPhone:true, + }, }, messages: { "deptName": { diff --git a/src/main/resources/templates/system/dict/data/add.html b/src/main/resources/templates/system/dict/data/add.html index 54b5c108..23cba294 100644 --- a/src/main/resources/templates/system/dict/data/add.html +++ b/src/main/resources/templates/system/dict/data/add.html @@ -29,40 +29,49 @@
                    -
                    - -
                    - -
                    -
                    -
                    - -
                    -
                    - - -
                    -
                    -
                    +
                    + +
                    + + table表格字典列显示样式属性 +
                    +
                    +
                    + +
                    +
                    + + +
                    +
                    +
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    diff --git a/src/main/resources/templates/system/dict/data/data.html b/src/main/resources/templates/system/dict/data/data.html index 1372df01..3cc08228 100644 --- a/src/main/resources/templates/system/dict/data/data.html +++ b/src/main/resources/templates/system/dict/data/data.html @@ -22,7 +22,7 @@
                  • 数据状态:
                  • @@ -38,12 +38,12 @@ 新增 - + 删除
                  • -
                    +
                    diff --git a/src/main/resources/templates/system/dict/data/edit.html b/src/main/resources/templates/system/dict/data/edit.html index 2b86c1ea..d0b8d5e1 100644 --- a/src/main/resources/templates/system/dict/data/edit.html +++ b/src/main/resources/templates/system/dict/data/edit.html @@ -30,40 +30,49 @@
                    -
                    - -
                    - -
                    -
                    -
                    - -
                    -
                    - - -
                    -
                    -
                    +
                    + +
                    + + table表格字典列显示样式属性 +
                    +
                    +
                    + +
                    +
                    + + +
                    +
                    +
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    diff --git a/src/main/resources/templates/system/dict/type/add.html b/src/main/resources/templates/system/dict/type/add.html index cf03ff19..cba62ae1 100644 --- a/src/main/resources/templates/system/dict/type/add.html +++ b/src/main/resources/templates/system/dict/type/add.html @@ -19,17 +19,17 @@
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    @@ -59,12 +59,11 @@ dataType: "json", data: { name : function() { - return $.trim($("#dictType").val()); + return $.common.trim($("#dictType").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/dict/type/edit.html b/src/main/resources/templates/system/dict/type/edit.html index b42c2fae..795c2464 100644 --- a/src/main/resources/templates/system/dict/type/edit.html +++ b/src/main/resources/templates/system/dict/type/edit.html @@ -20,17 +20,17 @@
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    @@ -60,15 +60,14 @@ dataType: "json", data: { dictId : function() { - return $.trim($("#dictId").val()); + return $("#dictId").val(); }, dictType : function() { - return $.trim($("#dictType").val()); + return $.common.trim($("#dictType").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/dict/type/type.html b/src/main/resources/templates/system/dict/type/type.html index b08b4147..1df47bd3 100644 --- a/src/main/resources/templates/system/dict/type/type.html +++ b/src/main/resources/templates/system/dict/type/type.html @@ -20,10 +20,10 @@
                  • 字典状态:
                  • -
                  • +
                  • - @@ -42,12 +42,12 @@ 新增 - + 删除
                  • -
                    +
                    diff --git a/src/main/resources/templates/system/menu/add.html b/src/main/resources/templates/system/menu/add.html index 42caeb85..d4ce7101 100644 --- a/src/main/resources/templates/system/menu/add.html +++ b/src/main/resources/templates/system/menu/add.html @@ -58,10 +58,10 @@
                    -
                    -
                    - - +
                    +
                    + +
                    @@ -79,6 +79,9 @@ var prefix = ctx + "system/menu" $("#form-menu-add").validate({ rules:{ + menuType:{ + required:true, + }, menuName:{ required:true, remote: { @@ -87,12 +90,11 @@ dataType: "json", data: { "menuName" : function() { - return $.trim($("#menuName").val()); + return $.common.trim($("#menuName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/menu/edit.html b/src/main/resources/templates/system/menu/edit.html index 6adb5fc7..3f641eb0 100644 --- a/src/main/resources/templates/system/menu/edit.html +++ b/src/main/resources/templates/system/menu/edit.html @@ -59,10 +59,10 @@
                    -
                    -
                    - - +
                    +
                    + +
                    @@ -86,6 +86,9 @@ $("#form-menu-edit").validate({ rules:{ + menuType:{ + required:true, + }, menuName:{ required:true, remote: { @@ -94,15 +97,14 @@ dataType: "json", data: { "menuId": function() { - return $("input[name='menuId']").val(); + return $("#menuId").val(); }, "menuName": function() { - return $("input[name='menuName']").val(); + return $.common.trim($("#menuName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/menu/menu.html b/src/main/resources/templates/system/menu/menu.html index 79f610a4..64f090de 100644 --- a/src/main/resources/templates/system/menu/menu.html +++ b/src/main/resources/templates/system/menu/menu.html @@ -16,11 +16,12 @@
                  • 菜单状态:
                  •  搜索 +  重置
                  • @@ -32,7 +33,7 @@ 新增
                    -
                    +
                    @@ -135,10 +136,10 @@ url: prefix + "/remove/" + id, success : function(result) { if (result.code == web_status.SUCCESS) { - $.modal.alertSuccess(result.msg); + $.modal.msgSuccess(result.msg); $.treeTable.refresh(); } else { - $.modal.alertError(result.msg); + $.modal.msgError(result.msg); } } }); diff --git a/src/main/resources/templates/system/notice/add.html b/src/main/resources/templates/system/notice/add.html index c9e58ef6..7849e6f4 100644 --- a/src/main/resources/templates/system/notice/add.html +++ b/src/main/resources/templates/system/notice/add.html @@ -17,7 +17,7 @@
                    @@ -30,10 +30,10 @@
                    -
                    -
                    - - +
                    +
                    + +
                    diff --git a/src/main/resources/templates/system/notice/edit.html b/src/main/resources/templates/system/notice/edit.html index 8bc96d2b..74671e2f 100644 --- a/src/main/resources/templates/system/notice/edit.html +++ b/src/main/resources/templates/system/notice/edit.html @@ -18,7 +18,7 @@
                    @@ -31,10 +31,10 @@
                    -
                    -
                    - - +
                    +
                    + +
                    diff --git a/src/main/resources/templates/system/notice/notice.html b/src/main/resources/templates/system/notice/notice.html index 9f42bed5..1a9c27ec 100644 --- a/src/main/resources/templates/system/notice/notice.html +++ b/src/main/resources/templates/system/notice/notice.html @@ -19,11 +19,12 @@
                  • 公告类型:
                  •  搜索 +  重置
                  • @@ -34,12 +35,12 @@ 新增 - + 删除
                    -
                    +
                    diff --git a/src/main/resources/templates/system/post/add.html b/src/main/resources/templates/system/post/add.html index a5d9290f..f45451c6 100644 --- a/src/main/resources/templates/system/post/add.html +++ b/src/main/resources/templates/system/post/add.html @@ -25,17 +25,17 @@
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    @@ -60,12 +60,11 @@ dataType: "json", data: { "postName" : function() { - return $.trim($("#postName").val()); + return $.common.trim($("#postName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -77,12 +76,11 @@ dataType: "json", data: { "postCode" : function() { - return $.trim($("#postCode").val()); + return $.common.trim($("#postCode").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/post/edit.html b/src/main/resources/templates/system/post/edit.html index 0498c887..4ab53835 100644 --- a/src/main/resources/templates/system/post/edit.html +++ b/src/main/resources/templates/system/post/edit.html @@ -26,17 +26,17 @@
                    -
                    -
                    - - +
                    +
                    + +
                    - +
                    @@ -64,12 +64,11 @@ return $("input[name='postId']").val(); }, "postName" : function() { - return $.trim($("#postName").val()); + return $.common.trim($("#postName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -84,12 +83,11 @@ return $("input[name='postId']").val(); }, "postCode" : function() { - return $.trim($("#postCode").val()); + return $.common.trim($("#postCode").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/post/post.html b/src/main/resources/templates/system/post/post.html index ada31734..0e9d5fb5 100644 --- a/src/main/resources/templates/system/post/post.html +++ b/src/main/resources/templates/system/post/post.html @@ -20,7 +20,7 @@
                  • 岗位状态:
                  • @@ -36,12 +36,12 @@ 新增 - + 删除
                  • -
                    +
                    diff --git a/src/main/resources/templates/system/role/add.html b/src/main/resources/templates/system/role/add.html index 208abfa0..c64af035 100644 --- a/src/main/resources/templates/system/role/add.html +++ b/src/main/resources/templates/system/role/add.html @@ -87,12 +87,11 @@ dataType: "json", data: { "roleName" : function() { - return $.trim($("#roleName").val()); + return $.common.trim($("#roleName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -104,12 +103,11 @@ dataType: "json", data: { "roleName" : function() { - return $.trim($("#roleName").val()); + return $.common.trim($("#roleName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/role/edit.html b/src/main/resources/templates/system/role/edit.html index ef3e10ef..bafe7858 100644 --- a/src/main/resources/templates/system/role/edit.html +++ b/src/main/resources/templates/system/role/edit.html @@ -88,15 +88,14 @@ dataType: "json", data: { "roleId": function() { - return $("input[name='roleId']").val(); + return $("#roleId").val(); }, "roleName": function() { - return $("input[name='roleName']").val(); + return $.common.trim($("#roleName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -108,15 +107,14 @@ dataType: "json", data: { "roleId": function() { - return $("input[name='roleId']").val(); + return $("#roleId").val(); }, "roleKey": function() { - return $("input[name='roleKey']").val(); + return $.common.trim($("#roleKey").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/role/role.html b/src/main/resources/templates/system/role/role.html index cbff9e8e..14f1d3bb 100644 --- a/src/main/resources/templates/system/role/role.html +++ b/src/main/resources/templates/system/role/role.html @@ -20,10 +20,10 @@
                  • 角色状态:
                  • -
                  • +
                  • - @@ -42,12 +42,12 @@ 新增 - + 删除
                  • -
                    +
                    diff --git a/src/main/resources/templates/system/user/add.html b/src/main/resources/templates/system/user/add.html index 4159ae3f..472237e9 100644 --- a/src/main/resources/templates/system/user/add.html +++ b/src/main/resources/templates/system/user/add.html @@ -47,7 +47,7 @@
                    @@ -105,12 +105,11 @@ dataType: "json", data: { name : function() { - return $.trim($("#loginName").val()); + return $.common.trim($("#loginName").val()); } }, dataFilter: function(data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -134,12 +133,11 @@ dataType: "json", data: { name: function () { - return $.trim($("#email").val()); + return $.common.trim($("#email").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -152,12 +150,11 @@ dataType: "json", data: { name: function () { - return $.trim($("#phonenumber").val()); + return $.common.trim($("#phonenumber").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/user/edit.html b/src/main/resources/templates/system/user/edit.html index a3afe15a..fdd76a90 100644 --- a/src/main/resources/templates/system/user/edit.html +++ b/src/main/resources/templates/system/user/edit.html @@ -42,7 +42,7 @@
                    @@ -105,15 +105,14 @@ dataType: "json", data: { "userId": function() { - return $("input[name='userId']").val(); + return $("#userId").val(); }, "email": function() { - return $("input[name='email']").val(); + return $.common.trim($("#email").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -126,15 +125,14 @@ dataType: "json", data: { "userId": function() { - return $("input[name='userId']").val(); + return $("#userId").val(); }, "phonenumber": function() { - return $("input[name='phonenumber']").val(); + return $.common.trim($("#phonenumber").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/user/profile/edit.html b/src/main/resources/templates/system/user/profile/edit.html index 137d8830..cb07bfbd 100644 --- a/src/main/resources/templates/system/user/profile/edit.html +++ b/src/main/resources/templates/system/user/profile/edit.html @@ -39,11 +39,11 @@
                    -
                    +
                    -
                    +
                    @@ -74,15 +74,14 @@ dataType: "json", data: { "userId": function() { - return $("input[name='userId']").val(); + return $("#userId").val(); }, "email": function() { - return $("input[name='email']").val(); + return $.common.trim($("#email").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, @@ -95,15 +94,14 @@ dataType: "json", data: { "userId": function() { - return $("input[name='userId']").val(); + return $("#userId").val(); }, "phonenumber": function() { - return $("input[name='phonenumber']").val(); + return $.common.trim($("#phonenumber").val()); } }, dataFilter: function (data, type) { - if (data == "0") return true; - else return false; + return $.validate.unique(data); } } }, diff --git a/src/main/resources/templates/system/user/profile/resetPwd.html b/src/main/resources/templates/system/user/profile/resetPwd.html index 6832f495..e7836ef4 100644 --- a/src/main/resources/templates/system/user/profile/resetPwd.html +++ b/src/main/resources/templates/system/user/profile/resetPwd.html @@ -28,6 +28,7 @@
                    + 请再次输入您的密码
                    diff --git a/src/main/resources/templates/system/user/user.html b/src/main/resources/templates/system/user/user.html index 376cb188..d3ec76cd 100644 --- a/src/main/resources/templates/system/user/user.html +++ b/src/main/resources/templates/system/user/user.html @@ -45,10 +45,10 @@
                  • 用户状态:
                  • -
                  • +
                  • - @@ -67,12 +67,12 @@ 新增 - + 删除
                  • -
                    +
                    diff --git a/src/main/resources/templates/tool/gen/gen.html b/src/main/resources/templates/tool/gen/gen.html index 9857d0a2..0495646c 100644 --- a/src/main/resources/templates/tool/gen/gen.html +++ b/src/main/resources/templates/tool/gen/gen.html @@ -16,7 +16,7 @@
                  • 表描述:
                  • -
                  • +
                  • - @@ -24,6 +24,7 @@
                  •  搜索 +  重置
                  • @@ -36,7 +37,7 @@
                    -
                    +
                    diff --git a/src/main/resources/templates/vm/html/list.html.vm b/src/main/resources/templates/vm/html/list.html.vm index ae4fad44..d7dd2c14 100644 --- a/src/main/resources/templates/vm/html/list.html.vm +++ b/src/main/resources/templates/vm/html/list.html.vm @@ -8,12 +8,12 @@ 新增 - + 删除
                    -
                    +
                    diff --git a/src/main/resources/templates/vm/java/Controller.java.vm b/src/main/resources/templates/vm/java/Controller.java.vm index 5d37a948..ac8fe2c6 100644 --- a/src/main/resources/templates/vm/java/Controller.java.vm +++ b/src/main/resources/templates/vm/java/Controller.java.vm @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.framework.aspectj.lang.annotation.Log; -import com.ruoyi.framework.aspectj.lang.constant.BusinessType; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import ${package}.domain.${className}; import ${package}.service.I${className}Service; import com.ruoyi.framework.web.controller.BaseController; @@ -66,7 +66,7 @@ public class ${className}Controller extends BaseController * 新增保存${tableComment} */ @RequiresPermissions("${moduleName}:${classname}:add") - @Log(title = "${tableComment}", action = BusinessType.INSERT) + @Log(title = "${tableComment}", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(${className} ${classname}) @@ -89,7 +89,7 @@ public class ${className}Controller extends BaseController * 修改保存${tableComment} */ @RequiresPermissions("${moduleName}:${classname}:edit") - @Log(title = "${tableComment}", action = BusinessType.UPDATE) + @Log(title = "${tableComment}", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(${className} ${classname}) @@ -101,7 +101,7 @@ public class ${className}Controller extends BaseController * 删除${tableComment} */ @RequiresPermissions("${moduleName}:${classname}:remove") - @Log(title = "${tableComment}", action = BusinessType.DELETE) + @Log(title = "${tableComment}", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids)