mirror of https://gitee.com/y_project/RuoYi.git
升级SpringBoot到最新版本2.1.1
parent
ea58f8db9c
commit
a74e58f7d5
2
pom.xml
2
pom.xml
|
@ -33,7 +33,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>2.0.5.RELEASE</version>
|
<version>2.1.1.RELEASE</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.quartz.domain.SysJob;
|
import com.ruoyi.quartz.domain.SysJob;
|
||||||
import com.ruoyi.quartz.service.ISysJobService;
|
import com.ruoyi.quartz.service.ISysJobService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.quartz.domain.SysJobLog;
|
import com.ruoyi.quartz.domain.SysJobLog;
|
||||||
import com.ruoyi.quartz.service.ISysJobLogService;
|
import com.ruoyi.quartz.service.ISysJobLogService;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysLogininfor;
|
import com.ruoyi.system.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.service.ISysLogininforService;
|
import com.ruoyi.system.service.ISysLogininforService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysOperLog;
|
import com.ruoyi.system.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,10 +13,10 @@ import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.enums.OnlineStatus;
|
import com.ruoyi.common.enums.OnlineStatus;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysUserOnline;
|
import com.ruoyi.system.domain.SysUserOnline;
|
||||||
import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
|
import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysDictData;
|
import com.ruoyi.system.domain.SysDictData;
|
||||||
import com.ruoyi.system.service.ISysDictDataService;
|
import com.ruoyi.system.service.ISysDictDataService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysDictType;
|
import com.ruoyi.system.domain.SysDictType;
|
||||||
import com.ruoyi.system.service.ISysDictTypeService;
|
import com.ruoyi.system.service.ISysDictTypeService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
import com.ruoyi.system.service.ISysNoticeService;
|
import com.ruoyi.system.service.ISysNoticeService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -14,11 +14,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.ExcelUtil;
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.generator.domain.TableInfo;
|
import com.ruoyi.generator.domain.TableInfo;
|
||||||
import com.ruoyi.generator.service.IGenService;
|
import com.ruoyi.generator.service.IGenService;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ehcache name="ruoyi">
|
<ehcache name="ruoyi" updateCheck="false">
|
||||||
|
|
||||||
<!-- 磁盘缓存位置 -->
|
<!-- 磁盘缓存位置 -->
|
||||||
<diskStore path="java.io.tmpdir"/>
|
<diskStore path="java.io.tmpdir"/>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||||
<a class="btn btn-success" th:onclick="'javascript:$.operate.add(\''+${dict.dictType}+'\')'" shiro:hasPermission="system:dict:add">
|
<a class="btn btn-success" th:onclick="$.operate.add([[${dict.dictType}]])" shiro:hasPermission="system:dict:add">
|
||||||
<i class="fa fa-plus"></i> 新增
|
<i class="fa fa-plus"></i> 新增
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:dict:edit">
|
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:dict:edit">
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务异常
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class BusinessException extends RuntimeException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected final String message;
|
||||||
|
|
||||||
|
public BusinessException(String message)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.common.page;
|
||||||
|
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.common.page;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.common.config.Global;
|
import com.ruoyi.common.config.Global;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel相关处理
|
* Excel相关处理
|
||||||
|
@ -376,7 +377,7 @@ public class ExcelUtil<T>
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.error("导出Excel异常{}", e.getMessage());
|
log.error("导出Excel异常{}", e.getMessage());
|
||||||
return AjaxResult.error("导出Excel失败,请联系网站管理员!");
|
throw new BusinessException("导出Excel失败,请联系网站管理员!");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class OnlineSessionFilter extends AccessControlFilter
|
||||||
subject.logout();
|
subject.logout();
|
||||||
}
|
}
|
||||||
saveRequestAndRedirectToLogin(request, response);
|
saveRequestAndRedirectToLogin(request, response);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转到登录页
|
// 跳转到登录页
|
||||||
|
|
|
@ -8,11 +8,11 @@ import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.page.PageDomain;
|
||||||
|
import com.ruoyi.common.page.TableDataInfo;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import com.ruoyi.framework.web.page.PageDomain;
|
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
||||||
import com.ruoyi.framework.web.page.TableSupport;
|
import com.ruoyi.framework.web.page.TableSupport;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
|
||||||
|
@ -79,6 +79,17 @@ public class BaseController
|
||||||
return rows > 0 ? success() : error();
|
return rows > 0 ? success() : error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应返回结果
|
||||||
|
*
|
||||||
|
* @param result 结果
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
protected AjaxResult toAjax(boolean result)
|
||||||
|
{
|
||||||
|
return result ? success() : error();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回成功
|
* 返回成功
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.exception.DemoModeException;
|
import com.ruoyi.common.exception.DemoModeException;
|
||||||
import com.ruoyi.framework.util.PermissionUtils;
|
import com.ruoyi.framework.util.PermissionUtils;
|
||||||
|
|
||||||
|
@ -60,6 +61,16 @@ public class DefaultExceptionHandler
|
||||||
return AjaxResult.error("服务器错误,请联系管理员");
|
return AjaxResult.error("服务器错误,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(BusinessException.class)
|
||||||
|
public AjaxResult businessException(BusinessException e)
|
||||||
|
{
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 演示模式异常
|
* 演示模式异常
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.framework.web.page;
|
package com.ruoyi.framework.web.page;
|
||||||
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.page.PageDomain;
|
||||||
import com.ruoyi.framework.util.ServletUtils;
|
import com.ruoyi.framework.util.ServletUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
|
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
|
||||||
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
|
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
|
||||||
<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
|
<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
|
||||||
method_params = #{methodParams},
|
<if test="methodParams != null">method_params = #{methodParams},</if>
|
||||||
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
||||||
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
|
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
|
||||||
<if test="status !=null">status = #{status},</if>
|
<if test="status !=null">status = #{status},</if>
|
||||||
|
|
|
@ -91,4 +91,11 @@ public interface SysDeptMapper
|
||||||
* @return 部门列表
|
* @return 部门列表
|
||||||
*/
|
*/
|
||||||
public List<String> selectRoleDeptTree(Long roleId);
|
public List<String> selectRoleDeptTree(Long roleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改所在部门的父级部门状态
|
||||||
|
*
|
||||||
|
* @param dept 部门
|
||||||
|
*/
|
||||||
|
public void updateDeptStatus(SysDept dept);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,14 @@ public interface SysLogininforMapper
|
||||||
* 批量删除系统登录日志
|
* 批量删除系统登录日志
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的数据
|
* @param ids 需要删除的数据
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteLogininforByIds(String[] ids);
|
public int deleteLogininforByIds(String[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空系统登录日志
|
* 清空系统登录日志
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int cleanLogininfor();
|
public int cleanLogininfor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
|
@ -162,6 +163,11 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
public int insertDept(SysDept dept)
|
public int insertDept(SysDept dept)
|
||||||
{
|
{
|
||||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||||
|
// 如果父节点不为"正常"状态,则不允许新增子节点
|
||||||
|
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
||||||
|
{
|
||||||
|
throw new BusinessException("部门停用,不允许新增");
|
||||||
|
}
|
||||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||||
return deptMapper.insertDept(dept);
|
return deptMapper.insertDept(dept);
|
||||||
}
|
}
|
||||||
|
@ -178,11 +184,30 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||||
if (StringUtils.isNotNull(info))
|
if (StringUtils.isNotNull(info))
|
||||||
{
|
{
|
||||||
String ancestors = info.getAncestors() + "," + dept.getParentId();
|
String ancestors = info.getAncestors() + "," + info.getDeptId();
|
||||||
dept.setAncestors(ancestors);
|
dept.setAncestors(ancestors);
|
||||||
updateDeptChildren(dept.getDeptId(), ancestors);
|
updateDeptChildren(dept.getDeptId(), ancestors);
|
||||||
}
|
}
|
||||||
return deptMapper.updateDept(dept);
|
int result = deptMapper.updateDept(dept);
|
||||||
|
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
|
||||||
|
{
|
||||||
|
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||||
|
updateParentDeptStatus(dept);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改该部门的父级部门状态
|
||||||
|
*
|
||||||
|
* @param dept 当前部门
|
||||||
|
*/
|
||||||
|
private void updateParentDeptStatus(SysDept dept)
|
||||||
|
{
|
||||||
|
String updateBy = dept.getUpdateBy();
|
||||||
|
dept = deptMapper.selectDeptById(dept.getDeptId());
|
||||||
|
dept.setUpdateBy(updateBy);
|
||||||
|
deptMapper.updateDeptStatus(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysDictType;
|
import com.ruoyi.system.domain.SysDictType;
|
||||||
|
@ -79,7 +80,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDictTypeByIds(String ids) throws Exception
|
public int deleteDictTypeByIds(String ids) throws BusinessException
|
||||||
{
|
{
|
||||||
Long[] dictIds = Convert.toLongArray(ids);
|
Long[] dictIds = Convert.toLongArray(ids);
|
||||||
for (Long dictId : dictIds)
|
for (Long dictId : dictIds)
|
||||||
|
@ -87,7 +88,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
SysDictType dictType = selectDictTypeById(dictId);
|
SysDictType dictType = selectDictTypeById(dictId);
|
||||||
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
|
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
|
||||||
{
|
{
|
||||||
throw new Exception(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
throw new BusinessException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
@ -92,7 +93,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePostByIds(String ids) throws Exception
|
public int deletePostByIds(String ids) throws BusinessException
|
||||||
{
|
{
|
||||||
Long[] postIds = Convert.toLongArray(ids);
|
Long[] postIds = Convert.toLongArray(ids);
|
||||||
for (Long postId : postIds)
|
for (Long postId : postIds)
|
||||||
|
@ -100,7 +101,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
SysPost post = selectPostById(postId);
|
SysPost post = selectPostById(postId);
|
||||||
if (countUserPostById(postId) > 0)
|
if (countUserPostById(postId) > 0)
|
||||||
{
|
{
|
||||||
throw new Exception(String.format("%1$s已分配,不能删除", post.getPostName()));
|
throw new BusinessException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return postMapper.deletePostByIds(postIds);
|
return postMapper.deletePostByIds(postIds);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
|
@ -141,7 +142,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteRoleByIds(String ids) throws Exception
|
public int deleteRoleByIds(String ids) throws BusinessException
|
||||||
{
|
{
|
||||||
Long[] roleIds = Convert.toLongArray(ids);
|
Long[] roleIds = Convert.toLongArray(ids);
|
||||||
for (Long roleId : roleIds)
|
for (Long roleId : roleIds)
|
||||||
|
@ -149,7 +150,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
SysRole role = selectRoleById(roleId);
|
SysRole role = selectRoleById(roleId);
|
||||||
if (countUserRoleByRoleId(roleId) > 0)
|
if (countUserRoleByRoleId(roleId) > 0)
|
||||||
{
|
{
|
||||||
throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
throw new BusinessException(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return roleMapper.deleteRoleByIds(roleIds);
|
return roleMapper.deleteRoleByIds(roleIds);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import com.ruoyi.common.support.Convert;
|
import com.ruoyi.common.support.Convert;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
@ -128,14 +129,14 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteUserByIds(String ids) throws Exception
|
public int deleteUserByIds(String ids) throws BusinessException
|
||||||
{
|
{
|
||||||
Long[] userIds = Convert.toLongArray(ids);
|
Long[] userIds = Convert.toLongArray(ids);
|
||||||
for (Long userId : userIds)
|
for (Long userId : userIds)
|
||||||
{
|
{
|
||||||
if (SysUser.isAdmin(userId))
|
if (SysUser.isAdmin(userId))
|
||||||
{
|
{
|
||||||
throw new Exception("不允许删除超级管理员用户");
|
throw new BusinessException("不允许删除超级管理员用户");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return userMapper.deleteUserByIds(userIds);
|
return userMapper.deleteUserByIds(userIds);
|
||||||
|
|
|
@ -137,4 +137,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
update sys_dept set del_flag = '2' where dept_id = #{deptId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateDeptStatus" parameterType="SysDept">
|
||||||
|
update sys_dept
|
||||||
|
<set>
|
||||||
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where dept_id in (${ancestors})
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -588,7 +588,7 @@ create table sys_job_log (
|
||||||
job_name varchar(64) not null comment '任务名称',
|
job_name varchar(64) not null comment '任务名称',
|
||||||
job_group varchar(64) not null comment '任务组名',
|
job_group varchar(64) not null comment '任务组名',
|
||||||
method_name varchar(500) comment '任务方法',
|
method_name varchar(500) comment '任务方法',
|
||||||
method_params varchar(200) default '' comment '方法参数',
|
method_params varchar(50) default null comment '方法参数',
|
||||||
job_message varchar(500) comment '日志信息',
|
job_message varchar(500) comment '日志信息',
|
||||||
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
status char(1) default '0' comment '执行状态(0正常 1失败)',
|
||||||
exception_info varchar(2000) default '' comment '异常信息',
|
exception_info varchar(2000) default '' comment '异常信息',
|
||||||
|
|
Loading…
Reference in New Issue