refactor(cutejava-framework):重构项目基础框架
- 优化了多个类的代码结构和注释 - 添加了新的工具类和配置类 - 调整了部分功能实现方式 - 统一了代码格式和命名规范 - 删除了七牛云存储 - 新增了Minio存储
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
"author": "Odboy",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"dev-win": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"dev-win1": "vue-cli-service serve",
|
||||
"dev-win2": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"dev-linux": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/ossStorage/uploadFile',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/ossStorage/removeFileByIds',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, del }
|
||||
@@ -14,8 +14,8 @@ const getters = {
|
||||
imagesUploadApi: state => state.api.imagesUploadApi,
|
||||
baseApi: state => state.api.baseApi,
|
||||
fileUploadApi: state => state.api.fileUploadApi,
|
||||
ossUploadApi: state => state.api.ossUploadApi,
|
||||
updateAvatarApi: state => state.api.updateAvatarApi,
|
||||
qiNiuUploadApi: state => state.api.qiNiuUploadApi,
|
||||
druidSqlApi: state => state.api.druidSqlApi,
|
||||
swaggerApi: state => state.api.swaggerApi,
|
||||
websocketApi: state => state.api.websocketApi,
|
||||
|
||||
@@ -6,8 +6,6 @@ const api = {
|
||||
imagesUploadApi: baseUrl + '/api/localStorage/uploadPicture',
|
||||
// 修改头像
|
||||
updateAvatarApi: baseUrl + '/api/user/modifyUserAvatar',
|
||||
// 上传文件到七牛云
|
||||
qiNiuUploadApi: baseUrl + '/api/qiNiuContent/uploadFile',
|
||||
// Sql 监控
|
||||
druidSqlApi: baseUrl + '/druid/index.html',
|
||||
// websocket
|
||||
@@ -16,6 +14,8 @@ const api = {
|
||||
swaggerApi: baseUrl + '/doc.html',
|
||||
// 文件上传
|
||||
fileUploadApi: baseUrl + '/api/localStorage/uploadFile',
|
||||
// oss上传
|
||||
ossUploadApi: baseUrl + '/api/ossStorage/uploadFile',
|
||||
// baseUrl,
|
||||
baseApi: baseUrl
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeName" style="padding-left: 8px;" @tab-click="tabClick">
|
||||
<el-tab-pane label="本地存储" name="first">
|
||||
<el-tab-pane label="本地存储" name="local">
|
||||
<Local ref="local" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="七牛云存储" name="second">
|
||||
<QiNiu ref="qiNiu" />
|
||||
<el-tab-pane label="OSS存储" name="oss">
|
||||
<Oss ref="oss" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QiNiu from './qiniu/index.vue'
|
||||
import Local from './local/index.vue'
|
||||
import Oss from './oss/index.vue'
|
||||
export default {
|
||||
name: 'Storage',
|
||||
components: { QiNiu, Local },
|
||||
components: { Local, Oss },
|
||||
data() {
|
||||
return {
|
||||
activeName: 'first'
|
||||
activeName: 'local'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
tabClick(name) {
|
||||
if (this.activeName === 'first') {
|
||||
if (this.activeName === 'local') {
|
||||
this.$refs.local.crud.toQuery()
|
||||
} else {
|
||||
this.$refs.qiNiu.crud.toQuery()
|
||||
this.$refs.oss.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<div class="app-container" style="padding: 8px;">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="small"
|
||||
placeholder="输入内容模糊搜索"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
<!-- 新增 -->
|
||||
<el-button
|
||||
slot="left"
|
||||
v-permission="['admin','storage:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-upload"
|
||||
@click="crud.toAdd"
|
||||
>上传
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
</div>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.add ? '文件上传' : '编辑文件'"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" size="small" label-width="80px">
|
||||
<el-form-item label="文件名">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<!-- 上传文件 -->
|
||||
<el-form-item v-if="crud.status.add" label="上传">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
:before-upload="beforeUpload"
|
||||
:auto-upload="false"
|
||||
:headers="headers"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:action="ossUploadApi + '?name=' + form.name"
|
||||
>
|
||||
<div class="my-upload"><i class="el-icon-upload" /> 添加文件</div>
|
||||
<div slot="tip" class="el-upload__tip">可上传任意格式文件,且不超过100M</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button v-if="crud.status.add" :loading="loading" type="primary" @click="upload">确认</el-button>
|
||||
<el-button v-else :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="serviceType" label="服务提供商" />
|
||||
<el-table-column prop="bucketName" label="存储桶名称" />
|
||||
<el-table-column prop="fileName" label="文件名称" />
|
||||
<el-table-column prop="fileSizeDesc" label="文件大小" />
|
||||
<el-table-column prop="fileMime" label="文件类型" />
|
||||
<el-table-column prop="fileMd5" label="文件Md5" width="260" />
|
||||
<el-table-column prop="createBy" label="操作人" />
|
||||
<el-table-column prop="createTime" label="创建日期" />
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button id="ossFileUrl" type="text" @click="handleCopyFileUrl(scope.row.fileUrl)">复制链接</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import crudFile from '@/api/system/ossStorage'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
import Clipboard from 'clipboard'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
const defaultForm = { id: null, name: '' }
|
||||
export default {
|
||||
components: { pagination, crudOperation, rrOperation, DateRangePicker },
|
||||
cruds() {
|
||||
return CRUD({ title: '文件', url: 'api/ossStorage', crudMethod: { ...crudFile }})
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
delAllLoading: false,
|
||||
loading: false,
|
||||
headers: { 'Authorization': getToken() },
|
||||
permission: {
|
||||
edit: ['admin', 'storage:edit'],
|
||||
del: ['admin', 'storage:del']
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi',
|
||||
'ossUploadApi'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
this.crud.optShow.add = false
|
||||
},
|
||||
methods: {
|
||||
// 上传文件
|
||||
upload() {
|
||||
this.$refs.upload.submit()
|
||||
},
|
||||
beforeUpload(file) {
|
||||
let isLt2M = true
|
||||
isLt2M = file.size / 1024 / 1024 < 100
|
||||
if (!isLt2M) {
|
||||
this.loading = false
|
||||
this.$message.error('上传文件大小不能超过 100MB')
|
||||
}
|
||||
this.form.name = file.name
|
||||
return isLt2M
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.crud.notify('上传成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$refs.upload.clearFiles()
|
||||
this.crud.status.add = CRUD.STATUS.NORMAL
|
||||
this.crud.resetForm()
|
||||
this.crud.toQuery()
|
||||
},
|
||||
// 监听上传失败
|
||||
handleError(e, file, fileList) {
|
||||
const msg = JSON.parse(e.message)
|
||||
this.$notify({
|
||||
title: msg.message,
|
||||
type: 'error',
|
||||
duration: 2500
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
handleCopyFileUrl(fileUrl) {
|
||||
const clipboard = new Clipboard('#ossFileUrl', {
|
||||
text(trigger) {
|
||||
return fileUrl
|
||||
}
|
||||
})
|
||||
// 复制成功
|
||||
clipboard.on('success', (e) => {
|
||||
Message.success('复制成功')
|
||||
clipboard.destroy()
|
||||
})
|
||||
// //复制失败
|
||||
clipboard.on('error', (e) => {
|
||||
Message.error('复制失败')
|
||||
clipboard.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .el-image__error, .el-image__placeholder {
|
||||
background: none;
|
||||
}
|
||||
|
||||
::v-deep .el-image-viewer__wrapper {
|
||||
top: 55px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,98 +0,0 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="dialog" :close-on-click-modal="false" title="七牛云配置" append-to-body width="580px">
|
||||
<el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="110px">
|
||||
<el-form-item label="Access Key" prop="accessKey">
|
||||
<el-input v-model="form.accessKey" style="width: 95%" placeholder="accessKey,在安全中心,秘钥管理中查看" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Secret Key" prop="secretKey">
|
||||
<el-input v-model="form.secretKey" type="password" style="width: 95%;" placeholder="secretKey,在安全中心,秘钥管理中查看" />
|
||||
</el-form-item>
|
||||
<el-form-item label="空间名称" prop="bucket">
|
||||
<el-input v-model="form.bucket" style="width: 95%;" placeholder="存储空间名称作为唯一的 Bucket 识别符" />
|
||||
</el-form-item>
|
||||
<el-form-item label="外链域名" prop="host">
|
||||
<el-input v-model="form.host" style="width: 95%;" placeholder="外链域名,可自定义,需在七牛云绑定" />
|
||||
</el-form-item>
|
||||
<el-form-item label="存储区域">
|
||||
<el-select v-model="form.zone" placeholder="请选择存储区域">
|
||||
<el-option
|
||||
v-for="item in zones"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="空间类型" prop="type">
|
||||
<el-radio v-model="form.type" label="公开">公开</el-radio>
|
||||
<el-radio v-model="form.type" label="私有">私有</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="dialog = false">取消</el-button>
|
||||
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryQiniuConfig, modifyQiniuConfig } from '@/api/system/qiniu'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
zones: ['华东', '华北', '东南亚'], dialog: false,
|
||||
loading: false, form: { accessKey: '', secretKey: '', bucket: '', host: '', zone: '', type: '' },
|
||||
rules: {
|
||||
accessKey: [
|
||||
{ required: true, message: '请输入accessKey', trigger: 'blur' }
|
||||
],
|
||||
secretKey: [
|
||||
{ required: true, message: '请输入secretKey', trigger: 'blur' }
|
||||
],
|
||||
bucket: [
|
||||
{ required: true, message: '请输入空间名称', trigger: 'blur' }
|
||||
],
|
||||
host: [
|
||||
{ required: true, message: '请输入外链域名', trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '空间类型不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
queryQiniuConfig().then(res => {
|
||||
this.form = res
|
||||
})
|
||||
},
|
||||
doSubmit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
modifyQiniuConfig(this.form).then(res => {
|
||||
this.$notify({
|
||||
title: '修改成功',
|
||||
type: 'success',
|
||||
duration: 2500
|
||||
})
|
||||
this.$parent.crud.toQuery()
|
||||
this.loading = false
|
||||
this.dialog = false
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,189 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container" style="padding: 8px;">
|
||||
<!--表单组件-->
|
||||
<eForm ref="form" />
|
||||
<!-- 工具栏 -->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.key" clearable size="small" placeholder="输入文件名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
<template slot="left">
|
||||
<!-- 上传 -->
|
||||
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-upload" @click="dialog = true">上传</el-button>
|
||||
<!-- 同步 -->
|
||||
<el-button :icon="icon" class="filter-item" size="mini" type="warning" @click="synchronize">同步</el-button>
|
||||
<!-- 配置 -->
|
||||
<el-button
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="success"
|
||||
icon="el-icon-s-tools"
|
||||
@click="doConfig"
|
||||
>配置</el-button>
|
||||
</template>
|
||||
</crudOperation>
|
||||
<!-- 文件上传 -->
|
||||
<el-dialog :visible.sync="dialog" :close-on-click-modal="false" append-to-body width="500px" @close="doSubmit">
|
||||
<el-upload
|
||||
:before-remove="handleBeforeRemove"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:file-list="fileList"
|
||||
:headers="headers"
|
||||
:action="qiNiuUploadApi"
|
||||
class="upload-demo"
|
||||
multiple
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" style="display: block;" class="el-upload__tip">请勿上传违法文件,且文件不超过15M</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" :show-overflow-tooltip="true" label="文件名">
|
||||
<template slot-scope="scope">
|
||||
<a href="JavaScript:" class="el-link el-link--primary" target="_blank" type="primary" @click="download(scope.row.id)">{{ scope.row.key }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="suffix" label="文件类型" @selection-change="crud.selectionChangeHandler" />
|
||||
<el-table-column prop="bucket" label="空间名称" />
|
||||
<el-table-column prop="size" label="文件大小" />
|
||||
<el-table-column prop="type" label="空间类型" />
|
||||
<el-table-column prop="updateTime" label="创建日期" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudQiNiu from '@/api/system/qiniu'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import eForm from './form.vue'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
|
||||
export default {
|
||||
components: { eForm, pagination, crudOperation, rrOperation, DateRangePicker },
|
||||
cruds() {
|
||||
return CRUD({ title: '七牛云文件', url: 'api/qiNiuContent', crudMethod: { ...crudQiNiu }})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
del: ['admin', 'storage:del']
|
||||
},
|
||||
title: '文件', dialog: false,
|
||||
icon: 'el-icon-refresh',
|
||||
url: '', headers: { 'Authorization': getToken() },
|
||||
dialogImageUrl: '', dialogVisible: false, fileList: [], files: [], newWin: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'qiNiuUploadApi'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
url(newVal, oldVal) {
|
||||
if (newVal && this.newWin) {
|
||||
this.newWin.sessionStorage.clear()
|
||||
this.newWin.location.href = newVal
|
||||
// 重定向后把url和newWin重置
|
||||
this.url = ''
|
||||
this.newWin = null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.crud.optShow.add = false
|
||||
this.crud.optShow.edit = false
|
||||
},
|
||||
methods: {
|
||||
// 七牛云配置
|
||||
doConfig() {
|
||||
const _this = this.$refs.form
|
||||
_this.init()
|
||||
_this.dialog = true
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
const uid = file.uid
|
||||
const id = response.id
|
||||
this.files.push({ uid, id })
|
||||
},
|
||||
handleBeforeRemove(file, fileList) {
|
||||
for (let i = 0; i < this.files.length; i++) {
|
||||
if (this.files[i].uid === file.uid) {
|
||||
crudQiNiu.del([this.files[i].id]).then(res => {})
|
||||
return true
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 刷新列表数据
|
||||
doSubmit() {
|
||||
this.fileList = []
|
||||
this.dialogVisible = false
|
||||
this.dialogImageUrl = ''
|
||||
this.dialog = false
|
||||
this.crud.toQuery()
|
||||
},
|
||||
// 监听上传失败
|
||||
handleError(e, file, fileList) {
|
||||
const msg = JSON.parse(e.message)
|
||||
this.crud.notify(msg.message, CRUD.NOTIFICATION_TYPE.ERROR)
|
||||
},
|
||||
// 下载文件
|
||||
download(id) {
|
||||
this.downloadLoading = true
|
||||
// 先打开一个空的新窗口,再请求
|
||||
this.newWin = window.open()
|
||||
crudQiNiu.createFilePreviewUrl(id).then(res => {
|
||||
this.downloadLoading = false
|
||||
this.url = res.url
|
||||
}).catch(err => {
|
||||
this.downloadLoading = false
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
// 同步数据
|
||||
synchronize() {
|
||||
this.icon = 'el-icon-loading'
|
||||
crudQiNiu.sync().then(res => {
|
||||
this.icon = 'el-icon-refresh'
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '数据同步成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
this.crud.toQuery()
|
||||
}).catch(err => {
|
||||
this.icon = 'el-icon-refresh'
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
+3
-2
@@ -15,7 +15,7 @@ https://github.com/odboy-tianjun/cutejava
|
||||
- 和数据库表一一对应的类, 以`Tb`结尾
|
||||
- API请求参数类名, 以`Args`结尾
|
||||
- API响应参数类名, 以`Vo`结尾
|
||||
- 事件驱动类名,以`Event`结尾
|
||||
- 事件驱动类名, 以`Event`结尾
|
||||
- 消息队列/Socket传输类名,以`Message`结尾
|
||||
- 常用的辅助类的类名, 以`Cs`开头
|
||||
- 查询分页、查询列表的方法,一律为同一个方法名
|
||||
@@ -52,7 +52,8 @@ https://github.com/odboy-tianjun/cutejava
|
||||
- 七牛云存储:可同步七牛云存储的数据到系统,无需登录七牛云直接操作云数据
|
||||
- 服务监控:监控服务器的负载情况
|
||||
|
||||
#### 系统模块
|
||||
#### 系统模块
|
||||
|
||||
- cutejava-framework:系统基础框架,提供核心功能,如:权限、数据权限、异常处理、日志、缓存、工具类、代码生成器、接口限流、接口防重、接口幂等。
|
||||
- cutejava-system:系统功能模块,提供用户、角色、菜单、部门、岗位、字典、日志、定时任务、邮件、七牛云存储、服务监控等功能
|
||||
- cutejava-pipeline:流水线模块,参考阿里云云效,提供流水线功能,可配置流水线任务,并支持任务依赖、任务参数、任务参数校验、任务参数回填。
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
package cn.odboy.annotation;
|
||||
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
|
||||
+2
-2
@@ -85,9 +85,9 @@ public class CsScriptHelper {
|
||||
try {
|
||||
// 执行脚本
|
||||
engine.eval(script);
|
||||
// 由ScriptEngines实现的接口,其方法允许调用以前已执行的脚本中的过程。
|
||||
// 由ScriptEngines实现的接口, 其方法允许调用以前已执行的脚本中的过程。
|
||||
Invocable inv = (Invocable) engine;
|
||||
// 调用全局函数,并传入参数
|
||||
// 调用全局函数, 并传入参数
|
||||
return inv.invokeFunction(functionName, args);
|
||||
} catch (ScriptException e) {
|
||||
throw new ScriptRuntimeException(e);
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ public class SpringBeanHolder implements ApplicationContextAware, DisposableBean
|
||||
private static boolean addCallback = true;
|
||||
|
||||
/**
|
||||
* 针对 某些初始化方法,在SpringContextHolder 未初始化时 提交回调方法。
|
||||
* 在SpringContextHolder 初始化后,进行回调使用
|
||||
* 针对 某些初始化方法, 在SpringContextHolder 未初始化时 提交回调方法。
|
||||
* 在SpringContextHolder 初始化后, 进行回调使用
|
||||
*
|
||||
* @param callBack 回调函数
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.odboy.framework.doc;
|
||||
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.util.AnonTagUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeansException;
|
||||
@@ -35,19 +36,15 @@ import java.util.stream.Collectors;
|
||||
@EnableSwagger2
|
||||
@RequiredArgsConstructor
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Value("${server.servlet.context-path:}")
|
||||
private String apiPath;
|
||||
|
||||
@Value("${app.swagger.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
private final AppProperties properties;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(enabled)
|
||||
.enable(properties.getSwagger().getEnabled())
|
||||
.pathMapping("/")
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
@@ -104,7 +101,7 @@ public class SwaggerConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解决Springfox与SpringBoot集成后,WebMvcRequestHandlerProvider和WebFluxRequestHandlerProvider冲突问题
|
||||
* 解决Springfox与SpringBoot集成后, WebMvcRequestHandlerProvider和WebFluxRequestHandlerProvider冲突问题
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
|
||||
-2
@@ -12,8 +12,6 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class MybatisPlusConfig {
|
||||
// MySQL的分页拦截器
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
|
||||
paginationInnerInterceptor.setMaxLimit(500L);
|
||||
/// 这个配置会导致:当分页没数据时,游标从0开始,会导致无论page为什么值,就算分页超出最大页数,依然能够查询到
|
||||
/// 这个配置会导致:当分页没数据时, 游标从0开始,会导致无论page为什么值,就算分页超出最大页数,依然能够查询到
|
||||
/// paginationInnerInterceptor.setOverflow(true);
|
||||
paginationInnerInterceptor.setOptimizeJoin(true);
|
||||
interceptor.addInnerInterceptor(paginationInnerInterceptor);
|
||||
|
||||
+43
-9
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package cn.odboy.framework.mybatisplus.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.util.FileUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||
@@ -42,6 +45,8 @@ import java.util.function.Consumer;
|
||||
*/
|
||||
@Data
|
||||
public class CsMpCmdGenUtil {
|
||||
// 项目根路径。生成结果 C:\Users\Administrator\Documents\GitHub\cutejava\cutejava
|
||||
private static final String projectRootPath = System.getProperty("user.dir") + "/";
|
||||
/**
|
||||
* 数据库类型 MySQL
|
||||
*/
|
||||
@@ -56,16 +61,18 @@ public class CsMpCmdGenUtil {
|
||||
private String databaseUsername;
|
||||
private String databasePassword;
|
||||
private String driverClassName;
|
||||
private String parentPackageName;
|
||||
private String parentPackageModuleName;
|
||||
private String parentPackageName = "cn.odboy";
|
||||
private String parentModuleName;
|
||||
|
||||
/**
|
||||
* 代码生成函数
|
||||
*
|
||||
* @param moduleName 模块名称
|
||||
* @param tablePrefix 表前缀(可空)
|
||||
* @param tableNames 表名称, 多个用逗号分隔
|
||||
*/
|
||||
public void gen(String tablePrefix, List<String> tableNames) {
|
||||
public void gen(String moduleName, String tablePrefix, List<String> tableNames) {
|
||||
this.parentModuleName = moduleName;
|
||||
// 1.数据库配置
|
||||
DataSourceConfig.Builder dataSourceConfigBuilder = new DataSourceConfig
|
||||
.Builder(this.databaseUrl, this.databaseUsername, this.databasePassword)
|
||||
@@ -111,7 +118,7 @@ public class CsMpCmdGenUtil {
|
||||
// 5.2.Controller策略配置
|
||||
// 开启生成@RestController控制器
|
||||
fastAutoGenerator.strategyConfig(strategyConfigBuilder -> strategyConfigBuilder.controllerBuilder().enableRestStyle());
|
||||
// 如果不需要生成Controller,fastAutoGenerator.templateConfig(templateConfig -> templateConfig.controller(""))。5.3.Service策略配置:格式化service接口和实现类的文件名称, 去掉默认的ServiceName前面的I
|
||||
// 如果不需要生成Controller, fastAutoGenerator.templateConfig(templateConfig -> templateConfig.controller(""))。5.3.Service策略配置:格式化service接口和实现类的文件名称, 去掉默认的ServiceName前面的I
|
||||
fastAutoGenerator.strategyConfig(strategyConfigBuilder -> strategyConfigBuilder
|
||||
.serviceBuilder()
|
||||
.formatServiceFileName("%sService")
|
||||
@@ -141,18 +148,45 @@ public class CsMpCmdGenUtil {
|
||||
.enableSkipView()
|
||||
.disableSqlFilter()
|
||||
.addInclude(tableNames)
|
||||
// 实体类生成策略
|
||||
.entityBuilder()
|
||||
.superClass(CsBaseUserTimeTb.class)
|
||||
.addIgnoreColumns("create_time", "update_time", "create_by", "update_by")
|
||||
// 开启生成实体时生成字段注解。
|
||||
// 会在实体类的属性前,添加[@TableField("nickname")]
|
||||
.enableTableFieldAnnotation()
|
||||
.disableSerialVersionUID()
|
||||
// 阶段2:Mapper策略配置
|
||||
.mapperBuilder()
|
||||
// 开启 @Mapper 注解。
|
||||
// 会在mapper接口上添加注解[@Mapper]
|
||||
// .enableMapperAnnotation()
|
||||
// 启用 BaseResultMap 生成。
|
||||
// 会在mapper.xml文件生成[通用查询映射结果]配置。
|
||||
// .enableBaseResultMap()
|
||||
// 启用 BaseColumnList。
|
||||
// 会在mapper.xml文件生成[通用查询结果列 ]配置
|
||||
// .enableBaseColumnList()
|
||||
// 阶段4:Controller策略配置
|
||||
.controllerBuilder()
|
||||
// 会在控制类中加[@RestController]注解。
|
||||
.enableRestStyle()
|
||||
// 开启驼峰转连字符
|
||||
.enableHyphenStyle()
|
||||
.build();
|
||||
}
|
||||
|
||||
private Consumer<PackageConfig.Builder> getPackageConfigConsumer() {
|
||||
String mapperPath = FileUtil.getTmpDirPath() + "CodeGen/resources/mapper";
|
||||
String mapperPath = projectRootPath + "CodeGen/resources/mapper";
|
||||
if (StrUtil.isBlank(this.parentModuleName)) {
|
||||
throw new BadRequestException("模块名称必填");
|
||||
}
|
||||
return packageConfigBuilder -> packageConfigBuilder
|
||||
.parent(this.parentPackageName == null ? "cn.codegen" : this.parentPackageName)
|
||||
.moduleName(this.parentPackageModuleName == null ? "moduleName" : this.parentPackageModuleName)
|
||||
.entity("domain")
|
||||
.parent(this.parentPackageName)
|
||||
.moduleName(this.parentModuleName)
|
||||
.entity("dal.dataobject")
|
||||
.mapper("dal.mysql")
|
||||
.service("service")
|
||||
.mapper("mapper")
|
||||
.serviceImpl("service.impl")
|
||||
.controller("rest")
|
||||
.pathInfo(Collections.singletonMap(OutputFile.xml, mapperPath));
|
||||
|
||||
+1
-1
@@ -4,8 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import cn.odboy.framework.mybatisplus.config.CsMpQuery;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.mybatisplus.config.CsMpQuery;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@ package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.framework.mybatisplus.core.CsMpQUtil;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.mybatisplus.core.CsMpQUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
|
||||
+2
@@ -21,6 +21,8 @@ public class AppProperties {
|
||||
private SwaggerApiDocSettingModel swagger;
|
||||
private ThreadPoolSettingModel asyncTaskPool;
|
||||
private ThreadPoolSettingModel pipelineTaskPool;
|
||||
private CaptchaModel captcha;
|
||||
private StorageOSSModel oss;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CaptchaModel extends CsObject {
|
||||
/**
|
||||
* 验证码有效时间, 单位: 秒
|
||||
*/
|
||||
private Long expireTime;
|
||||
}
|
||||
+4
-3
@@ -1,13 +1,14 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 密码加密传输,前端公钥加密,后端私钥解密
|
||||
* 密码加密传输, 前端公钥加密,后端私钥解密
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ContentRsaEncodeSettingModel {
|
||||
public String privateKey;
|
||||
public class ContentRsaEncodeSettingModel extends CsObject {
|
||||
private String privateKey;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -8,7 +9,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class JwtAuthSettingModel {
|
||||
public class JwtAuthSettingModel extends CsObject {
|
||||
/**
|
||||
* 必须使用最少88位的Base64对该令牌进行编码
|
||||
*/
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class OSSConfigModel extends CsObject {
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
private String endpoint;
|
||||
/**
|
||||
* 存储桶名称
|
||||
*/
|
||||
private String bucketName;
|
||||
/**
|
||||
* Access Key
|
||||
*/
|
||||
private String accessKey;
|
||||
/**
|
||||
* Secret Key
|
||||
*/
|
||||
private String secretKey;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StorageOSSModel {
|
||||
/**
|
||||
* 上传大小, 单位: M
|
||||
*/
|
||||
private Long maxSize;
|
||||
private OSSConfigModel minio;
|
||||
}
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -9,6 +10,6 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SwaggerApiDocSettingModel {
|
||||
private boolean enabled;
|
||||
public class SwaggerApiDocSettingModel extends CsObject {
|
||||
private Boolean enabled;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -11,7 +12,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ThreadPoolSettingModel {
|
||||
public class ThreadPoolSettingModel extends CsObject {
|
||||
/**
|
||||
* 核心线程池大小
|
||||
*/
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.constant.CaptchaCodeEnum;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.util.StringUtil;
|
||||
@@ -17,7 +18,7 @@ import java.awt.*;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserLoginCaptchaSettingModel {
|
||||
public class UserLoginCaptchaSettingModel extends CsObject {
|
||||
private CaptchaCodeEnum codeType;
|
||||
|
||||
/**
|
||||
@@ -61,7 +62,7 @@ public class UserLoginCaptchaSettingModel {
|
||||
case ARITHMETIC:
|
||||
// 算术类型 https://gitee.com/whvse/EasyCaptcha
|
||||
captcha = new FixedArithmeticCaptcha(width, height);
|
||||
// 几位数运算,默认是两位
|
||||
// 几位数运算, 默认是两位
|
||||
captcha.setLen(length);
|
||||
break;
|
||||
case CHINESE:
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -10,7 +11,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserLoginSettingModel {
|
||||
public class UserLoginSettingModel extends CsObject {
|
||||
/**
|
||||
* 账号单用户 登录
|
||||
*/
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class QuartzConfig {
|
||||
@Override
|
||||
protected Object createJobInstance(@NonNull TriggerFiredBundle bundle) throws Exception {
|
||||
try {
|
||||
// 调用父类的方法,把Job注入到spring中
|
||||
// 调用父类的方法, 把Job注入到spring中
|
||||
Object jobInstance = super.createJobInstance(bundle);
|
||||
capableBeanFactory.autowireBean(jobInstance);
|
||||
log.debug("Job instance created and autowired: {}", jobInstance.getClass().getName());
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ import java.util.Map;
|
||||
public class RedisConfiguration extends CachingConfigurerSupport {
|
||||
|
||||
/**
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)<br/>
|
||||
* 未配置可能导致,登录失败,反复登录等问题
|
||||
* 自动识别json对象白名单配置(仅允许解析的包名, 范围越小越安全)<br/>
|
||||
* 未配置可能导致, 登录失败, 反复登录等问题
|
||||
*/
|
||||
private static final String[] WHITELIST_STR = {
|
||||
"org.springframework",
|
||||
|
||||
@@ -162,7 +162,7 @@ public class RedisHelper {
|
||||
if (keys.length == 1) {
|
||||
boolean result = redisTemplate.delete(keys[0]);
|
||||
log.debug("--------------------------------------------");
|
||||
log.debug(new StringBuilder("删除缓存:").append(keys[0]).append(",结果:").append(result).toString());
|
||||
log.debug(new StringBuilder("删除缓存:").append(keys[0]).append(", 结果:").append(result).toString());
|
||||
log.debug("--------------------------------------------");
|
||||
} else {
|
||||
Set<Object> keySet = new HashSet<>();
|
||||
@@ -218,7 +218,7 @@ public class RedisHelper {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
// 如果 value 不是目标类型,则尝试将其反序列化为 clazz 类型 by
|
||||
// 如果 value 不是目标类型, 则尝试将其反序列化为 clazz 类型 by
|
||||
if (!clazz.isInstance(value)) {
|
||||
return JSON.parseObject(value.toString(), clazz);
|
||||
} else if (clazz.isInstance(value)) {
|
||||
@@ -308,7 +308,7 @@ public class RedisHelper {
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期,注意:这里将会替换原有的时间
|
||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期, 注意:这里将会替换原有的时间
|
||||
* @return true成功 false 失败
|
||||
*/
|
||||
public boolean set(String key, Object value, long time) {
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ public class AsyncTheadPoolConfig implements AsyncConfigurer {
|
||||
private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 自定义线程池,用法 @Async
|
||||
* 自定义线程池, 用法 @Async
|
||||
*
|
||||
* @return Executor
|
||||
*/
|
||||
@@ -39,7 +39,7 @@ public class AsyncTheadPoolConfig implements AsyncConfigurer {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义线程池,用法,注入到类中使用
|
||||
* 自定义线程池, 用法, 注入到类中使用
|
||||
*/
|
||||
@Bean("taskAsync")
|
||||
public ThreadPoolTaskExecutor taskAsync() {
|
||||
|
||||
+4
-10
@@ -1,6 +1,5 @@
|
||||
package cn.odboy.framework.server.core;
|
||||
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.server.converters.DateStringArraysToListDateConverter;
|
||||
import cn.odboy.framework.server.converters.DateStringToDateConverter;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
@@ -28,10 +27,6 @@ import java.util.List;
|
||||
@EnableWebMvc
|
||||
@RequiredArgsConstructor
|
||||
public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
/**
|
||||
* 文件配置
|
||||
*/
|
||||
private final AppProperties properties;
|
||||
private final DateStringArraysToListDateConverter dateStringArraysToListDateConverter;
|
||||
private final DateStringToDateConverter dateStringToDateConverter;
|
||||
private final FileUploadPathHelper fileUploadPathHelper;
|
||||
@@ -67,7 +62,7 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
supportMediaTypeList.add(MediaType.APPLICATION_JSON);
|
||||
FastJsonConfig config = new FastJsonConfig();
|
||||
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// 开启引用检测,枚举支持
|
||||
// 开启引用检测, 枚举支持
|
||||
config.setWriterFeatures(
|
||||
// 是否输出值为null的字段
|
||||
// SerializerFeature.WriteMapNullValue,
|
||||
@@ -77,12 +72,11 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
// JSONWriter.Feature.WriteNullListAsEmpty,
|
||||
// 字符类型字段如果为null,输出为"",而非null
|
||||
// JSONWriter.Feature.WriteNullStringAsEmpty,
|
||||
// 太具体的数值会直接影响逻辑本身,所以不要这个
|
||||
// 太具体的数值会直接影响逻辑本身, 所以不要这个
|
||||
// SerializerFeature.WriteNullNumberAsZero,
|
||||
JSONWriter.Feature.WriteEnumUsingToString,
|
||||
// SerializerFeature.DisableCircularReferenceDetect
|
||||
JSONWriter.Feature.ReferenceDetection
|
||||
);
|
||||
// SerializerFeature.DisableCircularReferenceDetect,
|
||||
JSONWriter.Feature.ReferenceDetection);
|
||||
fastJsonConverter.setFastJsonConfig(config);
|
||||
fastJsonConverter.setSupportedMediaTypes(supportMediaTypeList);
|
||||
fastJsonConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||
|
||||
-5
@@ -14,7 +14,6 @@ public class FileUploadPathHelper {
|
||||
/**
|
||||
* 单位MB
|
||||
*/
|
||||
private static final int FILE_MAX_SIZE = 100;
|
||||
private static final int AVATAR_MAX_SIZE = 5;
|
||||
private static final String PATH_WINDOWS = "C:\\${appName}\\file\\";
|
||||
private static final String PATH_MAC = "/Users/odboy/${appName}/file/";
|
||||
@@ -32,10 +31,6 @@ public class FileUploadPathHelper {
|
||||
return PATH_LINUX.replace("${appName}", appName);
|
||||
}
|
||||
|
||||
public int getFileMaxSize() {
|
||||
return FILE_MAX_SIZE;
|
||||
}
|
||||
|
||||
public int getAvatarMaxSize() {
|
||||
return AVATAR_MAX_SIZE;
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ public class CsWsServer {
|
||||
@Autowired
|
||||
private WsClientManager wsClientManager;
|
||||
/**
|
||||
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||
* 与某个客户端的连接会话, 需要通过它来给客户端发送数据
|
||||
*/
|
||||
private Session session;
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ public class CsWsServer {
|
||||
*/
|
||||
public void sendMessage(CsWsMessage message, @PathParam("sid") String sid) throws IOException {
|
||||
String body = JSON.toJSONString(message);
|
||||
log.info("推送消息到{},推送内容:{}", sid, message);
|
||||
log.info("推送消息到{}, 推送内容:{}", sid, message);
|
||||
try {
|
||||
if (sid == null) {
|
||||
sendToAll(body);
|
||||
|
||||
+2
-2
@@ -9,12 +9,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Component
|
||||
public class WsClientManager {
|
||||
/**
|
||||
* concurrent包的线程安全Map,用来存放每个客户端对应的MyWebSocket对象。(分布式必出问题)
|
||||
* concurrent包的线程安全Map, 用来存放每个客户端对应的MyWebSocket对象。(分布式必出问题)
|
||||
*/
|
||||
private final Map<String, CsWsServer> client = new ConcurrentHashMap<>();
|
||||
|
||||
public void addClient(String sid, CsWsServer csWsServer) {
|
||||
// 如果存在就先删除一个,防止重复推送消息
|
||||
// 如果存在就先删除一个, 防止重复推送消息
|
||||
client.remove(sid);
|
||||
client.put(sid, csWsServer);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class BigDecimalUtil {
|
||||
*
|
||||
* @param a 加数
|
||||
* @param b 加数
|
||||
* @return 两个加数的和,保留两位小数
|
||||
* @return 两个加数的和, 保留两位小数
|
||||
*/
|
||||
public static BigDecimal add(Object a, Object b) {
|
||||
BigDecimal bdA = toBigDecimal(a);
|
||||
@@ -49,7 +49,7 @@ public final class BigDecimalUtil {
|
||||
*
|
||||
* @param a 被减数
|
||||
* @param b 减数
|
||||
* @return 两数的差,保留两位小数
|
||||
* @return 两数的差, 保留两位小数
|
||||
*/
|
||||
public static BigDecimal subtract(Object a, Object b) {
|
||||
BigDecimal bdA = toBigDecimal(a);
|
||||
@@ -62,7 +62,7 @@ public final class BigDecimalUtil {
|
||||
*
|
||||
* @param a 乘数
|
||||
* @param b 乘数
|
||||
* @return 两个乘数的积,保留两位小数
|
||||
* @return 两个乘数的积, 保留两位小数
|
||||
*/
|
||||
public static BigDecimal multiply(Object a, Object b) {
|
||||
BigDecimal bdA = toBigDecimal(a);
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.experimental.UtilityClass;
|
||||
import java.io.Closeable;
|
||||
|
||||
/**
|
||||
* 用于关闭各种连接,缺啥补啥
|
||||
* 用于关闭各种连接, 缺啥补啥
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CloseUtil {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@UtilityClass
|
||||
public class CsDateUtil {
|
||||
/**
|
||||
* 获取当前时间毫秒数
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
public static String getNowDateTimeMsStr() {
|
||||
return DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间,但不包括毫秒数
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
public static String getNowDateTimeStr() {
|
||||
return DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间,但不包括毫秒数
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
public static String getNowDateStr() {
|
||||
return DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
*/
|
||||
public final class CsDistributedIdUtil {
|
||||
/**
|
||||
* 起始毫秒时间戳,2020-12-30
|
||||
* 起始毫秒时间戳, 2020-12-30
|
||||
*/
|
||||
private static final long START_TIMESTAMP = 1609314517000L;
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public final class CsDistributedIdUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数,初始化数据中心 ID 和机器 ID
|
||||
* 构造函数, 初始化数据中心 ID 和机器 ID
|
||||
*
|
||||
* @param dataCenterId 数据中心 ID
|
||||
* @param workerId 机器 ID
|
||||
@@ -116,7 +116,7 @@ public final class CsDistributedIdUtil {
|
||||
public long nextId() {
|
||||
long currentTimestamp = System.currentTimeMillis();
|
||||
|
||||
// 如果当前时间戳小于上一次生成 ID 的时间戳,说明时钟回拨,抛出异常
|
||||
// 如果当前时间戳小于上一次生成 ID 的时间戳, 说明时钟回拨,抛出异常
|
||||
if (currentTimestamp < lastTimestamp.get()) {
|
||||
throw new RuntimeException("Clock moved backwards. Refusing to generate id for " + (lastTimestamp.get() - currentTimestamp) + " milliseconds");
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public final class CsListUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* list转map,保留新值 -> Map<String, User> userMap = items.stream().collect(Collectors.toMap(User::getName, user -> user)) <br>
|
||||
* list转map,保留旧值 -> Map<String, User> userMap = users.stream().collect(Collectors.toMap(User::getName, user -> user, (existing, replacement) -> existing));
|
||||
* list转map, 保留新值 -> Map<String, User> userMap = items.stream().collect(Collectors.toMap(User::getName, user -> user)) <br>
|
||||
* list转map, 保留旧值 -> Map<String, User> userMap = users.stream().collect(Collectors.toMap(User::getName, user -> user, (existing, replacement) -> existing));
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
List<CsBaseUserTimeTb> entities = new ArrayList<>();
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
|
||||
import static cn.odboy.constant.SystemConst.*;
|
||||
|
||||
/**
|
||||
* File工具类,扩展 hutool 工具包
|
||||
* File工具类, 扩展 hutool 工具包
|
||||
*/
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
@@ -39,9 +39,9 @@ public final class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
/**
|
||||
* 系统临时目录
|
||||
* <br>
|
||||
* windows 包含路径分割符,但Linux 不包含,
|
||||
* 在windows \\==\ 前提下,
|
||||
* 为安全起见 同意拼装 路径分割符,
|
||||
* windows 包含路径分割符, 但Linux 不包含,
|
||||
* 在windows \\==\ 前提下,
|
||||
* 为安全起见 同意拼装 路径分割符,
|
||||
* <pre>
|
||||
* java.io.tmpdir
|
||||
* windows : C:\Users/xxx\AppData\Local\Temp\
|
||||
@@ -77,7 +77,7 @@ public final class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
String prefix = "." + getSuffix(fileName);
|
||||
File file = null;
|
||||
try {
|
||||
// 用uuid作为文件名,防止生成的临时文件重复
|
||||
// 用uuid作为文件名, 防止生成的临时文件重复
|
||||
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
|
||||
// MultipartFile to File
|
||||
multipartFile.transferTo(file);
|
||||
@@ -189,7 +189,7 @@ public final class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
});
|
||||
return sanitizedMap;
|
||||
}).collect(Collectors.toList());
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
// 一次性写出内容, 使用默认样式,强制输出标题
|
||||
writer.write(sanitizedList, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet) writer.getSheet();
|
||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||
|
||||
@@ -48,10 +48,10 @@ public final class IpUtil {
|
||||
// 排除loopback类型地址
|
||||
if (!inetAddr.isLoopbackAddress()) {
|
||||
if (inetAddr.isSiteLocalAddress()) {
|
||||
// 如果是site-local地址,就是它了
|
||||
// 如果是site-local地址, 就是它了
|
||||
return inetAddr.getHostAddress();
|
||||
} else if (candidateAddress == null) {
|
||||
// site-local类型的地址未被发现,先记录候选地址
|
||||
// site-local类型的地址未被发现, 先记录候选地址
|
||||
candidateAddress = inetAddr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* Rsa 工具类,公钥私钥生成,加解密
|
||||
* Rsa 工具类, 公钥私钥生成, 加解密
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class RsaEncryptUtil {
|
||||
@@ -42,7 +42,7 @@ public final class RsaEncryptUtil {
|
||||
System.out.println("加密后:" + text1);
|
||||
System.out.println("解密后:" + text2);
|
||||
if (RsaEncryptUtil.SRC.equals(text2)) {
|
||||
System.out.println("解密字符串和原始字符串一致,解密成功");
|
||||
System.out.println("解密字符串和原始字符串一致, 解密成功");
|
||||
} else {
|
||||
System.out.println("解密字符串和原始字符串不一致,解密失败");
|
||||
}
|
||||
|
||||
@@ -17,5 +17,11 @@
|
||||
<artifactId>cutejava-framework</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/io.minio/minio -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.5.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
+7
-7
@@ -3,19 +3,19 @@ package cn.odboy.system.controller;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.odboy.annotation.AnonymousPostMapping;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.constant.CaptchaCodeEnum;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.system.dal.model.SystemUserInfoVo;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.model.SystemUserLoginArgs;
|
||||
import cn.odboy.system.dal.redis.SystemRedisKey;
|
||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import cn.odboy.system.framework.permission.core.handler.TokenProvider;
|
||||
import cn.odboy.system.framework.permission.core.handler.UserDetailsHandler;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.util.RsaEncryptUtil;
|
||||
import cn.odboy.util.StringUtil;
|
||||
import com.wf.captcha.base.Captcha;
|
||||
@@ -99,7 +99,7 @@ public class SystemAuthController {
|
||||
@ApiOperation("获取用户信息")
|
||||
@PostMapping(value = "/info")
|
||||
public ResponseEntity<SystemUserInfoVo> getUserInfo() {
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo) SecurityHelper.getCurrentUser();
|
||||
SystemUserJwtVo jwtUser = (SystemUserJwtVo) CsSecurityHelper.getCurrentUser();
|
||||
SystemUserInfoVo userInfoVo = BeanUtil.copyProperties(jwtUser, SystemUserInfoVo.class);
|
||||
return ResponseEntity.ok(userInfoVo);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class SystemAuthController {
|
||||
// 获取运算的结果
|
||||
Captcha captcha = properties.getLogin().getCaptchaSetting().getCaptcha();
|
||||
String uuid = SystemRedisKey.CAPTCHA_LOGIN + IdUtil.simpleUUID();
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时,captcha.text()的结果有几率为浮点型
|
||||
//当验证码类型为 arithmetic时且长度 >= 2 时, captcha.text()的结果有几率为浮点型
|
||||
String captchaValue = captcha.text();
|
||||
if (captcha.getCharType() - 1 == CaptchaCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(SystemConst.SYMBOL_DOT)) {
|
||||
captchaValue = captchaValue.split("\\.")[0];
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class SystemCaptchaController {
|
||||
private final SystemEmailService systemEmailService;
|
||||
|
||||
@ApiOperation("重置邮箱,发送验证码")
|
||||
@ApiOperation("重置邮箱, 发送验证码")
|
||||
@PostMapping(value = "/sendResetEmailCaptcha")
|
||||
public ResponseEntity<Void> sendResetEmailCaptcha(@RequestParam String email) {
|
||||
systemEmailService.sendCaptcha(SystemCaptchaBizEnum.EMAIL_RESET_EMAIL_CODE, email);
|
||||
|
||||
+8
-8
@@ -3,8 +3,8 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.CreateSystemDeptArgs;
|
||||
import cn.odboy.system.dal.model.QuerySystemDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemCreateDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import cn.odboy.system.service.SystemDeptService;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -33,15 +33,15 @@ public class SystemDeptController {
|
||||
@ApiOperation("导出部门数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
public void exportDept(HttpServletResponse response, QuerySystemDeptArgs criteria) throws Exception {
|
||||
public void exportDept(HttpServletResponse response, SystemQueryDeptArgs criteria) throws Exception {
|
||||
systemDeptService.exportDeptExcel(systemDeptService.queryAllDept(criteria, false), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemDeptTb>>> queryDept(@Validated @RequestBody CsPageArgs<QuerySystemDeptArgs> args) throws Exception {
|
||||
QuerySystemDeptArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemDeptTb>>> queryDept(@Validated @RequestBody CsPageArgs<SystemQueryDeptArgs> args) throws Exception {
|
||||
SystemQueryDeptArgs criteria = args.getArgs();
|
||||
List<SystemDeptTb> depts = systemDeptService.queryAllDept(criteria, true);
|
||||
return new ResponseEntity<>(CsPageUtil.toPage(depts), HttpStatus.OK);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class SystemDeptController {
|
||||
data.setSubCount(data.getSubCount() - 1);
|
||||
}
|
||||
}
|
||||
// 编辑部门时不显示自己以及自己下级的数据,避免出现PID数据环形问题
|
||||
// 编辑部门时不显示自己以及自己下级的数据, 避免出现PID数据环形问题
|
||||
depts = depts.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toList());
|
||||
}
|
||||
deptSet.addAll(depts);
|
||||
@@ -73,7 +73,7 @@ public class SystemDeptController {
|
||||
@ApiOperation("新增部门")
|
||||
@PostMapping(value = "/saveDept")
|
||||
@PreAuthorize("@el.check('dept:add')")
|
||||
public ResponseEntity<Void> saveDept(@Validated @RequestBody CreateSystemDeptArgs resources) {
|
||||
public ResponseEntity<Void> saveDept(@Validated @RequestBody SystemCreateDeptArgs resources) {
|
||||
systemDeptService.saveDept(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class SystemDeptController {
|
||||
@PostMapping(value = "/removeDeptByIds")
|
||||
@PreAuthorize("@el.check('dept:del')")
|
||||
public ResponseEntity<Void> removeDeptByIds(@RequestBody Set<Long> ids) {
|
||||
// 获取部门,和其所有子部门
|
||||
// 获取部门, 和其所有子部门
|
||||
Set<SystemDeptTb> depts = systemDeptService.traverseDeptByIdWithPids(ids);
|
||||
// 验证是否被角色或用户关联
|
||||
systemDeptService.verifyBindRelationByIds(depts);
|
||||
|
||||
+7
-7
@@ -3,8 +3,8 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.CreateSystemDictArgs;
|
||||
import cn.odboy.system.dal.model.QuerySystemDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import cn.odboy.system.service.SystemDictService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -31,7 +31,7 @@ public class SystemDictController {
|
||||
@ApiOperation("导出字典数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public void exportDict(HttpServletResponse response, QuerySystemDictArgs criteria) throws IOException {
|
||||
public void exportDict(HttpServletResponse response, SystemQueryDictArgs criteria) throws IOException {
|
||||
systemDictService.exportDictExcel(systemDictService.queryDictByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ public class SystemDictController {
|
||||
@PostMapping(value = "/queryAllDict")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public ResponseEntity<List<SystemDictTb>> queryAllDict() {
|
||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(new QuerySystemDictArgs()), HttpStatus.OK);
|
||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(new SystemQueryDictArgs()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemDictTb>>> queryDictByArgs(@Validated @RequestBody CsPageArgs<QuerySystemDictArgs> args) {
|
||||
QuerySystemDictArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemDictTb>>> queryDictByArgs(@Validated @RequestBody CsPageArgs<SystemQueryDictArgs> args) {
|
||||
SystemQueryDictArgs criteria = args.getArgs();
|
||||
Page<SystemDictTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class SystemDictController {
|
||||
@ApiOperation("新增字典")
|
||||
@PostMapping(value = "/saveDict")
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
public ResponseEntity<Void> saveDict(@Validated @RequestBody CreateSystemDictArgs resources) {
|
||||
public ResponseEntity<Void> saveDict(@Validated @RequestBody SystemCreateDictArgs resources) {
|
||||
systemDictService.saveDict(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
+7
-7
@@ -3,8 +3,8 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.model.CreateSystemDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.QuerySystemDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictDetailArgs;
|
||||
import cn.odboy.system.service.SystemDictDetailService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -29,14 +29,14 @@ public class SystemDictDetailController {
|
||||
|
||||
@ApiOperation("查询字典详情")
|
||||
@PostMapping
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> queryDictDetailByCrud(@Validated @RequestBody CsPageArgs<QuerySystemDictDetailArgs> args) {
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> queryDictDetailByCrud(@Validated @RequestBody CsPageArgs<SystemQueryDictDetailArgs> args) {
|
||||
return queryDictDetailByArgs(args);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典详情")
|
||||
@PostMapping(value = "/queryDictDetailByArgs")
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> queryDictDetailByArgs(@Validated @RequestBody CsPageArgs<QuerySystemDictDetailArgs> args) {
|
||||
QuerySystemDictDetailArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> queryDictDetailByArgs(@Validated @RequestBody CsPageArgs<SystemQueryDictDetailArgs> args) {
|
||||
SystemQueryDictDetailArgs criteria = args.getArgs();
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemDictDetailService.queryDictDetailByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class SystemDictDetailController {
|
||||
@ApiOperation("查询多个字典详情")
|
||||
@GetMapping(value = "/getDictDetailMaps")
|
||||
public ResponseEntity<Map<String, List<SystemDictDetailTb>>> getDictDetailMaps(@RequestParam String dictName) {
|
||||
String[] names = dictName.split("[,,]");
|
||||
String[] names = dictName.split("[,, ]");
|
||||
Map<String, List<SystemDictDetailTb>> dictMap = new HashMap<>(16);
|
||||
for (String name : names) {
|
||||
dictMap.put(name, systemDictDetailService.queryDictDetailByName(name));
|
||||
@@ -55,7 +55,7 @@ public class SystemDictDetailController {
|
||||
@ApiOperation("新增字典详情")
|
||||
@PostMapping(value = "/saveDictDetail")
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
public ResponseEntity<Void> saveDictDetail(@Validated @RequestBody CreateSystemDictDetailArgs resources) {
|
||||
public ResponseEntity<Void> saveDictDetail(@Validated @RequestBody SystemCreateDictDetailArgs resources) {
|
||||
systemDictDetailService.saveDictDetail(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemEmailConfigTb;
|
||||
import cn.odboy.system.dal.model.SendSystemEmailArgs;
|
||||
import cn.odboy.system.dal.model.SystemSendEmailArgs;
|
||||
import cn.odboy.system.service.SystemEmailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -39,7 +39,7 @@ public class SystemEmailController {
|
||||
|
||||
@ApiOperation("发送邮件")
|
||||
@PostMapping(value = "/sendEmail")
|
||||
public ResponseEntity<Void> sendEmail(@Validated @RequestBody SendSystemEmailArgs sendEmailRequest) {
|
||||
public ResponseEntity<Void> sendEmail(@Validated @RequestBody SystemSendEmailArgs sendEmailRequest) {
|
||||
systemEmailService.sendEmail(sendEmailRequest);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
+7
-7
@@ -3,8 +3,8 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.CreateSystemJobArgs;
|
||||
import cn.odboy.system.dal.model.QuerySystemJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemCreateJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import cn.odboy.system.service.SystemJobService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -32,15 +32,15 @@ public class SystemJobController {
|
||||
@ApiOperation("导出岗位数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('job:list')")
|
||||
public void exportJob(HttpServletResponse response, QuerySystemJobArgs criteria) throws IOException {
|
||||
public void exportJob(HttpServletResponse response, SystemQueryJobArgs criteria) throws IOException {
|
||||
systemJobService.exportJobExcel(systemJobService.queryJobByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
@PostMapping(value = "/queryAllEnableJob")
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJobByArgs(@Validated @RequestBody CsPageArgs<QuerySystemJobArgs> args) {
|
||||
QuerySystemJobArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJobByArgs(@Validated @RequestBody CsPageArgs<SystemQueryJobArgs> args) {
|
||||
SystemQueryJobArgs criteria = args.getArgs();
|
||||
Page<SystemJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemJobService.queryJobByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -48,14 +48,14 @@ public class SystemJobController {
|
||||
@ApiOperation("查询岗位")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJobByCrud(@Validated @RequestBody CsPageArgs<QuerySystemJobArgs> args) {
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJobByCrud(@Validated @RequestBody CsPageArgs<SystemQueryJobArgs> args) {
|
||||
return queryJobByArgs(args);
|
||||
}
|
||||
|
||||
@ApiOperation("新增岗位")
|
||||
@PostMapping(value = "/saveJob")
|
||||
@PreAuthorize("@el.check('job:add')")
|
||||
public ResponseEntity<Void> saveJob(@Validated @RequestBody CreateSystemJobArgs resources) {
|
||||
public ResponseEntity<Void> saveJob(@Validated @RequestBody SystemCreateJobArgs resources) {
|
||||
systemJobService.saveJob(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
+6
-6
@@ -3,10 +3,10 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.constant.FileTypeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemLocalStorageArgs;
|
||||
import cn.odboy.system.service.SystemLocalStorageService;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.service.SystemLocalStorageService;
|
||||
import cn.odboy.util.FileUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -33,8 +33,8 @@ public class SystemLocalStorageController {
|
||||
@ApiOperation("查询文件")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemLocalStorageTb>>> queryLocalStorage(@Validated @RequestBody CsPageArgs<QuerySystemLocalStorageArgs> args) {
|
||||
QuerySystemLocalStorageArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemLocalStorageTb>>> queryLocalStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
||||
SystemQueryStorageArgs criteria = args.getArgs();
|
||||
Page<SystemLocalStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(localStorageService.queryLocalStorage(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class SystemLocalStorageController {
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, QuerySystemLocalStorageArgs criteria) throws IOException {
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs criteria) throws IOException {
|
||||
localStorageService.exportLocalStorageExcel(localStorageService.queryLocalStorage(criteria), response);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -3,12 +3,12 @@ package cn.odboy.system.controller;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemMenuArgs;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.system.service.SystemMenuService;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.SystemMenuVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import cn.odboy.system.service.SystemMenuService;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -34,14 +34,14 @@ public class SystemMenuController {
|
||||
@ApiOperation("导出菜单数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public void exportMenu(HttpServletResponse response, QuerySystemMenuArgs criteria) throws Exception {
|
||||
public void exportMenu(HttpServletResponse response, SystemQueryMenuArgs criteria) throws Exception {
|
||||
systemMenuService.exportMenuExcel(systemMenuService.queryAllMenu(criteria, false), response);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/buildMenus")
|
||||
@ApiOperation("获取前端所需菜单")
|
||||
public ResponseEntity<List<SystemMenuVo>> buildMenus() {
|
||||
List<SystemMenuTb> menuList = systemMenuService.queryMenuListByUserId(SecurityHelper.getCurrentUserId());
|
||||
List<SystemMenuTb> menuList = systemMenuService.queryMenuListByUserId(CsSecurityHelper.getCurrentUserId());
|
||||
List<SystemMenuTb> menus = systemMenuService.buildMenuTree(menuList);
|
||||
return new ResponseEntity<>(systemMenuService.buildMenuVo(menus), HttpStatus.OK);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class SystemMenuController {
|
||||
return new ResponseEntity<>(systemMenuService.queryMenuByPid(pid), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID")
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
||||
@PostMapping(value = "/queryChildMenuSet")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Set<Long>> queryChildMenuSet(@RequestParam Long id) {
|
||||
@@ -68,15 +68,15 @@ public class SystemMenuController {
|
||||
@PostMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryAllMenuByCrud(@Validated @RequestBody CsPageArgs<QuerySystemMenuArgs> args) throws Exception {
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryAllMenuByCrud(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args) throws Exception {
|
||||
return queryAllMenu(args);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/queryMenuByArgs")
|
||||
@ApiOperation("查询菜单")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryAllMenu(@Validated @RequestBody CsPageArgs<QuerySystemMenuArgs> args) throws Exception {
|
||||
QuerySystemMenuArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryAllMenu(@Validated @RequestBody CsPageArgs<SystemQueryMenuArgs> args) throws Exception {
|
||||
SystemQueryMenuArgs criteria = args.getArgs();
|
||||
List<SystemMenuTb> menuList = systemMenuService.queryAllMenu(criteria, true);
|
||||
return new ResponseEntity<>(CsPageUtil.toPage(menuList), HttpStatus.OK);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class SystemMenuController {
|
||||
}
|
||||
menus.addAll(menuList);
|
||||
}
|
||||
// 编辑菜单时不显示自己以及自己下级的数据,避免出现PID数据环形问题
|
||||
// 编辑菜单时不显示自己以及自己下级的数据, 避免出现PID数据环形问题
|
||||
menus = menus.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
||||
return new ResponseEntity<>(systemMenuService.buildMenuTree(new ArrayList<>(menus)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemOssStorageVo;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import cn.odboy.system.service.SystemOssStorageService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "工具:OSS存储管理")
|
||||
@RequestMapping("/api/ossStorage")
|
||||
public class SystemOssStorageController {
|
||||
private final SystemOssStorageService systemOssStorageService;
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemOssStorageVo>>> queryOssStorage(@Validated @RequestBody CsPageArgs<SystemQueryStorageArgs> args) {
|
||||
SystemQueryStorageArgs criteria = args.getArgs();
|
||||
Page<SystemOssStorageTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemOssStorageService.queryOssStorage(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, SystemQueryStorageArgs criteria) throws IOException {
|
||||
systemOssStorageService.exportOssStorageExcel(systemOssStorageService.queryOssStorage(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping(value = "/uploadFile")
|
||||
@PreAuthorize("@el.check('storage:add')")
|
||||
public ResponseEntity<Void> uploadFile(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
||||
systemOssStorageService.uploadFile(name, file);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@ApiOperation("多选删除")
|
||||
@PostMapping(value = "/removeFileByIds")
|
||||
public ResponseEntity<Void> removeFileByIds(@RequestBody Long[] ids) {
|
||||
systemOssStorageService.removeFileByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
// @ApiOperation(value = "图片/视频预览")
|
||||
// @GetMapping("/preview-file")
|
||||
// public ResponseEntity<Object> previewFile(@RequestParam("fileName") String fileName) {
|
||||
// // 校验文件名是否有效
|
||||
// if (StrUtil.isBlank(fileName)) {
|
||||
// log.warn("文件名为空,无法生成预签名 URL");
|
||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("文件名为空,无法生成预签名 URL");
|
||||
// }
|
||||
//
|
||||
// // 确保文件名包含完整的路径(例如:2025/04/28/78bda88f-ff2d-4c4f-9756-397c62c3771f.jpg)
|
||||
// if (!fileName.contains("/")) {
|
||||
// log.warn("请检查文件名是否正确,无法生成预签名 URL");
|
||||
// return null;
|
||||
// }
|
||||
// // 创建返回 map
|
||||
// Map<String, Object> res = new HashMap<>();
|
||||
// // 生成 1 小时有效的预签名 URL
|
||||
// try {
|
||||
// GetPresignedObjectUrlArgs presignedUrlArgs = GetPresignedObjectUrlArgs.builder()
|
||||
// // 获取 bucket 名称
|
||||
// .bucket(properties.getOss().getMinio().getBucketName())
|
||||
// // 使用完整路径
|
||||
// .object(fileName)
|
||||
// // 设置方法为 GET(读取文件)
|
||||
// .method(Method.GET)
|
||||
// // 设置 URL 过期时间为 1 小时 1*60*60
|
||||
// .expiry(3600).build();
|
||||
//
|
||||
// // 获取预签名 URL
|
||||
// String url = minioClient.getPresignedObjectUrl(presignedUrlArgs);
|
||||
// res.put("data", url);
|
||||
// // 记录生成的 URL
|
||||
// log.info("生成预签名 URL 成功,fileName: {}, url: {}", fileName, url);
|
||||
// } catch (Exception e) {
|
||||
// log.error("生成预签名 URL 失败,fileName: {}", fileName, e);
|
||||
// }
|
||||
// res.put("code", HttpStatus.OK.value());
|
||||
// res.put("msg", "上传成功");
|
||||
// return ResponseEntity.status(HttpStatus.OK).body(res);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 存储桶存在
|
||||
// *
|
||||
// * @param bucketName 存储桶名称
|
||||
// * @return {@link ResponseEntity }<{@link Object }>
|
||||
// */
|
||||
// @ApiOperation(value = "查看存储bucket是否存在")
|
||||
// @GetMapping("/bucketExists")
|
||||
// public ResponseEntity<Object> bucketExists(@RequestParam("bucketName") String bucketName) {
|
||||
// return ResponseEntity.status(HttpStatus.OK).body("查看存储bucket是否存在 bucketName : " + minioRepository.bucketExists(bucketName));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 制作桶
|
||||
// *
|
||||
// * @param bucketName 存储桶名称
|
||||
// * @return {@link ResponseEntity }<{@link Object }>
|
||||
// */
|
||||
// @ApiOperation(value = "创建存储bucket")
|
||||
// @GetMapping("/makeBucket")
|
||||
// public ResponseEntity<Object> makeBucket(String bucketName) {
|
||||
// return ResponseEntity.status(HttpStatus.OK).body("创建存储bucket bucketName : " + minioRepository.makeBucket(bucketName));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除存储桶
|
||||
// *
|
||||
// * @param bucketName 存储桶名称
|
||||
// * @return {@link ResponseEntity }<{@link Object }>
|
||||
// */
|
||||
// @ApiOperation(value = "删除存储bucket")
|
||||
// @GetMapping("/removeBucket")
|
||||
// public ResponseEntity<Object> removeBucket(String bucketName) {
|
||||
// return ResponseEntity.status(HttpStatus.OK).body("删除存储bucket bucketName : " + minioRepository.removeBucket(bucketName));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取所有存储桶
|
||||
// *
|
||||
// * @return {@link ResponseEntity }<{@link Object }>
|
||||
// */
|
||||
// @ApiOperation(value = "获取全部bucket")
|
||||
// @GetMapping("/queryAllBuckets")
|
||||
// public ResponseEntity<Object> queryAllBuckets() {
|
||||
// List<Bucket> allBuckets = minioRepository.queryAllBuckets();
|
||||
// // 获取名称 allBuckets.forEach(bucket -> log.info(bucket.name()));
|
||||
// List<String> bucketNames = allBuckets.stream().map(Bucket::name).collect(Collectors.toList());
|
||||
// HashMap<String, Object> response = new HashMap<>();
|
||||
// response.put("data", bucketNames);
|
||||
// response.put("code", HttpStatus.OK.value());
|
||||
// response.put("msg", "获取全部bucket成功");
|
||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 上传
|
||||
// *
|
||||
// * @param file 文件
|
||||
// * @return {@link ResponseEntity }<{@link Object }>
|
||||
// */
|
||||
// @ApiOperation(value = "文件上传返回url")
|
||||
// @PostMapping("/upload")
|
||||
// public ResponseEntity<Object> upload(@RequestParam("file") MultipartFile file) {
|
||||
// if (file.isEmpty()) {
|
||||
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("文件不能为空");
|
||||
// }
|
||||
// String objectName = minioRepository.upload(file);
|
||||
// if (null != objectName) {
|
||||
// HashMap<String, Object> response = new HashMap<>();
|
||||
// response.put("data", (properties.getOss().getMinio().getEndpoint() + "/" + properties.getOss().getMinio().getBucketName() + "/" + objectName));
|
||||
// response.put("code", HttpStatus.OK.value());
|
||||
// response.put("msg", "上传成功");
|
||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
// }
|
||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("文件上传失败");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文件上传
|
||||
// *
|
||||
// * @param file 文件
|
||||
// * @return 文件在Minio中的路径
|
||||
// */
|
||||
// @ApiOperation(value = "文件上传返回url")
|
||||
// @PostMapping("/upload")
|
||||
// public ResponseEntity<Object> upload(MultipartFile file) {
|
||||
// String originalFilename = file.getOriginalFilename();
|
||||
// if (StrUtil.isBlank(originalFilename)) {
|
||||
// throw new RuntimeException("文件名为空");
|
||||
// }
|
||||
// String fileExtension = FileUtil.getSuffix(originalFilename);
|
||||
// // 使用UUID确保文件名唯一
|
||||
// String fileName = UUID.randomUUID() + fileExtension;
|
||||
// // 使用日期加上文件名,方便分类
|
||||
// String objectName = CsDateUtil.getNowDateTimeMsStr() + "/" + fileName;
|
||||
//
|
||||
// log.info("准备上传文件,objectName: {}", objectName);
|
||||
//
|
||||
// // 通过更大缓冲区和流优化上传文件
|
||||
// try (InputStream fileInputStream = file.getInputStream()) {
|
||||
// // 上传前记录文件大小和类型
|
||||
// long fileSize = file.getSize();
|
||||
// log.info("上传文件大小:{} 字节, 文件类型:{}", fileSize, file.getContentType());
|
||||
// PutObjectArgs objectArgs = PutObjectArgs.builder()
|
||||
// .bucket(properties.getOss().getMinio().getBucketName())
|
||||
// .object(objectName)
|
||||
// .stream(fileInputStream, fileSize, -1)
|
||||
// .contentType(file.getContentType())
|
||||
// .build();
|
||||
// minioClient.putObject(objectArgs);
|
||||
// log.info("文件上传成功,objectName: {}", objectName);
|
||||
// HashMap<String, Object> response = new HashMap<>();
|
||||
// response.put("data", (properties.getOss().getMinio().getEndpoint() + "/" + properties.getOss().getMinio().getBucketName() + "/" + objectName));
|
||||
// response.put("code", HttpStatus.OK.value());
|
||||
// response.put("msg", "上传成功");
|
||||
// return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
// } catch (IOException e) {
|
||||
// log.error("上传文件失败,objectName: {}", objectName, e);
|
||||
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("文件上传失败");
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
package cn.odboy.system.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemQiniuConfigTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQiniuContentTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemQiniuArgs;
|
||||
import cn.odboy.system.service.SystemQiniuConfigService;
|
||||
import cn.odboy.system.service.SystemQiniuContentService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/qiNiuContent")
|
||||
@Api(tags = "工具:七牛云存储管理")
|
||||
public class SystemQiniuController {
|
||||
private final SystemQiniuContentService qiniuContentService;
|
||||
private final SystemQiniuConfigService qiNiuConfigService;
|
||||
|
||||
@ApiOperation("查询七牛云存储配置")
|
||||
@PostMapping(value = "/queryQiniuConfig")
|
||||
public ResponseEntity<SystemQiniuConfigTb> queryQiniuConfig() {
|
||||
return new ResponseEntity<>(qiNiuConfigService.getLastQiniuConfig(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("配置七牛云存储")
|
||||
@PostMapping(value = "/modifyQiniuConfig")
|
||||
public ResponseEntity<Void> modifyQiniuConfig(@Validated @RequestBody SystemQiniuConfigTb qiniuConfig) {
|
||||
qiNiuConfigService.saveQiniuConfig(qiniuConfig);
|
||||
qiNiuConfigService.modifyQiniuConfigType(qiniuConfig.getType());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportQiNiu(HttpServletResponse response, QuerySystemQiniuArgs criteria) throws IOException {
|
||||
qiniuContentService.exportQiniuContentExcel(qiniuContentService.queryQiniuContentByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@PostMapping
|
||||
public ResponseEntity<CsResultVo<List<SystemQiniuContentTb>>> queryQiniuContentByArgs(@Validated @RequestBody CsPageArgs<QuerySystemQiniuArgs> args) {
|
||||
QuerySystemQiniuArgs criteria = args.getArgs();
|
||||
Page<SystemQiniuContentTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(qiniuContentService.queryQiniuContentByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping("/uploadFile")
|
||||
public ResponseEntity<Map<String, Object>> uploadFile(@RequestParam MultipartFile file) {
|
||||
SystemQiniuContentTb qiniuContent = qiniuContentService.uploadFile(file);
|
||||
Map<String, Object> map = new HashMap<>(3);
|
||||
map.put("id", qiniuContent.getId());
|
||||
map.put("errno", 0);
|
||||
map.put("data", new String[]{qiniuContent.getUrl()});
|
||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("同步七牛云数据")
|
||||
@PostMapping(value = "/synchronize")
|
||||
public ResponseEntity<Void> synchronizeQiNiu() {
|
||||
qiniuContentService.synchronize();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("下载文件")
|
||||
@GetMapping(value = "/createFilePreviewUrl/{id}")
|
||||
public ResponseEntity<Map<String, Object>> createFilePreviewUrl(@PathVariable Long id) {
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put("url", qiniuContentService.createFilePreviewUrl(qiniuContentService.getQiniuContentById(id)));
|
||||
return new ResponseEntity<>(map, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("删除文件")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResponseEntity<Void> deleteQiNiu(@PathVariable Long id) {
|
||||
qiniuContentService.removeFileById(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("删除多张图片")
|
||||
@PostMapping(value = "/removeFileByIds")
|
||||
public ResponseEntity<Void> removeFileByIds(@RequestBody Long[] ids) {
|
||||
qiniuContentService.removeFileByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -3,12 +3,12 @@ package cn.odboy.system.controller;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.framework.context.SpringBeanHolder;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.UpdateSystemQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateQuartzJobArgs;
|
||||
import cn.odboy.system.service.SystemQuartzJobService;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -37,8 +37,8 @@ public class SystemQuartzJobController {
|
||||
@ApiOperation("查询定时任务")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJobByCrud(@Validated @RequestBody CsPageArgs<QuerySystemQuartzJobArgs> args) {
|
||||
QuerySystemQuartzJobArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJobByCrud(@Validated @RequestBody CsPageArgs<SystemQueryQuartzJobArgs> args) {
|
||||
SystemQueryQuartzJobArgs criteria = args.getArgs();
|
||||
Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzJobByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -46,21 +46,21 @@ public class SystemQuartzJobController {
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJob(HttpServletResponse response, QuerySystemQuartzJobArgs criteria) throws IOException {
|
||||
public void exportQuartzJob(HttpServletResponse response, SystemQueryQuartzJobArgs criteria) throws IOException {
|
||||
systemQuartzJobService.exportQuartzJobExcel(systemQuartzJobService.queryQuartzJobByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJobLog(HttpServletResponse response, QuerySystemQuartzJobArgs criteria) throws IOException {
|
||||
public void exportQuartzJobLog(HttpServletResponse response, SystemQueryQuartzJobArgs criteria) throws IOException {
|
||||
systemQuartzJobService.exportQuartzLogExcel(systemQuartzJobService.queryQuartzLogByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
@PostMapping(value = "/logs")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzLogTb>>> queryQuartzJobLog(QuerySystemQuartzJobArgs criteria) {
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzLogTb>>> queryQuartzJobLog(SystemQueryQuartzJobArgs criteria) {
|
||||
Page<SystemQuartzLogTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzLogByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class SystemQuartzJobController {
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("无效参数id");
|
||||
}
|
||||
// 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义
|
||||
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
||||
checkBean(resources.getBeanName());
|
||||
systemQuartzJobService.createJob(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -81,8 +81,8 @@ public class SystemQuartzJobController {
|
||||
@ApiOperation("修改定时任务")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||
public ResponseEntity<Void> updateQuartzJob(@Validated(SystemQuartzJobTb.Update.class) @RequestBody UpdateSystemQuartzJobArgs resources) {
|
||||
// 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义
|
||||
public ResponseEntity<Void> updateQuartzJob(@Validated(SystemQuartzJobTb.Update.class) @RequestBody SystemUpdateQuartzJobArgs resources) {
|
||||
// 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
||||
checkBean(resources.getBeanName());
|
||||
systemQuartzJobService.modifyQuartzJobResumeCron(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -113,7 +113,7 @@ public class SystemQuartzJobController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义
|
||||
* 验证Bean是不是合法的, 合法的定时任务 Bean 需要用 @Service 定义
|
||||
*
|
||||
* @param beanName Bean名称
|
||||
*/
|
||||
|
||||
+11
-11
@@ -3,12 +3,12 @@ package cn.odboy.system.controller;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.CreateSystemRoleArgs;
|
||||
import cn.odboy.system.dal.model.QuerySystemRoleArgs;
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.system.service.SystemRoleService;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import cn.odboy.system.service.SystemRoleService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -44,7 +44,7 @@ public class SystemRoleController {
|
||||
@ApiOperation("导出角色数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('role:list')")
|
||||
public void exportRole(HttpServletResponse response, QuerySystemRoleArgs criteria) throws IOException {
|
||||
public void exportRole(HttpServletResponse response, SystemQueryRoleArgs criteria) throws IOException {
|
||||
systemRoleService.exportRoleExcel(systemRoleService.queryRoleByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ public class SystemRoleController {
|
||||
@ApiOperation("查询角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemRoleTb>>> queryRoleByArgs(@Validated @RequestBody CsPageArgs<QuerySystemRoleArgs> args) {
|
||||
QuerySystemRoleArgs criteria = args.getArgs();
|
||||
public ResponseEntity<CsResultVo<List<SystemRoleTb>>> queryRoleByArgs(@Validated @RequestBody CsPageArgs<SystemQueryRoleArgs> args) {
|
||||
SystemQueryRoleArgs criteria = args.getArgs();
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemRoleService.queryRoleByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class SystemRoleController {
|
||||
@ApiOperation("新增角色")
|
||||
@PostMapping(value = "/saveRole")
|
||||
@PreAuthorize("@el.check('roles:add')")
|
||||
public ResponseEntity<Void> saveRole(@Validated @RequestBody CreateSystemRoleArgs resources) {
|
||||
public ResponseEntity<Void> saveRole(@Validated @RequestBody SystemCreateRoleArgs resources) {
|
||||
checkRoleLevels(resources.getLevel());
|
||||
systemRoleService.saveRole(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -118,11 +118,11 @@ public class SystemRoleController {
|
||||
* @return /
|
||||
*/
|
||||
private int checkRoleLevels(Integer level) {
|
||||
List<Integer> levels = systemRoleService.queryRoleByUsersId(SecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList());
|
||||
List<Integer> levels = systemRoleService.queryRoleByUsersId(CsSecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList());
|
||||
int min = Collections.min(levels);
|
||||
if (level != null) {
|
||||
if (level < min) {
|
||||
throw new BadRequestException("权限不足,你的角色级别:" + min + ",低于操作的角色级别:" + level);
|
||||
throw new BadRequestException("权限不足, 你的角色级别:" + min + ", 低于操作的角色级别:" + level);
|
||||
}
|
||||
}
|
||||
return min;
|
||||
|
||||
+18
-18
@@ -4,16 +4,16 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.base.CsSelectOptionItemVo;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.system.constant.SystemCaptchaBizEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemUserArgs;
|
||||
import cn.odboy.system.dal.model.UpdateSystemUserPasswordArgs;
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import cn.odboy.system.service.*;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import cn.odboy.util.RsaEncryptUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -52,16 +52,16 @@ public class SystemUserController {
|
||||
@ApiOperation("导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public void exportUserExcel(HttpServletResponse response, QuerySystemUserArgs criteria) throws IOException {
|
||||
public void exportUserExcel(HttpServletResponse response, SystemQueryUserArgs criteria) throws IOException {
|
||||
systemUserService.exportUserExcel(systemUserService.queryUserByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemUserTb>>> queryUserByArgs(@Validated @RequestBody CsPageArgs<QuerySystemUserArgs> args) {
|
||||
public ResponseEntity<CsResultVo<List<SystemUserTb>>> queryUserByArgs(@Validated @RequestBody CsPageArgs<SystemQueryUserArgs> args) {
|
||||
Page<Object> page = new Page<>(args.getPage(), args.getSize());
|
||||
QuerySystemUserArgs criteria = args.getArgs();
|
||||
SystemQueryUserArgs criteria = args.getArgs();
|
||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||
criteria.getDeptIds().add(criteria.getDeptId());
|
||||
// 先查找是否存在子节点
|
||||
@@ -70,7 +70,7 @@ public class SystemUserController {
|
||||
criteria.getDeptIds().addAll(systemDeptService.queryChildDeptIdListByDeptIds(data));
|
||||
}
|
||||
// 数据权限
|
||||
List<Long> dataScopes = systemDataService.queryDeptIdListByArgs(systemUserService.getUserByUsername(SecurityHelper.getCurrentUsername()));
|
||||
List<Long> dataScopes = systemDataService.queryDeptIdListByArgs(systemUserService.getUserByUsername(CsSecurityHelper.getCurrentUsername()));
|
||||
// criteria.getDeptIds() 不为空并且数据权限不为空则取交集
|
||||
if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)) {
|
||||
// 取交集
|
||||
@@ -109,7 +109,7 @@ public class SystemUserController {
|
||||
@ApiOperation("修改用户:个人中心")
|
||||
@PostMapping(value = "modifyUserCenterInfoById")
|
||||
public ResponseEntity<Object> modifyUserCenterInfoById(@Validated(SystemUserTb.Update.class) @RequestBody SystemUserTb resources) {
|
||||
if (!resources.getId().equals(SecurityHelper.getCurrentUserId())) {
|
||||
if (!resources.getId().equals(CsSecurityHelper.getCurrentUserId())) {
|
||||
throw new BadRequestException("不能修改他人资料");
|
||||
}
|
||||
systemUserService.modifyUserCenterInfoById(resources);
|
||||
@@ -121,10 +121,10 @@ public class SystemUserController {
|
||||
@PreAuthorize("@el.check('user:del')")
|
||||
public ResponseEntity<Object> removeUserByIds(@RequestBody Set<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel = Collections.min(systemRoleService.queryRoleByUsersId(SecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
Integer currentLevel = Collections.min(systemRoleService.queryRoleByUsersId(CsSecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
Integer optLevel = Collections.min(systemRoleService.queryRoleByUsersId(id).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足,不能删除:" + systemUserService.getUserById(id).getUsername());
|
||||
throw new BadRequestException("角色权限不足, 不能删除:" + systemUserService.getUserById(id).getUsername());
|
||||
}
|
||||
}
|
||||
systemUserService.removeUserByIds(ids);
|
||||
@@ -133,10 +133,10 @@ public class SystemUserController {
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@PostMapping(value = "/modifyUserPasswordByUsername")
|
||||
public ResponseEntity<Object> modifyUserPasswordByUsername(@RequestBody UpdateSystemUserPasswordArgs passVo) throws Exception {
|
||||
public ResponseEntity<Object> modifyUserPasswordByUsername(@RequestBody SystemUpdateUserPasswordArgs passVo) throws Exception {
|
||||
String oldPass = RsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getOldPass());
|
||||
String newPass = RsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getNewPass());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(SecurityHelper.getCurrentUsername());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(CsSecurityHelper.getCurrentUsername());
|
||||
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class SystemUserController {
|
||||
@PostMapping(value = "/modifyUserEmailByUsername/{code}")
|
||||
public ResponseEntity<Object> modifyUserEmailByUsername(@PathVariable String code, @RequestBody SystemUserTb resources) throws Exception {
|
||||
String password = RsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), resources.getPassword());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(SecurityHelper.getCurrentUsername());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(CsSecurityHelper.getCurrentUsername());
|
||||
if (!passwordEncoder.matches(password, user.getPassword())) {
|
||||
throw new BadRequestException("密码错误");
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class SystemUserController {
|
||||
* @param resources /
|
||||
*/
|
||||
private void checkLevel(SystemUserTb resources) {
|
||||
Integer currentLevel = Collections.min(systemRoleService.queryRoleByUsersId(SecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
Integer currentLevel = Collections.min(systemRoleService.queryRoleByUsersId(CsSecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
Integer optLevel = systemRoleService.getDeptLevelByRoles(resources.getRoles());
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足");
|
||||
@@ -190,9 +190,9 @@ public class SystemUserController {
|
||||
@ApiOperation("查询用户基础数据")
|
||||
@PostMapping(value = "/queryUserMetadataOptions")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<List<CsSelectOptionItemVo>> queryUserMetadataOptions(@Validated @RequestBody CsPageArgs<QuerySystemUserArgs> args) {
|
||||
public ResponseEntity<List<CsSelectOptionItemVo>> queryUserMetadataOptions(@Validated @RequestBody CsPageArgs<SystemQueryUserArgs> args) {
|
||||
int maxPageSize = 50;
|
||||
QuerySystemUserArgs criteria = args.getArgs();
|
||||
SystemQueryUserArgs criteria = args.getArgs();
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(c -> {
|
||||
c.eq(SystemUserTb::getPhone, criteria.getBlurry());
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* OSS存储
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2025-07-15
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_oss_storage")
|
||||
@ApiModel(value = "SystemOssStorage对象", description = "OSS存储")
|
||||
public class SystemOssStorageTb extends CsBaseUserTimeTb {
|
||||
@ApiModelProperty("ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("service_type")
|
||||
@ApiModelProperty("类型,比如minio")
|
||||
private String serviceType;
|
||||
@TableField("endpoint")
|
||||
@ApiModelProperty("服务地址")
|
||||
private String endpoint;
|
||||
@TableField("bucket_name")
|
||||
@ApiModelProperty("存储桶名称")
|
||||
private String bucketName;
|
||||
@TableField("file_name")
|
||||
@ApiModelProperty("完整文件名称")
|
||||
private String fileName;
|
||||
@TableField("file_size")
|
||||
@ApiModelProperty("文件大小, 单位:字节")
|
||||
private Long fileSize;
|
||||
@TableField("file_mime")
|
||||
@ApiModelProperty("文件类型")
|
||||
private String fileMime;
|
||||
@ApiModelProperty("短文件名")
|
||||
@TableField("file_prefix")
|
||||
private String filePrefix;
|
||||
@ApiModelProperty("文件后缀")
|
||||
@TableField("file_suffix")
|
||||
private String fileSuffix;
|
||||
@TableField("file_md5")
|
||||
@ApiModelProperty("文件md5")
|
||||
private String fileMd5;
|
||||
@TableField("file_url")
|
||||
@ApiModelProperty("文件链接")
|
||||
private String fileUrl;
|
||||
@TableField("file_code")
|
||||
@ApiModelProperty("文件编码")
|
||||
private String fileCode;
|
||||
@TableField("object_name")
|
||||
@ApiModelProperty("对象路径")
|
||||
private String objectName;
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 七牛云对象存储配置类
|
||||
*/
|
||||
@Data
|
||||
@TableName("system_qiniu_config")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemQiniuConfigTb extends CsObject {
|
||||
|
||||
@TableId("config_id")
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "accessKey")
|
||||
private String accessKey;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "secretKey")
|
||||
private String secretKey;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "存储空间名称作为唯一的 Bucket 识别符")
|
||||
private String bucket;
|
||||
|
||||
/**
|
||||
* Zone表示与机房的对应关系
|
||||
* 华东 Zone.zone0()
|
||||
* 华北 Zone.zone1()
|
||||
* 华南 Zone.zone2()
|
||||
* 北美 Zone.zoneNa0()
|
||||
* 东南亚 Zone.zoneAs0()
|
||||
*/
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "Zone表示与机房的对应关系")
|
||||
private String zone;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "外链域名,可自定义,需在七牛云绑定")
|
||||
private String host;
|
||||
|
||||
@ApiModelProperty(value = "空间类型:公开/私有")
|
||||
private String type = "公开";
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 上传成功后,存储结果
|
||||
*/
|
||||
@Data
|
||||
@TableName("system_qiniu_content")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemQiniuContentTb extends CsObject {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@TableField("name")
|
||||
@ApiModelProperty(value = "文件名")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "空间名")
|
||||
private String bucket;
|
||||
|
||||
@ApiModelProperty(value = "大小")
|
||||
private String size;
|
||||
|
||||
@ApiModelProperty(value = "文件地址")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
private String suffix;
|
||||
|
||||
@ApiModelProperty(value = "空间类型:公开/私有")
|
||||
private String type = "公开";
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "创建或更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class QuerySystemQiniuArgs {
|
||||
|
||||
@ApiModelProperty(value = "名称查询")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@ApiModelProperty(value = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@ApiModelProperty(value = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CreateSystemDeptArgs extends CsObject {
|
||||
public class SystemCreateDeptArgs extends CsObject {
|
||||
@NotBlank(message = "部门名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "部门排序必填")
|
||||
+1
-1
@@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CreateSystemDictArgs extends CsObject {
|
||||
public class SystemCreateDictArgs extends CsObject {
|
||||
@NotBlank(message = "字典名称必填")
|
||||
private String name;
|
||||
private String description;
|
||||
+1
-1
@@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CreateSystemDictDetailArgs extends CsObject {
|
||||
public class SystemCreateDictDetailArgs extends CsObject {
|
||||
@NotNull(message = "参数dict必填")
|
||||
private SystemDictTb dict;
|
||||
@NotBlank(message = "字典标签必填")
|
||||
+1
-1
@@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CreateSystemJobArgs extends CsObject {
|
||||
public class SystemCreateJobArgs extends CsObject {
|
||||
@NotBlank(message = "职位名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "职位排序必填")
|
||||
+1
-1
@@ -11,7 +11,7 @@ import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CreateSystemRoleArgs extends CsObject {
|
||||
public class SystemCreateRoleArgs extends CsObject {
|
||||
@NotBlank(message = "角色名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "角色级别必填")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemOssStorageVo extends SystemOssStorageTb {
|
||||
private String fileSizeDesc;
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QuerySystemDeptArgs {
|
||||
public class SystemQueryDeptArgs {
|
||||
|
||||
@ApiModelProperty(value = "部门id集合")
|
||||
private List<Long> ids;
|
||||
+1
-1
@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuerySystemDictArgs {
|
||||
public class SystemQueryDictArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
+1
-1
@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuerySystemDictDetailArgs {
|
||||
public class SystemQueryDictDetailArgs {
|
||||
|
||||
@ApiModelProperty(value = "标签")
|
||||
private String label;
|
||||
+1
-1
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class QuerySystemJobArgs {
|
||||
public class SystemQueryJobArgs {
|
||||
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String name;
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class QuerySystemMenuArgs {
|
||||
public class SystemQueryMenuArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class QuerySystemQuartzJobArgs {
|
||||
public class SystemQueryQuartzJobArgs {
|
||||
|
||||
@ApiModelProperty(value = "定时任务名称")
|
||||
private String jobName;
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class QuerySystemRoleArgs {
|
||||
public class SystemQueryRoleArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class QuerySystemLocalStorageArgs {
|
||||
public class SystemQueryStorageArgs {
|
||||
|
||||
@ApiModelProperty(value = "模糊查询")
|
||||
private String blurry;
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class QuerySystemUserArgs extends CsObject {
|
||||
public class SystemQueryUserArgs extends CsObject {
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SendSystemEmailArgs {
|
||||
public class SystemSendEmailArgs {
|
||||
|
||||
@NotEmpty
|
||||
@ApiModelProperty(value = "收件人")
|
||||
+1
-1
@@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class UpdateSystemQuartzJobArgs extends CsObject {
|
||||
public class SystemUpdateQuartzJobArgs extends CsObject {
|
||||
@NotNull
|
||||
private Long id;
|
||||
private String uuid;
|
||||
+1
-1
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
* 修改密码
|
||||
*/
|
||||
@Data
|
||||
public class UpdateSystemUserPasswordArgs {
|
||||
public class SystemUpdateUserPasswordArgs {
|
||||
|
||||
@ApiModelProperty(value = "旧密码")
|
||||
private String oldPass;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemDeptArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDeptMapper extends BaseMapper<SystemDeptTb> {
|
||||
List<SystemDeptTb> selectDeptByArgs(@Param("criteria") QuerySystemDeptArgs criteria);
|
||||
List<SystemDeptTb> selectDeptByArgs(@Param("criteria") SystemQueryDeptArgs criteria);
|
||||
|
||||
List<SystemDeptTb> selectDeptByPid(@Param("pid") Long pid);
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictDetailArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -19,9 +19,9 @@ import java.util.Set;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
||||
IPage<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") QuerySystemDictDetailArgs criteria, Page<Object> page);
|
||||
IPage<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria, Page<Object> page);
|
||||
|
||||
List<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") QuerySystemDictDetailArgs criteria);
|
||||
List<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria);
|
||||
|
||||
void deleteDictDetailByDictIds(@Param("dictIds") Set<Long> dictIds);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemDictArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDictMapper extends BaseMapper<SystemDictTb> {
|
||||
IPage<SystemDictTb> selectDictByArgs(@Param("criteria") QuerySystemDictArgs criteria, Page<SystemDictTb> page);
|
||||
IPage<SystemDictTb> selectDictByArgs(@Param("criteria") SystemQueryDictArgs criteria, Page<SystemDictTb> page);
|
||||
|
||||
List<SystemDictTb> selectDictByArgs(@Param("criteria") QuerySystemDictArgs criteria);
|
||||
List<SystemDictTb> selectDictByArgs(@Param("criteria") SystemQueryDictArgs criteria);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,5 +17,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface SystemJobMapper extends BaseMapper<SystemJobTb> {
|
||||
SystemJobTb getJobByName(@Param("name") String name);
|
||||
|
||||
IPage<SystemJobTb> selectJobByArgs(@Param("criteria") QuerySystemJobArgs criteria, Page<SystemJobTb> page);
|
||||
IPage<SystemJobTb> selectJobByArgs(@Param("criteria") SystemQueryJobArgs criteria, Page<SystemJobTb> page);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemLocalStorageArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -15,5 +15,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemLocalStorageMapper extends BaseMapper<SystemLocalStorageTb> {
|
||||
IPage<SystemLocalStorageTb> selectLocalStorageByArgs(@Param("criteria") QuerySystemLocalStorageArgs criteria, Page<SystemLocalStorageTb> page);
|
||||
IPage<SystemLocalStorageTb> selectLocalStorageByArgs(@Param("criteria") SystemQueryStorageArgs criteria, Page<SystemLocalStorageTb> page);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemMenuArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -19,7 +19,7 @@ import java.util.Set;
|
||||
@Mapper
|
||||
public interface SystemMenuMapper extends BaseMapper<SystemMenuTb> {
|
||||
|
||||
List<SystemMenuTb> selectMenuByArgs(@Param("criteria") QuerySystemMenuArgs criteria);
|
||||
List<SystemMenuTb> selectMenuByArgs(@Param("criteria") SystemQueryMenuArgs criteria);
|
||||
|
||||
LinkedHashSet<SystemMenuTb> selectMenuByRoleIdsAndType(@Param("roleIds") Set<Long> roleIds, @Param("type") Integer type);
|
||||
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* OSS存储 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2025-07-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemOssStorageMapper extends BaseMapper<SystemOssStorageTb> {
|
||||
IPage<SystemOssStorageTb> selectOssStorageByArgs(SystemQueryStorageArgs criteria, Page<SystemOssStorageTb> page);
|
||||
List<SystemOssStorageTb> selectOssStorageByArgs(SystemQueryStorageArgs criteria);
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQiniuConfigTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 七牛云配置表 Mapper
|
||||
*
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQiniuConfigMapper extends BaseMapper<SystemQiniuConfigTb> {
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQiniuContentTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemQiniuArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 七牛云存储记录 Mapper
|
||||
*
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQiniuContentMapper extends BaseMapper<SystemQiniuContentTb> {
|
||||
SystemQiniuContentTb getQiniuContentByName(@Param("name") String name);
|
||||
|
||||
IPage<SystemQiniuContentTb> selectQiniuContentByArgs(@Param("criteria") QuerySystemQiniuArgs criteria, Page<SystemQiniuContentTb> page);
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQuartzJobMapper extends BaseMapper<SystemQuartzJobTb> {
|
||||
IPage<SystemQuartzJobTb> selectQuartzJobByArgs(@Param("criteria") QuerySystemQuartzJobArgs criteria, Page<SystemQuartzJobTb> page);
|
||||
IPage<SystemQuartzJobTb> selectQuartzJobByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzJobTb> page);
|
||||
|
||||
List<SystemQuartzJobTb> selectAllEnableQuartzJob();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemQuartzJobArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -16,5 +16,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQuartzLogMapper extends BaseMapper<SystemQuartzLogTb> {
|
||||
IPage<SystemQuartzLogTb> selectQuartzLogByArgs(@Param("criteria") QuerySystemQuartzJobArgs criteria, Page<SystemQuartzLogTb> page);
|
||||
IPage<SystemQuartzLogTb> selectQuartzLogByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzLogTb> page);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -18,9 +18,9 @@ import java.util.Set;
|
||||
public interface SystemRoleMapper extends BaseMapper<SystemRoleTb> {
|
||||
List<SystemRoleTb> selectAllRole();
|
||||
|
||||
List<SystemRoleTb> selectRoleByArgs(@Param("criteria") QuerySystemRoleArgs criteria);
|
||||
List<SystemRoleTb> selectRoleByArgs(@Param("criteria") SystemQueryRoleArgs criteria);
|
||||
|
||||
Long countRoleByArgs(@Param("criteria") QuerySystemRoleArgs criteria);
|
||||
Long countRoleByArgs(@Param("criteria") SystemQueryRoleArgs criteria);
|
||||
|
||||
SystemRoleTb getRoleByName(@Param("name") String name);
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.QuerySystemUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -13,7 +13,7 @@ import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface SystemUserMapper extends BaseMapper<SystemUserTb> {
|
||||
IPage<SystemUserTb> selectUserByArgs(@Param("criteria") QuerySystemUserArgs criteria, Page<SystemUserTb> page);
|
||||
IPage<SystemUserTb> selectUserByArgs(@Param("criteria") SystemQueryUserArgs criteria, Page<SystemUserTb> page);
|
||||
|
||||
SystemUserTb getUserByUsername(@Param("username") String username);
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface SystemUserMapper extends BaseMapper<SystemUserTb> {
|
||||
|
||||
Long countUserByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
|
||||
Long countUserByArgs(@Param("criteria") QuerySystemUserArgs criteria);
|
||||
Long countUserByArgs(@Param("criteria") SystemQueryUserArgs criteria);
|
||||
|
||||
void updateUserPasswordByUsername(@Param("username") String username, @Param("password") String password);
|
||||
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package cn.odboy.system.dal.redis;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.util.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package cn.odboy.system.dal.redis;
|
||||
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.system.framework.permission.core.handler.TokenProvider;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.util.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package cn.odboy.system.framework.mybatisplus;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -20,7 +20,7 @@ public class MpMetaObjectHandler implements MetaObjectHandler {
|
||||
/* 操作人 */
|
||||
String username = "System";
|
||||
try {
|
||||
username = SecurityHelper.getCurrentUsername();
|
||||
username = CsSecurityHelper.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
this.strictInsertFill(metaObject, "createBy", String.class, username);
|
||||
@@ -34,7 +34,7 @@ public class MpMetaObjectHandler implements MetaObjectHandler {
|
||||
/* 操作人 */
|
||||
String username = "System";
|
||||
try {
|
||||
username = SecurityHelper.getCurrentUsername();
|
||||
username = CsSecurityHelper.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
this.strictUpdateFill(metaObject, "updateBy", String.class, username);
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package cn.odboy.system.framework.permission.config;
|
||||
|
||||
import cn.odboy.system.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.system.framework.permission.core.CsSecurityHelper;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class AuthorityConfig {
|
||||
*/
|
||||
public Boolean check(String... permissions) {
|
||||
// 获取当前用户的所有权限
|
||||
List<String> roleList = SecurityHelper.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
|
||||
List<String> roleList = CsSecurityHelper.getCurrentUser().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList());
|
||||
// 判断当前用户的所有权限是否包含接口上定义的权限
|
||||
return roleList.contains("admin") || Arrays.stream(permissions).anyMatch(roleList::contains);
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SecurityHelper {
|
||||
public class CsSecurityHelper {
|
||||
/**
|
||||
* 获取当前登录的用户
|
||||
*
|
||||
+2
-2
@@ -4,10 +4,10 @@ import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.redis.SystemRedisKey;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.RedisHelper;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.redis.SystemRedisKey;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtParser;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user