mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
Optimized RoleManagement, GroupManagement and UserManagement
This commit is contained in:
@@ -22,6 +22,7 @@ public class ResponseCode {
|
|||||||
public static final int DATABASE_DELETE_ERROR = 20034;
|
public static final int DATABASE_DELETE_ERROR = 20034;
|
||||||
public static final int DATABASE_TIMEOUT_ERROR = 20035;
|
public static final int DATABASE_TIMEOUT_ERROR = 20035;
|
||||||
public static final int DATABASE_CONNECT_ERROR = 20036;
|
public static final int DATABASE_CONNECT_ERROR = 20036;
|
||||||
|
public static final int DATABASE_DATA_TO_LONG = 20037;
|
||||||
|
|
||||||
public static final int UNAUTHORIZED = 30010;
|
public static final int UNAUTHORIZED = 30010;
|
||||||
public static final int ACCESS_DENIED = 30030;
|
public static final int ACCESS_DENIED = 30030;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.cfive.pinnacle.handler;
|
|||||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
@@ -28,6 +29,9 @@ public class CustomExceptionHandler {
|
|||||||
if (e instanceof DisabledException) {
|
if (e instanceof DisabledException) {
|
||||||
return ResponseResult.build(ResponseCode.USER_DISABLE, e.getMessage(), null);
|
return ResponseResult.build(ResponseCode.USER_DISABLE, e.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
if (e instanceof DataIntegrityViolationException) {
|
||||||
|
return ResponseResult.build(ResponseCode.DATABASE_DATA_TO_LONG, e.getMessage(), null);
|
||||||
|
}
|
||||||
|
|
||||||
log.debug(e.getMessage(), e);
|
log.debug(e.getMessage(), e);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const DATABASE_UPDATE_ERROR = 20033
|
|||||||
const DATABASE_DELETE_ERROR = 20034
|
const DATABASE_DELETE_ERROR = 20034
|
||||||
const DATABASE_TIMEOUT_ERROR = 20035
|
const DATABASE_TIMEOUT_ERROR = 20035
|
||||||
const DATABASE_CONNECT_ERROR = 20036
|
const DATABASE_CONNECT_ERROR = 20036
|
||||||
|
const DATABASE_DATA_TO_LONG = 20037
|
||||||
|
|
||||||
const UNAUTHORIZED = 30010
|
const UNAUTHORIZED = 30010
|
||||||
const ACCESS_DENIED = 30030
|
const ACCESS_DENIED = 30030
|
||||||
@@ -67,6 +68,7 @@ export {
|
|||||||
DATABASE_DELETE_ERROR,
|
DATABASE_DELETE_ERROR,
|
||||||
DATABASE_TIMEOUT_ERROR,
|
DATABASE_TIMEOUT_ERROR,
|
||||||
DATABASE_CONNECT_ERROR,
|
DATABASE_CONNECT_ERROR,
|
||||||
|
DATABASE_DATA_TO_LONG,
|
||||||
UNAUTHORIZED,
|
UNAUTHORIZED,
|
||||||
ACCESS_DENIED,
|
ACCESS_DENIED,
|
||||||
USER_DISABLE,
|
USER_DISABLE,
|
||||||
|
|||||||
@@ -37,7 +37,12 @@
|
|||||||
:model="groupForm"
|
:model="groupForm"
|
||||||
>
|
>
|
||||||
<el-form-item label="用户组名称" prop="inputGroupName">
|
<el-form-item label="用户组名称" prop="inputGroupName">
|
||||||
<el-input autocomplete="off" v-model="groupForm.inputGroupName" />
|
<el-input
|
||||||
|
autocomplete="off"
|
||||||
|
v-model="groupForm.inputGroupName"
|
||||||
|
maxlength="30"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户组角色">
|
<el-form-item label="用户组角色">
|
||||||
<el-select v-model="groupForm.selectedRoles" multiple style="width: 100%">
|
<el-select v-model="groupForm.selectedRoles" multiple style="width: 100%">
|
||||||
|
|||||||
@@ -38,7 +38,12 @@
|
|||||||
:model="roleForm"
|
:model="roleForm"
|
||||||
>
|
>
|
||||||
<el-form-item label="角色名称" prop="inputRoleName">
|
<el-form-item label="角色名称" prop="inputRoleName">
|
||||||
<el-input autocomplete="off" v-model="roleForm.inputRoleName" />
|
<el-input
|
||||||
|
autocomplete="off"
|
||||||
|
v-model="roleForm.inputRoleName"
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色权限">
|
<el-form-item label="角色权限">
|
||||||
<el-tree
|
<el-tree
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
v-model="userForm.inputUsername"
|
v-model="userForm.inputUsername"
|
||||||
placeholder="请输入用户名"
|
placeholder="请输入用户名"
|
||||||
|
maxlength="20"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码" prop="inputPassword" :required="isAddNew">
|
<el-form-item label="密码" prop="inputPassword" :required="isAddNew">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { clearLocalStorage, getToken } from '@/utils/common'
|
|||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import {
|
import {
|
||||||
ACCESS_DENIED,
|
ACCESS_DENIED,
|
||||||
|
DATABASE_DATA_TO_LONG,
|
||||||
TOKEN_HAS_EXPIRED,
|
TOKEN_HAS_EXPIRED,
|
||||||
TOKEN_IS_ILLEGAL,
|
TOKEN_IS_ILLEGAL,
|
||||||
UNAUTHORIZED
|
UNAUTHORIZED
|
||||||
@@ -49,6 +50,12 @@ service.interceptors.response.use(
|
|||||||
message: '<strong>暂无权限操作</strong>'
|
message: '<strong>暂无权限操作</strong>'
|
||||||
})
|
})
|
||||||
return await Promise.reject(response?.data)
|
return await Promise.reject(response?.data)
|
||||||
|
case DATABASE_DATA_TO_LONG:
|
||||||
|
ElMessage.error({
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
message: '<strong>数据过长</strong>'
|
||||||
|
})
|
||||||
|
return await Promise.reject(response?.data)
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user