mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 10:36:31 +08:00
commit:同步2.0版本(添加指定审批人功能)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// @import "../element-variables-light.scss";
|
@import "../element-variables-light.scss";
|
||||||
@import "../element-variables-dark.scss";
|
// @import "../element-variables-dark.scss";
|
||||||
// @import "../element-variables-green.scss";
|
// @import "../element-variables-green.scss";
|
||||||
// @import "../element-variables-orange.scss";
|
// @import "../element-variables-orange.scss";
|
||||||
// @import "../element-variables-blue.scss";
|
// @import "../element-variables-blue.scss";
|
||||||
@@ -1398,8 +1398,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none; }
|
outline: none; }
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover, .el-dropdown-menu__item:focus {
|
.el-dropdown-menu__item:not(.is-disabled):hover, .el-dropdown-menu__item:focus {
|
||||||
background-color: #409EFF;
|
background-color: #ecf5ff;
|
||||||
color: #FFFFFF; }
|
color: #66b1ff; }
|
||||||
.el-dropdown-menu__item i {
|
.el-dropdown-menu__item i {
|
||||||
margin-right: 5px; }
|
margin-right: 5px; }
|
||||||
.el-dropdown-menu__item--divided {
|
.el-dropdown-menu__item--divided {
|
||||||
|
|||||||
@@ -8039,8 +8039,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none; }
|
outline: none; }
|
||||||
.el-dropdown-menu__item:not(.is-disabled):hover, .el-dropdown-menu__item:focus {
|
.el-dropdown-menu__item:not(.is-disabled):hover, .el-dropdown-menu__item:focus {
|
||||||
background-color: #409EFF;
|
background-color: #ecf5ff;
|
||||||
color: #FFFFFF; }
|
color: #66b1ff; }
|
||||||
.el-dropdown-menu__item i {
|
.el-dropdown-menu__item i {
|
||||||
margin-right: 5px; }
|
margin-right: 5px; }
|
||||||
.el-dropdown-menu__item--divided {
|
.el-dropdown-menu__item--divided {
|
||||||
@@ -8583,7 +8583,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
background-color: #272C34; }
|
background-color: #FFFFFF; }
|
||||||
.el-menu::before,
|
.el-menu::before,
|
||||||
.el-menu::after {
|
.el-menu::after {
|
||||||
display: table;
|
display: table;
|
||||||
@@ -8700,7 +8700,7 @@
|
|||||||
height: 56px;
|
height: 56px;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #303133;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -8716,7 +8716,7 @@
|
|||||||
color: #909399; }
|
color: #909399; }
|
||||||
.el-menu-item:hover, .el-menu-item:focus {
|
.el-menu-item:hover, .el-menu-item:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-menu-item.is-disabled {
|
.el-menu-item.is-disabled {
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
@@ -8740,7 +8740,7 @@
|
|||||||
height: 56px;
|
height: 56px;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #303133;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -8756,13 +8756,13 @@
|
|||||||
color: #909399; }
|
color: #909399; }
|
||||||
.el-submenu__title:hover, .el-submenu__title:focus {
|
.el-submenu__title:hover, .el-submenu__title:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-submenu__title.is-disabled {
|
.el-submenu__title.is-disabled {
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
background: none !important; }
|
background: none !important; }
|
||||||
.el-submenu__title:hover {
|
.el-submenu__title:hover {
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-submenu .el-menu {
|
.el-submenu .el-menu {
|
||||||
border: none; }
|
border: none; }
|
||||||
.el-submenu .el-menu-item {
|
.el-submenu .el-menu-item {
|
||||||
@@ -19440,8 +19440,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 14px; }
|
font-size: 14px; }
|
||||||
.el-table-filter__list-item:hover {
|
.el-table-filter__list-item:hover {
|
||||||
background-color: #409EFF;
|
background-color: #ecf5ff;
|
||||||
color: #FFFFFF; }
|
color: #66b1ff; }
|
||||||
.el-table-filter__list-item.is-active {
|
.el-table-filter__list-item.is-active {
|
||||||
background-color: #409EFF;
|
background-color: #409EFF;
|
||||||
color: #FFFFFF; }
|
color: #FFFFFF; }
|
||||||
|
|||||||
@@ -490,7 +490,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
background-color: #272C34; }
|
background-color: #FFFFFF; }
|
||||||
.el-menu::before,
|
.el-menu::before,
|
||||||
.el-menu::after {
|
.el-menu::after {
|
||||||
display: table;
|
display: table;
|
||||||
@@ -607,7 +607,7 @@
|
|||||||
height: 56px;
|
height: 56px;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #303133;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -623,7 +623,7 @@
|
|||||||
color: #909399; }
|
color: #909399; }
|
||||||
.el-menu-item:hover, .el-menu-item:focus {
|
.el-menu-item:hover, .el-menu-item:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-menu-item.is-disabled {
|
.el-menu-item.is-disabled {
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
@@ -647,7 +647,7 @@
|
|||||||
height: 56px;
|
height: 56px;
|
||||||
line-height: 56px;
|
line-height: 56px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #FFFFFF;
|
color: #303133;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -663,13 +663,13 @@
|
|||||||
color: #909399; }
|
color: #909399; }
|
||||||
.el-submenu__title:hover, .el-submenu__title:focus {
|
.el-submenu__title:hover, .el-submenu__title:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-submenu__title.is-disabled {
|
.el-submenu__title.is-disabled {
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
background: none !important; }
|
background: none !important; }
|
||||||
.el-submenu__title:hover {
|
.el-submenu__title:hover {
|
||||||
background-color: #409EFF; }
|
background-color: #ecf5ff; }
|
||||||
.el-submenu .el-menu {
|
.el-submenu .el-menu {
|
||||||
border: none; }
|
border: none; }
|
||||||
.el-submenu .el-menu-item {
|
.el-submenu .el-menu-item {
|
||||||
|
|||||||
@@ -1373,8 +1373,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 14px; }
|
font-size: 14px; }
|
||||||
.el-table-filter__list-item:hover {
|
.el-table-filter__list-item:hover {
|
||||||
background-color: #409EFF;
|
background-color: #ecf5ff;
|
||||||
color: #FFFFFF; }
|
color: #66b1ff; }
|
||||||
.el-table-filter__list-item.is-active {
|
.el-table-filter__list-item.is-active {
|
||||||
background-color: #409EFF;
|
background-color: #409EFF;
|
||||||
color: #FFFFFF; }
|
color: #FFFFFF; }
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ const SysFlowTaskOperationType = new DictionaryBase('任务操作类型', [
|
|||||||
id: 'multi_abstain',
|
id: 'multi_abstain',
|
||||||
name: '弃权(会签)',
|
name: '弃权(会签)',
|
||||||
symbol: 'MULTI_ABSTAIN'
|
symbol: 'MULTI_ABSTAIN'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'set_assignee',
|
||||||
|
name: '指定审批人',
|
||||||
|
symbol: 'SET_ASSIGNEE'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
Vue.prototype.SysFlowTaskOperationType = SysFlowTaskOperationType;
|
Vue.prototype.SysFlowTaskOperationType = SysFlowTaskOperationType;
|
||||||
|
|||||||
@@ -35,13 +35,16 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-for="item in uploadWidgetImpl.fileList">
|
<template v-if="widgetConfig.isImage">
|
||||||
<img class="table-cell-image" v-if="widgetConfig.isImage" :key="item.url" :src="item.url" />
|
<el-image v-for="item in uploadWidgetImpl.fileList"
|
||||||
<a v-else :key="item.url" href="javascript:void(0);" @click="downloadFile(item.url, item.name)">
|
:preview-src-list="(uploadWidgetImpl.fileList || []).map(imgItem => imgItem.url)"
|
||||||
|
class="table-cell-image" :key="item.url" :src="item.url" fit="fill">
|
||||||
|
</el-image>
|
||||||
|
</template>
|
||||||
|
<a v-else v-for="item in uploadWidgetImpl.fileList" :key="item.url" href="javascript:void(0);" @click="downloadFile(item.url, item.name)">
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ export default {
|
|||||||
case this.SysFlowTaskOperationType.CO_SIGN:
|
case this.SysFlowTaskOperationType.CO_SIGN:
|
||||||
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
||||||
case this.SysFlowTaskOperationType.MULTI_SIGN:
|
case this.SysFlowTaskOperationType.MULTI_SIGN:
|
||||||
|
case this.SysFlowTaskOperationType.SET_ASSIGNEE:
|
||||||
return 'primary';
|
return 'primary';
|
||||||
case this.SysFlowTaskOperationType.SAVE:
|
case this.SysFlowTaskOperationType.SAVE:
|
||||||
return 'success';
|
return 'success';
|
||||||
@@ -150,6 +151,7 @@ export default {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case this.SysFlowTaskOperationType.AGREE:
|
case this.SysFlowTaskOperationType.AGREE:
|
||||||
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
||||||
|
case this.SysFlowTaskOperationType.SET_ASSIGNEE:
|
||||||
return 'success';
|
return 'success';
|
||||||
case this.SysFlowTaskOperationType.REFUSE:
|
case this.SysFlowTaskOperationType.REFUSE:
|
||||||
case this.SysFlowTaskOperationType.PARALLEL_REFUSE:
|
case this.SysFlowTaskOperationType.PARALLEL_REFUSE:
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export default {
|
|||||||
this.$dialog.show('选择用户', TaskUserSelect, {
|
this.$dialog.show('选择用户', TaskUserSelect, {
|
||||||
area: ['1000px', '600px']
|
area: ['1000px', '600px']
|
||||||
}, {
|
}, {
|
||||||
|
showAssignee: false,
|
||||||
multiple: this.multiSelect
|
multiple: this.multiSelect
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let assignee = null;
|
let assignee = null;
|
||||||
@@ -88,7 +89,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
showAssignSelect () {
|
showAssignSelect () {
|
||||||
return [this.SysFlowTaskOperationType.TRANSFER, this.SysFlowTaskOperationType.CO_SIGN, this.SysFlowTaskOperationType.MULTI_SIGN].indexOf(this.operation.type) !== -1;
|
return [
|
||||||
|
this.SysFlowTaskOperationType.TRANSFER,
|
||||||
|
this.SysFlowTaskOperationType.CO_SIGN,
|
||||||
|
this.SysFlowTaskOperationType.MULTI_SIGN,
|
||||||
|
this.SysFlowTaskOperationType.SET_ASSIGNEE
|
||||||
|
].indexOf(this.operation.type) !== -1;
|
||||||
},
|
},
|
||||||
multiSelect () {
|
multiSelect () {
|
||||||
return this.operation.type === this.SysFlowTaskOperationType.CO_SIGN || this.operation.type === this.SysFlowTaskOperationType.MULTI_SIGN;
|
return this.operation.type === this.SysFlowTaskOperationType.CO_SIGN || this.operation.type === this.SysFlowTaskOperationType.MULTI_SIGN;
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
<el-button type="primary" size="mini" @click="setStartUser">
|
<el-button type="primary" size="mini" @click="setStartUser">
|
||||||
流程发起人
|
流程发起人
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button v-if="showAssignee" type="primary" size="mini" @click="useAppointedAssignee">
|
||||||
|
使用指定审批人
|
||||||
|
</el-button>
|
||||||
<el-button type="primary" size="mini" @click="onSubmit" :disabled="!canCommit">
|
<el-button type="primary" size="mini" @click="onSubmit" :disabled="!canCommit">
|
||||||
添加用户
|
添加用户
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -77,6 +80,11 @@ import { SystemController } from '@/api';
|
|||||||
export default {
|
export default {
|
||||||
name: 'TaskUserSelect',
|
name: 'TaskUserSelect',
|
||||||
props: {
|
props: {
|
||||||
|
// 是否显示指定审批人
|
||||||
|
showAssignee: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
// 是否多选
|
// 是否多选
|
||||||
multiple: {
|
multiple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -122,6 +130,12 @@ export default {
|
|||||||
loginName: '${startUserName}'
|
loginName: '${startUserName}'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
useAppointedAssignee () {
|
||||||
|
this.onCancel(true, {
|
||||||
|
/* eslint-disable-next-line */
|
||||||
|
loginName: '${appointedAssignee}'
|
||||||
|
});
|
||||||
|
},
|
||||||
canSelect (row) {
|
canSelect (row) {
|
||||||
if (Array.isArray(this.usedUserIdList) && this.usedUserIdList.length > 0) {
|
if (Array.isArray(this.usedUserIdList) && this.usedUserIdList.length > 0) {
|
||||||
return this.usedUserIdList.indexOf(row.loginName) === -1;
|
return this.usedUserIdList.indexOf(row.loginName) === -1;
|
||||||
|
|||||||
@@ -136,10 +136,15 @@ export default {
|
|||||||
if (this.isOnlineForm) {
|
if (this.isOnlineForm) {
|
||||||
this.$refs.workflowForm.getFormData().then(formData => {
|
this.$refs.workflowForm.getFormData().then(formData => {
|
||||||
formData.taskVariableData = this.$refs.workflowForm.getVariableData(this.variableList);
|
formData.taskVariableData = this.$refs.workflowForm.getVariableData(this.variableList);
|
||||||
// 会签操作设置多实例处理人集合
|
|
||||||
if (operationType === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
if (operationType === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
||||||
|
// 会签操作设置多实例处理人集合
|
||||||
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
||||||
formData.taskVariableData.assigneeList = assignee.split(',');
|
formData.taskVariableData.assigneeList = assignee.split(',');
|
||||||
|
} else if (operationType === this.SysFlowTaskOperationType.SET_ASSIGNEE) {
|
||||||
|
// 设置下一个任务节点处理人
|
||||||
|
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
||||||
|
formData.taskVariableData.appointedAssignee = assignee;
|
||||||
}
|
}
|
||||||
resolve(formData);
|
resolve(formData);
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ export default {
|
|||||||
isStart ? resolve() : reject();
|
isStart ? resolve() : reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 会签或者审批操作
|
// 会签、指定审批人或者审批操作
|
||||||
if (!isStart || operation.type === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
if (!isStart || operation.type === this.SysFlowTaskOperationType.MULTI_SIGN || operation.type === this.SysFlowTaskOperationType.SET_ASSIGNEE) {
|
||||||
let title = isStart ? '提交' : (operation.type === this.SysFlowTaskOperationType.CO_SIGN ? '加签' : '审批');
|
let title = isStart ? '提交' : (operation.type === this.SysFlowTaskOperationType.CO_SIGN ? '加签' : '审批');
|
||||||
this.$dialog.show(title, TaskCommit, {
|
this.$dialog.show(title, TaskCommit, {
|
||||||
area: '500px'
|
area: '500px'
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ const SysFlowTaskOperationType = new DictionaryBase('任务操作类型', [
|
|||||||
id: 'multi_abstain',
|
id: 'multi_abstain',
|
||||||
name: '弃权(会签)',
|
name: '弃权(会签)',
|
||||||
symbol: 'MULTI_ABSTAIN'
|
symbol: 'MULTI_ABSTAIN'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'set_assignee',
|
||||||
|
name: '指定审批人',
|
||||||
|
symbol: 'SET_ASSIGNEE'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
Vue.prototype.SysFlowTaskOperationType = SysFlowTaskOperationType;
|
Vue.prototype.SysFlowTaskOperationType = SysFlowTaskOperationType;
|
||||||
|
|||||||
@@ -35,13 +35,16 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-for="item in uploadWidgetImpl.fileList">
|
<template v-if="widgetConfig.isImage">
|
||||||
<img class="table-cell-image" v-if="widgetConfig.isImage" :key="item.url" :src="item.url" />
|
<el-image v-for="item in uploadWidgetImpl.fileList"
|
||||||
<a v-else :key="item.url" href="javascript:void(0);" @click="downloadFile(item.url, item.name)">
|
:preview-src-list="(uploadWidgetImpl.fileList || []).map(imgItem => imgItem.url)"
|
||||||
|
class="table-cell-image" :key="item.url" :src="item.url" fit="fill">
|
||||||
|
</el-image>
|
||||||
|
</template>
|
||||||
|
<a v-else v-for="item in uploadWidgetImpl.fileList" :key="item.url" href="javascript:void(0);" @click="downloadFile(item.url, item.name)">
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ export default {
|
|||||||
case this.SysFlowTaskOperationType.CO_SIGN:
|
case this.SysFlowTaskOperationType.CO_SIGN:
|
||||||
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
||||||
case this.SysFlowTaskOperationType.MULTI_SIGN:
|
case this.SysFlowTaskOperationType.MULTI_SIGN:
|
||||||
|
case this.SysFlowTaskOperationType.SET_ASSIGNEE:
|
||||||
return 'primary';
|
return 'primary';
|
||||||
case this.SysFlowTaskOperationType.SAVE:
|
case this.SysFlowTaskOperationType.SAVE:
|
||||||
return 'success';
|
return 'success';
|
||||||
@@ -150,6 +151,7 @@ export default {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case this.SysFlowTaskOperationType.AGREE:
|
case this.SysFlowTaskOperationType.AGREE:
|
||||||
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
case this.SysFlowTaskOperationType.MULTI_AGREE:
|
||||||
|
case this.SysFlowTaskOperationType.SET_ASSIGNEE:
|
||||||
return 'success';
|
return 'success';
|
||||||
case this.SysFlowTaskOperationType.REFUSE:
|
case this.SysFlowTaskOperationType.REFUSE:
|
||||||
case this.SysFlowTaskOperationType.PARALLEL_REFUSE:
|
case this.SysFlowTaskOperationType.PARALLEL_REFUSE:
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export default {
|
|||||||
this.$dialog.show('选择用户', TaskUserSelect, {
|
this.$dialog.show('选择用户', TaskUserSelect, {
|
||||||
area: ['1000px', '600px']
|
area: ['1000px', '600px']
|
||||||
}, {
|
}, {
|
||||||
|
showAssignee: false,
|
||||||
multiple: this.multiSelect
|
multiple: this.multiSelect
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let assignee = null;
|
let assignee = null;
|
||||||
@@ -88,7 +89,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
showAssignSelect () {
|
showAssignSelect () {
|
||||||
return [this.SysFlowTaskOperationType.TRANSFER, this.SysFlowTaskOperationType.CO_SIGN, this.SysFlowTaskOperationType.MULTI_SIGN].indexOf(this.operation.type) !== -1;
|
return [
|
||||||
|
this.SysFlowTaskOperationType.TRANSFER,
|
||||||
|
this.SysFlowTaskOperationType.CO_SIGN,
|
||||||
|
this.SysFlowTaskOperationType.MULTI_SIGN,
|
||||||
|
this.SysFlowTaskOperationType.SET_ASSIGNEE
|
||||||
|
].indexOf(this.operation.type) !== -1;
|
||||||
},
|
},
|
||||||
multiSelect () {
|
multiSelect () {
|
||||||
return this.operation.type === this.SysFlowTaskOperationType.CO_SIGN || this.operation.type === this.SysFlowTaskOperationType.MULTI_SIGN;
|
return this.operation.type === this.SysFlowTaskOperationType.CO_SIGN || this.operation.type === this.SysFlowTaskOperationType.MULTI_SIGN;
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
<el-button type="primary" size="mini" @click="setStartUser">
|
<el-button type="primary" size="mini" @click="setStartUser">
|
||||||
流程发起人
|
流程发起人
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button v-if="showAssignee" type="primary" size="mini" @click="useAppointedAssignee">
|
||||||
|
使用指定审批人
|
||||||
|
</el-button>
|
||||||
<el-button type="primary" size="mini" @click="onSubmit" :disabled="!canCommit">
|
<el-button type="primary" size="mini" @click="onSubmit" :disabled="!canCommit">
|
||||||
添加用户
|
添加用户
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -77,6 +80,11 @@ import { SystemController } from '@/api';
|
|||||||
export default {
|
export default {
|
||||||
name: 'TaskUserSelect',
|
name: 'TaskUserSelect',
|
||||||
props: {
|
props: {
|
||||||
|
// 是否显示指定审批人
|
||||||
|
showAssignee: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
// 是否多选
|
// 是否多选
|
||||||
multiple: {
|
multiple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -122,6 +130,12 @@ export default {
|
|||||||
loginName: '${startUserName}'
|
loginName: '${startUserName}'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
useAppointedAssignee () {
|
||||||
|
this.onCancel(true, {
|
||||||
|
/* eslint-disable-next-line */
|
||||||
|
loginName: '${appointedAssignee}'
|
||||||
|
});
|
||||||
|
},
|
||||||
canSelect (row) {
|
canSelect (row) {
|
||||||
if (Array.isArray(this.usedUserIdList) && this.usedUserIdList.length > 0) {
|
if (Array.isArray(this.usedUserIdList) && this.usedUserIdList.length > 0) {
|
||||||
return this.usedUserIdList.indexOf(row.loginName) === -1;
|
return this.usedUserIdList.indexOf(row.loginName) === -1;
|
||||||
|
|||||||
@@ -136,10 +136,15 @@ export default {
|
|||||||
if (this.isOnlineForm) {
|
if (this.isOnlineForm) {
|
||||||
this.$refs.workflowForm.getFormData().then(formData => {
|
this.$refs.workflowForm.getFormData().then(formData => {
|
||||||
formData.taskVariableData = this.$refs.workflowForm.getVariableData(this.variableList);
|
formData.taskVariableData = this.$refs.workflowForm.getVariableData(this.variableList);
|
||||||
// 会签操作设置多实例处理人集合
|
|
||||||
if (operationType === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
if (operationType === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
||||||
|
// 会签操作设置多实例处理人集合
|
||||||
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
||||||
formData.taskVariableData.assigneeList = assignee.split(',');
|
formData.taskVariableData.assigneeList = assignee.split(',');
|
||||||
|
} else if (operationType === this.SysFlowTaskOperationType.SET_ASSIGNEE) {
|
||||||
|
// 设置下一个任务节点处理人
|
||||||
|
if (formData.taskVariableData == null) formData.taskVariableData = {};
|
||||||
|
formData.taskVariableData.appointedAssignee = assignee;
|
||||||
}
|
}
|
||||||
resolve(formData);
|
resolve(formData);
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ export default {
|
|||||||
isStart ? resolve() : reject();
|
isStart ? resolve() : reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 会签或者审批操作
|
// 会签、指定审批人或者审批操作
|
||||||
if (!isStart || operation.type === this.SysFlowTaskOperationType.MULTI_SIGN) {
|
if (!isStart || operation.type === this.SysFlowTaskOperationType.MULTI_SIGN || operation.type === this.SysFlowTaskOperationType.SET_ASSIGNEE) {
|
||||||
let title = isStart ? '提交' : (operation.type === this.SysFlowTaskOperationType.CO_SIGN ? '加签' : '审批');
|
let title = isStart ? '提交' : (operation.type === this.SysFlowTaskOperationType.CO_SIGN ? '加签' : '审批');
|
||||||
this.$dialog.show(title, TaskCommit, {
|
this.$dialog.show(title, TaskCommit, {
|
||||||
area: '500px'
|
area: '500px'
|
||||||
|
|||||||
1
orange-demo-multi/orange-demo-multi-service/.idea/.name
generated
Normal file
1
orange-demo-multi/orange-demo-multi-service/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
OrangeMultiDemo
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.baomidou:mybatis-plus:3.4.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus/3.4.2/mybatis-plus-3.4.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus/3.4.2/mybatis-plus-3.4.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus/3.4.2/mybatis-plus-3.4.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-annotation/3.4.2/mybatis-plus-annotation-3.4.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-annotation/3.4.2/mybatis-plus-annotation-3.4.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-annotation/3.4.2/mybatis-plus-annotation-3.4.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-boot-starter/3.4.2/mybatis-plus-boot-starter-3.4.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-boot-starter/3.4.2/mybatis-plus-boot-starter-3.4.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-boot-starter/3.4.2/mybatis-plus-boot-starter-3.4.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.baomidou:mybatis-plus-core:3.4.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-core/3.4.2/mybatis-plus-core-3.4.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-core/3.4.2/mybatis-plus-core-3.4.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-core/3.4.2/mybatis-plus-core-3.4.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.baomidou:mybatis-plus-extension:3.4.2">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-extension/3.4.2/mybatis-plus-extension-3.4.2.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-extension/3.4.2/mybatis-plus-extension-3.4.2-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/baomidou/mybatis-plus-extension/3.4.2/mybatis-plus-extension-3.4.2-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.google.code.gson:gson:2.8.6">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.6/gson-2.8.6-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.6/gson-2.8.6-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.thoughtworks.qdox:qdox:2.0.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/thoughtworks/qdox/qdox/2.0.0/qdox-2.0.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/thoughtworks/qdox/qdox/2.0.0/qdox-2.0.0-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/thoughtworks/qdox/qdox/2.0.0/qdox-2.0.0-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: com.xuxueli:xxl-job-core:2.2.0">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/xuxueli/xxl-job-core/2.2.0/xxl-job-core-2.2.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/xuxueli/xxl-job-core/2.2.0/xxl-job-core-2.2.0-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/com/xuxueli/xxl-job-core/2.2.0/xxl-job-core-2.2.0-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: io.netty:netty-all:4.1.63.Final">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/netty/netty-all/4.1.63.Final/netty-all-4.1.63.Final.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/netty/netty-all/4.1.63.Final/netty-all-4.1.63.Final-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/io/netty/netty-all/4.1.63.Final/netty-all-4.1.63.Final-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.codehaus.groovy:groovy:2.5.14">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
13
orange-demo-multi/orange-demo-multi-service/.idea/libraries/Maven__org_mybatis_mybatis_3_5_5.xml
generated
Normal file
13
orange-demo-multi/orange-demo-multi-service/.idea/libraries/Maven__org_mybatis_mybatis_3_5_5.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.mybatis:mybatis:3.5.5">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.5/mybatis-3.5.5.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.5/mybatis-3.5.5-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis/3.5.5/mybatis-3.5.5-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.mybatis:mybatis-spring:2.0.5">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.5/mybatis-spring-2.0.5.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.5/mybatis-spring-2.0.5-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/mybatis/mybatis-spring/2.0.5/mybatis-spring-2.0.5-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.springframework.kafka:spring-kafka:2.5.12.RELEASE">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/kafka/spring-kafka/2.5.12.RELEASE/spring-kafka-2.5.12.RELEASE.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/kafka/spring-kafka/2.5.12.RELEASE/spring-kafka-2.5.12.RELEASE-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/kafka/spring-kafka/2.5.12.RELEASE/spring-kafka-2.5.12.RELEASE-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/retry/spring-retry/1.2.5.RELEASE/spring-retry-1.2.5.RELEASE.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/retry/spring-retry/1.2.5.RELEASE/spring-retry-1.2.5.RELEASE-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/retry/spring-retry/1.2.5.RELEASE/spring-retry-1.2.5.RELEASE-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Maven: org.springframework:spring-messaging:5.2.14.RELEASE">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.14.RELEASE/spring-messaging-5.2.14.RELEASE.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.14.RELEASE/spring-messaging-5.2.14.RELEASE-javadoc.jar!/" />
|
||||||
|
</JAVADOC>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/springframework/spring-messaging/5.2.14.RELEASE/spring-messaging-5.2.14.RELEASE-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.ribbon:ribbon-transport:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-contexts:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-servo:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.inject:javax.inject:1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-core:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-httpclient:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-client:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-core:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey.contribs:jersey-apache-client4:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.servo:servo-core:0.12.21" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-commons-util:0.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-loadbalancer:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-statistics:0.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-starter-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-hystrix:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-httpclient:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-serialization:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-metrics-event-stream:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-javanica:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava-reactive-streams:1.2.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:4.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-client:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.3-beta" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.3-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration />
|
||||||
|
</facet>
|
||||||
|
<facet type="web" name="Web">
|
||||||
|
<configuration>
|
||||||
|
<webroots />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="common-log" />
|
||||||
|
<orderEntry type="module" module-name="common-sequence" />
|
||||||
|
<orderEntry type="module" module-name="common-core" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-csv:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.6.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.76" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.8.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.jimmyshi:bean-query:1.1.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.5.12.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-alibaba-commons:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.ribbon:ribbon-transport:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-contexts:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty-servo:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.inject:javax.inject:1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: io.reactivex:rxnetty:0.4.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-core:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-httpclient:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-client:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey:jersey-core:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.sun.jersey.contribs:jersey-apache-client4:1.19.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.servo:servo-core:0.12.21" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-commons-util:0.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.ribbon:ribbon-loadbalancer:2.3.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.netflix.netflix-commons:netflix-statistics:0.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-starter-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-hystrix:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-httpclient:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-serialization:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-metrics-event-stream:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-javanica:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava-reactive-streams:1.2.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:4.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-client:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.3-beta" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.3-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>application-consumer</artifactId>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>operation-log-consumer</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<artifactId>common-log</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.*</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.orange.demo.operationlogconsumer;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.cloud.client.SpringCloudApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志消费者服务启动类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@SpringCloudApplication
|
||||||
|
@ComponentScan("com.orange.demo")
|
||||||
|
public class OperationLogConsumerApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(OperationLogConsumerApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.orange.demo.operationlogconsumer.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源配置Bean对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@MapperScan(value = {"com.orange.demo.*.dao", "com.orange.demo.common.*.dao"})
|
||||||
|
public class DataSourceConfig {
|
||||||
|
|
||||||
|
@Bean(initMethod = "init", destroyMethod = "close")
|
||||||
|
@Primary
|
||||||
|
@ConfigurationProperties(prefix = "spring.datasource.druid")
|
||||||
|
public DataSource druidDataSource() {
|
||||||
|
return DruidDataSourceBuilder.create().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.orange.demo.operationlogconsumer.consumer;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
import com.orange.demo.common.log.service.SysOperationLogService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.config.KafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.ConsumerFactory;
|
||||||
|
import org.springframework.kafka.listener.ContainerProperties;
|
||||||
|
import org.springframework.kafka.support.Acknowledgment;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 各个微服务操作日志的消费者对象。该消费者会集中处理操作日志。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class OperationLogConsumer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysOperationLogService sysOperationLogService;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaListenerContainerFactory<?> batchFactory(ConsumerFactory<Integer, String> consumerFactory) {
|
||||||
|
ConcurrentKafkaListenerContainerFactory<Integer, String> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(consumerFactory);
|
||||||
|
factory.setConcurrency(10);
|
||||||
|
factory.getContainerProperties().setPollTimeout(1500);
|
||||||
|
//设置为批量消费,每个批次数量在Kafka配置参数中设置
|
||||||
|
factory.setBatchListener(true);
|
||||||
|
factory.getContainerProperties().setAckMode(ContainerProperties.AckMode.MANUAL_IMMEDIATE);
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@KafkaListener(
|
||||||
|
topics = {"${common-log.operation-log.kafkaTopic}"},
|
||||||
|
containerFactory = "batchFactory",
|
||||||
|
groupId = "operation-log")
|
||||||
|
public void listen(List<ConsumerRecord<?, ?>> recordList, Acknowledgment ack) {
|
||||||
|
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||||
|
List<SysOperationLog> operationLogList = new LinkedList<>();
|
||||||
|
for (ConsumerRecord<?, ?> record : recordList) {
|
||||||
|
Optional<?> message = Optional.ofNullable(record.value());
|
||||||
|
if (message.isPresent()) {
|
||||||
|
SysOperationLog operationLog =
|
||||||
|
JSON.parseObject(message.get().toString(), SysOperationLog.class);
|
||||||
|
operationLogList.add(operationLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(operationLogList)) {
|
||||||
|
try {
|
||||||
|
sysOperationLogService.batchSave(operationLogList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to batchSave SysOperationLog and try again one by one", e);
|
||||||
|
this.safeSave(operationLogList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ack.acknowledge();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void safeSave(List<SysOperationLog> operationLogList) {
|
||||||
|
for (SysOperationLog operationLog : operationLogList) {
|
||||||
|
try {
|
||||||
|
// 如果批量插入失败,为了确保最大限度的将操作日志数据插入到目的表。
|
||||||
|
// 这里我们将逐条插入,对于重复插入直接忽略错误,对于其他异常,需要用户修改后自行处理。
|
||||||
|
sysOperationLogService.saveNew(operationLog);
|
||||||
|
} catch (DuplicateKeyException e1) {
|
||||||
|
// 出现重复的场景,很大可能是因为之前插入数据库成功了,但是提交kafka offset失败了。
|
||||||
|
// 因此就会出现重复消费的情况,我们通过logId主键进行了去重。
|
||||||
|
log.warn("Duplicated Key for logId [{}]", operationLog.getLogId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: operation-log-consumer
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
config:
|
||||||
|
server-addr: localhost:8848
|
||||||
|
file-extension: yaml
|
||||||
|
# 共享配置文件,排序越高后,优先级越高。
|
||||||
|
shared-configs:
|
||||||
|
- data-id: application-dev.yaml
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!-- 本项目全部使用log4j2性能上有很大提升 -->
|
||||||
|
|
||||||
|
<!--monitorInterval="60" 自动检测配置文件更改时间 单位为秒 最小值为5 -->
|
||||||
|
<!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出。 -->
|
||||||
|
<configuration monitorInterval="20" status="OFF">
|
||||||
|
<!--日志变量 -->
|
||||||
|
<properties>
|
||||||
|
<!-- 日志主目录 ,需要保存到文件时请自己配置-->
|
||||||
|
<property name="LOG_HOME">./zzlogs/operation-log-consumer</property>
|
||||||
|
<!-- 日志备份目录 -->
|
||||||
|
<property name="BACKUP_HOME">./zzlogs/operation-log-consumer/backup</property>
|
||||||
|
<!-- 日志输出级别 -->
|
||||||
|
<property name="OUTPUT_LOG_LEVEL">info</property>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="LOG_PATTERN">
|
||||||
|
<!-- 输出格式%d{HH:mm:ss}时间24小时制 -->
|
||||||
|
<!-- %-5p日志级别 5位左对齐 [%t]线程名 [%c]类名 -->
|
||||||
|
<!--%l:输出日志事件的发生位置,相当于%c.%M(%F:%L)的组合,包括类全名、方法、文件名以及在代码中的行数。例如:test.TestLog4j.main(TestLog4j.java:10)。 -->
|
||||||
|
<!-- 另一种输出风格<PatternLayout pattern="级别%-5p [%d{YYYY-MM-dd HH:mm:ss}] [%t] 位置[%l] - 信息:%msg%n" /> -->
|
||||||
|
<!-- [%-5p][%d{yy-MM-dd HH:mm:ss}][%t]==>%m==>%c==>%L%n -->
|
||||||
|
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] [%t] ==> %msg%n
|
||||||
|
</property>
|
||||||
|
<property name="LOG_PATTERN_EX">
|
||||||
|
<!-- 下面注释中 %X{PtxId}, SpanId: %X{PspanId} 为PinPoint 中的traceid -->
|
||||||
|
[%-5p] [%d{YYYY-MM-dd HH:mm:ss}] [%t] ==> [TxId: %X{PtxId}, SpanId: %X{PspanId}] %msg%n
|
||||||
|
</property>
|
||||||
|
<!-- 日志保留天数 -->
|
||||||
|
<property name="EVERY_FILE_COUNT">31</property>
|
||||||
|
<!-- 日志切割的最小单位 -->
|
||||||
|
<property name="EVERY_FILE_SIZE">20M</property>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<appenders>
|
||||||
|
<!--Kafka输出 -->
|
||||||
|
<Kafka name="kafka_log" topic="zz-log-topic" syncSend="false" ignoreExceptions="false">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN_EX}"/>
|
||||||
|
<Property name="bootstrap.servers">localhost:9092</Property>
|
||||||
|
<Property name="max.block.ms">10000</Property>
|
||||||
|
</Kafka>
|
||||||
|
<!--控制台输出 -->
|
||||||
|
<console name="console" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
</console>
|
||||||
|
<!--每次大小超过size,则这size大小的日志会自动进行压缩,作为存档 -->
|
||||||
|
<rollingFile name="file_log" fileName="${LOG_HOME}/operation-log-consumer.log"
|
||||||
|
filePattern="${LOG_HOME}/operation-log-consumer-%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
|
<PatternLayout charset="UTF-8" pattern="${LOG_PATTERN_EX}"/>
|
||||||
|
<!-- 日志切割的最小单位 -->
|
||||||
|
<SizeBasedTriggeringPolicy size="${EVERY_FILE_SIZE}"/>
|
||||||
|
<!-- 默认的日志文件数量 -->
|
||||||
|
<DefaultRolloverStrategy max="${EVERY_FILE_COUNT}"/>
|
||||||
|
</rollingFile>
|
||||||
|
</appenders>
|
||||||
|
|
||||||
|
<!-- 然后定义logger,只有定义了logger并引入的appender,appender才会生效 -->
|
||||||
|
<!-- 这里我们把输出到控制台appender的日志级别设置为DEBUG,便于调试。但是输出文件我们缺省为INFO,两者均可随时修改。-->
|
||||||
|
<Loggers>
|
||||||
|
<Root level="${OUTPUT_LOG_LEVEL}">
|
||||||
|
<AppenderRef ref="console"/>
|
||||||
|
</Root>
|
||||||
|
<AsyncLogger name="com.orange.demo" additivity="false" level="info">
|
||||||
|
<AppenderRef ref="console"/>
|
||||||
|
<AppenderRef ref="kafka_log"/>
|
||||||
|
<AppenderRef ref="file_log"/>
|
||||||
|
</AsyncLogger>
|
||||||
|
<!-- 这里将dao的日志级别设置为DEBUG,是为了SQL语句的输出 -->
|
||||||
|
<AsyncLogger name="com.orange.demo.operationlogconsumer.dao" additivity="false" level="debug">
|
||||||
|
<AppenderRef ref="console"/>
|
||||||
|
<AppenderRef ref="kafka_log"/>
|
||||||
|
<AppenderRef ref="file_log"/>
|
||||||
|
</AsyncLogger>
|
||||||
|
<AsyncLogger name="com.orange.demo.common.log.dao" additivity="false" level="debug">
|
||||||
|
<AppenderRef ref="console"/>
|
||||||
|
<AppenderRef ref="kafka_log"/>
|
||||||
|
<AppenderRef ref="file_log"/>
|
||||||
|
</AsyncLogger>
|
||||||
|
</Loggers>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>OrangeMultiDemo</artifactId>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>application-consumer</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>operation-log-consumer</module>
|
||||||
|
</modules>
|
||||||
|
<dependencies>
|
||||||
|
<!--nacos 服务发现客户端-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package com.orange.demo.upmsapi.client;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.client.BaseFallbackFactory;
|
||||||
|
import com.orange.demo.common.core.config.FeignConfig;
|
||||||
|
import com.orange.demo.common.core.base.client.BaseClient;
|
||||||
|
import com.orange.demo.common.core.object.*;
|
||||||
|
import com.orange.demo.upmsapi.dto.SysDeptDto;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysDeptVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理服务远程数据操作访问接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
name = "upms",
|
||||||
|
configuration = FeignConfig.class,
|
||||||
|
fallbackFactory = SysDeptClient.SysDeptClientFallbackFactory.class)
|
||||||
|
public interface SysDeptClient extends BaseClient<SysDeptDto, SysDeptVo, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于主键的(In-list)条件获取远程数据接口。
|
||||||
|
*
|
||||||
|
* @param deptIds 主键Id集合。
|
||||||
|
* @param withDict 是否包含字典关联。
|
||||||
|
* @return 应答结果对象,包含主对象的数据集合。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/listByIds")
|
||||||
|
ResponseResult<List<SysDeptVo>> listByIds(
|
||||||
|
@RequestParam("deptIds") Set<Long> deptIds,
|
||||||
|
@RequestParam("withDict") Boolean withDict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基于主键Id,获取远程对象。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @param withDict 是否包含字典关联。
|
||||||
|
* @return 应答结果对象,包含主对象数据。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/getById")
|
||||||
|
ResponseResult<SysDeptVo> getById(
|
||||||
|
@RequestParam("deptId") Long deptId,
|
||||||
|
@RequestParam("withDict") Boolean withDict);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断参数列表中指定的主键Id,是否都存在。
|
||||||
|
*
|
||||||
|
* @param deptIds 主键Id集合。
|
||||||
|
* @return 应答结果对象,包含true全部存在,否则false。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/existIds")
|
||||||
|
ResponseResult<Boolean> existIds(@RequestParam("deptIds") Set<Long> deptIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断主键Id是否存在。
|
||||||
|
*
|
||||||
|
* @param deptId 参数主键Id。
|
||||||
|
* @return 应答结果对象,包含true表示存在,否则false。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/existId")
|
||||||
|
ResponseResult<Boolean> existId(@RequestParam("deptId") Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除主键Id关联的对象。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 应答结果对象。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/deleteById")
|
||||||
|
ResponseResult<Integer> deleteById(@RequestParam("deptId") Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除符合过滤条件的数据。
|
||||||
|
*
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @return 应答结果对象,包含删除数量。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/deleteBy")
|
||||||
|
ResponseResult<Integer> deleteBy(@RequestBody SysDeptDto filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程主对象中符合查询条件的数据列表。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含实体对象集合。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/listBy")
|
||||||
|
ResponseResult<MyPageData<SysDeptVo>> listBy(@RequestBody MyQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程主对象中符合查询条件的单条数据对象。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含实体对象。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/getBy")
|
||||||
|
ResponseResult<SysDeptVo> getBy(@RequestBody MyQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程主对象中符合查询条件的数据列表。
|
||||||
|
* 和listBy接口相比,以Map列表的方式返回的主要目的是,降低服务之间的耦合度。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含主对象集合。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/listMapBy")
|
||||||
|
ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程主对象中符合查询条件的数据数量。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含结果数量。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/countBy")
|
||||||
|
ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||||
|
*
|
||||||
|
* @param aggregationParam 聚合参数。
|
||||||
|
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@PostMapping("/sysDept/aggregateBy")
|
||||||
|
ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam);
|
||||||
|
|
||||||
|
@Component("UpmsSysDeptClientFallbackFactory")
|
||||||
|
@Slf4j
|
||||||
|
class SysDeptClientFallbackFactory
|
||||||
|
extends BaseFallbackFactory<SysDeptDto, SysDeptVo, Long, SysDeptClient> implements SysDeptClient {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysDeptClient create(Throwable throwable) {
|
||||||
|
log.error("Exception For Feign Remote Call.", throwable);
|
||||||
|
return new SysDeptClientFallbackFactory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.orange.demo.upmsapi.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与部门关联Dto。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("数据权限与部门关联Dto")
|
||||||
|
@Data
|
||||||
|
public class SysDataPermDeptDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限Id", required = true)
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "关联部门Id", required = true)
|
||||||
|
private Long deptId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.orange.demo.upmsapi.dto;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
|
import com.orange.demo.common.core.validator.ConstDictRef;
|
||||||
|
import com.orange.demo.common.datafilter.constant.DataPermRuleType;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Dto。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("数据权限Dto")
|
||||||
|
@Data
|
||||||
|
public class SysDataPermDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限Id", required = true)
|
||||||
|
@NotNull(message = "数据权限Id不能为空!", groups = {UpdateGroup.class})
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "显示名称", required = true)
|
||||||
|
@NotBlank(message = "数据权限名称不能为空!")
|
||||||
|
private String dataPermName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限规则类型", required = true)
|
||||||
|
@NotNull(message = "数据权限规则类型不能为空!")
|
||||||
|
@ConstDictRef(constDictClass = DataPermRuleType.class)
|
||||||
|
private Integer ruleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id列表(逗号分隔)。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(hidden = true)
|
||||||
|
private String deptIdListString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索字符串。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "LIKE 模糊搜索字符串")
|
||||||
|
private String searchString;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.orange.demo.upmsapi.dto;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SysDeptDto对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("SysDeptDto对象")
|
||||||
|
@Data
|
||||||
|
public class SysDeptDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "部门Id", required = true)
|
||||||
|
@NotNull(message = "数据验证失败,部门Id不能为空!", groups = {UpdateGroup.class})
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "部门名称", required = true)
|
||||||
|
@NotBlank(message = "数据验证失败,部门名称不能为空!")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "显示顺序", required = true)
|
||||||
|
@NotNull(message = "数据验证失败,显示顺序不能为空!")
|
||||||
|
private Integer showOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "父部门Id")
|
||||||
|
private Long parentId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.orange.demo.upmsapi.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录表
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("操作日志Dto")
|
||||||
|
@Data
|
||||||
|
public class SysOperationLogDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "主键Id")
|
||||||
|
private Long logId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型。
|
||||||
|
* 常量值定义可参考SysOperationLogType对象。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作类型")
|
||||||
|
private Integer operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每次请求的Id。
|
||||||
|
* 对于微服务之间的调用,在同一个请求的调用链中,该值是相同的。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "每次请求的Id")
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 请求地址。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "HTTP 请求地址")
|
||||||
|
private String requestUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应答状态。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "应答状态")
|
||||||
|
private Boolean success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作员名称")
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长最小值。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "调用时长最小值")
|
||||||
|
private Long elapseMin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长最大值。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "调用时长最大值")
|
||||||
|
private Long elapseMax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作开始时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作开始时间")
|
||||||
|
private String operationTimeStart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作开始时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作开始时间")
|
||||||
|
private String operationTimeEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.orange.demo.upmsapi.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与部门关联VO。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("数据权限与部门关联VO")
|
||||||
|
@Data
|
||||||
|
public class SysDataPermDeptVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限Id")
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "关联部门Id")
|
||||||
|
private Long deptId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.orange.demo.upmsapi.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限VO。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("数据权限VO")
|
||||||
|
@Data
|
||||||
|
public class SysDataPermVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限Id")
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "显示名称")
|
||||||
|
private String dataPermName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限规则类型")
|
||||||
|
private Integer ruleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id列表(逗号分隔)。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "部门Id列表")
|
||||||
|
private String deptIdListString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建者Id")
|
||||||
|
private Long createUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新者Id")
|
||||||
|
private Long updateUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与部门关联对象列表。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "数据权限与部门关联对象列表")
|
||||||
|
private List<Map<String, Object>> dataPermDeptList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.orange.demo.upmsapi.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SysDeptVO视图对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("SysDeptVO视图对象")
|
||||||
|
@Data
|
||||||
|
public class SysDeptVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "部门Id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "显示顺序")
|
||||||
|
private Integer showOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "父部门Id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建者Id")
|
||||||
|
private Long createUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新者Id")
|
||||||
|
private Long updateUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.orange.demo.upmsapi.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录表
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@ApiModel("操作日志VO")
|
||||||
|
@Data
|
||||||
|
public class SysOperationLogVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志主键Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作日志主键Id")
|
||||||
|
private Long logId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志描述。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "日志描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型。
|
||||||
|
* 常量值定义可参考SysOperationLogType对象。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作类型")
|
||||||
|
private Integer operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口所在服务名称。
|
||||||
|
* 通常为spring.application.name配置项的值。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "接口所在服务名称")
|
||||||
|
private String serviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用的controller全类名。
|
||||||
|
* 之所以为独立字段,是为了便于查询和统计接口的调用频度。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "调用的controller全类名")
|
||||||
|
private String apiClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用的controller中的方法。
|
||||||
|
* 格式为:接口类名 + "." + 方法名。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "调用的controller中的方法")
|
||||||
|
private String apiMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户会话sessionId。
|
||||||
|
* 主要是为了便于统计,以及跟踪查询定位问题。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户会话sessionId")
|
||||||
|
private String sessionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每次请求的Id。
|
||||||
|
* 对于微服务之间的调用,在同一个请求的调用链中,该值是相同的。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "每次请求的Id")
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "调用时长")
|
||||||
|
private Long elapse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 请求方法,如GET。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "HTTP 请求方法")
|
||||||
|
private String requestMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 请求地址。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "HTTP 请求地址")
|
||||||
|
private String requestUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* controller接口参数。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "controller接口参数")
|
||||||
|
private String requestArguments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* controller应答结果。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "controller应答结果")
|
||||||
|
private String responseResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求IP。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "请求IP")
|
||||||
|
private String requestIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应答状态。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "应答状态")
|
||||||
|
private Boolean success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "错误信息")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id。
|
||||||
|
* 仅用于多租户系统,是便于进行对租户的操作查询和统计分析。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "租户Id")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员Id。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作员Id")
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员名称。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作员名称")
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "操作时间")
|
||||||
|
private Date operationTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.orange.demo.upmsservice.config;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表示数据源类型的常量对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public final class DataSourceType {
|
||||||
|
|
||||||
|
public static final int MAIN = 0;
|
||||||
|
/**
|
||||||
|
* 对于多数据源服务,操作日志的数据源类型是固定值。如果有冲突,可以直接修改
|
||||||
|
* ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE的值。
|
||||||
|
* 如果保存SysOperationLog操作日志的数据和其他业务位于同库,为了便于今后的
|
||||||
|
* 迁移,这里也尽量要给其配置单独的数据源类型,今后数据库拆分时,可以直接修改
|
||||||
|
* 该值对应的配置项即可。
|
||||||
|
*/
|
||||||
|
public static final int OPERATION_LOG = ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE;
|
||||||
|
|
||||||
|
private static final Map<String, Integer> TYPE_MAP = new HashMap<>(2);
|
||||||
|
static {
|
||||||
|
TYPE_MAP.put("main", MAIN);
|
||||||
|
TYPE_MAP.put("operation-log", OPERATION_LOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据名称获取字典类型。
|
||||||
|
*
|
||||||
|
* @param name 数据源在配置中的名称。
|
||||||
|
* @return 返回可用于多数据源切换的数据源类型。
|
||||||
|
*/
|
||||||
|
public static Integer getDataSourceTypeByName(String name) {
|
||||||
|
return TYPE_MAP.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私有构造函数,明确标识该常量类的作用。
|
||||||
|
*/
|
||||||
|
private DataSourceType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.orange.demo.upmsservice.config;
|
||||||
|
|
||||||
|
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
|
||||||
|
import com.orange.demo.common.core.config.DynamicDataSource;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源配置对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@MapperScan(value = {"com.orange.demo.*.dao", "com.orange.demo.common.*.dao"})
|
||||||
|
public class MultiDataSourceConfig {
|
||||||
|
|
||||||
|
@Bean(initMethod = "init", destroyMethod = "close")
|
||||||
|
@ConfigurationProperties(prefix = "spring.datasource.druid.main")
|
||||||
|
public DataSource mainDataSource() {
|
||||||
|
return DruidDataSourceBuilder.create().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认生成的用于保存操作日志的数据源,可根据需求修改。
|
||||||
|
* 这里我们还是非常推荐给操作日志使用独立的数据源,这样便于今后的数据迁移。
|
||||||
|
*/
|
||||||
|
@Bean(initMethod = "init", destroyMethod = "close")
|
||||||
|
@ConfigurationProperties(prefix = "spring.datasource.druid.operation-log")
|
||||||
|
public DataSource operationLogDataSource() {
|
||||||
|
return DruidDataSourceBuilder.create().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
public DynamicDataSource dataSource() {
|
||||||
|
Map<Object, Object> targetDataSources = new HashMap<>(1);
|
||||||
|
targetDataSources.put(DataSourceType.MAIN, mainDataSource());
|
||||||
|
targetDataSources.put(DataSourceType.OPERATION_LOG, operationLogDataSource());
|
||||||
|
// 如果当前工程支持在线表单,这里请务必保证upms数据表所在数据库为缺省数据源。
|
||||||
|
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||||
|
dynamicDataSource.setTargetDataSources(targetDataSources);
|
||||||
|
dynamicDataSource.setDefaultTargetDataSource(mainDataSource());
|
||||||
|
return dynamicDataSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,303 @@
|
|||||||
|
package com.orange.demo.upmsservice.controller;
|
||||||
|
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.page.PageMethod;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.orange.demo.common.core.validator.UpdateGroup;
|
||||||
|
import com.orange.demo.common.core.constant.ErrorCodeEnum;
|
||||||
|
import com.orange.demo.common.core.object.*;
|
||||||
|
import com.orange.demo.common.core.util.MyModelUtil;
|
||||||
|
import com.orange.demo.common.core.util.MyCommonUtil;
|
||||||
|
import com.orange.demo.common.core.util.MyPageUtil;
|
||||||
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
|
import com.orange.demo.common.log.annotation.OperationLog;
|
||||||
|
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||||
|
import com.orange.demo.upmsapi.dto.SysDataPermDto;
|
||||||
|
import com.orange.demo.upmsapi.dto.SysUserDto;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysDataPermVo;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysUserVo;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDataPerm;
|
||||||
|
import com.orange.demo.upmsservice.model.SysUser;
|
||||||
|
import com.orange.demo.upmsservice.service.SysDataPermService;
|
||||||
|
import com.orange.demo.upmsservice.service.SysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.groups.Default;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限接口控制器对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Api(tags = "数据权限管理接口")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysDataPerm")
|
||||||
|
public class SysDataPermController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDataPermService sysDataPermService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新数据权限。
|
||||||
|
*
|
||||||
|
* @param sysDataPermDto 新增对象。
|
||||||
|
* @param deptIdListString 数据权限关联的部门Id列表,多个之间逗号分隔。
|
||||||
|
* @return 应答结果对象。包含新增数据权限对象的主键Id。
|
||||||
|
*/
|
||||||
|
@ApiOperationSupport(ignoreParameters = {
|
||||||
|
"sysDataPermDto.dataPermId",
|
||||||
|
"sysDataPermDto.createTimeStart",
|
||||||
|
"sysDataPermDto.createTimeEnd",
|
||||||
|
"sysDataPermDto.searchString"})
|
||||||
|
@OperationLog(type = SysOperationLogType.ADD)
|
||||||
|
@PostMapping("/add")
|
||||||
|
public ResponseResult<Long> add(
|
||||||
|
@MyRequestBody SysDataPermDto sysDataPermDto, @MyRequestBody String deptIdListString) {
|
||||||
|
String errorMessage = MyCommonUtil.getModelValidationError(sysDataPermDto);
|
||||||
|
if (errorMessage != null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
|
}
|
||||||
|
SysDataPerm sysDataPerm = MyModelUtil.copyTo(sysDataPermDto, SysDataPerm.class);
|
||||||
|
CallResult result = sysDataPermService.verifyRelatedData(sysDataPerm, deptIdListString);
|
||||||
|
if (!result.isSuccess()) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
|
}
|
||||||
|
Set<Long> deptIdSet = null;
|
||||||
|
if (result.getData() != null) {
|
||||||
|
deptIdSet = result.getData().getObject("deptIdSet", new TypeReference<Set<Long>>(){});
|
||||||
|
}
|
||||||
|
sysDataPermService.saveNew(sysDataPerm, deptIdSet);
|
||||||
|
return ResponseResult.success(sysDataPerm.getDataPermId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据权限。
|
||||||
|
*
|
||||||
|
* @param sysDataPermDto 更新的数据权限对象。
|
||||||
|
* @param deptIdListString 数据权限关联的部门Id列表,多个之间逗号分隔。
|
||||||
|
* @return 应答结果对象。
|
||||||
|
*/
|
||||||
|
@ApiOperationSupport(ignoreParameters = {
|
||||||
|
"sysDataPermDto.createTimeStart",
|
||||||
|
"sysDataPermDto.createTimeEnd",
|
||||||
|
"sysDataPermDto.searchString"})
|
||||||
|
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
public ResponseResult<Void> update(
|
||||||
|
@MyRequestBody SysDataPermDto sysDataPermDto, @MyRequestBody String deptIdListString) {
|
||||||
|
String errorMessage = MyCommonUtil.getModelValidationError(sysDataPermDto, Default.class, UpdateGroup.class);
|
||||||
|
if (errorMessage != null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
|
}
|
||||||
|
SysDataPerm originalSysDataPerm = sysDataPermService.getById(sysDataPermDto.getDataPermId());
|
||||||
|
if (originalSysDataPerm == null) {
|
||||||
|
errorMessage = "数据验证失败,当前数据权限并不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
SysDataPerm sysDataPerm = MyModelUtil.copyTo(sysDataPermDto, SysDataPerm.class);
|
||||||
|
CallResult result = sysDataPermService.verifyRelatedData(sysDataPerm, deptIdListString);
|
||||||
|
if (!result.isSuccess()) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, result.getErrorMessage());
|
||||||
|
}
|
||||||
|
Set<Long> deptIdSet = null;
|
||||||
|
if (result.getData() != null) {
|
||||||
|
deptIdSet = result.getData().getObject("deptIdSet", new TypeReference<Set<Long>>(){});
|
||||||
|
}
|
||||||
|
if (!sysDataPermService.update(sysDataPerm, originalSysDataPerm, deptIdSet)) {
|
||||||
|
errorMessage = "更新失败,数据不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据权限。
|
||||||
|
*
|
||||||
|
* @param dataPermId 待删除数据权限主键Id。
|
||||||
|
* @return 应答数据结果。
|
||||||
|
*/
|
||||||
|
@OperationLog(type = SysOperationLogType.DELETE)
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public ResponseResult<Void> delete(@MyRequestBody Long dataPermId) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
if (!sysDataPermService.remove(dataPermId)) {
|
||||||
|
String errorMessage = "数据操作失败,数据权限不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限列表。
|
||||||
|
*
|
||||||
|
* @param sysDataPermDtoFilter 数据权限查询过滤对象。
|
||||||
|
* @param orderParam 排序参数。
|
||||||
|
* @param pageParam 分页参数。
|
||||||
|
* @return 应答结果对象。包含数据权限列表。
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseResult<MyPageData<SysDataPermVo>> list(
|
||||||
|
@MyRequestBody SysDataPermDto sysDataPermDtoFilter,
|
||||||
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
|
if (pageParam != null) {
|
||||||
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
|
}
|
||||||
|
SysDataPerm filter = MyModelUtil.copyTo(sysDataPermDtoFilter, SysDataPerm.class);
|
||||||
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysDataPerm.class);
|
||||||
|
List<SysDataPerm> dataPermList = sysDataPermService.getSysDataPermList(filter, orderBy);
|
||||||
|
List<SysDataPermVo> dataPermVoList = MyModelUtil.copyCollectionTo(dataPermList, SysDataPermVo.class);
|
||||||
|
long totalCount = 0L;
|
||||||
|
if (dataPermList instanceof Page) {
|
||||||
|
totalCount = ((Page<SysDataPerm>) dataPermList).getTotal();
|
||||||
|
}
|
||||||
|
return ResponseResult.success(MyPageUtil.makeResponseData(dataPermVoList, totalCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看单条数据权限详情。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限的主键Id。
|
||||||
|
* @return 应答结果对象,包含数据权限的详情。
|
||||||
|
*/
|
||||||
|
@GetMapping("/view")
|
||||||
|
public ResponseResult<SysDataPermVo> view(@RequestParam Long dataPermId) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
SysDataPerm sysDataPerm =
|
||||||
|
sysDataPermService.getByIdWithRelation(dataPermId, MyRelationParam.full());
|
||||||
|
if (sysDataPerm == null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
SysDataPermVo sysDataPermVo = MyModelUtil.copyTo(sysDataPerm, SysDataPermVo.class);
|
||||||
|
return ResponseResult.success(sysDataPermVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取不包含指定数据权限Id的用户列表。
|
||||||
|
* 用户和数据权限是多对多关系,当前接口将返回没有赋值指定DataPermId的用户列表。可用于给数据权限添加新用户。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @param sysUserDtoFilter 用户数据的过滤对象。
|
||||||
|
* @param orderParam 排序参数。
|
||||||
|
* @param pageParam 分页参数。
|
||||||
|
* @return 应答结果对象,包含用户列表数据。
|
||||||
|
*/
|
||||||
|
@PostMapping("/listNotInDataPermUser")
|
||||||
|
public ResponseResult<MyPageData<SysUserVo>> listNotInDataPermUser(
|
||||||
|
@MyRequestBody Long dataPermId,
|
||||||
|
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||||
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
|
ResponseResult<Void> verifyResult = this.doDataPermUserVerify(dataPermId);
|
||||||
|
if (!verifyResult.isSuccess()) {
|
||||||
|
return ResponseResult.errorFrom(verifyResult);
|
||||||
|
}
|
||||||
|
if (pageParam != null) {
|
||||||
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
|
}
|
||||||
|
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||||
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||||
|
List<SysUser> userList =
|
||||||
|
sysUserService.getNotInSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||||
|
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||||
|
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拥有指定数据权限的用户列表。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限Id。
|
||||||
|
* @param sysUserDtoFilter 用户过滤对象。
|
||||||
|
* @param orderParam 排序参数。
|
||||||
|
* @param pageParam 分页参数。
|
||||||
|
* @return 应答结果对象,包含用户列表数据。
|
||||||
|
*/
|
||||||
|
@PostMapping("/listDataPermUser")
|
||||||
|
public ResponseResult<MyPageData<SysUserVo>> listDataPermUser(
|
||||||
|
@MyRequestBody Long dataPermId,
|
||||||
|
@MyRequestBody SysUserDto sysUserDtoFilter,
|
||||||
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
|
ResponseResult<Void> verifyResult = this.doDataPermUserVerify(dataPermId);
|
||||||
|
if (!verifyResult.isSuccess()) {
|
||||||
|
return ResponseResult.errorFrom(verifyResult);
|
||||||
|
}
|
||||||
|
if (pageParam != null) {
|
||||||
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
|
}
|
||||||
|
SysUser filter = MyModelUtil.copyTo(sysUserDtoFilter, SysUser.class);
|
||||||
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysUser.class);
|
||||||
|
List<SysUser> userList =
|
||||||
|
sysUserService.getSysUserListByDataPermId(dataPermId, filter, orderBy);
|
||||||
|
List<SysUserVo> userVoList = MyModelUtil.copyCollectionTo(userList, SysUserVo.class);
|
||||||
|
return ResponseResult.success(MyPageUtil.makeResponseData(userVoList));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponseResult<Void> doDataPermUserVerify(Long dataPermId) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(dataPermId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
if (!sysDataPermService.existId(dataPermId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为指定数据权限添加用户列表。该操作可同时给一批用户赋值数据权限,并在同一事务内完成。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @param userIdListString 逗号分隔的用户Id列表。
|
||||||
|
* @return 应答结果对象。
|
||||||
|
*/
|
||||||
|
@OperationLog(type = SysOperationLogType.ADD_M2M)
|
||||||
|
@PostMapping("/addDataPermUser")
|
||||||
|
public ResponseResult<Void> addDataPermUser(
|
||||||
|
@MyRequestBody Long dataPermId, @MyRequestBody String userIdListString) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(dataPermId, userIdListString)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
Set<Long> userIdSet =
|
||||||
|
Arrays.stream(userIdListString.split(",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||||
|
if (!sysDataPermService.existId(dataPermId)
|
||||||
|
|| !sysUserService.existUniqueKeyList("userId", userIdSet)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||||
|
}
|
||||||
|
sysDataPermService.addDataPermUserList(dataPermId, userIdSet);
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为指定用户移除指定数据权限。
|
||||||
|
*
|
||||||
|
* @param dataPermId 指定数据权限主键Id。
|
||||||
|
* @param userId 指定用户主键Id。
|
||||||
|
* @return 应答数据结果。
|
||||||
|
*/
|
||||||
|
@OperationLog(type = SysOperationLogType.DELETE_M2M)
|
||||||
|
@PostMapping("/deleteDataPermUser")
|
||||||
|
public ResponseResult<Void> deleteDataPermUser(
|
||||||
|
@MyRequestBody Long dataPermId, @MyRequestBody Long userId) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(dataPermId, userId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
if (!sysDataPermService.removeDataPermUser(dataPermId, userId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
package com.orange.demo.upmsservice.controller;
|
||||||
|
|
||||||
|
import cn.jimmyshi.beanquery.BeanQuery;
|
||||||
|
import com.orange.demo.common.log.annotation.OperationLog;
|
||||||
|
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||||
|
import com.github.pagehelper.page.PageMethod;
|
||||||
|
import com.orange.demo.upmsservice.model.*;
|
||||||
|
import com.orange.demo.upmsservice.service.*;
|
||||||
|
import com.orange.demo.upmsapi.dto.*;
|
||||||
|
import com.orange.demo.upmsapi.vo.*;
|
||||||
|
import com.orange.demo.common.core.object.*;
|
||||||
|
import com.orange.demo.common.core.util.*;
|
||||||
|
import com.orange.demo.common.core.constant.*;
|
||||||
|
import com.orange.demo.common.core.base.controller.BaseController;
|
||||||
|
import com.orange.demo.common.core.base.service.IBaseService;
|
||||||
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理操作控制器类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Api(tags = "部门管理管理接口")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysDept")
|
||||||
|
public class SysDeptController extends BaseController<SysDept, SysDeptVo, Long> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IBaseService<SysDept, Long> service() {
|
||||||
|
return sysDeptService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增部门管理数据。
|
||||||
|
*
|
||||||
|
* @param sysDeptDto 新增对象。
|
||||||
|
* @return 应答结果对象,包含新增对象主键Id。
|
||||||
|
*/
|
||||||
|
@ApiOperationSupport(ignoreParameters = {"sysDeptDto.deptId"})
|
||||||
|
@OperationLog(type = SysOperationLogType.ADD)
|
||||||
|
@PostMapping("/add")
|
||||||
|
public ResponseResult<Long> add(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||||
|
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, false);
|
||||||
|
if (errorMessage != null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
|
}
|
||||||
|
SysDept sysDept = MyModelUtil.copyTo(sysDeptDto, SysDept.class);
|
||||||
|
// 验证父Id的数据合法性
|
||||||
|
SysDept parentSysDept = null;
|
||||||
|
if (MyCommonUtil.isNotBlankOrNull(sysDept.getParentId())) {
|
||||||
|
parentSysDept = sysDeptService.getById(sysDept.getParentId());
|
||||||
|
if (parentSysDept == null) {
|
||||||
|
errorMessage = "数据验证失败,关联的父节点并不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sysDept = sysDeptService.saveNew(sysDept, parentSysDept);
|
||||||
|
return ResponseResult.success(sysDept.getDeptId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新部门管理数据。
|
||||||
|
*
|
||||||
|
* @param sysDeptDto 更新对象。
|
||||||
|
* @return 应答结果对象。
|
||||||
|
*/
|
||||||
|
@OperationLog(type = SysOperationLogType.UPDATE)
|
||||||
|
@PostMapping("/update")
|
||||||
|
public ResponseResult<Void> update(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||||
|
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, true);
|
||||||
|
if (errorMessage != null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||||
|
}
|
||||||
|
SysDept sysDept = MyModelUtil.copyTo(sysDeptDto, SysDept.class);
|
||||||
|
SysDept originalSysDept = sysDeptService.getById(sysDept.getDeptId());
|
||||||
|
if (originalSysDept == null) {
|
||||||
|
// NOTE: 修改下面方括号中的话述
|
||||||
|
errorMessage = "数据验证失败,当前 [数据] 并不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
// 验证父Id的数据合法性
|
||||||
|
if (MyCommonUtil.isNotBlankOrNull(sysDept.getParentId())
|
||||||
|
&& ObjectUtils.notEqual(sysDept.getParentId(), originalSysDept.getParentId())) {
|
||||||
|
SysDept parentSysDept = sysDeptService.getById(sysDept.getParentId());
|
||||||
|
if (parentSysDept == null) {
|
||||||
|
errorMessage = "数据验证失败,关联的父节点并不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_PARENT_ID_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!sysDeptService.update(sysDept, originalSysDept)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除部门管理数据。
|
||||||
|
*
|
||||||
|
* @param deptId 删除对象主键Id。
|
||||||
|
* @return 应答结果对象。
|
||||||
|
*/
|
||||||
|
@OperationLog(type = SysOperationLogType.DELETE)
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public ResponseResult<Void> delete(@MyRequestBody Long deptId) {
|
||||||
|
String errorMessage;
|
||||||
|
if (MyCommonUtil.existBlankArgument(deptId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
// 验证关联Id的数据合法性
|
||||||
|
SysDept originalSysDept = sysDeptService.getById(deptId);
|
||||||
|
if (originalSysDept == null) {
|
||||||
|
// NOTE: 修改下面方括号中的话述
|
||||||
|
errorMessage = "数据验证失败,当前 [对象] 并不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
if (sysDeptService.hasChildren(deptId)) {
|
||||||
|
// NOTE: 修改下面方括号中的话述
|
||||||
|
errorMessage = "数据验证失败,当前 [对象存在子对象],请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||||
|
}
|
||||||
|
if (sysDeptService.hasChildrenUser(deptId)) {
|
||||||
|
errorMessage = "数据验证失败,请先移除部门用户数据后,再删除当前部门!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.HAS_CHILDREN_DATA, errorMessage);
|
||||||
|
}
|
||||||
|
if (!sysDeptService.remove(deptId)) {
|
||||||
|
errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);
|
||||||
|
}
|
||||||
|
return ResponseResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列出符合过滤条件的部门管理列表。
|
||||||
|
*
|
||||||
|
* @param sysDeptDtoFilter 过滤对象。
|
||||||
|
* @param orderParam 排序参数。
|
||||||
|
* @param pageParam 分页参数。
|
||||||
|
* @return 应答结果对象,包含查询结果集。
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseResult<MyPageData<SysDeptVo>> list(
|
||||||
|
@MyRequestBody SysDeptDto sysDeptDtoFilter,
|
||||||
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
|
if (pageParam != null) {
|
||||||
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
|
}
|
||||||
|
SysDept sysDeptFilter = MyModelUtil.copyTo(sysDeptDtoFilter, SysDept.class);
|
||||||
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysDept.class);
|
||||||
|
List<SysDept> sysDeptList = sysDeptService.getSysDeptListWithRelation(sysDeptFilter, orderBy);
|
||||||
|
return ResponseResult.success(MyPageUtil.makeResponseData(sysDeptList, SysDept.INSTANCE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看指定部门管理对象详情。
|
||||||
|
*
|
||||||
|
* @param deptId 指定对象主键Id。
|
||||||
|
* @return 应答结果对象,包含对象详情。
|
||||||
|
*/
|
||||||
|
@GetMapping("/view")
|
||||||
|
public ResponseResult<SysDeptVo> view(@RequestParam Long deptId) {
|
||||||
|
if (MyCommonUtil.existBlankArgument(deptId)) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||||
|
}
|
||||||
|
SysDept sysDept = sysDeptService.getByIdWithRelation(deptId, MyRelationParam.full());
|
||||||
|
if (sysDept == null) {
|
||||||
|
return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST);
|
||||||
|
}
|
||||||
|
SysDeptVo sysDeptVo = SysDept.INSTANCE.fromModel(sysDept);
|
||||||
|
return ResponseResult.success(sysDeptVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以字典形式返回全部部门管理数据集合。字典的键值为[deptId, deptName]。
|
||||||
|
* 白名单接口,登录用户均可访问。
|
||||||
|
*
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @return 应答结果对象,包含字典形式的数据集合。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listDict")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listDict(SysDept filter) {
|
||||||
|
List<SysDept> resultList = sysDeptService.getListByFilter(filter);
|
||||||
|
return ResponseResult.success(
|
||||||
|
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典Id集合,获取查询后的字典数据。
|
||||||
|
*
|
||||||
|
* @param dictIds 字典Id集合。
|
||||||
|
* @return 应答结果对象,包含字典形式的数据集合。
|
||||||
|
*/
|
||||||
|
@PostMapping("/listDictByIds")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listDictByIds(
|
||||||
|
@MyRequestBody(elementType = Long.class) List<Long> dictIds) {
|
||||||
|
List<SysDept> resultList = sysDeptService.getInList(new HashSet<>(dictIds));
|
||||||
|
return ResponseResult.success(
|
||||||
|
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据父主键Id,以字典的形式返回其下级数据列表。
|
||||||
|
* 白名单接口,登录用户均可访问。
|
||||||
|
*
|
||||||
|
* @param parentId 父主键Id。
|
||||||
|
* @return 按照字典的形式返回下级数据列表。
|
||||||
|
*/
|
||||||
|
@GetMapping("/listDictByParentId")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> listDictByParentId(@RequestParam(required = false) Long parentId) {
|
||||||
|
List<SysDept> resultList = sysDeptService.getListByParentId("parentId", parentId);
|
||||||
|
return ResponseResult.success(
|
||||||
|
BeanQuery.select("parentId as parentId", "deptId as id", "deptName as name").executeFrom(resultList));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键Id集合,获取数据对象集合。仅限于微服务间远程接口调用。
|
||||||
|
*
|
||||||
|
* @param deptIds 主键Id集合。
|
||||||
|
* @param withDict 是否包含字典关联。
|
||||||
|
* @return 应答结果对象,包含主对象集合。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "listByIds")
|
||||||
|
@PostMapping("/listByIds")
|
||||||
|
public ResponseResult<List<SysDeptVo>> listByIds(
|
||||||
|
@RequestParam Set<Long> deptIds, @RequestParam Boolean withDict) {
|
||||||
|
return super.baseListByIds(deptIds, withDict, SysDept.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键Id,获取数据对象。仅限于微服务间远程接口调用。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @param withDict 是否包含字典关联。
|
||||||
|
* @return 应答结果对象,包含主对象数据。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "getById")
|
||||||
|
@PostMapping("/getById")
|
||||||
|
public ResponseResult<SysDeptVo> getById(
|
||||||
|
@RequestParam Long deptId, @RequestParam Boolean withDict) {
|
||||||
|
return super.baseGetById(deptId, withDict, SysDept.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断参数列表中指定的主键Id集合,是否全部存在。仅限于微服务间远程接口调用。
|
||||||
|
*
|
||||||
|
* @param deptIds 主键Id集合。
|
||||||
|
* @return 应答结果对象,包含true全部存在,否则false。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "existIds")
|
||||||
|
@PostMapping("/existIds")
|
||||||
|
public ResponseResult<Boolean> existIds(@RequestParam Set<Long> deptIds) {
|
||||||
|
return super.baseExistIds(deptIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断参数列表中指定的主键Id是否存在。仅限于微服务间远程接口调用。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 应答结果对象,包含true表示存在,否则false。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "existId")
|
||||||
|
@PostMapping("/existId")
|
||||||
|
public ResponseResult<Boolean> existId(@RequestParam Long deptId) {
|
||||||
|
return super.baseExistId(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键Id删除数据。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 删除数量。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "deleteById")
|
||||||
|
@PostMapping("/deleteById")
|
||||||
|
public ResponseResult<Integer> deleteById(@RequestParam Long deptId) throws Exception {
|
||||||
|
SysDept filter = new SysDept();
|
||||||
|
filter.setDeptId(deptId);
|
||||||
|
return super.baseDeleteBy(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除符合过滤条件的数据。
|
||||||
|
*
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @return 删除数量。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "deleteBy")
|
||||||
|
@PostMapping("/deleteBy")
|
||||||
|
public ResponseResult<Integer> deleteBy(@RequestBody SysDeptDto filter) throws Exception {
|
||||||
|
return super.baseDeleteBy(MyModelUtil.copyTo(filter, SysDept.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "listBy")
|
||||||
|
@PostMapping("/listBy")
|
||||||
|
public ResponseResult<MyPageData<SysDeptVo>> listBy(@RequestBody MyQueryParam queryParam) {
|
||||||
|
return super.baseListBy(queryParam, SysDept.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复杂的查询调用,包括(in list)过滤,对象条件过滤,分页和排序等。主要用于微服务间远程过程调用。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 分页数据集合对象。如MyQueryParam参数的分页属性为空,则不会执行分页操作,只是基于MyPageData对象返回数据结果。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "listMapBy")
|
||||||
|
@PostMapping("/listMapBy")
|
||||||
|
public ResponseResult<MyPageData<Map<String, Object>>> listMapBy(@RequestBody MyQueryParam queryParam) {
|
||||||
|
return super.baseListMapBy(queryParam, SysDept.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复杂的查询调用,仅返回单体记录。主要用于微服务间远程过程调用。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含符合查询过滤条件的对象结果集。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "getBy")
|
||||||
|
@PostMapping("/getBy")
|
||||||
|
public ResponseResult<SysDeptVo> getBy(@RequestBody MyQueryParam queryParam) {
|
||||||
|
return super.baseGetBy(queryParam, SysDept.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程主对象中符合查询条件的数据数量。主要用于微服务间远程过程调用。
|
||||||
|
*
|
||||||
|
* @param queryParam 查询参数。
|
||||||
|
* @return 应答结果对象,包含结果数量。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "countBy")
|
||||||
|
@PostMapping("/countBy")
|
||||||
|
public ResponseResult<Integer> countBy(@RequestBody MyQueryParam queryParam) {
|
||||||
|
return super.baseCountBy(queryParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取远程对象中符合查询条件的分组聚合计算Map列表。
|
||||||
|
*
|
||||||
|
* @param aggregationParam 聚合参数。
|
||||||
|
* @return 应该结果对象,包含聚合计算后的分组Map列表。
|
||||||
|
*/
|
||||||
|
@ApiOperation(hidden = true, value = "aggregateBy")
|
||||||
|
@PostMapping("/aggregateBy")
|
||||||
|
public ResponseResult<List<Map<String, Object>>> aggregateBy(@RequestBody MyAggregationParam aggregationParam) {
|
||||||
|
return super.baseAggregateBy(aggregationParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.orange.demo.upmsservice.controller;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.page.PageMethod;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import com.orange.demo.common.core.annotation.MyRequestBody;
|
||||||
|
import com.orange.demo.common.core.object.*;
|
||||||
|
import com.orange.demo.common.core.util.MyModelUtil;
|
||||||
|
import com.orange.demo.common.core.util.MyPageUtil;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
import com.orange.demo.common.log.service.SysOperationLogService;
|
||||||
|
import com.orange.demo.upmsapi.dto.SysOperationLogDto;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysOperationLogVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志接口控制器对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Api(tags = "操作日志接口")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sysOperationLog")
|
||||||
|
public class SysOperationLogController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysOperationLogService operationLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限列表。
|
||||||
|
*
|
||||||
|
* @param sysOperationLogDtoFilter 操作日志查询过滤对象。
|
||||||
|
* @param orderParam 排序参数。
|
||||||
|
* @param pageParam 分页参数。
|
||||||
|
* @return 应答结果对象。包含操作日志列表。
|
||||||
|
*/
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseResult<MyPageData<SysOperationLogVo>> list(
|
||||||
|
@MyRequestBody SysOperationLogDto sysOperationLogDtoFilter,
|
||||||
|
@MyRequestBody MyOrderParam orderParam,
|
||||||
|
@MyRequestBody MyPageParam pageParam) {
|
||||||
|
if (pageParam != null) {
|
||||||
|
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||||
|
}
|
||||||
|
SysOperationLog filter = MyModelUtil.copyTo(sysOperationLogDtoFilter, SysOperationLog.class);
|
||||||
|
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysOperationLog.class);
|
||||||
|
List<SysOperationLog> operationLogList = operationLogService.getSysOperationLogList(filter, orderBy);
|
||||||
|
List<SysOperationLogVo> operationLogVoList = MyModelUtil.copyCollectionTo(operationLogList, SysOperationLogVo.class);
|
||||||
|
long totalCount = 0L;
|
||||||
|
if (operationLogList instanceof Page) {
|
||||||
|
totalCount = ((Page<SysOperationLog>) operationLogList).getTotal();
|
||||||
|
}
|
||||||
|
return ResponseResult.success(MyPageUtil.makeResponseData(operationLogVoList, totalCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.orange.demo.upmsservice.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDataPermDept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与部门关系数据访问操作接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDataPermDeptMapper extends BaseDaoMapper<SysDataPermDept> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.orange.demo.upmsservice.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDataPerm;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限数据访问操作接口。
|
||||||
|
* NOTE: 该对象一定不能被 @EnableDataPerm 注解标注,否则会导致无限递归。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDataPermMapper extends BaseDaoMapper<SysDataPerm> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据权限列表。
|
||||||
|
*
|
||||||
|
* @param sysDataPermFilter 过滤对象。
|
||||||
|
* @param orderBy 排序字符串。
|
||||||
|
* @return 过滤后的数据权限列表。
|
||||||
|
*/
|
||||||
|
List<SysDataPerm> getSysDataPermList(
|
||||||
|
@Param("sysDataPermFilter") SysDataPerm sysDataPermFilter, @Param("orderBy") String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定用户的数据权限列表。
|
||||||
|
*
|
||||||
|
* @param userId 用户Id。
|
||||||
|
* @return 数据权限列表。
|
||||||
|
*/
|
||||||
|
List<SysDataPerm> getSysDataPermListByUserId(@Param("userId") Long userId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.orange.demo.upmsservice.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDataPermUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与用户关系数据访问操作接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDataPermUserMapper extends BaseDaoMapper<SysDataPermUser> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.orange.demo.upmsservice.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDept;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理数据操作访问接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDeptMapper extends BaseDaoMapper<SysDept> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入对象列表。
|
||||||
|
*
|
||||||
|
* @param sysDeptList 新增对象列表。
|
||||||
|
*/
|
||||||
|
void insertList(List<SysDept> sysDeptList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取过滤后的对象列表。
|
||||||
|
*
|
||||||
|
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||||
|
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||||
|
* @param sysDeptFilter 过滤对象。
|
||||||
|
* @param orderBy 排序字符串,order by从句的参数。
|
||||||
|
* @return 对象列表。
|
||||||
|
*/
|
||||||
|
<M> List<SysDept> getSysDeptList(
|
||||||
|
@Param("inFilterColumn") String inFilterColumn,
|
||||||
|
@Param("inFilterValues") Set<M> inFilterValues,
|
||||||
|
@Param("sysDeptFilter") SysDept sysDeptFilter,
|
||||||
|
@Param("orderBy") String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对象列表,过滤条件中包含like和between条件,以及指定属性的(in list)过滤条件。
|
||||||
|
*
|
||||||
|
* @param inFilterColumn 参与(In-list)过滤的数据表列。
|
||||||
|
* @param inFilterValues 参与(In-list)过滤的数据表列值集合。
|
||||||
|
* @param sysDeptFilter 过滤对象。
|
||||||
|
* @return 对象列表。
|
||||||
|
*/
|
||||||
|
<M> Integer getSysDeptCount(
|
||||||
|
@Param("inFilterColumn") String inFilterColumn,
|
||||||
|
@Param("inFilterValues") Set<M> inFilterValues,
|
||||||
|
@Param("sysDeptFilter") SysDept sysDeptFilter);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.orange.demo.upmsservice.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.upmsservice.model.SysDeptRelation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门关系树关联关系表访问接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDeptRelationMapper extends BaseDaoMapper<SysDeptRelation> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将myDeptId的所有子部门,与其父部门parentDeptId解除关联关系。
|
||||||
|
*
|
||||||
|
* @param parentDeptId myDeptId的父部门Id。
|
||||||
|
* @param myDeptId 当前部门。
|
||||||
|
*/
|
||||||
|
void removeBetweenChildrenAndParents(
|
||||||
|
@Param("parentDeptId") Long parentDeptId, @Param("myDeptId") Long myDeptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入部门关联数据。
|
||||||
|
* 由于目前版本(3.4.1)的Mybatis Plus没有提供真正的批量插入,为了保证效率需要自己实现。
|
||||||
|
* 目前我们仅仅给出MySQL的insert list实现作为参考,其他数据库需要自行修改。
|
||||||
|
*
|
||||||
|
* @param deptRelationList 部门关联关系数据列表。
|
||||||
|
*/
|
||||||
|
void insertList(List<SysDeptRelation> deptRelationList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入当前部门的所有父部门列表,包括自己和自己的关系。
|
||||||
|
*
|
||||||
|
* @param parentDeptId myDeptId的父部门Id。
|
||||||
|
* @param myDeptId 当前部门。
|
||||||
|
*/
|
||||||
|
void insertParentList(@Param("parentDeptId") Long parentDeptId, @Param("myDeptId") Long myDeptId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.upmsservice.dao.SysDataPermDeptMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.upmsservice.model.SysDataPermDept">
|
||||||
|
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||||
|
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.upmsservice.dao.SysDataPermMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.upmsservice.model.SysDataPerm">
|
||||||
|
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||||
|
<result column="data_perm_name" jdbcType="VARCHAR" property="dataPermName"/>
|
||||||
|
<result column="rule_type" jdbcType="INTEGER" property="ruleType"/>
|
||||||
|
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
|
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMapEx" type="com.orange.demo.upmsservice.model.SysDataPerm" extends="BaseResultMap">
|
||||||
|
<collection property="dataPermDeptList" column="data_perm_id" javaType="ArrayList"
|
||||||
|
ofType="com.orange.demo.upmsservice.model.SysDataPermDept" notNullColumn="dept_id"
|
||||||
|
resultMap="com.orange.demo.upmsservice.dao.SysDataPermDeptMapper.BaseResultMap">
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="filterRef">
|
||||||
|
<if test="sysDataPermFilter != null">
|
||||||
|
<if test="sysDataPermFilter.ruleType != null">
|
||||||
|
AND zz_sys_data_perm.rule_type = #{sysDataPermFilter.ruleType}
|
||||||
|
</if>
|
||||||
|
<if test="sysDataPermFilter.searchString != null and sysDataPermFilter.searchString != ''">
|
||||||
|
<bind name= "safeSearchString" value= "'%' + sysDataPermFilter.searchString + '%'" />
|
||||||
|
AND IFNULL(zz_sys_data_perm.data_perm_name, '') LIKE #{safeSearchString}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
AND zz_sys_data_perm.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getSysDataPermList" resultMap="BaseResultMap" parameterType="com.orange.demo.upmsservice.model.SysDataPerm">
|
||||||
|
SELECT
|
||||||
|
zz_sys_data_perm.*
|
||||||
|
FROM
|
||||||
|
zz_sys_data_perm
|
||||||
|
<where>
|
||||||
|
<include refid="filterRef"/>
|
||||||
|
</where>
|
||||||
|
<if test="orderBy != null and orderBy != ''">
|
||||||
|
ORDER BY ${orderBy}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysDataPermListByUserId" resultMap="BaseResultMapEx" parameterType="com.orange.demo.upmsservice.model.SysDataPerm">
|
||||||
|
SELECT
|
||||||
|
zz_sys_data_perm.*,
|
||||||
|
zz_sys_data_perm_dept.*
|
||||||
|
FROM
|
||||||
|
zz_sys_data_perm_user
|
||||||
|
INNER JOIN
|
||||||
|
zz_sys_data_perm ON zz_sys_data_perm_user.data_perm_id = zz_sys_data_perm.data_perm_id
|
||||||
|
LEFT JOIN
|
||||||
|
zz_sys_data_perm_dept ON zz_sys_data_perm.data_perm_id = zz_sys_data_perm_dept.data_perm_id
|
||||||
|
<where>
|
||||||
|
AND zz_sys_data_perm_user.user_id = #{userId}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.upmsservice.dao.SysDataPermUserMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.upmsservice.model.SysDataPermUser">
|
||||||
|
<id column="data_perm_id" jdbcType="BIGINT" property="dataPermId"/>
|
||||||
|
<id column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||||
|
</resultMap>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.upmsservice.dao.SysDeptMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.upmsservice.model.SysDept">
|
||||||
|
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||||
|
<result column="dept_name" jdbcType="VARCHAR" property="deptName"/>
|
||||||
|
<result column="show_order" jdbcType="INTEGER" property="showOrder"/>
|
||||||
|
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
||||||
|
<result column="deleted_flag" jdbcType="INTEGER" property="deletedFlag"/>
|
||||||
|
<result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
|
||||||
|
<result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insertList">
|
||||||
|
INSERT INTO zz_sys_dept
|
||||||
|
(dept_id,
|
||||||
|
dept_name,
|
||||||
|
show_order,
|
||||||
|
parent_id,
|
||||||
|
deleted_flag,
|
||||||
|
create_user_id,
|
||||||
|
update_user_id,
|
||||||
|
create_time,
|
||||||
|
update_time)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" index="index" item="item" separator="," >
|
||||||
|
(#{item.deptId},
|
||||||
|
#{item.deptName},
|
||||||
|
#{item.showOrder},
|
||||||
|
#{item.parentId},
|
||||||
|
#{item.deletedFlag},
|
||||||
|
#{item.createUserId},
|
||||||
|
#{item.updateUserId},
|
||||||
|
#{item.createTime},
|
||||||
|
#{item.updateTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||||
|
<sql id="filterRef">
|
||||||
|
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||||
|
<include refid="com.orange.demo.upmsservice.dao.SysDeptMapper.inputFilterRef"/>
|
||||||
|
AND zz_sys_dept.deleted_flag = ${@com.orange.demo.common.core.constant.GlobalDeletedFlag@NORMAL}
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||||
|
<sql id="inputFilterRef">
|
||||||
|
<if test="sysDeptFilter != null">
|
||||||
|
<if test="sysDeptFilter.deptName != null and sysDeptFilter.deptName != ''">
|
||||||
|
<bind name = "safeSysDeptDeptName" value = "'%' + sysDeptFilter.deptName + '%'" />
|
||||||
|
AND zz_sys_dept.dept_name LIKE #{safeSysDeptDeptName}
|
||||||
|
</if>
|
||||||
|
<if test="sysDeptFilter.parentId != null">
|
||||||
|
AND zz_sys_dept.parent_id = #{sysDeptFilter.parentId}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getSysDeptList" resultMap="BaseResultMap" parameterType="com.orange.demo.upmsservice.model.SysDept">
|
||||||
|
SELECT * FROM zz_sys_dept
|
||||||
|
<where>
|
||||||
|
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||||
|
AND ${inFilterColumn} IN
|
||||||
|
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||||
|
'${item}'
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<include refid="filterRef"/>
|
||||||
|
</where>
|
||||||
|
<if test="orderBy != null and orderBy != ''">
|
||||||
|
ORDER BY ${orderBy}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getSysDeptCount" resultType="java.lang.Integer" parameterType="com.orange.demo.upmsservice.model.SysDept">
|
||||||
|
SELECT COUNT(1) FROM zz_sys_dept
|
||||||
|
<where>
|
||||||
|
<if test="inFilterColumn != null and inFilterColumn != '' and inFilterValues != null and inFilterValues.size > 0">
|
||||||
|
AND ${inFilterColumn} IN
|
||||||
|
<foreach collection="inFilterValues" item="item" open="(" separator="," close=")">
|
||||||
|
'${item}'
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<include refid="filterRef"/>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.upmsservice.dao.SysDeptRelationMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.upmsservice.model.SysDeptRelation">
|
||||||
|
<id column="parent_dept_id" jdbcType="BIGINT" property="parentDeptId"/>
|
||||||
|
<id column="dept_id" jdbcType="BIGINT" property="deptId"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<delete id="removeBetweenChildrenAndParents">
|
||||||
|
DELETE a FROM zz_sys_dept_relation a
|
||||||
|
INNER JOIN zz_sys_dept_relation b ON a.dept_id = b.dept_id
|
||||||
|
WHERE a.parent_dept_id = #{parentDeptId} AND b.parent_dept_id = #{myDeptId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertList">
|
||||||
|
INSERT INTO zz_sys_dept_relation(parent_dept_id, dept_id) VALUES
|
||||||
|
<foreach collection="list" index="index" item="item" separator=",">
|
||||||
|
(#{item.parentDeptId}, #{item.deptId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertParentList">
|
||||||
|
INSERT INTO zz_sys_dept_relation(parent_dept_id, dept_id)
|
||||||
|
SELECT t.parent_dept_id, #{myDeptId} FROM zz_sys_dept_relation t
|
||||||
|
WHERE t.dept_id = #{parentDeptId}
|
||||||
|
UNION ALL
|
||||||
|
SELECT #{myDeptId}, #{myDeptId}
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.orange.demo.upmsservice.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.orange.demo.common.core.annotation.RelationManyToMany;
|
||||||
|
import com.orange.demo.common.core.base.model.BaseModel;
|
||||||
|
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||||
|
import com.orange.demo.common.core.util.MyCommonUtil;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysDataPermVo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限实体对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "zz_sys_data_perm")
|
||||||
|
public class SysDataPerm extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键Id。
|
||||||
|
*/
|
||||||
|
@TableId(value = "data_perm_id")
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示名称。
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_perm_name")
|
||||||
|
private String dataPermName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限规则类型(0: 全部可见 1: 只看自己 2: 只看本部门 3: 本部门及子部门 4: 多部门及子部门 5: 自定义部门列表)。
|
||||||
|
*/
|
||||||
|
@TableField(value = "rule_type")
|
||||||
|
private Integer ruleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
@TableField(value = "deleted_flag")
|
||||||
|
private Integer deletedFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String deptIdListString;
|
||||||
|
|
||||||
|
@RelationManyToMany(
|
||||||
|
relationMapperName = "sysDataPermDeptMapper",
|
||||||
|
relationMasterIdField = "dataPermId",
|
||||||
|
relationModelClass = SysDataPermDept.class)
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<SysDataPermDept> dataPermDeptList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String searchString;
|
||||||
|
|
||||||
|
public void setSearchString(String searchString) {
|
||||||
|
this.searchString = MyCommonUtil.replaceSqlWildcard(searchString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysDataPermModelMapper extends BaseModelMapper<SysDataPermVo, SysDataPerm> {
|
||||||
|
/**
|
||||||
|
* 转换VO对象到实体对象。
|
||||||
|
*
|
||||||
|
* @param sysDataPermVo 域对象。
|
||||||
|
* @return 实体对象。
|
||||||
|
*/
|
||||||
|
@Mapping(target = "dataPermDeptList", expression = "java(mapToBean(sysDataPermVo.getDataPermDeptList(), com.orange.demo.upmsservice.model.SysDataPermDept.class))")
|
||||||
|
@Override
|
||||||
|
SysDataPerm toModel(SysDataPermVo sysDataPermVo);
|
||||||
|
/**
|
||||||
|
* 转换实体对象到VO对象。
|
||||||
|
*
|
||||||
|
* @param sysDataPerm 实体对象。
|
||||||
|
* @return 域对象。
|
||||||
|
*/
|
||||||
|
@Mapping(target = "dataPermDeptList", expression = "java(beanToMap(sysDataPerm.getDataPermDeptList(), false))")
|
||||||
|
@Override
|
||||||
|
SysDataPermVo fromModel(SysDataPerm sysDataPerm);
|
||||||
|
}
|
||||||
|
public static final SysDataPermModelMapper INSTANCE = Mappers.getMapper(SysDataPerm.SysDataPermModelMapper.class);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.orange.demo.upmsservice.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与部门关联实体对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(of = {"deptId"})
|
||||||
|
@TableName(value = "zz_sys_data_perm_dept")
|
||||||
|
public class SysDataPermDept {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_perm_id")
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联部门Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "dept_id")
|
||||||
|
private Long deptId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.orange.demo.upmsservice.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限与用户关联实体对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "zz_sys_data_perm_user")
|
||||||
|
public class SysDataPermUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_perm_id")
|
||||||
|
private Long dataPermId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "user_id")
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.orange.demo.upmsservice.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.orange.demo.upmsapi.vo.SysDeptVo;
|
||||||
|
import com.orange.demo.common.core.base.model.BaseModel;
|
||||||
|
import com.orange.demo.common.core.base.mapper.BaseModelMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.mapstruct.*;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SysDept实体对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "zz_sys_dept")
|
||||||
|
public class SysDept extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id。
|
||||||
|
*/
|
||||||
|
@TableId(value = "dept_id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称。
|
||||||
|
*/
|
||||||
|
@TableField(value = "dept_name")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序。
|
||||||
|
*/
|
||||||
|
@TableField(value = "show_order")
|
||||||
|
private Integer showOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "parent_id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑删除标记字段(1: 正常 -1: 已删除)。
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
@TableField(value = "deleted_flag")
|
||||||
|
private Integer deletedFlag;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysDeptModelMapper extends BaseModelMapper<SysDeptVo, SysDept> {
|
||||||
|
}
|
||||||
|
public static final SysDeptModelMapper INSTANCE = Mappers.getMapper(SysDeptModelMapper.class);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.orange.demo.upmsservice.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门关联实体对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "zz_sys_dept_relation")
|
||||||
|
public class SysDeptRelation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级部门Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "parent_dept_id")
|
||||||
|
private Long parentDeptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "dept_id")
|
||||||
|
private Long deptId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.orange.demo.upmsservice.service;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.service.IBaseService;
|
||||||
|
import com.orange.demo.common.core.object.CallResult;
|
||||||
|
import com.orange.demo.upmsservice.model.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限数据服务接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDataPermService extends IBaseService<SysDataPerm, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存新增的数据权限对象。
|
||||||
|
*
|
||||||
|
* @param dataPerm 新增的数据权限对象。
|
||||||
|
* @param deptIdSet 关联的部门Id列表。
|
||||||
|
* @return 新增后的数据权限对象。
|
||||||
|
*/
|
||||||
|
SysDataPerm saveNew(SysDataPerm dataPerm, Set<Long> deptIdSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据权限对象。
|
||||||
|
*
|
||||||
|
* @param dataPerm 更新的数据权限对象。
|
||||||
|
* @param originalDataPerm 原有的数据权限对象。
|
||||||
|
* @param deptIdSet 关联的部门Id列表。
|
||||||
|
* @return 更新成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean update(SysDataPerm dataPerm, SysDataPerm originalDataPerm, Set<Long> deptIdSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定数据权限。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @return 删除成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean remove(Long dataPermId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据权限列表。
|
||||||
|
*
|
||||||
|
* @param filter 数据权限过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 数据权限查询列表。
|
||||||
|
*/
|
||||||
|
List<SysDataPerm> getSysDataPermList(SysDataPerm filter, String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定会话的数据权限集合从缓存中移除。
|
||||||
|
*
|
||||||
|
* @param sessionId 会话Id。
|
||||||
|
*/
|
||||||
|
void removeDataPermCache(String sessionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定用户的指定会话的数据权限集合存入缓存。
|
||||||
|
*
|
||||||
|
* @param sessionId 会话Id。
|
||||||
|
* @param userId 用户主键Id。
|
||||||
|
* @param deptId 用户所属部门主键Id。
|
||||||
|
* @return 查询并缓存后的数据权限集合。返回格式为,Map<RuleType, DeptIdString>。
|
||||||
|
*/
|
||||||
|
Map<Integer, String> putDataPermCache(String sessionId, Long userId, Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定用户Id的数据权限列表。并基于权限规则类型进行了一级分组。
|
||||||
|
*
|
||||||
|
* @param userId 指定的用户Id。
|
||||||
|
* @param deptId 用户所属部门主键Id。
|
||||||
|
* @return 合并优化后的数据权限列表。返回格式为,Map<RuleType, DeptIdString>。
|
||||||
|
*/
|
||||||
|
Map<Integer, String> getSysDataPermListByUserId(Long userId, Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户和数据权限之间的多对多关联关系。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限Id。
|
||||||
|
* @param userIdSet 关联的用户Id列表。
|
||||||
|
*/
|
||||||
|
void addDataPermUserList(Long dataPermId, Set<Long> userIdSet);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除用户和数据权限之间的多对多关联关系。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @param userId 用户主键Id。
|
||||||
|
* @return true移除成功,否则false。
|
||||||
|
*/
|
||||||
|
boolean removeDataPermUser(Long dataPermId, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证数据权限对象关联菜单数据是否都合法。
|
||||||
|
*
|
||||||
|
* @param dataPerm 与数据权限关联的菜单数据列表。
|
||||||
|
* @param deptIdListString 与数据权限关联的部门Id列表。
|
||||||
|
* @return 验证结果。
|
||||||
|
*/
|
||||||
|
CallResult verifyRelatedData(SysDataPerm dataPerm, String deptIdListString);
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.orange.demo.upmsservice.service;
|
||||||
|
|
||||||
|
import com.orange.demo.upmsservice.model.*;
|
||||||
|
import com.orange.demo.common.core.base.service.IBaseService;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理数据操作服务接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysDeptService extends IBaseService<SysDept, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存新增的部门对象。
|
||||||
|
*
|
||||||
|
* @param sysDept 新增的部门对象。
|
||||||
|
* @param parentSysDept 上级部门对象。
|
||||||
|
* @return 新增后的部门对象。
|
||||||
|
*/
|
||||||
|
SysDept saveNew(SysDept sysDept, SysDept parentSysDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新部门对象。
|
||||||
|
*
|
||||||
|
* @param sysDept 更新的部门对象。
|
||||||
|
* @param originalSysDept 原有的部门对象。
|
||||||
|
* @return 更新成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean update(SysDept sysDept, SysDept originalSysDept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定数据。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean remove(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||||
|
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||||
|
*
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
List<SysDept> getSysDeptList(SysDept filter, String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||||
|
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||||
|
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||||
|
*
|
||||||
|
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||||
|
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
<M> List<SysDept> getSysDeptList(String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||||
|
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||||
|
*
|
||||||
|
* @param filter 主表过滤对象。
|
||||||
|
* @param orderBy 排序对象。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
List<SysDept> getSysDeptListWithRelation(SysDept filter, String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||||
|
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||||
|
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||||
|
*
|
||||||
|
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||||
|
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||||
|
* @param filter 主表过滤对象。
|
||||||
|
* @param orderBy 排序对象。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
<M> List<SysDept> getSysDeptListWithRelation(
|
||||||
|
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定对象是否包含下级对象。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 存在返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean hasChildren(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定部门Id是否包含用户对象。
|
||||||
|
*
|
||||||
|
* @param deptId 部门主键Id。
|
||||||
|
* @return 存在返回true,否则false。
|
||||||
|
*/
|
||||||
|
boolean hasChildrenUser(Long deptId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,336 @@
|
|||||||
|
package com.orange.demo.upmsservice.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.orange.demo.common.core.base.service.BaseService;
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||||
|
import com.orange.demo.common.core.object.CallResult;
|
||||||
|
import com.orange.demo.common.core.util.MyModelUtil;
|
||||||
|
import com.orange.demo.common.core.util.RedisKeyUtil;
|
||||||
|
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||||
|
import com.orange.demo.common.datafilter.constant.DataPermRuleType;
|
||||||
|
import com.orange.demo.upmsservice.dao.SysDataPermDeptMapper;
|
||||||
|
import com.orange.demo.upmsservice.dao.SysDataPermMapper;
|
||||||
|
import com.orange.demo.upmsservice.dao.SysDataPermUserMapper;
|
||||||
|
import com.orange.demo.upmsservice.service.SysDataPermService;
|
||||||
|
import com.orange.demo.upmsservice.service.SysDeptService;
|
||||||
|
import com.orange.demo.upmsservice.model.*;
|
||||||
|
import com.orange.demo.upmsservice.config.ApplicationConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.redisson.api.RBucket;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限数据服务类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service("sysDataPermService")
|
||||||
|
public class SysDataPermServiceImpl extends BaseService<SysDataPerm, Long> implements SysDataPermService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDataPermMapper sysDataPermMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDataPermDeptMapper sysDataPermDeptMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDataPermUserMapper sysDataPermUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
@Autowired
|
||||||
|
private ApplicationConfig applicationConfig;
|
||||||
|
@Autowired
|
||||||
|
private IdGeneratorWrapper idGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回主对象的Mapper对象。
|
||||||
|
*
|
||||||
|
* @return 主对象的Mapper对象。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected BaseDaoMapper<SysDataPerm> mapper() {
|
||||||
|
return sysDataPermMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存新增的数据权限对象。
|
||||||
|
*
|
||||||
|
* @param dataPerm 新增的数据权限对象。
|
||||||
|
* @param deptIdSet 关联的部门Id列表。
|
||||||
|
* @return 新增后的数据权限对象。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public SysDataPerm saveNew(SysDataPerm dataPerm, Set<Long> deptIdSet) {
|
||||||
|
dataPerm.setDataPermId(idGenerator.nextLongId());
|
||||||
|
dataPerm.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||||
|
MyModelUtil.fillCommonsForInsert(dataPerm);
|
||||||
|
sysDataPermMapper.insert(dataPerm);
|
||||||
|
this.insertRelationData(dataPerm, deptIdSet);
|
||||||
|
return dataPerm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新数据权限对象。
|
||||||
|
*
|
||||||
|
* @param dataPerm 更新的数据权限对象。
|
||||||
|
* @param originalDataPerm 原有的数据权限对象。
|
||||||
|
* @param deptIdSet 关联的部门Id列表。
|
||||||
|
* @return 更新成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean update(SysDataPerm dataPerm, SysDataPerm originalDataPerm, Set<Long> deptIdSet) {
|
||||||
|
MyModelUtil.fillCommonsForUpdate(dataPerm, originalDataPerm);
|
||||||
|
UpdateWrapper<SysDataPerm> uw = this.createUpdateQueryForNullValue(dataPerm, dataPerm.getDataPermId());
|
||||||
|
if (sysDataPermMapper.update(dataPerm, uw) != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||||
|
dataPermDept.setDataPermId(dataPerm.getDataPermId());
|
||||||
|
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||||
|
this.insertRelationData(dataPerm, deptIdSet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定数据权限。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @return 删除成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean remove(Long dataPermId) {
|
||||||
|
if (sysDataPermMapper.deleteById(dataPermId) != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||||
|
dataPermDept.setDataPermId(dataPermId);
|
||||||
|
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||||
|
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||||
|
dataPermUser.setDataPermId(dataPermId);
|
||||||
|
sysDataPermUserMapper.delete(new QueryWrapper<>(dataPermUser));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据权限列表。
|
||||||
|
*
|
||||||
|
* @param filter 数据权限过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 数据权限查询列表。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDataPerm> getSysDataPermList(SysDataPerm filter, String orderBy) {
|
||||||
|
return sysDataPermMapper.getSysDataPermList(filter, orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定会话的数据权限集合从缓存中移除。
|
||||||
|
*
|
||||||
|
* @param sessionId 会话Id。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeDataPermCache(String sessionId) {
|
||||||
|
String sessionPermKey = RedisKeyUtil.makeSessionDataPermIdKey(sessionId);
|
||||||
|
redissonClient.getBucket(sessionPermKey).deleteAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将指定用户的指定会话的数据权限集合存入缓存。
|
||||||
|
*
|
||||||
|
* @param sessionId 会话Id。
|
||||||
|
* @param userId 用户主键Id。
|
||||||
|
* @param deptId 用户所属部门主键Id。
|
||||||
|
* @return 查询并缓存后的数据权限集合。返回格式为,Map<RuleType, DeptIdString>。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<Integer, String> putDataPermCache(String sessionId, Long userId, Long deptId) {
|
||||||
|
Map<Integer, String> dataPermMap = this.getSysDataPermListByUserId(userId, deptId);
|
||||||
|
if (dataPermMap.size() > 0) {
|
||||||
|
String dataPermSessionKey = RedisKeyUtil.makeSessionDataPermIdKey(sessionId);
|
||||||
|
RBucket<String> bucket = redissonClient.getBucket(dataPermSessionKey);
|
||||||
|
bucket.set(JSON.toJSONString(dataPermMap),
|
||||||
|
applicationConfig.getDataPermExpiredSeconds(), TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
return dataPermMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定用户Id的数据权限列表。并基于权限规则类型进行了一级分组。
|
||||||
|
*
|
||||||
|
* @param userId 指定的用户Id。
|
||||||
|
* @param deptId 用户所属部门主键Id。
|
||||||
|
* @return 合并优化后的数据权限列表。返回格式为,Map<RuleType, DeptIdString>。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<Integer, String> getSysDataPermListByUserId(Long userId, Long deptId) {
|
||||||
|
List<SysDataPerm> dataPermList = sysDataPermMapper.getSysDataPermListByUserId(userId);
|
||||||
|
dataPermList.forEach(dataPerm -> {
|
||||||
|
if (CollectionUtils.isNotEmpty(dataPerm.getDataPermDeptList())) {
|
||||||
|
Set<Long> deptIdSet = dataPerm.getDataPermDeptList().stream()
|
||||||
|
.map(SysDataPermDept::getDeptId).collect(Collectors.toSet());
|
||||||
|
dataPerm.setDeptIdListString(StringUtils.join(deptIdSet, ","));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 为了更方便进行后续的合并优化处理,这里再基于规则类型进行分组。ruleMap的key是规则类型。
|
||||||
|
Map<Integer, List<SysDataPerm>> ruleMap =
|
||||||
|
dataPermList.stream().collect(Collectors.groupingBy(SysDataPerm::getRuleType));
|
||||||
|
Map<Integer, String> resultMap = new HashMap<>(ruleMap.size());
|
||||||
|
// 如有有ALL存在,就可以直接退出了,没有必要在处理后续的规则了。
|
||||||
|
if (ruleMap.containsKey(DataPermRuleType.TYPE_ALL)) {
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_ALL, "null");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
// 这里优先合并最复杂的多部门及子部门场景。
|
||||||
|
String deptIds = processMultiDeptAndChildren(ruleMap, deptId);
|
||||||
|
if (deptIds != null) {
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT, deptIds);
|
||||||
|
}
|
||||||
|
// 合并当前部门及子部门的优化
|
||||||
|
if (ruleMap.get(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT) != null) {
|
||||||
|
// 需要与仅仅当前部门规则进行合并。
|
||||||
|
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT, "null");
|
||||||
|
}
|
||||||
|
// 合并自定义部门了。
|
||||||
|
deptIds = processMultiDept(ruleMap, deptId);
|
||||||
|
if (deptIds != null) {
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_CUSTOM_DEPT_LIST, deptIds);
|
||||||
|
}
|
||||||
|
// 最后处理当前部门和当前用户。
|
||||||
|
if (ruleMap.get(DataPermRuleType.TYPE_DEPT_ONLY) != null) {
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_DEPT_ONLY, "null");
|
||||||
|
}
|
||||||
|
if (ruleMap.get(DataPermRuleType.TYPE_USER_ONLY) != null) {
|
||||||
|
resultMap.put(DataPermRuleType.TYPE_USER_ONLY, "null");
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String processMultiDeptAndChildren(Map<Integer, List<SysDataPerm>> ruleMap, Long deptId) {
|
||||||
|
List<SysDataPerm> parentDeptList = ruleMap.get(DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT);
|
||||||
|
if (parentDeptList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Set<Long> deptIdSet = new HashSet<>();
|
||||||
|
for (SysDataPerm parentDept : parentDeptList) {
|
||||||
|
deptIdSet.addAll(Arrays.stream(StringUtils.split(
|
||||||
|
parentDept.getDeptIdListString(), ",")).map(Long::valueOf).collect(Collectors.toSet()));
|
||||||
|
}
|
||||||
|
// 在合并所有的多父部门Id之后,需要判断是否有本部门及子部门的规则。如果有,就继续合并。
|
||||||
|
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT)) {
|
||||||
|
// 如果多父部门列表中包含当前部门,那么可以直接删除该规则了,如果没包含,就加入到多部门的DEPT_ID的IN LIST中。
|
||||||
|
deptIdSet.add(deptId);
|
||||||
|
ruleMap.remove(DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT);
|
||||||
|
}
|
||||||
|
// 需要与仅仅当前部门规则进行合并。
|
||||||
|
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_ONLY)) {
|
||||||
|
if (deptIdSet.contains(deptId)) {
|
||||||
|
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.join(deptIdSet, ',');
|
||||||
|
}
|
||||||
|
|
||||||
|
private String processMultiDept(Map<Integer, List<SysDataPerm>> ruleMap, Long deptId) {
|
||||||
|
List<SysDataPerm> customDeptList = ruleMap.get(DataPermRuleType.TYPE_CUSTOM_DEPT_LIST);
|
||||||
|
if (customDeptList == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Set<Long> deptIdSet = new HashSet<>();
|
||||||
|
for (SysDataPerm customDept : customDeptList) {
|
||||||
|
deptIdSet.addAll(Arrays.stream(StringUtils.split(
|
||||||
|
customDept.getDeptIdListString(), ",")).map(Long::valueOf).collect(Collectors.toSet()));
|
||||||
|
}
|
||||||
|
if (ruleMap.containsKey(DataPermRuleType.TYPE_DEPT_ONLY)) {
|
||||||
|
deptIdSet.add(deptId);
|
||||||
|
ruleMap.remove(DataPermRuleType.TYPE_DEPT_ONLY);
|
||||||
|
}
|
||||||
|
return StringUtils.join(deptIdSet, ',');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户和数据权限之间的多对多关联关系。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限Id。
|
||||||
|
* @param userIdSet 关联的用户Id列表。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void addDataPermUserList(Long dataPermId, Set<Long> userIdSet) {
|
||||||
|
for (Long userId : userIdSet) {
|
||||||
|
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||||
|
dataPermUser.setDataPermId(dataPermId);
|
||||||
|
dataPermUser.setUserId(userId);
|
||||||
|
sysDataPermUserMapper.insert(dataPermUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除用户和数据权限之间的多对多关联关系。
|
||||||
|
*
|
||||||
|
* @param dataPermId 数据权限主键Id。
|
||||||
|
* @param userId 用户主键Id。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean removeDataPermUser(Long dataPermId, Long userId) {
|
||||||
|
SysDataPermUser dataPermUser = new SysDataPermUser();
|
||||||
|
dataPermUser.setDataPermId(dataPermId);
|
||||||
|
dataPermUser.setUserId(userId);
|
||||||
|
return sysDataPermUserMapper.delete(new QueryWrapper<>(dataPermUser)) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证数据权限对象关联菜单数据是否都合法。
|
||||||
|
*
|
||||||
|
* @param dataPerm 与数据权限关联的菜单数据列表。
|
||||||
|
* @param deptIdListString 与数据权限关联的部门Id列表。
|
||||||
|
* @return 验证结果。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CallResult verifyRelatedData(SysDataPerm dataPerm, String deptIdListString) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
if (dataPerm.getRuleType() == DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT
|
||||||
|
|| dataPerm.getRuleType() == DataPermRuleType.TYPE_CUSTOM_DEPT_LIST) {
|
||||||
|
if (StringUtils.isBlank(deptIdListString)) {
|
||||||
|
return CallResult.error("数据验证失败,部门列表不能为空!");
|
||||||
|
}
|
||||||
|
Set<Long> deptIdSet = Arrays.stream(StringUtils.split(
|
||||||
|
deptIdListString, ",")).map(Long::valueOf).collect(Collectors.toSet());
|
||||||
|
if (!sysDeptService.existAllPrimaryKeys(deptIdSet)) {
|
||||||
|
return CallResult.error("数据验证失败,存在不合法的部门数据,请刷新后重试!");
|
||||||
|
}
|
||||||
|
jsonObject.put("deptIdSet", deptIdSet);
|
||||||
|
}
|
||||||
|
return CallResult.ok(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertRelationData(SysDataPerm dataPerm, Set<Long> deptIdSet) {
|
||||||
|
if (CollectionUtils.isNotEmpty(deptIdSet)) {
|
||||||
|
for (Long deptId : deptIdSet) {
|
||||||
|
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||||
|
dataPermDept.setDataPermId(dataPerm.getDataPermId());
|
||||||
|
dataPermDept.setDeptId(deptId);
|
||||||
|
sysDataPermDeptMapper.insert(dataPermDept);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,279 @@
|
|||||||
|
package com.orange.demo.upmsservice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.orange.demo.upmsservice.service.*;
|
||||||
|
import com.orange.demo.upmsservice.dao.*;
|
||||||
|
import com.orange.demo.upmsservice.model.*;
|
||||||
|
import com.orange.demo.common.core.util.*;
|
||||||
|
import com.orange.demo.common.core.object.MyRelationParam;
|
||||||
|
import com.orange.demo.common.core.constant.GlobalDeletedFlag;
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.common.core.base.service.BaseService;
|
||||||
|
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门管理数据操作服务类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service("sysDeptService")
|
||||||
|
public class SysDeptServiceImpl extends BaseService<SysDept, Long> implements SysDeptService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptMapper sysDeptMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptRelationMapper sysDeptRelationMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private SysDataPermDeptMapper sysDataPermDeptMapper;
|
||||||
|
@Autowired
|
||||||
|
private IdGeneratorWrapper idGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回当前Service的主表Mapper对象。
|
||||||
|
*
|
||||||
|
* @return 主表Mapper对象。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected BaseDaoMapper<SysDept> mapper() {
|
||||||
|
return sysDeptMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存新增的部门对象。
|
||||||
|
*
|
||||||
|
* @param sysDept 新增的部门对象。
|
||||||
|
* @param parentSysDept 上级部门对象。
|
||||||
|
* @return 新增后的部门对象。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public SysDept saveNew(SysDept sysDept, SysDept parentSysDept) {
|
||||||
|
sysDept.setDeptId(idGenerator.nextLongId());
|
||||||
|
sysDept.setDeletedFlag(GlobalDeletedFlag.NORMAL);
|
||||||
|
MyModelUtil.fillCommonsForInsert(sysDept);
|
||||||
|
sysDeptMapper.insert(sysDept);
|
||||||
|
// 同步插入部门关联关系数据
|
||||||
|
if (parentSysDept == null) {
|
||||||
|
sysDeptRelationMapper.insert(new SysDeptRelation(sysDept.getDeptId(), sysDept.getDeptId()));
|
||||||
|
} else {
|
||||||
|
sysDeptRelationMapper.insertParentList(parentSysDept.getDeptId(), sysDept.getDeptId());
|
||||||
|
}
|
||||||
|
return sysDept;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新部门对象。
|
||||||
|
*
|
||||||
|
* @param sysDept 更新的部门对象。
|
||||||
|
* @param originalSysDept 原有的部门对象。
|
||||||
|
* @return 更新成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean update(SysDept sysDept, SysDept originalSysDept) {
|
||||||
|
MyModelUtil.fillCommonsForUpdate(sysDept, originalSysDept);
|
||||||
|
UpdateWrapper<SysDept> uw = this.createUpdateQueryForNullValue(sysDept, sysDept.getDeptId());
|
||||||
|
if (sysDeptMapper.update(sysDept, uw) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.notEqual(sysDept.getParentId(), originalSysDept.getParentId())) {
|
||||||
|
this.updateParentRelation(sysDept, originalSysDept);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateParentRelation(SysDept sysDept, SysDept originalSysDept) {
|
||||||
|
// 1. 在删除当前部门与原有父部门的关联关系之前,先将原有的所有父部门Id缓存。
|
||||||
|
List<Long> originalParentIdList = new LinkedList<>();
|
||||||
|
if (originalSysDept.getParentId() != null) {
|
||||||
|
SysDept originalParentDept = getById(originalSysDept.getParentId());
|
||||||
|
while (originalParentDept != null) {
|
||||||
|
originalParentIdList.add(originalParentDept.getDeptId());
|
||||||
|
if (originalParentDept.getParentId() == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
originalParentDept = getById(originalParentDept.getParentId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 删除其子部门与其原有父部门之间的关联关系。
|
||||||
|
for (Long parentDeptId : originalParentIdList) {
|
||||||
|
sysDeptRelationMapper.removeBetweenChildrenAndParents(parentDeptId, sysDept.getDeptId());
|
||||||
|
}
|
||||||
|
// 2. 将当前部门与原有的父部门列表解除关系。
|
||||||
|
SysDeptRelation filter = new SysDeptRelation();
|
||||||
|
filter.setDeptId(sysDept.getDeptId());
|
||||||
|
sysDeptRelationMapper.delete(new QueryWrapper<>(filter));
|
||||||
|
// 3. 将当前部门和新的父部门列表建立关联关系。
|
||||||
|
// 在插入与新父部门的关联关系
|
||||||
|
List<SysDeptRelation> deptRelationList = new LinkedList<>();
|
||||||
|
// 先插入自己和自己的关系。
|
||||||
|
deptRelationList.add(new SysDeptRelation(sysDept.getDeptId(), sysDept.getDeptId()));
|
||||||
|
SysDept parentSysDept = null;
|
||||||
|
if (sysDept.getParentId() != null) {
|
||||||
|
parentSysDept = getById(sysDept.getParentId());
|
||||||
|
}
|
||||||
|
List<Long> newParentIdList = new LinkedList<>();
|
||||||
|
// 再插入直接父部门,以及父部门的父部门,并向上以此类推。
|
||||||
|
while (parentSysDept != null) {
|
||||||
|
newParentIdList.add(parentSysDept.getDeptId());
|
||||||
|
deptRelationList.add(
|
||||||
|
new SysDeptRelation(parentSysDept.getDeptId(), sysDept.getDeptId()));
|
||||||
|
if (parentSysDept.getParentId() == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parentSysDept = getById(parentSysDept.getParentId());
|
||||||
|
}
|
||||||
|
sysDeptRelationMapper.insertList(deptRelationList);
|
||||||
|
// 4. 将当前部门的子部门与其新的父部门建立关联关系
|
||||||
|
QueryWrapper<SysDeptRelation> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(MyModelUtil.mapToColumnName("parentDeptId", SysDeptRelation.class), sysDept.getDeptId());
|
||||||
|
queryWrapper.ne(MyModelUtil.mapToColumnName("deptId", SysDeptRelation.class), sysDept.getDeptId());
|
||||||
|
List<SysDeptRelation> childRelationList = sysDeptRelationMapper.selectList(queryWrapper);
|
||||||
|
List<SysDeptRelation> newChildrenAndParentList = new LinkedList<>();
|
||||||
|
for (Long newParentId : newParentIdList) {
|
||||||
|
for (SysDeptRelation childDeptRelation : childRelationList) {
|
||||||
|
newChildrenAndParentList.add(new SysDeptRelation(newParentId, childDeptRelation.getDeptId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(newChildrenAndParentList)) {
|
||||||
|
sysDeptRelationMapper.insertList(newChildrenAndParentList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定数据。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 成功返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public boolean remove(Long deptId) {
|
||||||
|
if (sysDeptMapper.deleteById(deptId) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 这里删除当前部门及其父部门的关联关系。
|
||||||
|
// 当前部门和子部门的关系无需在这里删除,因为包含子部门时不能删除父部门。
|
||||||
|
SysDeptRelation deptRelation = new SysDeptRelation();
|
||||||
|
deptRelation.setDeptId(deptId);
|
||||||
|
sysDeptRelationMapper.delete(new QueryWrapper<>(deptRelation));
|
||||||
|
SysDataPermDept dataPermDept = new SysDataPermDept();
|
||||||
|
dataPermDept.setDeptId(deptId);
|
||||||
|
sysDataPermDeptMapper.delete(new QueryWrapper<>(dataPermDept));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取单表查询结果。由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||||
|
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||||
|
*
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDept> getSysDeptList(SysDept filter, String orderBy) {
|
||||||
|
return sysDeptMapper.getSysDeptList(null, null, filter, orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||||
|
* 由于没有关联数据查询,因此在仅仅获取单表数据的场景下,效率更高。
|
||||||
|
* 如果需要同时获取关联数据,请移步(getSysDeptListWithRelation)方法。
|
||||||
|
*
|
||||||
|
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||||
|
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||||
|
* @param filter 过滤对象。
|
||||||
|
* @param orderBy 排序参数。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public <M> List<SysDept> getSysDeptList(
|
||||||
|
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy) {
|
||||||
|
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysDept.class);
|
||||||
|
return sysDeptMapper.getSysDeptList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,以及主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||||
|
* 该查询会涉及到一对一从表的关联过滤,或一对多从表的嵌套关联过滤,因此性能不如单表过滤。
|
||||||
|
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||||
|
*
|
||||||
|
* @param filter 主表过滤对象。
|
||||||
|
* @param orderBy 排序对象。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDept> getSysDeptListWithRelation(SysDept filter, String orderBy) {
|
||||||
|
List<SysDept> resultList = sysDeptMapper.getSysDeptList(null, null, filter, orderBy);
|
||||||
|
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||||
|
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||||
|
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||||
|
this.buildRelationForDataList(resultList, MyRelationParam.normal(), batchSize);
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取主表的查询结果,查询条件中包括主表过滤对象和指定字段的(in list)过滤。
|
||||||
|
* 同时还包含主表关联的字典数据和一对一从表数据,以及一对一从表的字典数据。
|
||||||
|
* 如果仅仅需要获取主表数据,请移步(getSysDeptList),以便获取更好的查询性能。
|
||||||
|
*
|
||||||
|
* @param inFilterField (In-list)指定的字段(Java成员字段,而非数据列名)。
|
||||||
|
* @param inFilterValues inFilterField指定字段的(In-list)数据列表。
|
||||||
|
* @param filter 主表过滤对象。
|
||||||
|
* @param orderBy 排序对象。
|
||||||
|
* @return 查询结果集。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public <M> List<SysDept> getSysDeptListWithRelation(
|
||||||
|
String inFilterField, Set<M> inFilterValues, SysDept filter, String orderBy) {
|
||||||
|
String inFilterColumn = MyModelUtil.mapToColumnName(inFilterField, SysDept.class);
|
||||||
|
List<SysDept> resultList =
|
||||||
|
sysDeptMapper.getSysDeptList(inFilterColumn, inFilterValues, filter, orderBy);
|
||||||
|
// 在缺省生成的代码中,如果查询结果resultList不是Page对象,说明没有分页,那么就很可能是数据导出接口调用了当前方法。
|
||||||
|
// 为了避免一次性的大量数据关联,规避因此而造成的系统运行性能冲击,这里手动进行了分批次读取,开发者可按需修改该值。
|
||||||
|
int batchSize = resultList instanceof Page ? 0 : 1000;
|
||||||
|
this.buildRelationForDataList(resultList, MyRelationParam.dictOnly(), batchSize);
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定对象是否包含下级对象。
|
||||||
|
*
|
||||||
|
* @param deptId 主键Id。
|
||||||
|
* @return 存在返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean hasChildren(Long deptId) {
|
||||||
|
SysDept filter = new SysDept();
|
||||||
|
filter.setParentId(deptId);
|
||||||
|
return getCountByFilter(filter) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断指定部门Id是否包含用户对象。
|
||||||
|
*
|
||||||
|
* @param deptId 部门主键Id。
|
||||||
|
* @return 存在返回true,否则false。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean hasChildrenUser(Long deptId) {
|
||||||
|
SysUser sysUser = new SysUser();
|
||||||
|
sysUser.setDeptId(deptId);
|
||||||
|
return sysUserService.getCountByFilter(sysUser) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration />
|
||||||
|
</facet>
|
||||||
|
<facet type="web" name="Web">
|
||||||
|
<configuration>
|
||||||
|
<webroots />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="common-core" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-csv:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.6.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.76" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.8.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.jimmyshi:bean-query:1.1.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||||
|
<orderEntry type="module" module-name="common-redis" />
|
||||||
|
<orderEntry type="library" name="Maven: org.redisson:redisson:3.15.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.63.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.cache:cache-api:1.1.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.16.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex.rxjava3:rxjava:3.0.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling-river:2.0.11.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling:2.0.11.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-starter-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-hystrix:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-httpclient:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-serialization:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-metrics-event-stream:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-javanica:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava-reactive-streams:1.2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:4.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-client:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.3-beta" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.3-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>common-datafilter</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<name>common-datafilter</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<artifactId>common-core</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<artifactId>common-redis</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.orange.demo.common.datafilter.aop;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.object.GlobalThreadLocal;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用Mybatis拦截器数据过滤的AOP处理类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
@Order(1)
|
||||||
|
@Slf4j
|
||||||
|
public class DisableDataFilterAspect {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有标记了DisableDataFilter注解的方法。
|
||||||
|
*/
|
||||||
|
@Pointcut("@annotation(com.orange.demo.common.core.annotation.DisableDataFilter)")
|
||||||
|
public void disableDataFilterPointCut() {
|
||||||
|
// 空注释,避免sonar警告
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("disableDataFilterPointCut()")
|
||||||
|
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||||
|
boolean dataFilterEnabled = GlobalThreadLocal.setDataFilter(false);
|
||||||
|
try {
|
||||||
|
return point.proceed();
|
||||||
|
} finally {
|
||||||
|
GlobalThreadLocal.setDataFilter(dataFilterEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.orange.demo.common.datafilter.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* common-datafilter模块的自动配置引导类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@EnableConfigurationProperties({DataFilterProperties.class})
|
||||||
|
public class DataFilterAutoConfig {
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.orange.demo.common.datafilter.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* common-datafilter模块的配置类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "datafilter")
|
||||||
|
public class DataFilterProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用租户过滤。
|
||||||
|
*/
|
||||||
|
@Value("${datafilter.tenant.enabled:false}")
|
||||||
|
private Boolean enabledTenantFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启动数据权限过滤。
|
||||||
|
*/
|
||||||
|
@Value("${datafilter.dataperm.enabled:false}")
|
||||||
|
private Boolean enabledDataPermFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门关联表的表名前缀,如zz_。该值主要用在MybatisDataFilterInterceptor拦截器中,
|
||||||
|
* 用于拼接数据权限过滤的SQL语句。
|
||||||
|
*/
|
||||||
|
@Value("${datafilter.dataperm.deptRelationTablePrefix:}")
|
||||||
|
private String deptRelationTablePrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该值为true的时候,在进行数据权限过滤时,会加上表名,如:zz_sys_user.dept_id = xxx。
|
||||||
|
* 为false时,过滤条件不加表名,只是使用字段名,如:dept_id = xxx。该值目前主要适用于
|
||||||
|
* Oracle分页SQL使用了子查询的场景。此场景下,由于子查询使用了别名,再在数据权限过滤条件中
|
||||||
|
* 加上原有表名时,SQL语法会报错。
|
||||||
|
*/
|
||||||
|
@Value("${datafilter.dataperm.addTableNamePrefix:true}")
|
||||||
|
private Boolean addTableNamePrefix;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.orange.demo.common.datafilter.config;
|
||||||
|
|
||||||
|
import com.orange.demo.common.datafilter.interceptor.DataFilterInterceptor;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加数据过滤相关的拦截器。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class DataFilterWebMvcConfigurer implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(new DataFilterInterceptor()).addPathPatterns("/**");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.orange.demo.common.datafilter.constant;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限规则类型常量类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public final class DataPermRuleType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看全部。
|
||||||
|
*/
|
||||||
|
public static final int TYPE_ALL = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅查看当前用户
|
||||||
|
*/
|
||||||
|
public static final int TYPE_USER_ONLY = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅查看当前部门
|
||||||
|
*/
|
||||||
|
public static final int TYPE_DEPT_ONLY = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在部门及子部门
|
||||||
|
*/
|
||||||
|
public static final int TYPE_DEPT_AND_CHILD_DEPT = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多部门及子部门
|
||||||
|
*/
|
||||||
|
public static final int TYPE_MULTI_DEPT_AND_CHILD_DEPT = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义部门列表
|
||||||
|
*/
|
||||||
|
public static final int TYPE_CUSTOM_DEPT_LIST = 5;
|
||||||
|
|
||||||
|
private static final Map<Object, String> DICT_MAP = new HashMap<>(6);
|
||||||
|
static {
|
||||||
|
DICT_MAP.put(0, "查看全部");
|
||||||
|
DICT_MAP.put(1, "仅查看当前用户");
|
||||||
|
DICT_MAP.put(2, "仅查看所在部门");
|
||||||
|
DICT_MAP.put(3, "所在部门及子部门");
|
||||||
|
DICT_MAP.put(4, "多部门及子部门");
|
||||||
|
DICT_MAP.put(5, "自定义部门列表");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断参数是否为当前常量字典的合法取值范围。
|
||||||
|
*
|
||||||
|
* @param value 待验证的参数值。
|
||||||
|
* @return 合法返回true,否则false。
|
||||||
|
*/
|
||||||
|
public static boolean isValid(Integer value) {
|
||||||
|
return value != null && DICT_MAP.containsKey(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私有构造函数,明确标识该常量类的作用。
|
||||||
|
*/
|
||||||
|
private DataPermRuleType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.orange.demo.common.datafilter.interceptor;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.object.GlobalThreadLocal;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主要用于初始化,通过Mybatis拦截器插件进行数据过滤的标记。
|
||||||
|
* 在调用controller接口处理方法之前,必须强制将数据过滤标记设置为缺省值。
|
||||||
|
* 这样可以避免使用当前线程在处理上一个请求时,未能正常清理的数据过滤标记值。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class DataFilterInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
|
throws Exception {
|
||||||
|
// 每次进入Controller接口之前,均主动打开数据权限验证。
|
||||||
|
// 可以避免该Servlet线程在处理之前的请求时异常退出,从而导致该状态数据没有被正常清除。
|
||||||
|
GlobalThreadLocal.setDataFilter(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||||
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
// 这里需要加注释,否则sonar不happy。
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||||
|
throws Exception {
|
||||||
|
GlobalThreadLocal.clearDataFilter();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,469 @@
|
|||||||
|
package com.orange.demo.common.datafilter.interceptor;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.common.core.annotation.*;
|
||||||
|
import com.orange.demo.common.core.exception.NoDataPermException;
|
||||||
|
import com.orange.demo.common.core.object.GlobalThreadLocal;
|
||||||
|
import com.orange.demo.common.core.object.TokenData;
|
||||||
|
import com.orange.demo.common.core.util.ApplicationContextHolder;
|
||||||
|
import com.orange.demo.common.core.util.ContextUtil;
|
||||||
|
import com.orange.demo.common.core.util.MyModelUtil;
|
||||||
|
import com.orange.demo.common.core.util.RedisKeyUtil;
|
||||||
|
import com.orange.demo.common.datafilter.config.DataFilterProperties;
|
||||||
|
import com.orange.demo.common.datafilter.constant.DataPermRuleType;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.jsqlparser.JSQLParserException;
|
||||||
|
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||||
|
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||||
|
import net.sf.jsqlparser.statement.Statement;
|
||||||
|
import net.sf.jsqlparser.statement.delete.Delete;
|
||||||
|
import net.sf.jsqlparser.statement.select.FromItem;
|
||||||
|
import net.sf.jsqlparser.statement.select.PlainSelect;
|
||||||
|
import net.sf.jsqlparser.statement.select.Select;
|
||||||
|
import net.sf.jsqlparser.statement.select.SubSelect;
|
||||||
|
import net.sf.jsqlparser.statement.update.Update;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
|
||||||
|
import org.apache.ibatis.executor.statement.StatementHandler;
|
||||||
|
import org.apache.ibatis.mapping.BoundSql;
|
||||||
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
|
import org.apache.ibatis.mapping.SqlCommandType;
|
||||||
|
import org.apache.ibatis.plugin.*;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mybatis拦截器。目前用于数据权限的统一拦截和注入处理。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class MybatisDataFilterInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
@Autowired
|
||||||
|
private DataFilterProperties properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象缓存。由于Set是排序后的,因此在查找排除方法名称时效率更高。
|
||||||
|
* 在应用服务启动的监听器中(LoadDataPermMapperListener),会调用当前对象的(loadMappersWithDataPerm)方法,加载缓存。
|
||||||
|
*/
|
||||||
|
private final Map<String, ModelDataPermInfo> cachedDataPermMap = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* 租户租户对象缓存。
|
||||||
|
*/
|
||||||
|
private final Map<String, ModelTenantInfo> cachedTenantMap = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预先加载与数据过滤相关的数据到缓存,该函数会在(LoadDataFilterInfoListener)监听器中调用。
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("all")
|
||||||
|
public void loadInfoWithDataFilter() {
|
||||||
|
Map<String, BaseDaoMapper> mapperMap =
|
||||||
|
ApplicationContextHolder.getApplicationContext().getBeansOfType(BaseDaoMapper.class);
|
||||||
|
for (BaseDaoMapper<?> mapperProxy : mapperMap.values()) {
|
||||||
|
// 优先处理jdk的代理
|
||||||
|
Object proxy = ReflectUtil.getFieldValue(mapperProxy, "h");
|
||||||
|
// 如果不是jdk的代理,再看看cjlib的代理。
|
||||||
|
if (proxy == null) {
|
||||||
|
proxy = ReflectUtil.getFieldValue(mapperProxy, "CGLIB$CALLBACK_0");
|
||||||
|
}
|
||||||
|
Class<?> mapperClass = (Class<?>) ReflectUtil.getFieldValue(proxy, "mapperInterface");
|
||||||
|
if (properties.getEnabledTenantFilter()) {
|
||||||
|
loadTenantFilterData(mapperClass);
|
||||||
|
}
|
||||||
|
if (properties.getEnabledDataPermFilter()) {
|
||||||
|
EnableDataPerm rule = mapperClass.getAnnotation(EnableDataPerm.class);
|
||||||
|
if (rule != null) {
|
||||||
|
loadDataPermFilterRules(mapperClass, rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadTenantFilterData(Class<?> mapperClass) {
|
||||||
|
Class<?> modelClass = (Class<?>) ((ParameterizedType)
|
||||||
|
mapperClass.getGenericInterfaces()[0]).getActualTypeArguments()[0];
|
||||||
|
Field[] fields = ReflectUtil.getFields(modelClass);
|
||||||
|
for (Field field : fields) {
|
||||||
|
if (field.getAnnotation(TenantFilterColumn.class) != null) {
|
||||||
|
ModelTenantInfo tenantInfo = new ModelTenantInfo();
|
||||||
|
tenantInfo.setModelName(modelClass.getSimpleName());
|
||||||
|
tenantInfo.setTableName(modelClass.getAnnotation(TableName.class).value());
|
||||||
|
tenantInfo.setFieldName(field.getName());
|
||||||
|
tenantInfo.setColumnName(MyModelUtil.mapToColumnName(field, modelClass));
|
||||||
|
// 判断当前dao中是否包括不需要自动注入租户Id过滤的方法。
|
||||||
|
DisableTenantFilter disableTenantFilter = mapperClass.getAnnotation(DisableTenantFilter.class);
|
||||||
|
if (disableTenantFilter != null) {
|
||||||
|
// 这里开始获取当前Mapper已经声明的的SqlId中,有哪些是需要排除在外的。
|
||||||
|
// 排除在外的将不进行数据过滤。
|
||||||
|
Set<String> excludeMethodNameSet = new HashSet<>();
|
||||||
|
for (String excludeName : disableTenantFilter.includeMethodName()) {
|
||||||
|
excludeMethodNameSet.add(excludeName);
|
||||||
|
// 这里是给pagehelper中,分页查询先获取数据总量的查询。
|
||||||
|
excludeMethodNameSet.add(excludeName + "_COUNT");
|
||||||
|
}
|
||||||
|
tenantInfo.setExcludeMethodNameSet(excludeMethodNameSet);
|
||||||
|
}
|
||||||
|
cachedTenantMap.put(mapperClass.getName(), tenantInfo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadDataPermFilterRules(Class<?> mapperClass, EnableDataPerm rule) {
|
||||||
|
String sysDataPermMapperName = "SysDataPermMapper";
|
||||||
|
// 由于给数据权限Mapper添加@EnableDataPerm,将会导致无限递归,因此这里检测到之后,
|
||||||
|
// 会在系统启动加载监听器的时候,及时抛出异常。
|
||||||
|
if (StringUtils.equals(sysDataPermMapperName, mapperClass.getSimpleName())) {
|
||||||
|
throw new IllegalStateException("Add @EnableDataPerm annotation to SysDataPermMapper is ILLEGAL!");
|
||||||
|
}
|
||||||
|
// 这里开始获取当前Mapper已经声明的的SqlId中,有哪些是需要排除在外的。
|
||||||
|
// 排除在外的将不进行数据过滤。
|
||||||
|
Set<String> excludeMethodNameSet = null;
|
||||||
|
String[] excludes = rule.excluseMethodName();
|
||||||
|
if (excludes.length > 0) {
|
||||||
|
excludeMethodNameSet = new HashSet<>();
|
||||||
|
for (String excludeName : excludes) {
|
||||||
|
excludeMethodNameSet.add(excludeName);
|
||||||
|
// 这里是给pagehelper中,分页查询先获取数据总量的查询。
|
||||||
|
excludeMethodNameSet.add(excludeName + "_COUNT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取Mapper关联的主表信息,包括表名,user过滤字段名和dept过滤字段名。
|
||||||
|
Class<?> modelClazz = (Class<?>)
|
||||||
|
((ParameterizedType) mapperClass.getGenericInterfaces()[0]).getActualTypeArguments()[0];
|
||||||
|
Field[] fields = ReflectUtil.getFields(modelClazz);
|
||||||
|
Field userFilterField = null;
|
||||||
|
Field deptFilterField = null;
|
||||||
|
for (Field field : fields) {
|
||||||
|
if (null != field.getAnnotation(UserFilterColumn.class)) {
|
||||||
|
userFilterField = field;
|
||||||
|
}
|
||||||
|
if (null != field.getAnnotation(DeptFilterColumn.class)) {
|
||||||
|
deptFilterField = field;
|
||||||
|
}
|
||||||
|
if (userFilterField != null && deptFilterField != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 通过注解解析与Mapper关联的Model,并获取与数据权限关联的信息,并将结果缓存。
|
||||||
|
ModelDataPermInfo info = new ModelDataPermInfo();
|
||||||
|
info.setMainTableName(MyModelUtil.mapToTableName(modelClazz));
|
||||||
|
info.setExcludeMethodNameSet(excludeMethodNameSet);
|
||||||
|
if (userFilterField != null) {
|
||||||
|
info.setUserFilterColumn(MyModelUtil.mapToColumnName(userFilterField, modelClazz));
|
||||||
|
}
|
||||||
|
if (deptFilterField != null) {
|
||||||
|
info.setDeptFilterColumn(MyModelUtil.mapToColumnName(deptFilterField, modelClazz));
|
||||||
|
}
|
||||||
|
cachedDataPermMap.put(mapperClass.getName(), info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object intercept(Invocation invocation) throws Throwable {
|
||||||
|
// 判断当前线程本地存储中,业务操作是否禁用了数据权限过滤,如果禁用,则不进行后续的数据过滤处理了。
|
||||||
|
if (!GlobalThreadLocal.enabledDataFilter()) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
// 只有在HttpServletRequest场景下,该拦截器才起作用,对于系统级别的预加载数据不会应用数据权限。
|
||||||
|
if (!ContextUtil.hasRequestContext()) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
// 没有登录的用户,不会参与租户过滤,如果需要过滤的,自己在代码中手动实现
|
||||||
|
// 通常对于无需登录的白名单url,也无需过滤了。
|
||||||
|
// 另外就是登录接口中,获取菜单列表的接口,由于尚未登录,没有TokenData,所以这个接口我们手动加入了该条件。
|
||||||
|
if (TokenData.takeFromRequest() == null) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
RoutingStatementHandler handler = (RoutingStatementHandler) invocation.getTarget();
|
||||||
|
StatementHandler delegate =
|
||||||
|
(StatementHandler) ReflectUtil.getFieldValue(handler, "delegate");
|
||||||
|
// 通过反射获取delegate父类BaseStatementHandler的mappedStatement属性
|
||||||
|
MappedStatement mappedStatement =
|
||||||
|
(MappedStatement) ReflectUtil.getFieldValue(delegate, "mappedStatement");
|
||||||
|
SqlCommandType commandType = mappedStatement.getSqlCommandType();
|
||||||
|
// 对于INSERT语句,我们不进行任何数据过滤。
|
||||||
|
if (commandType == SqlCommandType.INSERT) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
String sqlId = mappedStatement.getId();
|
||||||
|
int pos = StringUtils.lastIndexOf(sqlId, ".");
|
||||||
|
String className = StringUtils.substring(sqlId, 0, pos);
|
||||||
|
String methodName = StringUtils.substring(sqlId, pos + 1);
|
||||||
|
// 先进行租户过滤条件的处理,再将解析并处理后的SQL Statement交给下一步的数据权限过滤去处理。
|
||||||
|
// 这样做的目的主要是为了减少一次SQL解析的过程,因为这是高频操作,所以要尽量去优化。
|
||||||
|
Statement statement = null;
|
||||||
|
if (properties.getEnabledTenantFilter()) {
|
||||||
|
statement = this.processTenantFilter(className, methodName, delegate.getBoundSql(), commandType);
|
||||||
|
}
|
||||||
|
// 处理数据权限过滤。
|
||||||
|
if (properties.getEnabledDataPermFilter()) {
|
||||||
|
this.processDataPermFilter(className, methodName, delegate.getBoundSql(), commandType, statement, sqlId);
|
||||||
|
}
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Statement processTenantFilter(
|
||||||
|
String className, String methodName, BoundSql boundSql, SqlCommandType commandType) throws JSQLParserException {
|
||||||
|
ModelTenantInfo info = cachedTenantMap.get(className);
|
||||||
|
if (info == null || CollUtil.contains(info.getExcludeMethodNameSet(), methodName)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String sql = boundSql.getSql();
|
||||||
|
Statement statement = CCJSqlParserUtil.parse(sql);
|
||||||
|
StringBuilder filterBuilder = new StringBuilder(64);
|
||||||
|
filterBuilder.append(info.tableName).append(".")
|
||||||
|
.append(info.columnName)
|
||||||
|
.append("=")
|
||||||
|
.append(TokenData.takeFromRequest().getTenantId());
|
||||||
|
String dataFilter = filterBuilder.toString();
|
||||||
|
if (commandType == SqlCommandType.UPDATE) {
|
||||||
|
Update update = (Update) statement;
|
||||||
|
this.buildWhereClause(update, dataFilter);
|
||||||
|
} else if (commandType == SqlCommandType.DELETE) {
|
||||||
|
Delete delete = (Delete) statement;
|
||||||
|
this.buildWhereClause(delete, dataFilter);
|
||||||
|
} else {
|
||||||
|
Select select = (Select) statement;
|
||||||
|
PlainSelect selectBody = (PlainSelect) select.getSelectBody();
|
||||||
|
FromItem fromItem = selectBody.getFromItem();
|
||||||
|
if (fromItem != null) {
|
||||||
|
PlainSelect subSelect = null;
|
||||||
|
if (fromItem instanceof SubSelect) {
|
||||||
|
subSelect = (PlainSelect) ((SubSelect) fromItem).getSelectBody();
|
||||||
|
}
|
||||||
|
if (subSelect != null) {
|
||||||
|
buildWhereClause(subSelect, dataFilter);
|
||||||
|
} else {
|
||||||
|
buildWhereClause(selectBody, dataFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReflectUtil.setFieldValue(boundSql, "sql", statement.toString());
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processDataPermFilter(
|
||||||
|
String className, String methodName, BoundSql boundSql, SqlCommandType commandType, Statement statement, String sqlId)
|
||||||
|
throws JSQLParserException {
|
||||||
|
// 判断当前线程本地存储中,业务操作是否禁用了数据权限过滤,如果禁用,则不进行后续的数据过滤处理了。
|
||||||
|
// 数据过滤权限中,INSERT不过滤。如果是管理员则不参与数据权限的数据过滤,显示全部数据。
|
||||||
|
TokenData tokenData = TokenData.takeFromRequest();
|
||||||
|
if (Boolean.TRUE.equals(tokenData.getIsAdmin())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ModelDataPermInfo info = cachedDataPermMap.get(className);
|
||||||
|
// 再次查找当前方法是否为排除方法,如果不是,就参与数据权限注入过滤。
|
||||||
|
if (info == null || CollUtil.contains(info.getExcludeMethodNameSet(), methodName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String dataPermSessionKey = RedisKeyUtil.makeSessionDataPermIdKey(tokenData.getSessionId());
|
||||||
|
String dataPermData = redissonClient.getBucket(dataPermSessionKey).get().toString();
|
||||||
|
if (StringUtils.isBlank(dataPermData)) {
|
||||||
|
throw new NoDataPermException("No Related DataPerm found for SQL_ID [ " + sqlId + " ].");
|
||||||
|
}
|
||||||
|
Map<Integer, String> dataPermMap = new HashMap<>(8);
|
||||||
|
for (Map.Entry<String, Object> entry : JSON.parseObject(dataPermData).entrySet()) {
|
||||||
|
dataPermMap.put(Integer.valueOf(entry.getKey()), entry.getValue().toString());
|
||||||
|
}
|
||||||
|
if (MapUtils.isEmpty(dataPermMap)) {
|
||||||
|
throw new NoDataPermException("No Related DataPerm found for SQL_ID [ " + sqlId + " ].");
|
||||||
|
}
|
||||||
|
if (dataPermMap.containsKey(DataPermRuleType.TYPE_ALL)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.processDataPerm(info, dataPermMap, boundSql, commandType, statement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processDataPerm(
|
||||||
|
ModelDataPermInfo info,
|
||||||
|
Map<Integer, String> dataPermMap,
|
||||||
|
BoundSql boundSql,
|
||||||
|
SqlCommandType commandType,
|
||||||
|
Statement statement) throws JSQLParserException {
|
||||||
|
List<String> criteriaList = new LinkedList<>();
|
||||||
|
for (Map.Entry<Integer, String> entry : dataPermMap.entrySet()) {
|
||||||
|
String filterClause = processDataPermRule(info, entry.getKey(), entry.getValue());
|
||||||
|
if (StringUtils.isNotBlank(filterClause)) {
|
||||||
|
criteriaList.add(filterClause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(criteriaList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
StringBuilder filterBuilder = new StringBuilder(128);
|
||||||
|
filterBuilder.append("(");
|
||||||
|
filterBuilder.append(StringUtils.join(criteriaList, " OR "));
|
||||||
|
filterBuilder.append(")");
|
||||||
|
String dataFilter = filterBuilder.toString();
|
||||||
|
if (statement == null) {
|
||||||
|
String sql = boundSql.getSql();
|
||||||
|
statement = CCJSqlParserUtil.parse(sql);
|
||||||
|
}
|
||||||
|
if (commandType == SqlCommandType.UPDATE) {
|
||||||
|
Update update = (Update) statement;
|
||||||
|
this.buildWhereClause(update, dataFilter);
|
||||||
|
} else if (commandType == SqlCommandType.DELETE) {
|
||||||
|
Delete delete = (Delete) statement;
|
||||||
|
this.buildWhereClause(delete, dataFilter);
|
||||||
|
} else {
|
||||||
|
Select select = (Select) statement;
|
||||||
|
PlainSelect selectBody = (PlainSelect) select.getSelectBody();
|
||||||
|
FromItem fromItem = selectBody.getFromItem();
|
||||||
|
PlainSelect subSelect = null;
|
||||||
|
if (fromItem != null) {
|
||||||
|
if (fromItem instanceof SubSelect) {
|
||||||
|
subSelect = (PlainSelect) ((SubSelect) fromItem).getSelectBody();
|
||||||
|
}
|
||||||
|
if (subSelect != null) {
|
||||||
|
buildWhereClause(subSelect, dataFilter);
|
||||||
|
} else {
|
||||||
|
buildWhereClause(selectBody, dataFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReflectUtil.setFieldValue(boundSql, "sql", statement.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String processDataPermRule(ModelDataPermInfo info, Integer ruleType, String deptIds) {
|
||||||
|
TokenData tokenData = TokenData.takeFromRequest();
|
||||||
|
StringBuilder filter = new StringBuilder(128);
|
||||||
|
if (ruleType == DataPermRuleType.TYPE_USER_ONLY) {
|
||||||
|
if (StringUtils.isNotBlank(info.getUserFilterColumn())) {
|
||||||
|
if (properties.getAddTableNamePrefix()) {
|
||||||
|
filter.append(info.getMainTableName()).append(".");
|
||||||
|
}
|
||||||
|
filter.append(info.getUserFilterColumn())
|
||||||
|
.append(" = ")
|
||||||
|
.append(tokenData.getUserId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StringUtils.isNotBlank(info.getDeptFilterColumn())) {
|
||||||
|
if (ruleType == DataPermRuleType.TYPE_DEPT_ONLY) {
|
||||||
|
if (properties.getAddTableNamePrefix()) {
|
||||||
|
filter.append(info.getMainTableName()).append(".");
|
||||||
|
}
|
||||||
|
filter.append(info.getDeptFilterColumn())
|
||||||
|
.append(" = ")
|
||||||
|
.append(tokenData.getDeptId());
|
||||||
|
} else if (ruleType == DataPermRuleType.TYPE_DEPT_AND_CHILD_DEPT) {
|
||||||
|
filter.append(" EXISTS ")
|
||||||
|
.append("(SELECT 1 FROM ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation WHERE ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation.parent_dept_id = ")
|
||||||
|
.append(tokenData.getDeptId())
|
||||||
|
.append(" AND ");
|
||||||
|
if (properties.getAddTableNamePrefix()) {
|
||||||
|
filter.append(info.getMainTableName()).append(".");
|
||||||
|
}
|
||||||
|
filter.append(info.getDeptFilterColumn())
|
||||||
|
.append(" = ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation.dept_id) ");
|
||||||
|
} else if (ruleType == DataPermRuleType.TYPE_MULTI_DEPT_AND_CHILD_DEPT) {
|
||||||
|
filter.append(" EXISTS ")
|
||||||
|
.append("(SELECT 1 FROM ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation WHERE ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation.parent_dept_id IN (")
|
||||||
|
.append(deptIds)
|
||||||
|
.append(") AND ");
|
||||||
|
if (properties.getAddTableNamePrefix()) {
|
||||||
|
filter.append(info.getMainTableName()).append(".");
|
||||||
|
}
|
||||||
|
filter.append(info.getDeptFilterColumn())
|
||||||
|
.append(" = ")
|
||||||
|
.append(properties.getDeptRelationTablePrefix())
|
||||||
|
.append("sys_dept_relation.dept_id) ");
|
||||||
|
} else if (ruleType == DataPermRuleType.TYPE_CUSTOM_DEPT_LIST) {
|
||||||
|
if (properties.getAddTableNamePrefix()) {
|
||||||
|
filter.append(info.getMainTableName()).append(".");
|
||||||
|
}
|
||||||
|
filter.append(info.getDeptFilterColumn())
|
||||||
|
.append(" IN (")
|
||||||
|
.append(deptIds)
|
||||||
|
.append(") ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildWhereClause(Update update, String dataFilter) throws JSQLParserException {
|
||||||
|
if (update.getWhere() == null) {
|
||||||
|
update.setWhere(CCJSqlParserUtil.parseCondExpression(dataFilter));
|
||||||
|
} else {
|
||||||
|
AndExpression and = new AndExpression(
|
||||||
|
CCJSqlParserUtil.parseCondExpression(dataFilter), update.getWhere());
|
||||||
|
update.setWhere(and);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildWhereClause(Delete delete, String dataFilter) throws JSQLParserException {
|
||||||
|
if (delete.getWhere() == null) {
|
||||||
|
delete.setWhere(CCJSqlParserUtil.parseCondExpression(dataFilter));
|
||||||
|
} else {
|
||||||
|
AndExpression and = new AndExpression(
|
||||||
|
CCJSqlParserUtil.parseCondExpression(dataFilter), delete.getWhere());
|
||||||
|
delete.setWhere(and);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildWhereClause(PlainSelect select, String dataFilter) throws JSQLParserException {
|
||||||
|
if (select.getWhere() == null) {
|
||||||
|
select.setWhere(CCJSqlParserUtil.parseCondExpression(dataFilter));
|
||||||
|
} else {
|
||||||
|
AndExpression and = new AndExpression(
|
||||||
|
CCJSqlParserUtil.parseCondExpression(dataFilter), select.getWhere());
|
||||||
|
select.setWhere(and);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object plugin(Object target) {
|
||||||
|
return Plugin.wrap(target, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProperties(Properties properties) {
|
||||||
|
// 这里需要空注解,否则sonar会不happy。
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
private static final class ModelDataPermInfo {
|
||||||
|
private Set<String> excludeMethodNameSet;
|
||||||
|
private String userFilterColumn;
|
||||||
|
private String deptFilterColumn;
|
||||||
|
private String mainTableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
private static final class ModelTenantInfo {
|
||||||
|
private Set<String> excludeMethodNameSet;
|
||||||
|
private String modelName;
|
||||||
|
private String tableName;
|
||||||
|
private String fieldName;
|
||||||
|
private String columnName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.orange.demo.common.datafilter.listener;
|
||||||
|
|
||||||
|
import com.orange.demo.common.datafilter.interceptor.MybatisDataFilterInterceptor;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用服务启动监听器。
|
||||||
|
* 目前主要功能是调用MybatisDataFilterInterceptor中的loadInfoWithDataFilter方法,
|
||||||
|
* 将标记有过滤注解的数据加载到缓存,以提升系统运行时效率。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class LoadDataFilterInfoListener implements ApplicationListener<ApplicationReadyEvent> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||||
|
MybatisDataFilterInterceptor interceptor =
|
||||||
|
applicationReadyEvent.getApplicationContext().getBean(MybatisDataFilterInterceptor.class);
|
||||||
|
interceptor.loadInfoWithDataFilter();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
|
com.orange.demo.common.datafilter.config.DataFilterAutoConfig
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="Spring" name="Spring">
|
||||||
|
<configuration />
|
||||||
|
</facet>
|
||||||
|
<facet type="web" name="Web">
|
||||||
|
<configuration>
|
||||||
|
<webroots />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="common-sequence" />
|
||||||
|
<orderEntry type="module" module-name="common-core" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.glassfish:jakarta.el:3.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.45" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:guava:29.0-jre" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.11.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-csv:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.6.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.76" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.8.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: cn.jimmyshi:bean-query:1.1.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.23" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.5.12.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-freemarker:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.13.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-starter-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: de.codecentric:spring-boot-admin-client:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config:2.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.spring:spring-context-support:1.0.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-client:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-common:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.alibaba.nacos:nacos-api:1.4.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.prometheus:simpleclient:0.5.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.3.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.9.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-hystrix:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.archaius:archaius-core:0.7.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.github.openfeign:feign-httpclient:10.10.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-hystrix:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-ribbon:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-netflix-archaius:2.2.6.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-core:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava:1.3.8" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-serialization:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: com.fasterxml.jackson.module:jackson-module-afterburner:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-metrics-event-stream:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.netflix.hystrix:hystrix-javanica:1.5.18" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: io.reactivex:rxjava-reactive-streams:1.2.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mapstruct:mapstruct-processor:1.4.2.Final" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-recipes:4.3.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-framework:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.curator:curator-client:4.0.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.5.3-beta" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: commons-cli:commons-cli:1.4" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.3-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.12.10" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.lmax:disruptor:3.4.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.3.10.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.16.1" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.vintage:junit-vintage-engine:5.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.6.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.3.3" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.2.14.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.7.0" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>common-log</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<name>common-log</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.orange.demo</groupId>
|
||||||
|
<artifactId>common-sequence</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.*</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.orange.demo.common.log.annotation;
|
||||||
|
|
||||||
|
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录注解。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface OperationLog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述。
|
||||||
|
*/
|
||||||
|
String description() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型。
|
||||||
|
*/
|
||||||
|
int type() default SysOperationLogType.OTHER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存应答结果。
|
||||||
|
* 对于类似导出和文件下载之类的接口,该参与应该设置为false。
|
||||||
|
*/
|
||||||
|
boolean saveResponse() default true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
package com.orange.demo.common.log.aop;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||||
|
import com.orange.demo.common.core.object.ResponseResult;
|
||||||
|
import com.orange.demo.common.core.object.TokenData;
|
||||||
|
import com.orange.demo.common.core.util.ContextUtil;
|
||||||
|
import com.orange.demo.common.core.util.IpUtil;
|
||||||
|
import com.orange.demo.common.core.util.MyCommonUtil;
|
||||||
|
import com.orange.demo.common.log.annotation.OperationLog;
|
||||||
|
import com.orange.demo.common.log.config.OperationLogProperties;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
import com.orange.demo.common.log.model.constant.SysOperationLogType;
|
||||||
|
import com.orange.demo.common.sequence.wrapper.IdGeneratorWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.Signature;
|
||||||
|
import org.aspectj.lang.annotation.*;
|
||||||
|
import org.aspectj.lang.reflect.MethodSignature;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录处理AOP对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
@Order(1)
|
||||||
|
@Slf4j
|
||||||
|
public class OperationLogAspect {
|
||||||
|
|
||||||
|
@Value("${spring.application.name}")
|
||||||
|
private String serviceName;
|
||||||
|
@Autowired
|
||||||
|
private KafkaTemplate<String, Object> kafkaTemplate;
|
||||||
|
@Autowired
|
||||||
|
private OperationLogProperties properties;
|
||||||
|
@Autowired
|
||||||
|
private IdGeneratorWrapper idGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息、请求参数和应答结果字符串的最大长度。
|
||||||
|
*/
|
||||||
|
private final static int MAX_LENGTH = 2000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有controller方法。
|
||||||
|
*/
|
||||||
|
@Pointcut("execution(public * com.orange.demo..controller..*(..))")
|
||||||
|
public void operationLogPointCut() {
|
||||||
|
// 空注释,避免sonar警告
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("operationLogPointCut()")
|
||||||
|
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
|
// 计时。
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
HttpServletRequest request = ContextUtil.getHttpRequest();
|
||||||
|
HttpServletResponse response = ContextUtil.getHttpResponse();
|
||||||
|
String traceId = this.getTraceId(request);
|
||||||
|
request.setAttribute(ApplicationConstant.HTTP_HEADER_TRACE_ID, traceId);
|
||||||
|
// 将流水号通过应答头返回给前端,便于问题精确定位。
|
||||||
|
response.setHeader(ApplicationConstant.HTTP_HEADER_TRACE_ID, traceId);
|
||||||
|
MDC.put(ApplicationConstant.HTTP_HEADER_TRACE_ID, traceId);
|
||||||
|
TokenData tokenData = TokenData.takeFromRequest();
|
||||||
|
// 为log4j2日志设定变量,使日志可以输出更多有价值的信息。
|
||||||
|
if (tokenData != null) {
|
||||||
|
MDC.put("sessionId", tokenData.getSessionId());
|
||||||
|
MDC.put("userId", tokenData.getUserId().toString());
|
||||||
|
}
|
||||||
|
String[] parameterNames = this.getParameterNames(joinPoint);
|
||||||
|
Object[] args = joinPoint.getArgs();
|
||||||
|
JSONObject jsonArgs = new JSONObject();
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
Object arg = args[i];
|
||||||
|
if (this.isNormalArgs(arg)) {
|
||||||
|
String parameterName = parameterNames[i];
|
||||||
|
jsonArgs.put(parameterName, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String params = jsonArgs.toJSONString();
|
||||||
|
SysOperationLog operationLog = null;
|
||||||
|
OperationLog operationLogAnnotation = null;
|
||||||
|
boolean saveOperationLog = properties.isEnabled();
|
||||||
|
if (saveOperationLog) {
|
||||||
|
operationLogAnnotation = getOperationLogAnnotation(joinPoint);
|
||||||
|
saveOperationLog = (operationLogAnnotation != null);
|
||||||
|
}
|
||||||
|
if (saveOperationLog) {
|
||||||
|
operationLog = this.buildSysOperationLog(operationLogAnnotation, joinPoint, params, traceId, tokenData);
|
||||||
|
}
|
||||||
|
Object result;
|
||||||
|
log.info("开始请求,url={}, reqData={}", request.getRequestURI(), params);
|
||||||
|
try {
|
||||||
|
// 调用原来的方法
|
||||||
|
result = joinPoint.proceed();
|
||||||
|
String respData = result == null ? "null" : JSON.toJSONString(result);
|
||||||
|
Long elapse = System.currentTimeMillis() - start;
|
||||||
|
if (saveOperationLog) {
|
||||||
|
this.operationLogPostProcess(operationLogAnnotation, respData, operationLog, result);
|
||||||
|
}
|
||||||
|
log.info("请求完成, url={},elapse={}ms, respData={}", request.getRequestURI(), elapse, respData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (saveOperationLog) {
|
||||||
|
operationLog.setSuccess(false);
|
||||||
|
operationLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, MAX_LENGTH));
|
||||||
|
}
|
||||||
|
log.error("请求报错,url={}, reqData={}, error={}", request.getRequestURI(), params, e.getMessage());
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
if (saveOperationLog) {
|
||||||
|
operationLog.setElapse(System.currentTimeMillis() - start);
|
||||||
|
kafkaTemplate.send(properties.getKafkaTopic(), JSON.toJSONString(operationLog));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SysOperationLog buildSysOperationLog(
|
||||||
|
OperationLog operationLogAnnotation,
|
||||||
|
ProceedingJoinPoint joinPoint,
|
||||||
|
String params,
|
||||||
|
String traceId,
|
||||||
|
TokenData tokenData) {
|
||||||
|
HttpServletRequest request = ContextUtil.getHttpRequest();
|
||||||
|
SysOperationLog operationLog = new SysOperationLog();
|
||||||
|
operationLog.setLogId(idGenerator.nextLongId());
|
||||||
|
operationLog.setTraceId(traceId);
|
||||||
|
operationLog.setDescription(operationLogAnnotation.description());
|
||||||
|
operationLog.setOperationType(operationLogAnnotation.type());
|
||||||
|
operationLog.setServiceName(this.serviceName);
|
||||||
|
operationLog.setApiClass(joinPoint.getTarget().getClass().getName());
|
||||||
|
operationLog.setApiMethod(operationLog.getApiClass() + "." + joinPoint.getSignature().getName());
|
||||||
|
operationLog.setRequestMethod(request.getMethod());
|
||||||
|
operationLog.setRequestUrl(request.getRequestURI());
|
||||||
|
if (tokenData != null) {
|
||||||
|
operationLog.setRequestIp(tokenData.getLoginIp());
|
||||||
|
} else {
|
||||||
|
operationLog.setRequestIp(IpUtil.getRemoteIpAddress(request));
|
||||||
|
}
|
||||||
|
operationLog.setOperationTime(new Date());
|
||||||
|
if (params != null) {
|
||||||
|
if (params.length() <= MAX_LENGTH) {
|
||||||
|
operationLog.setRequestArguments(params);
|
||||||
|
} else {
|
||||||
|
operationLog.setRequestArguments(StringUtils.substring(params, 0, MAX_LENGTH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tokenData != null) {
|
||||||
|
// 对于非多租户系统,该值为空可以忽略。
|
||||||
|
operationLog.setTenantId(tokenData.getTenantId());
|
||||||
|
operationLog.setSessionId(tokenData.getSessionId());
|
||||||
|
operationLog.setOperatorId(tokenData.getUserId());
|
||||||
|
operationLog.setOperatorName(tokenData.getLoginName());
|
||||||
|
}
|
||||||
|
return operationLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void operationLogPostProcess(
|
||||||
|
OperationLog operationLogAnnotation, String respData, SysOperationLog operationLog, Object result) {
|
||||||
|
if (operationLogAnnotation.saveResponse()) {
|
||||||
|
if (respData.length() <= MAX_LENGTH) {
|
||||||
|
operationLog.setResponseResult(respData);
|
||||||
|
} else {
|
||||||
|
operationLog.setResponseResult(StringUtils.substring(respData, 0, MAX_LENGTH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理大部分返回ResponseResult的接口。
|
||||||
|
if (!(result instanceof ResponseResult)) {
|
||||||
|
if (ContextUtil.hasRequestContext()) {
|
||||||
|
operationLog.setSuccess(ContextUtil.getHttpResponse().getStatus() == HttpServletResponse.SC_OK);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ResponseResult<?> responseResult = (ResponseResult<?>) result;
|
||||||
|
operationLog.setSuccess(responseResult.isSuccess());
|
||||||
|
if (!responseResult.isSuccess()) {
|
||||||
|
operationLog.setErrorMsg(responseResult.getErrorMessage());
|
||||||
|
}
|
||||||
|
if (operationLog.getOperationType().equals(SysOperationLogType.LOGIN)) {
|
||||||
|
// 对于登录操作,由于在调用登录方法之前,没有可用的TokenData。
|
||||||
|
// 因此如果登录成功,可再次通过TokenData.takeFromRequest()获取TokenData。
|
||||||
|
if (operationLog.getSuccess()) {
|
||||||
|
// 这里为了保证LoginController.doLogin方法,一定将TokenData存入Request.Attribute之中,
|
||||||
|
// 我们将不做空值判断,一旦出错,开发者可在调试时立刻发现异常,并根据这里的注释进行修复。
|
||||||
|
TokenData tokenData = TokenData.takeFromRequest();
|
||||||
|
// 对于非多租户系统,为了保证代码一致性,仍可保留对tenantId的赋值代码。
|
||||||
|
operationLog.setTenantId(tokenData.getTenantId());
|
||||||
|
operationLog.setSessionId(tokenData.getSessionId());
|
||||||
|
operationLog.setOperatorId(tokenData.getUserId());
|
||||||
|
operationLog.setOperatorName(tokenData.getLoginName());
|
||||||
|
} else {
|
||||||
|
HttpServletRequest request = ContextUtil.getHttpRequest();
|
||||||
|
// 登录操作需要特殊处理,无论是登录成功还是失败,都要记录operator_name字段。
|
||||||
|
operationLog.setOperatorName(request.getParameter("loginName"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] getParameterNames(ProceedingJoinPoint joinPoint) {
|
||||||
|
Signature signature = joinPoint.getSignature();
|
||||||
|
MethodSignature methodSignature = (MethodSignature) signature;
|
||||||
|
return methodSignature.getParameterNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OperationLog getOperationLogAnnotation(JoinPoint joinPoint) throws Exception {
|
||||||
|
Signature signature = joinPoint.getSignature();
|
||||||
|
MethodSignature methodSignature = (MethodSignature) signature;
|
||||||
|
Method method = methodSignature.getMethod();
|
||||||
|
return method.getAnnotation(OperationLog.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTraceId(HttpServletRequest request) {
|
||||||
|
// 获取请求流水号。
|
||||||
|
// 对于微服务系统,为了保证traceId在全调用链的唯一性,因此在网关的过滤器中创建了该值。
|
||||||
|
String traceId = request.getHeader(ApplicationConstant.HTTP_HEADER_TRACE_ID);
|
||||||
|
if (StringUtils.isBlank(traceId)) {
|
||||||
|
traceId = MyCommonUtil.generateUuid();
|
||||||
|
}
|
||||||
|
return traceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNormalArgs(Object o) {
|
||||||
|
if (o instanceof List) {
|
||||||
|
List<?> list = (List<?>) o;
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
return !(list.get(0) instanceof MultipartFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !(o instanceof HttpServletRequest)
|
||||||
|
&& !(o instanceof HttpServletResponse)
|
||||||
|
&& !(o instanceof MultipartFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.orange.demo.common.log.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* common-log模块的自动配置引导类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@EnableConfigurationProperties({OperationLogProperties.class})
|
||||||
|
public class CommonLogAutoConfig {
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.orange.demo.common.log.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志的配置类。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "common-log.operation-log")
|
||||||
|
public class OperationLogProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否采集操作日志。
|
||||||
|
*/
|
||||||
|
private boolean enabled = true;
|
||||||
|
/**
|
||||||
|
* kafka topic
|
||||||
|
*/
|
||||||
|
private String kafkaTopic = "SysOperationLog";
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.orange.demo.common.log.dao;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统操作日志对应的数据访问对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysOperationLogMapper extends BaseDaoMapper<SysOperationLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入。
|
||||||
|
*
|
||||||
|
* @param operationLogList 操作日志列表。
|
||||||
|
*/
|
||||||
|
void insertList(List<SysOperationLog> operationLogList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据过滤条件和排序规则,查询操作日志。
|
||||||
|
*
|
||||||
|
* @param sysOperationLogFilter 操作日志的过滤对象。
|
||||||
|
* @param orderBy 排序规则。
|
||||||
|
* @return 查询列表。
|
||||||
|
*/
|
||||||
|
List<SysOperationLog> getSysOperationLogList(
|
||||||
|
@Param("sysOperationLogFilter") SysOperationLog sysOperationLogFilter,
|
||||||
|
@Param("orderBy") String orderBy);
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.orange.demo.common.log.dao.SysOperationLogMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.orange.demo.common.log.model.SysOperationLog">
|
||||||
|
<id column="log_id" jdbcType="BIGINT" property="logId"/>
|
||||||
|
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||||
|
<result column="operation_type" jdbcType="INTEGER" property="operationType"/>
|
||||||
|
<result column="service_name" jdbcType="VARCHAR" property="serviceName"/>
|
||||||
|
<result column="api_class" jdbcType="VARCHAR" property="apiClass"/>
|
||||||
|
<result column="api_method" jdbcType="VARCHAR" property="apiMethod"/>
|
||||||
|
<result column="session_id" jdbcType="VARCHAR" property="sessionId"/>
|
||||||
|
<result column="trace_id" jdbcType="VARCHAR" property="traceId"/>
|
||||||
|
<result column="elapse" jdbcType="BIGINT" property="elapse"/>
|
||||||
|
<result column="request_method" jdbcType="VARCHAR" property="requestMethod"/>
|
||||||
|
<result column="request_url" jdbcType="VARCHAR" property="requestUrl"/>
|
||||||
|
<result column="request_arguments" jdbcType="VARCHAR" property="requestArguments"/>
|
||||||
|
<result column="response_result" jdbcType="VARCHAR" property="responseResult"/>
|
||||||
|
<result column="request_ip" jdbcType="VARCHAR" property="requestIp"/>
|
||||||
|
<result column="success" jdbcType="BIT" property="success"/>
|
||||||
|
<result column="error_msg" jdbcType="VARCHAR" property="errorMsg"/>
|
||||||
|
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
|
||||||
|
<result column="operator_id" jdbcType="BIGINT" property="operatorId"/>
|
||||||
|
<result column="operator_name" jdbcType="VARCHAR" property="operatorName"/>
|
||||||
|
<result column="operation_time" jdbcType="TIMESTAMP" property="operationTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 这里仅包含调用接口输入的主表过滤条件 -->
|
||||||
|
<sql id="filterRef">
|
||||||
|
<if test="sysOperationLogFilter != null">
|
||||||
|
<if test="sysOperationLogFilter.operationType != null">
|
||||||
|
AND zz_sys_operation_log.operation_type = #{sysOperationLogFilter.operationType}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.requestUrl != null and sysOperationLogFilter.requestUrl != ''">
|
||||||
|
<bind name = "safeRequestUrl" value = "'%' + sysOperationLogFilter.requestUrl + '%'" />
|
||||||
|
AND zz_sys_operation_log.request_url LIKE #{safeRequestUrl}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.traceId != null and sysOperationLogFilter.traceId != ''">
|
||||||
|
AND zz_sys_operation_log.trace_id = #{sysOperationLogFilter.traceId}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.success != null">
|
||||||
|
AND zz_sys_operation_log.success = #{sysOperationLogFilter.success}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.operatorName != null and sysOperationLogFilter.operatorName != ''">
|
||||||
|
<bind name = "safeOperatorName" value = "'%' + sysOperationLogFilter.operatorName + '%'" />
|
||||||
|
AND zz_sys_operation_log.operator_name LIKE #{safeOperatorName}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.elapseMin != null and sysOperationLogFilter.elapseMin != ''">
|
||||||
|
AND zz_sys_operation_log.elapse >= #{sysOperationLogFilter.elapseMin}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.elapseMax != null and sysOperationLogFilter.elapseMax != ''">
|
||||||
|
AND zz_sys_operation_log.elapse <= #{sysOperationLogFilter.elapseMax}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.operationTimeStart != null and sysOperationLogFilter.operationTimeStart != ''">
|
||||||
|
AND zz_sys_operation_log.operation_time >= #{sysOperationLogFilter.operationTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="sysOperationLogFilter.operationTimeEnd != null and sysOperationLogFilter.operationTimeEnd != ''">
|
||||||
|
AND zz_sys_operation_log.operation_time <= #{sysOperationLogFilter.operationTimeEnd}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="insertList">
|
||||||
|
INSERT INTO zz_sys_operation_log VALUES
|
||||||
|
<foreach collection="list" index="index" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.logId},
|
||||||
|
#{item.description},
|
||||||
|
#{item.operationType},
|
||||||
|
#{item.serviceName},
|
||||||
|
#{item.apiClass},
|
||||||
|
#{item.apiMethod},
|
||||||
|
#{item.sessionId},
|
||||||
|
#{item.traceId},
|
||||||
|
#{item.elapse},
|
||||||
|
#{item.requestMethod},
|
||||||
|
#{item.requestUrl},
|
||||||
|
#{item.requestArguments},
|
||||||
|
#{item.responseResult},
|
||||||
|
#{item.requestIp},
|
||||||
|
#{item.success},
|
||||||
|
#{item.errorMsg},
|
||||||
|
#{item.tenantId},
|
||||||
|
#{item.operatorId},
|
||||||
|
#{item.operatorName},
|
||||||
|
#{item.operationTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getSysOperationLogList" resultMap="BaseResultMap" parameterType="com.orange.demo.common.log.model.SysOperationLog">
|
||||||
|
SELECT * FROM zz_sys_operation_log
|
||||||
|
<where>
|
||||||
|
<include refid="filterRef"/>
|
||||||
|
</where>
|
||||||
|
<if test="orderBy != null and orderBy != ''">
|
||||||
|
ORDER BY ${orderBy}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
package com.orange.demo.common.log.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.orange.demo.common.core.annotation.TenantFilterColumn;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志记录表
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("zz_sys_operation_log")
|
||||||
|
public class SysOperationLog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键Id。
|
||||||
|
*/
|
||||||
|
@TableId(value = "log_id")
|
||||||
|
private Long logId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志描述。
|
||||||
|
*/
|
||||||
|
@TableField(value = "description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型。
|
||||||
|
* 常量值定义可参考SysOperationLogType对象。
|
||||||
|
*/
|
||||||
|
@TableField(value = "operation_type")
|
||||||
|
private Integer operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口所在服务名称。
|
||||||
|
* 通常为spring.application.name配置项的值。
|
||||||
|
*/
|
||||||
|
@TableField(value = "service_name")
|
||||||
|
private String serviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用的controller全类名。
|
||||||
|
* 之所以为独立字段,是为了便于查询和统计接口的调用频度。
|
||||||
|
*/
|
||||||
|
@TableField(value = "api_class")
|
||||||
|
private String apiClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用的controller中的方法。
|
||||||
|
* 格式为:接口类名 + "." + 方法名。
|
||||||
|
*/
|
||||||
|
@TableField(value = "api_method")
|
||||||
|
private String apiMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户会话sessionId。
|
||||||
|
* 主要是为了便于统计,以及跟踪查询定位问题。
|
||||||
|
*/
|
||||||
|
@TableField(value = "session_id")
|
||||||
|
private String sessionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每次请求的Id。
|
||||||
|
* 对于微服务之间的调用,在同一个请求的调用链中,该值是相同的。
|
||||||
|
*/
|
||||||
|
@TableField(value = "trace_id")
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长。
|
||||||
|
*/
|
||||||
|
@TableField(value = "elapse")
|
||||||
|
private Long elapse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 请求方法,如GET。
|
||||||
|
*/
|
||||||
|
@TableField(value = "request_method")
|
||||||
|
private String requestMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP 请求地址。
|
||||||
|
*/
|
||||||
|
@TableField(value = "request_url")
|
||||||
|
private String requestUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* controller接口参数。
|
||||||
|
*/
|
||||||
|
@TableField(value = "request_arguments")
|
||||||
|
private String requestArguments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* controller应答结果。
|
||||||
|
*/
|
||||||
|
@TableField(value = "response_result")
|
||||||
|
private String responseResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求IP。
|
||||||
|
*/
|
||||||
|
@TableField(value = "request_ip")
|
||||||
|
private String requestIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应答状态。
|
||||||
|
*/
|
||||||
|
@TableField(value = "success")
|
||||||
|
private Boolean success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息。
|
||||||
|
*/
|
||||||
|
@TableField(value = "error_msg")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id。
|
||||||
|
* 仅用于多租户系统,是便于进行对租户的操作查询和统计分析。
|
||||||
|
*/
|
||||||
|
@TenantFilterColumn
|
||||||
|
@TableField(value = "tenant_id")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员Id。
|
||||||
|
*/
|
||||||
|
@TableField(value = "operator_id")
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作员名称。
|
||||||
|
*/
|
||||||
|
@TableField(value = "operator_name")
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间。
|
||||||
|
*/
|
||||||
|
@TableField(value = "operation_time")
|
||||||
|
private Date operationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长最小值。
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long elapseMin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用时长最大值。
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long elapseMax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作开始时间。
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String operationTimeStart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作结束时间。
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String operationTimeEnd;
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.orange.demo.common.log.model.constant;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志类型常量字典对象。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public final class SysOperationLogType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他。
|
||||||
|
*/
|
||||||
|
public static final int OTHER = -1;
|
||||||
|
/**
|
||||||
|
* 登录。
|
||||||
|
*/
|
||||||
|
public static final int LOGIN = 0;
|
||||||
|
/**
|
||||||
|
* 登出。
|
||||||
|
*/
|
||||||
|
public static final int LOGOUT = 5;
|
||||||
|
/**
|
||||||
|
* 新增。
|
||||||
|
*/
|
||||||
|
public static final int ADD = 10;
|
||||||
|
/**
|
||||||
|
* 修改。
|
||||||
|
*/
|
||||||
|
public static final int UPDATE = 15;
|
||||||
|
/**
|
||||||
|
* 删除。
|
||||||
|
*/
|
||||||
|
public static final int DELETE = 20;
|
||||||
|
/**
|
||||||
|
* 新增多对多关联。
|
||||||
|
*/
|
||||||
|
public static final int ADD_M2M = 25;
|
||||||
|
/**
|
||||||
|
* 移除多对多关联。
|
||||||
|
*/
|
||||||
|
public static final int DELETE_M2M = 30;
|
||||||
|
/**
|
||||||
|
* 查询。
|
||||||
|
*/
|
||||||
|
public static final int LIST = 35;
|
||||||
|
/**
|
||||||
|
* 分组查询。
|
||||||
|
*/
|
||||||
|
public static final int LIST_WITH_GROUP = 40;
|
||||||
|
/**
|
||||||
|
* 导出。
|
||||||
|
*/
|
||||||
|
public static final int EXPORT = 45;
|
||||||
|
/**
|
||||||
|
* 上传。
|
||||||
|
*/
|
||||||
|
public static final int UPLOAD = 50;
|
||||||
|
/**
|
||||||
|
* 下载。
|
||||||
|
*/
|
||||||
|
public static final int DOWNLOAD = 55;
|
||||||
|
/**
|
||||||
|
* 重置缓存。
|
||||||
|
*/
|
||||||
|
public static final int RELOAD_CACHE = 60;
|
||||||
|
/**
|
||||||
|
* 发布。
|
||||||
|
*/
|
||||||
|
public static final int PUBLISH = 65;
|
||||||
|
/**
|
||||||
|
* 取消发布。
|
||||||
|
*/
|
||||||
|
public static final int UNPUBLISH = 70;
|
||||||
|
/**
|
||||||
|
* 暂停。
|
||||||
|
*/
|
||||||
|
public static final int SUSPEND = 75;
|
||||||
|
/**
|
||||||
|
* 恢复。
|
||||||
|
*/
|
||||||
|
public static final int RESUME = 80;
|
||||||
|
/**
|
||||||
|
* 启动流程。
|
||||||
|
*/
|
||||||
|
public static final int START_PROCESS = 100;
|
||||||
|
/**
|
||||||
|
* 停止流程。
|
||||||
|
*/
|
||||||
|
public static final int STOP_PROCESS = 105;
|
||||||
|
/**
|
||||||
|
* 删除流程。
|
||||||
|
*/
|
||||||
|
public static final int DELETE_PROCESS = 110;
|
||||||
|
/**
|
||||||
|
* 取消流程。
|
||||||
|
*/
|
||||||
|
public static final int CANCEL_PROCESS = 115;
|
||||||
|
/**
|
||||||
|
* 提交任务。
|
||||||
|
*/
|
||||||
|
public static final int SUBMIT_TASK = 120;
|
||||||
|
|
||||||
|
private static final Map<Object, String> DICT_MAP = new HashMap<>(15);
|
||||||
|
static {
|
||||||
|
DICT_MAP.put(OTHER, "其他");
|
||||||
|
DICT_MAP.put(LOGIN, "登录");
|
||||||
|
DICT_MAP.put(LOGOUT, "登出");
|
||||||
|
DICT_MAP.put(ADD, "新增");
|
||||||
|
DICT_MAP.put(UPDATE, "修改");
|
||||||
|
DICT_MAP.put(DELETE, "删除");
|
||||||
|
DICT_MAP.put(ADD_M2M, "新增多对多关联");
|
||||||
|
DICT_MAP.put(DELETE_M2M, "移除多对多关联");
|
||||||
|
DICT_MAP.put(LIST, "查询");
|
||||||
|
DICT_MAP.put(LIST_WITH_GROUP, "分组查询");
|
||||||
|
DICT_MAP.put(EXPORT, "导出");
|
||||||
|
DICT_MAP.put(UPLOAD, "上传");
|
||||||
|
DICT_MAP.put(DOWNLOAD, "下载");
|
||||||
|
DICT_MAP.put(RELOAD_CACHE, "重置缓存");
|
||||||
|
DICT_MAP.put(PUBLISH, "发布");
|
||||||
|
DICT_MAP.put(UNPUBLISH, "取消发布");
|
||||||
|
DICT_MAP.put(SUSPEND, "暂停");
|
||||||
|
DICT_MAP.put(RESUME, "恢复");
|
||||||
|
DICT_MAP.put(START_PROCESS, "启动流程");
|
||||||
|
DICT_MAP.put(STOP_PROCESS, "停止流程");
|
||||||
|
DICT_MAP.put(DELETE_PROCESS, "删除流程");
|
||||||
|
DICT_MAP.put(CANCEL_PROCESS, "取消流程");
|
||||||
|
DICT_MAP.put(SUBMIT_TASK, "提交任务");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断参数是否为当前常量字典的合法值。
|
||||||
|
*
|
||||||
|
* @param value 待验证的参数值。
|
||||||
|
* @return 合法返回true,否则false。
|
||||||
|
*/
|
||||||
|
public static boolean isValid(Integer value) {
|
||||||
|
return value != null && DICT_MAP.containsKey(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 私有构造函数,明确标识该常量类的作用。
|
||||||
|
*/
|
||||||
|
private SysOperationLogType() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.orange.demo.common.log.service;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.base.service.IBaseService;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志服务接口。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
public interface SysOperationLogService extends IBaseService<SysOperationLog, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步的插入一条新操作日志。
|
||||||
|
*
|
||||||
|
* @param operationLog 操作日志对象。
|
||||||
|
*/
|
||||||
|
void saveNewAsync(SysOperationLog operationLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入一条新操作日志。
|
||||||
|
*
|
||||||
|
* @param operationLog 操作日志对象。
|
||||||
|
*/
|
||||||
|
void saveNew(SysOperationLog operationLog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入。
|
||||||
|
*
|
||||||
|
* @param sysOperationLogList 操作日志列表。
|
||||||
|
*/
|
||||||
|
void batchSave(List<SysOperationLog> sysOperationLogList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据过滤条件和排序规则,查询操作日志。
|
||||||
|
*
|
||||||
|
* @param filter 操作日志的过滤对象。
|
||||||
|
* @param orderBy 排序规则。
|
||||||
|
* @return 查询列表。
|
||||||
|
*/
|
||||||
|
List<SysOperationLog> getSysOperationLogList(SysOperationLog filter, String orderBy);
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.orange.demo.common.log.service.impl;
|
||||||
|
|
||||||
|
import com.orange.demo.common.core.annotation.MyDataSource;
|
||||||
|
import com.orange.demo.common.core.base.dao.BaseDaoMapper;
|
||||||
|
import com.orange.demo.common.core.base.service.BaseService;
|
||||||
|
import com.orange.demo.common.core.constant.ApplicationConstant;
|
||||||
|
import com.orange.demo.common.log.dao.SysOperationLogMapper;
|
||||||
|
import com.orange.demo.common.log.model.SysOperationLog;
|
||||||
|
import com.orange.demo.common.log.service.SysOperationLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作日志服务实现类。
|
||||||
|
* 这里需要重点解释下MyDataSource注解。在单数据源服务中,由于没有DataSourceAspect的切面类,所以该注解不会
|
||||||
|
* 有任何作用和影响。然而在多数据源情况下,由于每个服务都有自己的DataSourceType常量对象,表示不同的数据源。
|
||||||
|
* 而common-log在公用模块中,不能去依赖业务服务,因此这里给出了一个固定值。我们在业务的DataSourceType中,也要
|
||||||
|
* 使用该值ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE,去关联操作日志所需的数据源配置。
|
||||||
|
*
|
||||||
|
* @author Jerry
|
||||||
|
* @date 2020-08-08
|
||||||
|
*/
|
||||||
|
@MyDataSource(ApplicationConstant.OPERATION_LOG_DATASOURCE_TYPE)
|
||||||
|
@Service
|
||||||
|
public class SysOperationLogServiceImpl extends BaseService<SysOperationLog, Long> implements SysOperationLogService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysOperationLogMapper sysOperationLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BaseDaoMapper<SysOperationLog> mapper() {
|
||||||
|
return sysOperationLogMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步插入一条新操作日志。通常用于在橙单中创建的单体工程服务。
|
||||||
|
*
|
||||||
|
* @param operationLog 操作日志对象。
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void saveNewAsync(SysOperationLog operationLog) {
|
||||||
|
sysOperationLogMapper.insert(operationLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入一条新操作日志。
|
||||||
|
*
|
||||||
|
* @param operationLog 操作日志对象。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void saveNew(SysOperationLog operationLog) {
|
||||||
|
sysOperationLogMapper.insert(operationLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入。通常用于在橙单中创建的微服务工程服务。
|
||||||
|
*
|
||||||
|
* @param sysOperationLogList 操作日志列表。
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void batchSave(List<SysOperationLog> sysOperationLogList) {
|
||||||
|
sysOperationLogMapper.insertList(sysOperationLogList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据过滤条件和排序规则,查询操作日志。
|
||||||
|
*
|
||||||
|
* @param filter 操作日志的过滤对象。
|
||||||
|
* @param orderBy 排序规则。
|
||||||
|
* @return 查询列表。
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysOperationLog> getSysOperationLogList(SysOperationLog filter, String orderBy) {
|
||||||
|
return sysOperationLogMapper.getSysOperationLogList(filter, orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user