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