refactor(system): 重构系统模块接口和数据结构
- 更新了多个控制器的接口设计,使用 CsPageArgs 封装分页参数 - 修改了部分 API 的 HTTP 方法,优化了请求结构 - 统一了查询接口的命名规范 - 调整了部分参数和返回值类型,提高了代码复用性
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import request from '@/utils/request'
|
||||
import qs from 'qs'
|
||||
|
||||
// export function initData(url, params) {
|
||||
// return request({
|
||||
// url: url + '?' + qs.stringify(params, { indices: false }),
|
||||
// method: 'get'
|
||||
// })
|
||||
// }
|
||||
|
||||
export function initData(url, params) {
|
||||
return request({
|
||||
url: url + '?' + qs.stringify(params, { indices: false }),
|
||||
method: 'get'
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import request from '@/utils/request'
|
||||
export function queryDeptList(params) {
|
||||
return request({
|
||||
url: 'api/dept',
|
||||
method: 'get',
|
||||
params
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export function queryDeptSuperiorTree(ids, exclude) {
|
||||
return request({
|
||||
url: 'api/dept/queryDeptSuperiorTree?exclude=' + exclude,
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/dept/saveDept',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/dept/modifyDept',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/dict/saveDict',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/dict/modifyDictById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,35 +2,24 @@ import request from '@/utils/request'
|
||||
|
||||
export function get(dictName) {
|
||||
const params = {
|
||||
dictName,
|
||||
page: 0,
|
||||
size: 9999
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: {
|
||||
dictName: dictName
|
||||
}
|
||||
}
|
||||
return request({
|
||||
url: 'api/dictDetail',
|
||||
method: 'get',
|
||||
params
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// export function getDictMap(dictName) {
|
||||
// const params = {
|
||||
// dictName,
|
||||
// page: 0,
|
||||
// size: 9999
|
||||
// }
|
||||
// return request({
|
||||
// url: 'api/dictDetail/getDictDetailMaps',
|
||||
// method: 'get',
|
||||
// params
|
||||
// })
|
||||
// }
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/dictDetail/saveDictDetail',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -46,7 +35,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/dictDetail/modifyDictDetailById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export function modifyEmailConfig(data) {
|
||||
return request({
|
||||
url: 'api/email/modifyEmailConfig',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ export function sendEmail(data) {
|
||||
return request({
|
||||
url: 'api/email/sendEmail',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -2,14 +2,16 @@ import request from '@/utils/request'
|
||||
|
||||
export function getAllJob() {
|
||||
const params = {
|
||||
page: 0,
|
||||
size: 9999,
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
return request({
|
||||
url: 'api/job',
|
||||
method: 'get',
|
||||
params
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,7 +19,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/job/saveJob',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -33,7 +35,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/job/modifyJobById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ export function queryMenuListByPid(pid) {
|
||||
export function getMenus(params) {
|
||||
return request({
|
||||
url: 'api/menus',
|
||||
method: 'get',
|
||||
params
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function queryMenuSuperior(ids) {
|
||||
return request({
|
||||
url: 'api/menus/queryMenuSuperior',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/menus/saveMenu',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/menus/modifyMenuById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export function modifyQiniuConfig(data) {
|
||||
return request({
|
||||
url: 'api/qiNiuContent/modifyQiniuConfig',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
+7
-7
@@ -2,15 +2,15 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/jobs',
|
||||
url: 'api/quartzJob/createQuartzJob',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/jobs',
|
||||
url: 'api/quartzJob',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
@@ -18,22 +18,22 @@ export function del(ids) {
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/jobs',
|
||||
url: 'api/quartzJob',
|
||||
method: 'put',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function switchQuartzJobStatus(id) {
|
||||
return request({
|
||||
url: 'api/jobs/switchQuartzJobStatus/' + id,
|
||||
url: 'api/quartzJob/switchQuartzJobStatus/' + id,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function startQuartzJob(id) {
|
||||
return request({
|
||||
url: 'api/jobs/startQuartzJob/' + id,
|
||||
url: 'api/quartzJob/startQuartzJob/' + id,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
@@ -12,7 +12,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/roles/saveRole',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/roles/modifyRoleById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ export function add(data) {
|
||||
return request({
|
||||
url: 'api/users/saveUser',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export function edit(data) {
|
||||
return request({
|
||||
url: 'api/users/modifyUserById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function editUser(data) {
|
||||
return request({
|
||||
url: 'api/users/modifyUserCenterInfoById',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export function updatePass(user) {
|
||||
return request({
|
||||
url: 'api/users/modifyUserPasswordByUsername',
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -61,19 +61,22 @@ export function updateEmail(form) {
|
||||
return request({
|
||||
url: 'api/users/modifyUserEmailByUsername/' + form.code,
|
||||
method: 'post',
|
||||
data
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function queryUserMetaPage(query) {
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 50,
|
||||
args: {
|
||||
blurry: query
|
||||
}
|
||||
}
|
||||
return request({
|
||||
url: 'api/users/queryUserMetadataOptions',
|
||||
method: 'post',
|
||||
data: {
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
blurry: query
|
||||
}
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { initData, download } from '@/api/data'
|
||||
import { parseTime, downloadFile } from '@/utils/index'
|
||||
import { download, initData } from '@/api/data'
|
||||
import { downloadFile, parseTime } from '@/utils/index'
|
||||
import Vue from 'vue'
|
||||
|
||||
/**
|
||||
@@ -348,9 +348,11 @@ function CRUD(options) {
|
||||
return {
|
||||
page: crud.page.page,
|
||||
size: crud.page.size,
|
||||
args: {
|
||||
...crud.query,
|
||||
...crud.params
|
||||
}
|
||||
}
|
||||
},
|
||||
// 当前页改变
|
||||
pageChangeHandler(e) {
|
||||
|
||||
@@ -60,7 +60,11 @@ export default {
|
||||
params['pid'] = node.data.id
|
||||
}
|
||||
setTimeout(() => {
|
||||
queryDeptList(params).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: params
|
||||
}).then(res => {
|
||||
if (resolve) {
|
||||
resolve(res.content)
|
||||
} else {
|
||||
|
||||
@@ -29,14 +29,11 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="顶级部门">
|
||||
<el-radio-group v-model="form.isTop" style="width: 140px">
|
||||
<el-radio-group v-model="form.isTop" style="width: 370px">
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="enabled">
|
||||
<el-radio v-for="item in dict.dept_status" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.isTop === '0'" style="margin-bottom: 0;" label="上级部门" prop="pid">
|
||||
<treeselect
|
||||
v-model="form.pid"
|
||||
@@ -46,6 +43,9 @@
|
||||
placeholder="选择上级类目"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="enabled">
|
||||
<el-radio v-for="item in dict.dept_status" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
@@ -139,7 +139,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getDeptDatas(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { pid: tree.id }
|
||||
}
|
||||
setTimeout(() => {
|
||||
crudDept.queryDeptList(params).then(res => {
|
||||
resolve(res.content)
|
||||
@@ -178,7 +182,11 @@ export default {
|
||||
})
|
||||
},
|
||||
getDepts() {
|
||||
crudDept.queryDeptList({ enabled: true }).then(res => {
|
||||
crudDept.queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -190,7 +198,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudDept.queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
crudDept.queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryEmailConfig, modifyEmailConfig } from '@/api/tools/email'
|
||||
import { queryEmailConfig, modifyEmailConfig } from '@/api/system/email'
|
||||
export default {
|
||||
name: 'Config',
|
||||
data() {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendEmail } from '@/api/tools/email'
|
||||
import { sendEmail } from '@/api/system/email'
|
||||
import { upload } from '@/utils/upload'
|
||||
import { mapGetters } from 'vuex'
|
||||
import E from 'wangeditor'
|
||||
|
||||
@@ -200,7 +200,11 @@ export default {
|
||||
}
|
||||
},
|
||||
getMenus(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
const params = {
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { pid: tree.id }
|
||||
}
|
||||
setTimeout(() => {
|
||||
crudMenu.getMenus(params).then(res => {
|
||||
resolve(res.content)
|
||||
@@ -220,7 +224,7 @@ export default {
|
||||
},
|
||||
loadMenus({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudMenu.getMenusTree(parentNode.id).then(res => {
|
||||
crudMenu.queryMenuListByPid(parentNode.id).then(res => {
|
||||
parentNode.children = res.map(function(obj) {
|
||||
if (!obj.leaf) {
|
||||
obj.children = null
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-input v-model="query.username" clearable size="small" placeholder="输入用户名称查询" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<el-input v-model="query.userName" clearable size="small" placeholder="输入用户名称查询" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation>
|
||||
@@ -55,7 +55,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { kickOutUser } from '@/api/monitor/online'
|
||||
import { kickOutUser } from '@/api/system/online'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -65,7 +65,7 @@ export default {
|
||||
name: 'OnlineUser',
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
cruds() {
|
||||
return CRUD({ url: 'auth/online', title: '在线用户' })
|
||||
return CRUD({ url: 'api/user/online', title: '在线用户' })
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
data() {
|
||||
|
||||
+11
-11
@@ -85,16 +85,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column :show-overflow-tooltip="true" prop="description" width="150px" label="描述" />
|
||||
<el-table-column :show-overflow-tooltip="true" prop="createTime" width="136px" label="创建日期" />
|
||||
<el-table-column v-if="checkPer(['admin','timing:edit','timing:del'])" label="操作" width="170px" align="center" fixed="right">
|
||||
<el-table-column v-if="checkPer(['admin','quartzJob:edit','quartzJob:del'])" label="操作" width="170px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-permission="['admin','timing:edit']" size="mini" style="margin-right: 3px;" type="text" @click="crud.toEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-permission="['admin','timing:edit']" style="margin-left: -2px" type="text" size="mini" @click="execute(scope.row.id)">执行</el-button>
|
||||
<el-button v-permission="['admin','timing:edit']" style="margin-left: 3px" type="text" size="mini" @click="updateStatus(scope.row.id,scope.row.isPause ? '恢复' : '暂停')">
|
||||
<el-button v-permission="['admin','quartzJob:edit']" size="mini" style="margin-right: 3px;" type="text" @click="crud.toEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-permission="['admin','quartzJob:edit']" style="margin-left: -2px" type="text" size="mini" @click="execute(scope.row.id)">执行</el-button>
|
||||
<el-button v-permission="['admin','quartzJob:edit']" style="margin-left: 3px" type="text" size="mini" @click="updateStatus(scope.row.id,scope.row.isPause ? '恢复' : '暂停')">
|
||||
{{ scope.row.isPause ? '恢复' : '暂停' }}
|
||||
</el-button>
|
||||
<el-popover
|
||||
:ref="scope.row.id"
|
||||
v-permission="['admin','timing:del']"
|
||||
v-permission="['admin','quartzJob:del']"
|
||||
placement="top"
|
||||
width="200"
|
||||
>
|
||||
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudJob from '@/api/quartzjob/timing'
|
||||
import crudJob from '@/api/system/quartzJob'
|
||||
import Log from './log'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
@@ -124,19 +124,19 @@ import DateRangePicker from '@/components/DateRangePicker'
|
||||
|
||||
const defaultForm = { id: null, jobName: null, subTask: null, beanName: null, methodName: null, params: null, cronExpression: null, pauseAfterFailure: true, isPause: false, personInCharge: null, email: null, description: null }
|
||||
export default {
|
||||
name: 'Timing',
|
||||
name: 'QuartzJob',
|
||||
components: { Log, pagination, crudOperation, rrOperation, DateRangePicker },
|
||||
cruds() {
|
||||
return CRUD({ title: '定时任务', url: 'api/jobs', crudMethod: { ...crudJob }})
|
||||
return CRUD({ title: '定时任务', url: 'api/quartzJob', crudMethod: { ...crudJob }})
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
return {
|
||||
delLoading: false,
|
||||
permission: {
|
||||
add: ['admin', 'timing:add'],
|
||||
edit: ['admin', 'timing:edit'],
|
||||
del: ['admin', 'timing:del']
|
||||
add: ['admin', 'quartzJob:add'],
|
||||
edit: ['admin', 'quartzJob:edit'],
|
||||
del: ['admin', 'quartzJob:del']
|
||||
},
|
||||
rules: {
|
||||
jobName: [
|
||||
+1
-1
@@ -82,7 +82,7 @@ export default {
|
||||
},
|
||||
// 获取数据前设置好接口地址
|
||||
beforeInit() {
|
||||
this.url = 'api/jobs/logs'
|
||||
this.url = 'api/quartzJob/logs'
|
||||
this.size = 6
|
||||
return true
|
||||
},
|
||||
@@ -284,7 +284,11 @@ export default {
|
||||
},
|
||||
// 获取部门数据
|
||||
getDepts() {
|
||||
queryDeptList({ enabled: true }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -317,7 +321,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
@@ -376,7 +376,11 @@ export default {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
getDepts() {
|
||||
queryDeptList({ enabled: true }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true }
|
||||
}).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
@@ -405,7 +409,11 @@ export default {
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
queryDeptList({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
queryDeptList({
|
||||
page: 1,
|
||||
size: 999999,
|
||||
args: { enabled: true, pid: parentNode.id }
|
||||
}).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
|
||||
@@ -5,6 +5,9 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 结果封装类
|
||||
*/
|
||||
@@ -15,4 +18,11 @@ import lombok.NoArgsConstructor;
|
||||
public class CsResultVo<T> extends CsSerializeObject {
|
||||
private T content;
|
||||
private long totalElements;
|
||||
|
||||
public static <T> CsResultVo<List<T>> emptyListData() {
|
||||
CsResultVo<List<T>> result = new CsResultVo<>();
|
||||
result.setTotalElements(0);
|
||||
result.setContent(new ArrayList<>());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ public final class CsPageUtil extends cn.hutool.core.util.PageUtil {
|
||||
/**
|
||||
* List 分页
|
||||
*/
|
||||
public static <T> List<T> softPaging(int page, int size, List<T> list) {
|
||||
int pageIndex = page - 1;
|
||||
int fromIndex = pageIndex * size;
|
||||
int toIndex = pageIndex * size + size;
|
||||
public static <T> List<T> softPaging(long page, long size, List<T> list) {
|
||||
int pageIndex = Math.toIntExact(page - 1);
|
||||
int fromIndex = Math.toIntExact(pageIndex * size);
|
||||
int toIndex = Math.toIntExact(pageIndex * size + size);
|
||||
if (fromIndex > list.size()) {
|
||||
return Collections.emptyList();
|
||||
} else if (toIndex >= list.size()) {
|
||||
|
||||
@@ -89,21 +89,21 @@ public final class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小转换 -> ok
|
||||
* 文件大小转换
|
||||
*/
|
||||
public static String getSize(long size) {
|
||||
String resultSize;
|
||||
if (size / GB >= 1) {
|
||||
//如果当前Byte的值大于等于1GB
|
||||
resultSize = DF.format(size / (float) GB) + "GB ";
|
||||
resultSize = DF.format(size / (float) GB) + " GB";
|
||||
} else if (size / MB >= 1) {
|
||||
//如果当前Byte的值大于等于1MB
|
||||
resultSize = DF.format(size / (float) MB) + "MB ";
|
||||
resultSize = DF.format(size / (float) MB) + " MB";
|
||||
} else if (size / KB >= 1) {
|
||||
//如果当前Byte的值大于等于1KB
|
||||
resultSize = DF.format(size / (float) KB) + "KB ";
|
||||
resultSize = DF.format(size / (float) KB) + " KB";
|
||||
} else {
|
||||
resultSize = size + "B ";
|
||||
resultSize = size + " B";
|
||||
}
|
||||
return resultSize;
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.core.dal.model.CreateSystemDeptArgs;
|
||||
@@ -37,9 +38,10 @@ public class SystemDeptController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemDeptTb>>> queryDeptPage(QuerySystemDeptArgs criteria) throws Exception {
|
||||
public ResponseEntity<CsResultVo<List<SystemDeptTb>>> queryDept(@Validated @RequestBody CsPageArgs<QuerySystemDeptArgs> args) throws Exception {
|
||||
QuerySystemDeptArgs criteria = args.getArgs();
|
||||
List<SystemDeptTb> depts = systemDeptService.queryAllDept(criteria, true);
|
||||
return new ResponseEntity<>(CsPageUtil.toPage(depts), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.core.dal.model.CreateSystemDictArgs;
|
||||
@@ -42,9 +43,10 @@ public class SystemDictController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemDictTb>>> queryDict(QuerySystemDictArgs criteria) {
|
||||
public ResponseEntity<CsResultVo<List<SystemDictTb>>> queryDictByArgs(@Validated @RequestBody CsPageArgs<QuerySystemDictArgs> args) {
|
||||
QuerySystemDictArgs criteria = args.getArgs();
|
||||
Page<SystemDictTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemDictService.queryDictByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.core.dal.model.CreateSystemDictDetailArgs;
|
||||
@@ -27,8 +28,9 @@ public class SystemDictDetailController {
|
||||
private final SystemDictDetailService systemDictDetailService;
|
||||
|
||||
@ApiOperation("查询字典详情")
|
||||
@GetMapping
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> selectDictDetailByArgs(QuerySystemDictDetailArgs criteria) {
|
||||
@PostMapping
|
||||
public ResponseEntity<CsResultVo<List<SystemDictDetailTb>>> queryDictDetailByArgs(@Validated @RequestBody CsPageArgs<QuerySystemDictDetailArgs> args) {
|
||||
QuerySystemDictDetailArgs criteria = args.getArgs();
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemDictDetailService.queryDictDetailByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.core.dal.model.CreateSystemJobArgs;
|
||||
@@ -36,9 +37,10 @@ public class SystemJobController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJob(QuerySystemJobArgs criteria) {
|
||||
public ResponseEntity<CsResultVo<List<SystemJobTb>>> queryJobByArgs(@Validated @RequestBody CsPageArgs<QuerySystemJobArgs> args) {
|
||||
QuerySystemJobArgs criteria = args.getArgs();
|
||||
Page<SystemJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemJobService.queryJobByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,6 +1,7 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.core.dal.model.QuerySystemMenuArgs;
|
||||
@@ -64,10 +65,11 @@ public class SystemMenuController {
|
||||
return new ResponseEntity<>(ids, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryMenu(QuerySystemMenuArgs criteria) throws Exception {
|
||||
public ResponseEntity<CsResultVo<List<SystemMenuTb>>> queryAllMenu(@Validated @RequestBody CsPageArgs<QuerySystemMenuArgs> args) throws Exception {
|
||||
QuerySystemMenuArgs criteria = args.getArgs();
|
||||
List<SystemMenuTb> menuList = systemMenuService.queryAllMenu(criteria, true);
|
||||
return new ResponseEntity<>(CsPageUtil.toPage(menuList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+9
-4
@@ -1,9 +1,12 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.core.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.util.DesEncryptUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -11,6 +14,7 @@ import org.springframework.data.domain.Pageable;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
@@ -21,16 +25,17 @@ import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/auth/online")
|
||||
@RequestMapping("/api/user/online")
|
||||
@Api(tags = "系统:在线用户管理")
|
||||
public class SystemOnlineController {
|
||||
private final SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
||||
|
||||
@ApiOperation("查询在线用户")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check()")
|
||||
public ResponseEntity<CsResultVo<List<SystemUserOnlineVo>>> queryOnlineUser(String username, Pageable pageable) {
|
||||
return new ResponseEntity<>(systemUserOnlineInfoDAO.queryUserOnlineModelPage(username, pageable), HttpStatus.OK);
|
||||
public ResponseEntity<CsResultVo<List<SystemUserOnlineVo>>> queryOnlineUser(@Validated @RequestBody CsPageArgs<SystemUserOnlineVo> args) {
|
||||
IPage<SystemUserOnlineVo> page = new Page<>(args.getPage(), args.getSize());
|
||||
return new ResponseEntity<>(systemUserOnlineInfoDAO.queryUserOnlineModelPage(args.getArgs(), page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
|
||||
+6
-4
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemQiniuConfigTb;
|
||||
import cn.odboy.core.dal.dataobject.SystemQiniuContentTb;
|
||||
@@ -56,15 +57,16 @@ public class SystemQiniuController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@GetMapping
|
||||
public ResponseEntity<CsResultVo<List<SystemQiniuContentTb>>> queryQiNiu(QuerySystemQiniuArgs criteria) {
|
||||
@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
|
||||
public ResponseEntity<Map<String, Object>> uploadQiNiu(@RequestParam MultipartFile file) {
|
||||
@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());
|
||||
|
||||
+16
-14
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.context.SpringBeanHolder;
|
||||
import cn.odboy.core.dal.dataobject.SystemQuartzJobTb;
|
||||
@@ -28,44 +29,45 @@ import java.util.Set;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/jobs")
|
||||
@RequestMapping("/api/quartzJob")
|
||||
@Api(tags = "系统:定时任务管理")
|
||||
public class SystemQuartzJobController {
|
||||
private final SystemQuartzJobService systemQuartzJobService;
|
||||
|
||||
@ApiOperation("查询定时任务")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJob(QuerySystemQuartzJobArgs criteria) {
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJobByArgs(@Validated @RequestBody CsPageArgs<QuerySystemQuartzJobArgs> args) {
|
||||
QuerySystemQuartzJobArgs criteria = args.getArgs();
|
||||
Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzJobByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJob(HttpServletResponse response, QuerySystemQuartzJobArgs criteria) throws IOException {
|
||||
systemQuartzJobService.exportQuartzJobExcel(systemQuartzJobService.queryQuartzJobByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public void exportQuartzJobLog(HttpServletResponse response, QuerySystemQuartzJobArgs criteria) throws IOException {
|
||||
systemQuartzJobService.exportQuartzLogExcel(systemQuartzJobService.queryQuartzLogByArgs(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
@GetMapping(value = "/logs")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PostMapping(value = "/logs")
|
||||
@PreAuthorize("@el.check('quartzJob:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemQuartzLogTb>>> queryQuartzJobLog(QuerySystemQuartzJobArgs criteria) {
|
||||
Page<SystemQuartzLogTb> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemQuartzJobService.queryQuartzLogByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("新增定时任务")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('timing:add')")
|
||||
@PostMapping(value = "/createQuartzJob")
|
||||
@PreAuthorize("@el.check('quartzJob:add')")
|
||||
public ResponseEntity<Void> createQuartzJob(@Validated @RequestBody SystemQuartzJobTb resources) {
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("无效参数id");
|
||||
@@ -78,7 +80,7 @@ public class SystemQuartzJobController {
|
||||
|
||||
@ApiOperation("修改定时任务")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||
public ResponseEntity<Void> updateQuartzJob(@Validated(SystemQuartzJobTb.Update.class) @RequestBody UpdateSystemQuartzJobArgs resources) {
|
||||
// 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义
|
||||
checkBean(resources.getBeanName());
|
||||
@@ -88,7 +90,7 @@ public class SystemQuartzJobController {
|
||||
|
||||
@ApiOperation("更改定时任务状态")
|
||||
@PostMapping(value = "/switchQuartzJobStatus/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||
public ResponseEntity<Void> switchQuartzJobStatus(@PathVariable Long id) {
|
||||
systemQuartzJobService.switchQuartzJobStatus(systemQuartzJobService.getQuartzJobById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -96,7 +98,7 @@ public class SystemQuartzJobController {
|
||||
|
||||
@ApiOperation("执行定时任务")
|
||||
@PostMapping(value = "/startQuartzJob/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@el.check('quartzJob:edit')")
|
||||
public ResponseEntity<Void> startQuartzJob(@PathVariable Long id) {
|
||||
systemQuartzJobService.startQuartzJob(systemQuartzJobService.getQuartzJobById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -104,7 +106,7 @@ public class SystemQuartzJobController {
|
||||
|
||||
@ApiOperation("删除定时任务")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('timing:del')")
|
||||
@PreAuthorize("@el.check('quartzJob:del')")
|
||||
public ResponseEntity<Void> removeJobByIds(@RequestBody Set<Long> ids) {
|
||||
systemQuartzJobService.removeJobByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+6
-4
@@ -1,6 +1,7 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.core.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.core.dal.model.CreateSystemRoleArgs;
|
||||
@@ -48,16 +49,17 @@ public class SystemRoleController {
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的角色")
|
||||
@PostMapping(value = "/selectAllRole")
|
||||
@PostMapping(value = "/queryRoleList")
|
||||
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
|
||||
public ResponseEntity<List<SystemRoleTb>> selectAllRole() {
|
||||
public ResponseEntity<List<SystemRoleTb>> queryRoleList() {
|
||||
return new ResponseEntity<>(systemRoleService.queryAllRole(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemRoleTb>>> queryRolePage(QuerySystemRoleArgs criteria) {
|
||||
public ResponseEntity<CsResultVo<List<SystemRoleTb>>> queryRoleByArgs(@Validated @RequestBody CsPageArgs<QuerySystemRoleArgs> args) {
|
||||
QuerySystemRoleArgs criteria = args.getArgs();
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
return new ResponseEntity<>(systemRoleService.queryRoleByArgs(criteria, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
+7
-5
@@ -1,6 +1,7 @@
|
||||
package cn.odboy.core.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.odboy.base.CsPageArgs;
|
||||
import cn.odboy.base.CsResultVo;
|
||||
import cn.odboy.base.CsSelectOptionItemVo;
|
||||
import cn.odboy.core.constant.SystemCaptchaBizEnum;
|
||||
@@ -12,7 +13,6 @@ import cn.odboy.core.dal.model.UpdateSystemUserPasswordArgs;
|
||||
import cn.odboy.core.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.core.framework.properties.AppProperties;
|
||||
import cn.odboy.core.service.*;
|
||||
import cn.odboy.core.service.system.*;
|
||||
import cn.odboy.exception.BadRequestException;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import cn.odboy.util.RsaEncryptUtil;
|
||||
@@ -57,10 +57,11 @@ public class SystemUserController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@GetMapping
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<CsResultVo<List<SystemUserTb>>> queryUser(QuerySystemUserArgs criteria) {
|
||||
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
||||
public ResponseEntity<CsResultVo<List<SystemUserTb>>> queryUserByArgs(@Validated @RequestBody CsPageArgs<QuerySystemUserArgs> args) {
|
||||
Page<Object> page = new Page<>(args.getPage(), args.getSize());
|
||||
QuerySystemUserArgs criteria = args.getArgs();
|
||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||
criteria.getDeptIds().add(criteria.getDeptId());
|
||||
// 先查找是否存在子节点
|
||||
@@ -189,8 +190,9 @@ public class SystemUserController {
|
||||
@ApiOperation("查询用户基础数据")
|
||||
@PostMapping(value = "/queryUserMetadataOptions")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<List<CsSelectOptionItemVo>> queryUserMetadataOptions(@Validated @RequestBody QuerySystemUserArgs criteria) {
|
||||
public ResponseEntity<List<CsSelectOptionItemVo>> queryUserMetadataOptions(@Validated @RequestBody CsPageArgs<QuerySystemUserArgs> args) {
|
||||
int maxPageSize = 50;
|
||||
QuerySystemUserArgs criteria = args.getArgs();
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(c -> {
|
||||
c.eq(SystemUserTb::getPhone, criteria.getBlurry());
|
||||
|
||||
+8
-4
@@ -7,9 +7,9 @@ import cn.odboy.core.framework.permission.core.handler.TokenProvider;
|
||||
import cn.odboy.core.framework.properties.AppProperties;
|
||||
import cn.odboy.redis.RedisHelper;
|
||||
import cn.odboy.util.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -107,14 +107,18 @@ public class SystemUserOnlineInfoDAO {
|
||||
/**
|
||||
* 查询全部数据
|
||||
*
|
||||
* @param username /
|
||||
* @param onlineVo /
|
||||
* @param pageable /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public CsResultVo<List<SystemUserOnlineVo>> queryUserOnlineModelPage(String username, Pageable pageable) {
|
||||
public CsResultVo<List<SystemUserOnlineVo>> queryUserOnlineModelPage(SystemUserOnlineVo onlineVo, IPage<SystemUserOnlineVo> pageable) {
|
||||
String username = null;
|
||||
if (onlineVo != null) {
|
||||
username = onlineVo.getUserName();
|
||||
}
|
||||
List<SystemUserOnlineVo> onlineUserList = queryUserOnlineModelListByUsername(username);
|
||||
List<SystemUserOnlineVo> paging = CsPageUtil.softPaging(pageable.getPageNumber(), pageable.getPageSize(), onlineUserList);
|
||||
List<SystemUserOnlineVo> paging = CsPageUtil.softPaging(pageable.getCurrent(), pageable.getSize(), onlineUserList);
|
||||
return CsPageUtil.toPage(paging, onlineUserList.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.odboy.core.dal.redis.SystemUserInfoDAO;
|
||||
import cn.odboy.core.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.core.framework.permission.core.SecurityHelper;
|
||||
import cn.odboy.core.framework.properties.AppProperties;
|
||||
import cn.odboy.core.framework.server.core.FileUploadPathHelper;
|
||||
import cn.odboy.exception.BadRequestException;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import cn.odboy.util.FileUtil;
|
||||
@@ -40,6 +41,7 @@ public class SystemUserService {
|
||||
private final AppProperties properties;
|
||||
private final SystemUserInfoDAO systemUserInfoDAO;
|
||||
private final SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
||||
private final FileUploadPathHelper fileUploadPathHelper;
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
@@ -202,7 +204,7 @@ public class SystemUserService {
|
||||
throw new BadRequestException("异常用户数据,请联系管理员处理");
|
||||
}
|
||||
// 文件大小验证
|
||||
FileUtil.checkSize(properties.getFile().getAvatarMaxSize(), multipartFile.getSize());
|
||||
FileUtil.checkSize(fileUploadPathHelper.getAvatarMaxSize(), multipartFile.getSize());
|
||||
// 验证文件上传的格式
|
||||
String image = "gif jpg png jpeg";
|
||||
String fileType = FileUtil.getSuffix(multipartFile.getOriginalFilename());
|
||||
@@ -210,7 +212,7 @@ public class SystemUserService {
|
||||
throw new BadRequestException("文件格式错误!, 仅支持 " + image + " 格式");
|
||||
}
|
||||
String oldPath = user.getAvatarPath();
|
||||
File file = FileUtil.upload(multipartFile, properties.getFile().getPath().getAvatar());
|
||||
File file = FileUtil.upload(multipartFile, fileUploadPathHelper.getPath());
|
||||
user.setAvatarPath(Objects.requireNonNull(file).getPath());
|
||||
user.setAvatarName(file.getName());
|
||||
systemUserMapper.insertOrUpdate(user);
|
||||
|
||||
Reference in New Issue
Block a user