增加“文件管理”模块,整合MinIO
This commit is contained in:
parent
36854b8ea8
commit
c646c95c7b
@ -1,13 +1,38 @@
|
||||
import axios from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {ElLoading, ElMessage} from 'element-plus'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { blobValidate } from '@/utils/ruoyi'
|
||||
import { globalHeaders } from '@/utils/request';
|
||||
|
||||
const baseURL = import.meta.env.VITE_APP_BASE_API
|
||||
|
||||
export default {
|
||||
async oss(ossId) {
|
||||
const url = baseURL + '/resource/oss/download/' + ossId;
|
||||
let downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
try {
|
||||
const res = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: globalHeaders()
|
||||
});
|
||||
const isBlob = blobValidate(res.data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data], { type: 'application/octet-stream' });
|
||||
saveAs(blob, decodeURIComponent(res.headers['download-filename']));
|
||||
} else {
|
||||
this.printErrMsg(res.data);
|
||||
}
|
||||
downloadLoadingInstance.close();
|
||||
} catch (r) {
|
||||
console.error(r);
|
||||
ElMessage.error('下载文件出现错误,请联系管理员!');
|
||||
downloadLoadingInstance.close();
|
||||
}
|
||||
},
|
||||
name(name, isDelete = true) {
|
||||
var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete
|
||||
axios({
|
||||
|
@ -129,6 +129,20 @@ export const dynamicRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/system/oss-config',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['system:oss:list'],
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/system/oss/config.vue'),
|
||||
name: 'OssConfig',
|
||||
meta: { title: '配置管理', activeMenu: '/system/oss', icon: '' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/tool/gen-edit',
|
||||
component: Layout,
|
||||
@ -142,6 +156,20 @@ export const dynamicRoutes = [
|
||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen', icon: '' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/check/one-person',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
permissions: ['check:cadre:list'],
|
||||
children: [
|
||||
{
|
||||
path: 'index/:cadreId(\\d+)',
|
||||
component: () => import('@/views/check/oneperson/onePersonAnalysis.vue'),
|
||||
name: 'onePersonAnalysis',
|
||||
meta: { title: '个人画像', activeMenu: '/check/oneperson', icon: '' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -10,8 +10,16 @@ import useUserStore from '@/store/modules/user'
|
||||
let downloadLoadingInstance;
|
||||
// 是否显示重新登录
|
||||
export let isRelogin = { show: false };
|
||||
export const globalHeaders = () => {
|
||||
return {
|
||||
Authorization: 'Bearer ' + getToken(),
|
||||
clientid: import.meta.env.VITE_APP_CLIENT_ID
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
|
@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">RuoYi-Flex多租户管理系统</h3>
|
||||
<h3 class="title">RuoYi-Flex管理系统</h3>
|
||||
<el-form-item prop="tenantId">
|
||||
<el-input
|
||||
v-model="loginForm.tenantId"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="租户编号"
|
||||
v-show="false"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="company" class="el-input__icon input-icon"/>
|
||||
</el-input>
|
||||
|
25
pom.xml
25
pom.xml
@ -50,6 +50,8 @@
|
||||
<alibaba-ttl.version>2.14.3</alibaba-ttl.version>
|
||||
<spring-boot-admin.version>3.1.6</spring-boot-admin.version>
|
||||
<powerjob.version>4.3.6</powerjob.version>
|
||||
<!-- OSS 配置 -->
|
||||
<aws-java-sdk-s3.version>1.12.540</aws-java-sdk-s3.version>
|
||||
|
||||
<!-- 插件版本 -->
|
||||
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
|
||||
@ -197,13 +199,6 @@
|
||||
<version>${oshi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- io常用工具类 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-io</groupId>-->
|
||||
<!-- <artifactId>commons-io</artifactId>-->
|
||||
<!-- <version>${commons.io.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
@ -329,6 +324,13 @@
|
||||
<version>${lock4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- OSS 配置 -->
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-s3</artifactId>
|
||||
<version>${aws-java-sdk-s3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--Annotation Processor-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -366,14 +368,6 @@
|
||||
<version>${powerjob.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 定时任务-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-quartz</artifactId>-->
|
||||
<!-- <version>${revision}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- PowerJob定时任务处理器-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
@ -395,6 +389,7 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- demo模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
|
@ -18,6 +18,7 @@
|
||||
<module>ruoyi-common-json</module>
|
||||
<module>ruoyi-common-log</module>
|
||||
<module>ruoyi-common-orm</module>
|
||||
<module>ruoyi-common-oss</module>
|
||||
<module>ruoyi-common-ratelimiter</module>
|
||||
<module>ruoyi-common-redis</module>
|
||||
<module>ruoyi-common-security</module>
|
||||
|
@ -61,6 +61,13 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- oss对象存储服务模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 限流公共服务 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
|
@ -50,6 +50,11 @@
|
||||
<artifactId>ruoyi-common-orm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-oss</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-redis</artifactId>
|
||||
|
@ -117,7 +117,7 @@ public class SysConfigController extends BaseController {
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updateByKey")
|
||||
public R<Void> updateByKey(@RequestBody SysConfigBo config) {
|
||||
boolean updated = configService.updateConfig(config);
|
||||
boolean updated = configService.updateConfigByKey(config);
|
||||
if (!updated) {
|
||||
R.fail("修改参数'" + config.getConfigName() + "'失败!");
|
||||
}
|
||||
|
@ -71,6 +71,14 @@ public interface ISysConfigService extends IBaseService<SysConfig>
|
||||
*/
|
||||
boolean updateConfig(SysConfigBo configBo);
|
||||
|
||||
/**
|
||||
* 根据Key修改参数配置
|
||||
*
|
||||
* @param configBo 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean updateConfigByKey(SysConfigBo configBo);
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
|
@ -166,6 +166,23 @@ public class SysConfigServiceImpl extends BaseServiceImpl<SysConfigMapper, SysCo
|
||||
return this.updateById(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Key修改参数配置
|
||||
*
|
||||
* @param configBo 参数配置信息
|
||||
* @return true 更新成功,false 更新失败。
|
||||
*/
|
||||
@CacheEvict(cacheNames = CacheNames.SYS_CONFIG, key = "#configBo.configKey")
|
||||
@Override
|
||||
public boolean updateConfigByKey(SysConfigBo configBo) {
|
||||
SysConfig config = MapstructUtils.convert(configBo, SysConfig.class);
|
||||
QueryWrapper queryWrapper=query().where(SYS_CONFIG.CONFIG_KEY.eq(config.getConfigKey()));
|
||||
SysConfig sysConfig = this.getOne(queryWrapper);
|
||||
sysConfig.setConfigValue(config.getConfigValue());
|
||||
queryWrapper.and(SYS_CONFIG.CONFIG_VALUE.eq(config.getConfigValue()));
|
||||
return this.update(sysConfig,queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
|
@ -26,6 +26,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.annotation.DataScope;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.core.text.Convert;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
@ -94,7 +95,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
|
||||
*/
|
||||
@Override
|
||||
public List<SysDeptVo> selectDeptList(SysDeptBo deptBo) {
|
||||
QueryWrapper queryWrapper = dataScopeService.addCondition(buildQueryWrapper(deptBo));
|
||||
QueryWrapper queryWrapper = dataScopeService.addCondition(buildQueryWrapper(deptBo));//数据权限条件过滤
|
||||
return this.listAs(queryWrapper, SysDeptVo.class);
|
||||
}
|
||||
|
||||
|
@ -710,4 +710,6 @@ insert into sys_menu values('118', '文件管理', '1', '10', 'oss',
|
||||
ALTER TABLE `sys_user`
|
||||
CHANGE COLUMN `avatar` `avatar` BIGINT NULL DEFAULT NULL COMMENT '头像地址' AFTER `gender`;
|
||||
|
||||
|
||||
-- 表sys_config 的数据:
|
||||
INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES
|
||||
(20, 'OSS预览列表资源开关', 'sys.oss.previewListResource', 'true', 'Y', 1, '2023-09-30 21:55:15', 1, '2023-12-01 22:32:10', 'true:开启, false:关闭');
|
||||
|
Loading…
Reference in New Issue
Block a user