Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev
Conflicts: pom.xml ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml ruoyi-ui/src/layout/components/Settings/index.vue ruoyi-ui/src/plugins/download.js ruoyi-ui/src/store/modules/permission.js ruoyi-ui/src/views/index.vue ruoyi-ui/src/views/monitor/server/index.vue ruoyi-ui/src/views/system/role/index.vue ry.bat
This commit is contained in:
commit
42a3117e2a
@ -24,6 +24,6 @@ public @interface RepeatSubmit {
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
String message() default "不允许重复提交,请稍后再试";
|
||||
String message() default "不允许重复提交,请稍候再试";
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Threads {
|
||||
* 停止线程池
|
||||
* 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务.
|
||||
* 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数.
|
||||
* 如果仍人超時,則強制退出.
|
||||
* 如果仍然超時,則強制退出.
|
||||
* 另对在shutdown时线程本身被调用中断做了处理.
|
||||
*/
|
||||
public static void shutdownAndAwaitTermination(ExecutorService pool) {
|
||||
|
@ -22,9 +22,6 @@ public class FileUtils extends FileUtil {
|
||||
* @return
|
||||
*/
|
||||
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
|
||||
|
||||
String percentEncodedFileName = percentEncode(realFileName);
|
||||
|
||||
StringBuilder contentDispositionValue = new StringBuilder();
|
||||
@ -35,6 +32,8 @@ public class FileUtils extends FileUtil {
|
||||
.append("utf-8''")
|
||||
.append(percentEncodedFileName);
|
||||
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
|
||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||
response.setHeader("download-filename", percentEncodedFileName);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole> {
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
List<Integer> selectRoleListByUserId(Long userId);
|
||||
List<Long> selectRoleListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
|
@ -55,7 +55,7 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
List<Integer> selectRoleListByUserId(Long userId);
|
||||
List<Long> selectRoleListByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
|
@ -117,7 +117,7 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<Integer> selectRoleListByUserId(Long userId) {
|
||||
public List<Long> selectRoleListByUserId(Long userId) {
|
||||
return baseMapper.selectRoleListByUserId(userId);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ export default {
|
||||
this.sideTheme = val;
|
||||
},
|
||||
saveSetting() {
|
||||
this.$modal.loading("正在保存到本地,请稍后...");
|
||||
this.$modal.loading("正在保存到本地,请稍候...");
|
||||
this.$cache.local.set(
|
||||
"layout-setting",
|
||||
`{
|
||||
@ -178,7 +178,7 @@ export default {
|
||||
setTimeout(this.$modal.closeLoading(), 1000)
|
||||
},
|
||||
resetSetting() {
|
||||
this.$modal.loading("正在清除设置缓存并刷新,请稍后...");
|
||||
this.$modal.loading("正在清除设置缓存并刷新,请稍候...");
|
||||
this.$cache.local.remove("layout-setting")
|
||||
setTimeout("window.location.reload()", 1000)
|
||||
}
|
||||
|
60
ruoyi-ui/src/plugins/auth.js
Normal file
60
ruoyi-ui/src/plugins/auth.js
Normal file
@ -0,0 +1,60 @@
|
||||
import store from '@/store'
|
||||
|
||||
function authPermission(permission) {
|
||||
const all_permission = "*:*:*";
|
||||
const permissions = store.getters && store.getters.permissions
|
||||
if (permission && permission.length > 0) {
|
||||
return permissions.some(v => {
|
||||
return all_permission === v || v === permission
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function authRole(role) {
|
||||
const super_admin = "admin";
|
||||
const roles = store.getters && store.getters.roles
|
||||
if (role && role.length > 0) {
|
||||
return roles.some(v => {
|
||||
return super_admin === v || v === role
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
// 验证用户是否具备某权限
|
||||
hasPermi(permission) {
|
||||
return authPermission(permission);
|
||||
},
|
||||
// 验证用户是否含有指定权限,只需包含其中一个
|
||||
hasPermiOr(permissions) {
|
||||
return permissions.some(item => {
|
||||
return authPermission(item)
|
||||
})
|
||||
},
|
||||
// 验证用户是否含有指定权限,必须全部拥有
|
||||
hasPermiAnd(permissions) {
|
||||
return permissions.every(item => {
|
||||
return authPermission(item)
|
||||
})
|
||||
},
|
||||
// 验证用户是否具备某角色
|
||||
hasRole(role) {
|
||||
return authRole(role);
|
||||
},
|
||||
// 验证用户是否含有指定角色,只需包含其中一个
|
||||
hasRoleOr(roles) {
|
||||
return roles.some(item => {
|
||||
return authRole(item)
|
||||
})
|
||||
},
|
||||
// 验证用户是否含有指定角色,必须全部拥有
|
||||
hasRoleAnd(roles) {
|
||||
return roles.every(item => {
|
||||
return authRole(item)
|
||||
})
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { saveAs } from 'file-saver'
|
||||
import axios from 'axios'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
const baseURL = process.env.VUE_APP_BASE_API
|
||||
|
||||
@ -35,9 +36,14 @@ export default {
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then(res => {
|
||||
}).then(async (res) => {
|
||||
const isLogin = await this.blobValidate(res.data);
|
||||
if (isLogin) {
|
||||
const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||
} else {
|
||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
||||
}
|
||||
})
|
||||
},
|
||||
oss(ossId) {
|
||||
@ -47,9 +53,14 @@ export default {
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then(res => {
|
||||
}).then(async (res) => {
|
||||
const isLogin = await this.blobValidate(res.data);
|
||||
if (isLogin) {
|
||||
const blob = new Blob([res.data], { type: 'application/octet-stream' })
|
||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||
} else {
|
||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
||||
}
|
||||
})
|
||||
},
|
||||
zip(url, name) {
|
||||
@ -59,13 +70,27 @@ export default {
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then(res => {
|
||||
}).then(async (res) => {
|
||||
const isLogin = await this.blobValidate(res.data);
|
||||
if (isLogin) {
|
||||
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||
this.saveAs(blob, name)
|
||||
} else {
|
||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
||||
}
|
||||
})
|
||||
},
|
||||
saveAs(text, name, opts) {
|
||||
saveAs(text, name, opts);
|
||||
},
|
||||
async blobValidate(data) {
|
||||
try {
|
||||
const text = await data.text();
|
||||
JSON.parse(text);
|
||||
return false;
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
import auth from './auth'
|
||||
import cache from './cache'
|
||||
import modal from './modal'
|
||||
import download from './download'
|
||||
|
||||
export default {
|
||||
install(Vue) {
|
||||
// 认证对象
|
||||
Vue.prototype.$auth = auth
|
||||
// 缓存对象
|
||||
Vue.prototype.$cache = cache
|
||||
// 模态框对象
|
||||
|
@ -86,7 +86,7 @@ function filterChildren(childrenMap, lastRouter = false) {
|
||||
var children = []
|
||||
childrenMap.forEach((el, index) => {
|
||||
if (el.children && el.children.length) {
|
||||
if (el.component === 'ParentView') {
|
||||
if (el.component === 'ParentView' && !lastRouter) {
|
||||
el.children.forEach(c => {
|
||||
c.path = el.path + '/' + c.path
|
||||
if (c.children && c.children.length) {
|
||||
@ -106,8 +106,13 @@ function filterChildren(childrenMap, lastRouter = false) {
|
||||
return children
|
||||
}
|
||||
|
||||
export const loadView = (view) => { // 路由懒加载
|
||||
export const loadView = (view) => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
return (resolve) => require([`@/views/${view}`], resolve)
|
||||
} else {
|
||||
// 使用 import 实现生产环境的路由懒加载
|
||||
return () => import(`@/views/${view}`)
|
||||
}
|
||||
}
|
||||
|
||||
export default permission
|
||||
|
@ -478,7 +478,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "Index",
|
||||
data() {
|
||||
|
2
ruoyi-ui/src/views/monitor/cache/index.vue
vendored
2
ruoyi-ui/src/views/monitor/cache/index.vue
vendored
@ -139,7 +139,7 @@ export default {
|
||||
},
|
||||
// 打开加载层
|
||||
openLoading() {
|
||||
this.$modal.loading("正在加载缓存监控数据,请稍后!");
|
||||
this.$modal.loading("正在加载缓存监控数据,请稍候!");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -200,7 +200,7 @@
|
||||
ref="menu"
|
||||
node-key="id"
|
||||
:check-strictly="!form.menuCheckStrictly"
|
||||
empty-text="加载中,请稍后"
|
||||
empty-text="加载中,请稍候"
|
||||
:props="defaultProps"
|
||||
></el-tree>
|
||||
</el-form-item>
|
||||
@ -245,7 +245,7 @@
|
||||
ref="dept"
|
||||
node-key="id"
|
||||
:check-strictly="!form.deptCheckStrictly"
|
||||
empty-text="加载中,请稍后"
|
||||
empty-text="加载中,请稍候"
|
||||
:props="defaultProps"
|
||||
></el-tree>
|
||||
</el-form-item>
|
||||
|
26
ry.bat
26
ry.bat
@ -1,21 +1,21 @@
|
||||
@echo off
|
||||
|
||||
rem jar平级目录
|
||||
rem jarƽ<EFBFBD><EFBFBD>Ŀ¼
|
||||
set AppName=ruoyi-admin.jar
|
||||
|
||||
rem JVM参数
|
||||
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||
rem JVM<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||
|
||||
|
||||
ECHO.
|
||||
ECHO. [1] 启动%AppName%
|
||||
ECHO. [2] 关闭%AppName%
|
||||
ECHO. [3] 重启%AppName%
|
||||
ECHO. [4] 启动状态 %AppName%
|
||||
ECHO. [5] 退 出
|
||||
ECHO. [1] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>%AppName%
|
||||
ECHO. [2] <EFBFBD>ر<EFBFBD>%AppName%
|
||||
ECHO. [3] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>%AppName%
|
||||
ECHO. [4] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ %AppName%
|
||||
ECHO. [5] <EFBFBD><EFBFBD> <20><>
|
||||
ECHO.
|
||||
|
||||
ECHO.请输入选择项目的序号:
|
||||
ECHO.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
set /p ID=
|
||||
IF "%id%"=="1" GOTO start
|
||||
IF "%id%"=="2" GOTO stop
|
||||
@ -33,13 +33,13 @@ PAUSE
|
||||
PAUSE
|
||||
)
|
||||
|
||||
start javaw -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||
start javaw %JAVA_OPTS% -jar %AppName%
|
||||
|
||||
echo starting……
|
||||
echo starting<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
echo Start %AppName% success...
|
||||
goto:eof
|
||||
|
||||
rem 函数stop通过jps命令查找pid并结束进程
|
||||
rem <EFBFBD><EFBFBD><EFBFBD><EFBFBD>stopͨ<EFBFBD><EFBFBD>jps<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pid<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
:stop
|
||||
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
|
||||
set pid=%%a
|
||||
@ -48,7 +48,7 @@ rem
|
||||
if not defined pid (echo process %AppName% does not exists) else (
|
||||
echo prepare to kill %image_name%
|
||||
echo start kill %pid% ...
|
||||
rem 根据进程ID,kill进程
|
||||
rem <EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>ID<EFBFBD><EFBFBD>kill<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
taskkill /f /pid %pid%
|
||||
)
|
||||
goto:eof
|
||||
|
10
ry.sh
10
ry.sh
@ -1,13 +1,9 @@
|
||||
#!/bin/sh
|
||||
# author ruoyi
|
||||
# ./ry.sh start 启动
|
||||
# ./ry.sh stop 停止
|
||||
# ./ry.sh restart 重启
|
||||
# ./ry.sh status 状态
|
||||
# ./ry.sh start 启动 stop 停止 restart 重启 status 状态
|
||||
AppName=ruoyi-admin.jar
|
||||
|
||||
# JVM参数
|
||||
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
|
||||
APP_HOME=`pwd`
|
||||
LOG_PATH=$APP_HOME/logs/$AppName.log
|
||||
|
||||
@ -30,7 +26,7 @@ function start()
|
||||
if [ x"$PID" != x"" ]; then
|
||||
echo "$AppName is running..."
|
||||
else
|
||||
nohup java -jar $JVM_OPTS target/$AppName > /dev/null 2>&1 &
|
||||
nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 &
|
||||
echo "Start $AppName success..."
|
||||
fi
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user