Compare commits
16 Commits
58f2173fb0
...
jdk17
| Author | SHA1 | Date | |
|---|---|---|---|
| 6eacbfddd4 | |||
| 34e2f340c0 | |||
| 0e57f6856a | |||
| 37267b4c7c | |||
| e134006794 | |||
| be2971765e | |||
| 6742565f97 | |||
| b6418e1e3a | |||
| b072b83f80 | |||
| 4dcc10f2f7 | |||
| 4d1119997e | |||
| 1740b7bea2 | |||
| 51bca63ec6 | |||
| 5aef7728b2 | |||
| 18add92466 | |||
| 841f1af49a |
5
.idea/inspectionProfiles/Project_Default.xml
generated
5
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -1,6 +1,11 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<Languages>
|
||||||
|
<language minSize="47" name="Java" />
|
||||||
|
</Languages>
|
||||||
|
</inspection_tool>
|
||||||
<inspection_tool class="HttpUrlsUsage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
<inspection_tool class="HttpUrlsUsage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="mavenCentral" />
|
<option name="id" value="mavenCentral" />
|
||||||
<option name="name" value="mavenCentral" />
|
<option name="name" value="mavenCentral" />
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="corretto-11" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.retry</groupId>
|
<groupId>org.springframework.retry</groupId>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dtflys.forest</groupId>
|
<groupId>com.dtflys.forest</groupId>
|
||||||
<artifactId>forest-spring-boot-starter</artifactId>
|
<artifactId>forest-spring-boot3-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
|||||||
@@ -8,9 +8,13 @@ const information = {
|
|||||||
export function useAmis(amisObject) {
|
export function useAmis(amisObject) {
|
||||||
document.title = information.title
|
document.title = information.title
|
||||||
let amis = amisRequire('amis/embed')
|
let amis = amisRequire('amis/embed')
|
||||||
|
let struct = amisObject(information)
|
||||||
|
if (information.debug) {
|
||||||
|
console.log(struct)
|
||||||
|
}
|
||||||
amis.embed(
|
amis.embed(
|
||||||
'#app',
|
'#app',
|
||||||
amisObject(information),
|
struct,
|
||||||
{
|
{
|
||||||
data: {
|
data: {
|
||||||
base: information.baseUrl,
|
base: information.baseUrl,
|
||||||
@@ -100,7 +104,14 @@ export function inputFileFormItemCommonOptions(accept = '*', maxSize = size5MB)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function copyField(field, tips = '复制', ignoreLength = 0, extra = undefined) {
|
/**
|
||||||
|
* @param {string} field
|
||||||
|
* @param {string} label
|
||||||
|
* @param {string} tips
|
||||||
|
* @param {number} ignoreLength
|
||||||
|
* @param {{}} extra
|
||||||
|
*/
|
||||||
|
export function copyField(field, label, tips = '复制', ignoreLength = 0, extra = undefined) {
|
||||||
let tpl = ignoreLength === 0 ? `\${${field}}` : `\${TRUNCATE(${field}, ${ignoreLength})}`
|
let tpl = ignoreLength === 0 ? `\${${field}}` : `\${TRUNCATE(${field}, ${ignoreLength})}`
|
||||||
let content = extra
|
let content = extra
|
||||||
? {
|
? {
|
||||||
@@ -117,8 +128,10 @@ export function copyField(field, tips = '复制', ignoreLength = 0, extra = unde
|
|||||||
tpl: tpl,
|
tpl: tpl,
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
name: field,
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
size: 'none',
|
size: 'none',
|
||||||
|
className: 'nowrap',
|
||||||
body: [
|
body: [
|
||||||
content,
|
content,
|
||||||
{
|
{
|
||||||
@@ -135,7 +148,68 @@ export function copyField(field, tips = '复制', ignoreLength = 0, extra = unde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mappingField(field, mapping) {
|
/**
|
||||||
|
* @param {string} label
|
||||||
|
* @param {number} width
|
||||||
|
* @param {Array} buttons
|
||||||
|
*/
|
||||||
|
export function operationField(label, width = 100, buttons = []) {
|
||||||
|
return {
|
||||||
|
label: label,
|
||||||
|
width: width,
|
||||||
|
type: 'operation',
|
||||||
|
fixed: 'right',
|
||||||
|
className: 'nowrap',
|
||||||
|
buttons: buttons,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} field
|
||||||
|
* @param {string} label
|
||||||
|
* @param {number} width
|
||||||
|
*/
|
||||||
|
export function timeField(field, label, width = 150) {
|
||||||
|
return {
|
||||||
|
label: label,
|
||||||
|
width: width,
|
||||||
|
align: 'center',
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: `\${IF(${field}, DATETOSTR(${field}), '-')}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function stringWrapField(field, label, width = undefined) {
|
||||||
|
return stringField(field, label, width, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} field
|
||||||
|
* @param {string} label
|
||||||
|
* @param {number} width
|
||||||
|
* @param {boolean} wrap
|
||||||
|
*/
|
||||||
|
export function stringField(field, label, width = undefined, wrap = false) {
|
||||||
|
let data = {
|
||||||
|
name: field,
|
||||||
|
label: label,
|
||||||
|
}
|
||||||
|
if (width) {
|
||||||
|
data['width'] = width
|
||||||
|
}
|
||||||
|
if (wrap) {
|
||||||
|
data['className'] = 'nowrap'
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} field
|
||||||
|
* @param {string} label
|
||||||
|
* @param {[{label: *, value: *, color: string}]} mapping
|
||||||
|
* @param {number} width
|
||||||
|
*/
|
||||||
|
export function mappingField(field, label, mapping, width = 80) {
|
||||||
let mapData = {
|
let mapData = {
|
||||||
'*': `<span class='label bg-gray-300'>\${${field}}</span>`,
|
'*': `<span class='label bg-gray-300'>\${${field}}</span>`,
|
||||||
}
|
}
|
||||||
@@ -143,8 +217,11 @@ export function mappingField(field, mapping) {
|
|||||||
mapData[item['value']] = `<span class='label ${item['color']}'>${item['label']}</span>`
|
mapData[item['value']] = `<span class='label ${item['color']}'>${item['label']}</span>`
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
label: label,
|
||||||
type: 'mapping',
|
type: 'mapping',
|
||||||
|
width: width,
|
||||||
value: `\${${field}}`,
|
value: `\${${field}}`,
|
||||||
|
align: 'center',
|
||||||
map: mapData,
|
map: mapData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,12 +248,23 @@ export const userStateMapping = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export const confirmationStateMapping = [
|
export const confirmationStateMapping = [
|
||||||
|
mappingItem('未确权', 'NONE'),
|
||||||
mappingItem('草稿', 'DRAFT', 'bg-primary'),
|
mappingItem('草稿', 'DRAFT', 'bg-primary'),
|
||||||
mappingItem('审查中', 'CHECKING', 'bg-warning'),
|
mappingItem('审查中', 'CHECKING', 'bg-warning'),
|
||||||
mappingItem('通过', 'NORMAL', 'bg-success'),
|
mappingItem('通过', 'NORMAL', 'bg-success'),
|
||||||
mappingItem('驳回', 'REJECT', 'bg-danger'),
|
mappingItem('驳回', 'REJECT', 'bg-danger'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const checkTypeMapping = [
|
||||||
|
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
|
||||||
|
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
|
||||||
|
]
|
||||||
|
|
||||||
|
export const checkOverMapping = [
|
||||||
|
mappingItem('完结', 'true', 'bg-success'),
|
||||||
|
mappingItem('进行中', 'false', 'bg-primary'),
|
||||||
|
]
|
||||||
|
|
||||||
function api(method, url) {
|
function api(method, url) {
|
||||||
return {
|
return {
|
||||||
method: method,
|
method: method,
|
||||||
@@ -195,6 +283,21 @@ export function apiPost(url) {
|
|||||||
return api('post', url)
|
return api('post', url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function arrayInCheck(array, field) {
|
||||||
|
return `\${ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function arrayOutCheck(array, field) {
|
||||||
|
return `\${!ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export const confirmationState = {
|
||||||
|
none: 'NONE',
|
||||||
|
draft: 'DRAFT',
|
||||||
|
checking: 'CHECKING',
|
||||||
|
normal: 'NORMAL',
|
||||||
|
}
|
||||||
|
|
||||||
export function roleCheck(roles) {
|
export function roleCheck(roles) {
|
||||||
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
|
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
label: '资源名称',
|
label: '资源名称',
|
||||||
|
maxLength: 10,
|
||||||
|
showCounter: true,
|
||||||
required: true,
|
required: true,
|
||||||
...formInputClearable,
|
...formInputClearable,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,22 +16,8 @@ const dialogBody = [
|
|||||||
{
|
{
|
||||||
type: 'group',
|
type: 'group',
|
||||||
body: [
|
body: [
|
||||||
{
|
mappingField('role', '角色', userRoleMapping),
|
||||||
type: 'control',
|
mappingField('state', '账号状态', userStateMapping),
|
||||||
name: 'role',
|
|
||||||
label: '角色',
|
|
||||||
body: [
|
|
||||||
mappingField('role', userRoleMapping),
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'control',
|
|
||||||
name: 'state',
|
|
||||||
label: '账号状态',
|
|
||||||
body: [
|
|
||||||
mappingField('state', userStateMapping)
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
...formCreatedUserAndModifiedUser(),
|
...formCreatedUserAndModifiedUser(),
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
import {apiGet, apiPost, checkerOnly, crudCommonOptions} from "../../components/constants.js";
|
import {
|
||||||
|
apiGet,
|
||||||
|
checkerOnly,
|
||||||
|
checkOverMapping,
|
||||||
|
checkTypeMapping,
|
||||||
|
crudCommonOptions,
|
||||||
|
mappingField,
|
||||||
|
operationField,
|
||||||
|
stringField,
|
||||||
|
timeField,
|
||||||
|
} from "../../components/constants.js";
|
||||||
import {permissionDetailDialog} from "../../components/permission/dialog-permission.js";
|
import {permissionDetailDialog} from "../../components/permission/dialog-permission.js";
|
||||||
|
|
||||||
export function tabCheck() {
|
export function tabCheck() {
|
||||||
@@ -6,54 +16,62 @@ export function tabCheck() {
|
|||||||
visibleOn: checkerOnly,
|
visibleOn: checkerOnly,
|
||||||
title: '审核审查',
|
title: '审核审查',
|
||||||
icon: 'fa fa-shield-halved',
|
icon: 'fa fa-shield-halved',
|
||||||
|
reload: true,
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
|
name: 'check_order_list',
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: apiGet('${base}/check/list'),
|
api: apiGet('${base}/check_order/list'),
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
|
stringField('description', '描述'),
|
||||||
|
mappingField('type', '类型', checkTypeMapping),
|
||||||
|
mappingField('over', '状态', checkOverMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
stringField('createdUsername', '创建人', 100),
|
||||||
|
timeField('modifiedTime', '最后修改时间'),
|
||||||
|
stringField('modifiedUsername', '最后操作人', 100),
|
||||||
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
name: 'name',
|
visibleOn: '${!over}',
|
||||||
label: '描述',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '操作',
|
|
||||||
width: 100,
|
|
||||||
type: 'operation',
|
|
||||||
fixed: 'right',
|
|
||||||
className: 'nowrap',
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '查看',
|
label: '处理',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
...permissionDetailDialog(
|
...permissionDetailDialog(
|
||||||
'parameters.confirmationId',
|
'parameters.confirmationId',
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: 'each',
|
|
||||||
name: 'operations',
|
|
||||||
items: {
|
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '${item.name}',
|
label: '同意',
|
||||||
level: '${item.level}',
|
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: {
|
close: true,
|
||||||
...apiPost('${base}/check/operation/${item.operation}'),
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
||||||
data: '${parameters}'
|
reload: 'check_order_list',
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
]
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '拒绝',
|
||||||
|
actionType: 'ajax',
|
||||||
|
close: true,
|
||||||
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
||||||
|
reload: 'check_order_list',
|
||||||
|
},
|
||||||
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
]
|
{
|
||||||
}
|
visibleOn: '${over}',
|
||||||
]
|
type: 'action',
|
||||||
}
|
label: '查看',
|
||||||
]
|
level: 'link',
|
||||||
|
...permissionDetailDialog('parameters.confirmationId'),
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,18 @@ import {
|
|||||||
resourceDetailDialog,
|
resourceDetailDialog,
|
||||||
resourceEditeDialog
|
resourceEditeDialog
|
||||||
} from "../../components/resource/dialog-resource.js";
|
} from "../../components/resource/dialog-resource.js";
|
||||||
import {apiGet, crudCommonOptions, userOnly} from "../../components/constants.js";
|
import {
|
||||||
|
apiGet,
|
||||||
|
arrayInCheck,
|
||||||
|
arrayOutCheck,
|
||||||
|
confirmationState,
|
||||||
|
confirmationStateMapping,
|
||||||
|
crudCommonOptions,
|
||||||
|
mappingField,
|
||||||
|
operationField,
|
||||||
|
timeField,
|
||||||
|
userOnly
|
||||||
|
} from "../../components/constants.js";
|
||||||
|
|
||||||
export function resourceList() {
|
export function resourceList() {
|
||||||
return {
|
return {
|
||||||
@@ -23,26 +34,15 @@ export function resourceList() {
|
|||||||
{
|
{
|
||||||
label: '名称',
|
label: '名称',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
width: 200,
|
width: 150,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '描述',
|
label: '描述',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
},
|
},
|
||||||
{
|
mappingField('confirmationState', '确权状态', confirmationStateMapping),
|
||||||
label: '创建时间',
|
timeField('createdTime', '创建时间'),
|
||||||
width: 150,
|
operationField('操作', undefined, [
|
||||||
align: 'center',
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '操作',
|
|
||||||
width: 100,
|
|
||||||
type: 'operation',
|
|
||||||
fixed: 'right',
|
|
||||||
className: 'nowrap',
|
|
||||||
buttons: [
|
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '详情',
|
label: '详情',
|
||||||
@@ -57,14 +57,18 @@ export function resourceList() {
|
|||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
disabledOn: '${confirmationId}',
|
disabledOn: arrayOutCheck([confirmationState.none, confirmationState.draft], 'confirmationState'),
|
||||||
|
disabledTip: '审查或确权成功后无法编辑',
|
||||||
|
tooltipPlacement: 'top',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
...resourceEditeDialog(),
|
...resourceEditeDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabledOn: '${confirmationId}',
|
disabledOn: arrayInCheck([confirmationState.checking], 'confirmationState'),
|
||||||
|
disabledTip: '审查中无法删除',
|
||||||
|
tooltipPlacement: 'bottom',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: "删除",
|
label: "删除",
|
||||||
confirmTitle: '确认删除',
|
confirmTitle: '确认删除',
|
||||||
@@ -74,8 +78,7 @@ export function resourceList() {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]),
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +88,7 @@ export function tabData() {
|
|||||||
visibleOn: userOnly,
|
visibleOn: userOnly,
|
||||||
title: '数据资源',
|
title: '数据资源',
|
||||||
icon: 'fa fa-database',
|
icon: 'fa fa-database',
|
||||||
|
reload: true,
|
||||||
body: resourceList(),
|
body: resourceList(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,17 @@ import {
|
|||||||
confirmationStateMapping,
|
confirmationStateMapping,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
mappingField,
|
mappingField,
|
||||||
|
operationField,
|
||||||
providerOnly,
|
providerOnly,
|
||||||
userOnly
|
stringField,
|
||||||
|
stringWrapField,
|
||||||
|
timeField,
|
||||||
|
userOnly,
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
import {
|
import {
|
||||||
permissionAddDialog,
|
permissionAddDialog,
|
||||||
permissionDetailDialog,
|
permissionDetailDialog,
|
||||||
permissionEditeDialog
|
permissionEditeDialog,
|
||||||
} from "../../components/permission/dialog-permission.js";
|
} from "../../components/permission/dialog-permission.js";
|
||||||
|
|
||||||
export function tabPermissions() {
|
export function tabPermissions() {
|
||||||
@@ -17,6 +21,7 @@ export function tabPermissions() {
|
|||||||
visibleOn: userOnly,
|
visibleOn: userOnly,
|
||||||
title: '权属管理',
|
title: '权属管理',
|
||||||
icon: 'fa fa-user-shield',
|
icon: 'fa fa-user-shield',
|
||||||
|
reload: true,
|
||||||
body: {
|
body: {
|
||||||
type: 'tabs',
|
type: 'tabs',
|
||||||
tabs: [
|
tabs: [
|
||||||
@@ -39,35 +44,11 @@ export function tabPermissions() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
stringField('name', '名称', 200),
|
||||||
label: '名称',
|
stringWrapField('description', '描述'),
|
||||||
name: 'name',
|
mappingField('state', '状态', confirmationStateMapping),
|
||||||
width: 200,
|
timeField('createdTime', '创建时间'),
|
||||||
},
|
operationField('操作', undefined, [
|
||||||
{
|
|
||||||
label: '描述',
|
|
||||||
name: 'description',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '状态',
|
|
||||||
width: 80,
|
|
||||||
align: 'center',
|
|
||||||
...mappingField('state', confirmationStateMapping)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '创建时间',
|
|
||||||
width: 150,
|
|
||||||
align: 'center',
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '操作',
|
|
||||||
width: 100,
|
|
||||||
type: 'operation',
|
|
||||||
fixed: 'right',
|
|
||||||
className: 'nowrap',
|
|
||||||
buttons: [
|
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '查看',
|
label: '查看',
|
||||||
@@ -102,7 +83,7 @@ export function tabPermissions() {
|
|||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
disabledOn: "${state === 'CHECKING'}",
|
disabledOn: "${state !== 'DRAFT'}",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
@@ -113,14 +94,13 @@ export function tabPermissions() {
|
|||||||
type: 'action',
|
type: 'action',
|
||||||
label: "删除",
|
label: "删除",
|
||||||
confirmTitle: '确认删除',
|
confirmTitle: '确认删除',
|
||||||
confirmText: '确认删除名称为「${name}」的确权申请吗?',
|
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: apiGet('${base}/confirmation/remove/${id}'),
|
api: apiGet('${base}/confirmation/remove/${id}'),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]),
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
copyField,
|
copyField,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
mappingField,
|
mappingField,
|
||||||
|
operationField,
|
||||||
|
timeField,
|
||||||
userRoleMapping,
|
userRoleMapping,
|
||||||
userStateMapping
|
userStateMapping
|
||||||
} from '../../components/constants.js'
|
} from '../../components/constants.js'
|
||||||
@@ -15,6 +17,7 @@ export function tabUser() {
|
|||||||
visibleOn: administratorOnly,
|
visibleOn: administratorOnly,
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
icon: 'fa fa-user',
|
icon: 'fa fa-user',
|
||||||
|
reload: true,
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
@@ -30,49 +33,18 @@ export function tabUser() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
{
|
copyField(
|
||||||
name: 'username',
|
|
||||||
label: '邮箱',
|
|
||||||
...copyField(
|
|
||||||
'username',
|
'username',
|
||||||
|
'邮箱',
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
userDetailDialog(),
|
userDetailDialog(),
|
||||||
)
|
),
|
||||||
},
|
mappingField('role', '角色', userRoleMapping, 120),
|
||||||
{
|
mappingField('state', '账号状态', userStateMapping),
|
||||||
label: '角色',
|
timeField('createdTime', '创建时间'),
|
||||||
width: 120,
|
timeField('lastLoginTime', '上次登陆时间'),
|
||||||
align: 'center',
|
operationField('操作', undefined, [
|
||||||
...mappingField('role', userRoleMapping)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '账号状态',
|
|
||||||
width: 80,
|
|
||||||
align: 'center',
|
|
||||||
...mappingField('state', userStateMapping)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '创建时间',
|
|
||||||
width: 150,
|
|
||||||
align: 'center',
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '上次登陆时间',
|
|
||||||
width: 150,
|
|
||||||
align: 'center',
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: "${IF(lastLoginTime, DATETOSTR(lastLoginTime), '-')}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '操作',
|
|
||||||
width: 100,
|
|
||||||
type: 'operation',
|
|
||||||
fixed: 'right',
|
|
||||||
className: 'nowrap',
|
|
||||||
buttons: [
|
|
||||||
{
|
{
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
label: '审核',
|
label: '审核',
|
||||||
@@ -103,8 +75,7 @@ export function tabUser() {
|
|||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: apiGet('${base}/user_management/enable/${username}'),
|
api: apiGet('${base}/user_management/enable/${username}'),
|
||||||
}
|
}
|
||||||
]
|
]),
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -19,6 +19,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.eshore</groupId>
|
<groupId>com.eshore</groupId>
|
||||||
<artifactId>gringotts-forest</artifactId>
|
<artifactId>gringotts-forest</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.authentication.entity;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.core.Constants;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.resource.entity.DataResource;
|
||||||
|
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.NamedAttributeNode;
|
||||||
|
import jakarta.persistence.NamedEntityGraph;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import java.util.Set;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Entity
|
||||||
|
@DynamicUpdate
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Table(name = Constants.TABLE_PREFIX + "authentication")
|
||||||
|
@NamedEntityGraph(name = "authentication.list", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "target"),
|
||||||
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
|
})
|
||||||
|
@NamedEntityGraph(name = "authentication.detail", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "target"),
|
||||||
|
@NamedAttributeNode(value = "evidences"),
|
||||||
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
|
})
|
||||||
|
public class Authentication extends CheckingNeededEntity {
|
||||||
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
private DataResource target;
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
|
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
@ToString.Exclude
|
||||||
|
private Set<DataFile> evidences;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@MappedSuperclass
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
public class CheckingNeededEntity extends LogicDeleteEntity {
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private State state = State.DRAFT;
|
||||||
|
|
||||||
|
public enum State {
|
||||||
|
/**
|
||||||
|
* 无确权
|
||||||
|
*/
|
||||||
|
NONE,
|
||||||
|
/**
|
||||||
|
* 草稿
|
||||||
|
*/
|
||||||
|
DRAFT,
|
||||||
|
/**
|
||||||
|
* 审查中
|
||||||
|
*/
|
||||||
|
CHECKING,
|
||||||
|
/**
|
||||||
|
* 正常
|
||||||
|
*/
|
||||||
|
NORMAL,
|
||||||
|
/**
|
||||||
|
* 驳回
|
||||||
|
*/
|
||||||
|
REJECT,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import javax.persistence.EntityListeners;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.springframework.data.annotation.CreatedDate;
|
|
||||||
import org.springframework.data.annotation.LastModifiedDate;
|
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实体类公共字段
|
|
||||||
*
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-20
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@MappedSuperclass
|
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
|
||||||
public class DatetimeOnlyEntity extends IdOnlyEntity {
|
|
||||||
@CreatedDate
|
|
||||||
private LocalDateTime createdTime;
|
|
||||||
@LastModifiedDate
|
|
||||||
private LocalDateTime modifiedTime;
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.entity;
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
import javax.persistence.EntityListeners;
|
import jakarta.persistence.EntityListeners;
|
||||||
import javax.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import javax.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.SoftDelete;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类公共字段
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@MappedSuperclass
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@SoftDelete(columnName = "delete")
|
||||||
|
public class LogicDeleteEntity extends SimpleEntity {
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Boolean deleted = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.SoftDelete;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类公共字段
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-20
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@MappedSuperclass
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@SoftDelete(columnName = "delete")
|
||||||
|
public class LogicDeleteIdOnlyEntity extends IdOnlyEntity {
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Boolean deleted = false;
|
||||||
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.entity;
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.web.domain.user.entity.User;
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import javax.persistence.ConstraintMode;
|
|
||||||
import javax.persistence.EntityListeners;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.ForeignKey;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -24,7 +24,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString(callSuper = true)
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
public class SimpleEntity extends IdOnlyEntity {
|
public class SimpleEntity extends IdOnlyEntity {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.service;
|
package com.eshore.gringotts.web.domain.base.service;
|
||||||
|
|
||||||
import lombok.Data;
|
import com.eshore.gringotts.web.domain.check.entity.CheckOrder;
|
||||||
import lombok.Value;
|
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,34 +10,5 @@ import org.eclipse.collections.api.map.ImmutableMap;
|
|||||||
* @date 2024-11-28
|
* @date 2024-11-28
|
||||||
*/
|
*/
|
||||||
public interface CheckingService {
|
public interface CheckingService {
|
||||||
ImmutableList<CheckOrder> checkingList();
|
void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters);
|
||||||
|
|
||||||
void onChecked(String operation, ImmutableMap<String, Object> parameters);
|
|
||||||
|
|
||||||
@Value
|
|
||||||
class CheckOrder {
|
|
||||||
String name;
|
|
||||||
ImmutableList<CheckOperation> operations;
|
|
||||||
ImmutableMap<String, Object> parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
class CheckOperation {
|
|
||||||
/**
|
|
||||||
* 全局唯一
|
|
||||||
*/
|
|
||||||
private final String operation;
|
|
||||||
private final String name;
|
|
||||||
private final String level;
|
|
||||||
|
|
||||||
public CheckOperation(String operation, String name) {
|
|
||||||
this(operation, name, "default");
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckOperation(String operation, String name, String level) {
|
|
||||||
this.operation = operation;
|
|
||||||
this.name = name;
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ClassUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.user.service.UserService;
|
||||||
|
import jakarta.persistence.EntityManager;
|
||||||
|
import jakarta.persistence.Query;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-21
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public abstract class LogicDeleteService<ENTITY extends LogicDeleteEntity> extends SimpleServiceSupport<ENTITY> {
|
||||||
|
private final EntityManager manager;
|
||||||
|
|
||||||
|
public LogicDeleteService(SimpleRepository<ENTITY, Long> repository, UserService userService, EntityManager manager) {
|
||||||
|
super(repository, userService);
|
||||||
|
this.manager = manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImmutableList<Predicate> extraListPredicates(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
|
return Lists.immutable.of(builder.equal(root.get("deleted"), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImmutableList<Predicate> extraDetailPredicates(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
|
return Lists.immutable.of(builder.equal(root.get("deleted"), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
|
@Override
|
||||||
|
public void remove(Long id) {
|
||||||
|
String entityName = ClassUtil.getTypeArgument(this.getClass()).getSimpleName();
|
||||||
|
Query query = manager.createQuery(StrUtil.format("update {} entity set deleted=true where id=?1", entityName));
|
||||||
|
query.setParameter(1, id);
|
||||||
|
query.executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,9 +8,12 @@ import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
|||||||
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
import com.eshore.gringotts.web.domain.user.entity.User;
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.user.service.UserService;
|
import com.eshore.gringotts.web.domain.user.service.UserService;
|
||||||
|
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||||
|
import jakarta.persistence.criteria.CriteriaQuery;
|
||||||
|
import jakarta.persistence.criteria.Predicate;
|
||||||
|
import jakarta.persistence.criteria.Root;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
@@ -24,8 +27,8 @@ import org.springframework.data.domain.Sort;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implements SimpleService<ENTITY> {
|
public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implements SimpleService<ENTITY> {
|
||||||
private final SimpleRepository<ENTITY, Long> repository;
|
protected final SimpleRepository<ENTITY, Long> repository;
|
||||||
private final UserService userService;
|
protected final UserService userService;
|
||||||
|
|
||||||
public SimpleServiceSupport(SimpleRepository<ENTITY, Long> repository, UserService userService) {
|
public SimpleServiceSupport(SimpleRepository<ENTITY, Long> repository, UserService userService) {
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
@@ -64,6 +67,7 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
if (User.isNotAdministrator(user)) {
|
if (User.isNotAdministrator(user)) {
|
||||||
predicates.add(builder.equal(root.get("createdUser"), user));
|
predicates.add(builder.equal(root.get("createdUser"), user));
|
||||||
}
|
}
|
||||||
|
predicates.addAllIterable(extraListPredicates(root, query, builder));
|
||||||
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||||
},
|
},
|
||||||
Sort.by("createdTime").descending()
|
Sort.by("createdTime").descending()
|
||||||
@@ -81,12 +85,17 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
if (User.isNotAdministrator(user)) {
|
if (User.isNotAdministrator(user)) {
|
||||||
predicates.add(builder.equal(root.get("createdUser"), user));
|
predicates.add(builder.equal(root.get("createdUser"), user));
|
||||||
}
|
}
|
||||||
|
predicates.addAllIterable(extraListPredicates(root, query, builder));
|
||||||
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||||
},
|
},
|
||||||
Sort.by("createdTime").descending()
|
Sort.by("createdTime").descending()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ImmutableList<Predicate> extraListPredicates(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
|
return Lists.immutable.empty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ENTITY> detailOptional(Long id) {
|
public Optional<ENTITY> detailOptional(Long id) {
|
||||||
if (ObjectUtil.isNull(id)) {
|
if (ObjectUtil.isNull(id)) {
|
||||||
@@ -101,11 +110,16 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
if (User.isNotAdministrator(user)) {
|
if (User.isNotAdministrator(user)) {
|
||||||
predicates.add(builder.equal(root.get("createdUser"), user));
|
predicates.add(builder.equal(root.get("createdUser"), user));
|
||||||
}
|
}
|
||||||
|
predicates.addAllIterable(extraDetailPredicates(root, query, builder));
|
||||||
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
return builder.and(predicates.toArray(new Predicate[predicates.size()]));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ImmutableList<Predicate> extraDetailPredicates(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
|
return Lists.immutable.empty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ENTITY detail(Long id) {
|
public ENTITY detail(Long id) {
|
||||||
return detailOrNull(id);
|
return detailOrNull(id);
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
package com.eshore.gringotts.web.domain.check.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
|
||||||
import com.eshore.gringotts.web.domain.base.controller.ListController;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
|
||||||
import org.eclipse.collections.api.factory.Maps;
|
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
|
||||||
import org.eclipse.collections.api.map.MutableMap;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监管
|
|
||||||
*
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-28
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("check")
|
|
||||||
public class CheckController implements ListController<CheckingService.CheckOrder> {
|
|
||||||
private final ImmutableList<CheckingService> checkingServices;
|
|
||||||
private final MutableMap<String, CheckingService> serviceMap = Maps.mutable.<String, CheckingService>empty().asSynchronized();
|
|
||||||
|
|
||||||
public CheckController(ApplicationContext applicationContext) {
|
|
||||||
this.checkingServices = Lists.immutable.ofAll(applicationContext.getBeansOfType(CheckingService.class).values());
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@Override
|
|
||||||
public AmisResponse<ImmutableList<CheckingService.CheckOrder>> list() throws Exception {
|
|
||||||
return AmisResponse.responseSuccess(
|
|
||||||
checkingServices.flatCollect(checkingService -> {
|
|
||||||
ImmutableList<CheckingService.CheckOrder> orders = checkingService.checkingList();
|
|
||||||
orders.flatCollect(CheckingService.CheckOrder::getOperations)
|
|
||||||
.forEach(operation -> serviceMap.put(operation.getOperation(), checkingService));
|
|
||||||
return orders;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/operation/{operation}")
|
|
||||||
public AmisResponse<Object> operation(@PathVariable String operation, @RequestBody ImmutableMap<String, Object> data) {
|
|
||||||
log.info("Check operation: {} data: {} target: {}", operation, data, serviceMap.get(operation).getClass().getSimpleName());
|
|
||||||
CheckingService service = serviceMap.getOrDefault(operation, null);
|
|
||||||
if (ObjectUtil.isNull(service)) {
|
|
||||||
throw new RuntimeException("服务未找到");
|
|
||||||
}
|
|
||||||
service.onChecked(operation, data);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.check.controller;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
|
import com.eshore.gringotts.web.domain.base.controller.ListController;
|
||||||
|
import com.eshore.gringotts.web.domain.check.entity.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.check.service.CheckOrderService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监管
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-28
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("check_order")
|
||||||
|
public class CheckOrderController implements ListController<CheckOrderController.ListItem> {
|
||||||
|
private final CheckOrderService checkOrderService;
|
||||||
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
|
public CheckOrderController(CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
||||||
|
this.checkOrderService = checkOrderService;
|
||||||
|
this.mapper = builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Override
|
||||||
|
public AmisResponse<ImmutableList<CheckOrderController.ListItem>> list() throws Exception {
|
||||||
|
return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
private ListItem toListItem(CheckOrder order) {
|
||||||
|
ListItem item = new ListItem();
|
||||||
|
item.setCheckOrderId(order.getId());
|
||||||
|
item.setDescription(order.getDescription());
|
||||||
|
item.setType(order.getType());
|
||||||
|
item.setParameters(mapper.readValue(order.getParameters(), new TypeReference<>() {}));
|
||||||
|
item.setOver(order.getOver());
|
||||||
|
item.setCreatedUsername(order.getCreatedUser().getUsername());
|
||||||
|
item.setCreatedTime(order.getCreatedTime());
|
||||||
|
item.setModifiedUsername(order.getModifiedUser().getUsername());
|
||||||
|
item.setModifiedTime(order.getModifiedTime());
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/operation/{id}/{operation}")
|
||||||
|
public AmisResponse<Object> operation(@PathVariable Long id, @PathVariable CheckOrder.Operation operation) throws JsonProcessingException {
|
||||||
|
log.info("id:{}, operation:{}", id, operation);
|
||||||
|
checkOrderService.operation(id, operation);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static final class ListItem {
|
||||||
|
private Long checkOrderId;
|
||||||
|
private String description;
|
||||||
|
private CheckOrder.Type type;
|
||||||
|
private ImmutableMap<String, Object> parameters;
|
||||||
|
private Boolean over;
|
||||||
|
private LocalDateTime createdTime;
|
||||||
|
private String createdUsername;
|
||||||
|
private LocalDateTime modifiedTime;
|
||||||
|
private String modifiedUsername;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.check.entity;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.core.Constants;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.NamedAttributeNode;
|
||||||
|
import jakarta.persistence.NamedEntityGraph;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Entity
|
||||||
|
@DynamicUpdate
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Table(name = Constants.TABLE_PREFIX + "check_order")
|
||||||
|
@NamedEntityGraph(name = "check_order.list", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
|
})
|
||||||
|
@NamedEntityGraph(name = "check_order.detail", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
|
})
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CheckOrder extends SimpleEntity {
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String keyword;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String description;
|
||||||
|
@Column(nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Type type;
|
||||||
|
/**
|
||||||
|
* JSON 结构 Map<String, Object>
|
||||||
|
*/
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String parameters;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private Target target;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String targetClass;
|
||||||
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
@ToString.Exclude
|
||||||
|
private User targetUser;
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private User.Role targetRole;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Boolean over = false;
|
||||||
|
|
||||||
|
public CheckOrder(
|
||||||
|
String keyword,
|
||||||
|
String description,
|
||||||
|
Type type,
|
||||||
|
String parameters,
|
||||||
|
String targetClass,
|
||||||
|
User targetUser
|
||||||
|
) {
|
||||||
|
this.keyword = keyword;
|
||||||
|
this.description = description;
|
||||||
|
this.type = type;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.target = Target.USER;
|
||||||
|
this.targetClass = targetClass;
|
||||||
|
this.targetUser = targetUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CheckOrder(
|
||||||
|
String keyword,
|
||||||
|
String description,
|
||||||
|
Type type,
|
||||||
|
String parameters,
|
||||||
|
String targetClass,
|
||||||
|
User.Role targetRole
|
||||||
|
) {
|
||||||
|
this.keyword = keyword;
|
||||||
|
this.description = description;
|
||||||
|
this.type = type;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.target = Target.ROLE;
|
||||||
|
this.targetClass = targetClass;
|
||||||
|
this.targetRole = targetRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Operation {
|
||||||
|
APPLY,
|
||||||
|
REJECT,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
CONFIRMATION,
|
||||||
|
AUTHENTICATION,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Target {
|
||||||
|
USER,
|
||||||
|
ROLE,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.check.repository;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.check.entity.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-29
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("NullableProblems")
|
||||||
|
@Repository
|
||||||
|
public interface CheckOrderRepository extends SimpleRepository<CheckOrder, Long> {
|
||||||
|
@Override
|
||||||
|
@EntityGraph(value = "check_order.list", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
|
List<CheckOrder> findAll(Specification<CheckOrder> specification);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@EntityGraph(value = "check_order.list", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
|
List<CheckOrder> findAll(Specification<CheckOrder> specification, Sort sort);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@EntityGraph(value = "check_order.detail", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
|
Optional<CheckOrder> findOne(Specification<CheckOrder> specification);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update CheckOrder check set check.over = true, check.modifiedUser = ?2, check.modifiedTime = current_timestamp where check.id = ?1")
|
||||||
|
void overById(Long id, User modifiedUser);
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.check.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
|
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
||||||
|
import com.eshore.gringotts.web.domain.check.entity.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.check.repository.CheckOrderRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.user.service.UserService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @date 2024-11-29
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class CheckOrderService extends SimpleServiceSupport<CheckOrder> {
|
||||||
|
private final ApplicationContext applicationContext;
|
||||||
|
private final ObjectMapper mapper;
|
||||||
|
private final CheckOrderRepository checkOrderRepository;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
public CheckOrderService(CheckOrderRepository repository, UserService userService, ApplicationContext applicationContext, Jackson2ObjectMapperBuilder builder) {
|
||||||
|
super(repository, userService);
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
this.mapper = builder.build();
|
||||||
|
this.checkOrderRepository = repository;
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void operation(Long id, CheckOrder.Operation operation) throws JsonProcessingException {
|
||||||
|
CheckOrder order = detailOrThrow(id);
|
||||||
|
CheckingService service = applicationContext.getBean(order.getTargetClass(), CheckingService.class);
|
||||||
|
if (ObjectUtil.isNull(service)) {
|
||||||
|
throw new RuntimeException(StrUtil.format("名为「{}」的服务未找到", order.getTargetClass()));
|
||||||
|
}
|
||||||
|
ImmutableMap<String, Object> parameters = mapper.readValue(order.getParameters(), new TypeReference<>() {});
|
||||||
|
service.onChecked(order, operation, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void over(Long id) {
|
||||||
|
checkOrderRepository.overById(id, userService.currentLoginUser());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
|||||||
import com.eshore.gringotts.web.domain.confirmation.service.ConfirmationService;
|
import com.eshore.gringotts.web.domain.confirmation.service.ConfirmationService;
|
||||||
import com.eshore.gringotts.web.domain.resource.service.DataResourceService;
|
import com.eshore.gringotts.web.domain.resource.service.DataResourceService;
|
||||||
import com.eshore.gringotts.web.domain.upload.service.DataFileService;
|
import com.eshore.gringotts.web.domain.upload.service.DataFileService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -40,7 +41,7 @@ public class ConfirmationController extends SimpleControllerSupport<Confirmation
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/submit/{id}")
|
@GetMapping("/submit/{id}")
|
||||||
public AmisResponse<Object> submit(@PathVariable Long id) {
|
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
||||||
confirmationService.submit(id);
|
confirmationService.submit(id);
|
||||||
return AmisResponse.responseSuccess();
|
return AmisResponse.responseSuccess();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,23 @@
|
|||||||
package com.eshore.gringotts.web.domain.confirmation.entity;
|
package com.eshore.gringotts.web.domain.confirmation.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.DataResource;
|
import com.eshore.gringotts.web.domain.resource.entity.DataResource;
|
||||||
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
||||||
|
import jakarta.persistence.CascadeType;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
|
import jakarta.persistence.NamedAttributeNode;
|
||||||
|
import jakarta.persistence.NamedEntityGraph;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ConstraintMode;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EntityListeners;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.ForeignKey;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -35,7 +32,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString(callSuper = true)
|
||||||
@Entity
|
@Entity
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
@@ -50,35 +47,12 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
public class Confirmation extends SimpleEntity {
|
public class Confirmation extends CheckingNeededEntity {
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@OneToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
private DataResource target;
|
private DataResource target;
|
||||||
private String description;
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||||
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Set<DataFile> evidences;
|
private Set<DataFile> evidences;
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private State state = State.DRAFT;
|
|
||||||
|
|
||||||
public enum State {
|
|
||||||
/**
|
|
||||||
* 草稿
|
|
||||||
*/
|
|
||||||
DRAFT,
|
|
||||||
/**
|
|
||||||
* 审查中
|
|
||||||
*/
|
|
||||||
CHECKING,
|
|
||||||
/**
|
|
||||||
* 正常
|
|
||||||
*/
|
|
||||||
NORMAL,
|
|
||||||
/**
|
|
||||||
* 驳回
|
|
||||||
*/
|
|
||||||
REJECT,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package com.eshore.gringotts.web.domain.confirmation.repository;
|
|||||||
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.user.entity.User;
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
|||||||
@@ -4,14 +4,19 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
||||||
|
import com.eshore.gringotts.web.domain.check.entity.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.check.service.CheckOrderService;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.repository.ConfirmationRepository;
|
import com.eshore.gringotts.web.domain.confirmation.repository.ConfirmationRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.user.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.user.service.UserService;
|
import com.eshore.gringotts.web.domain.user.service.UserService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
|
||||||
import org.eclipse.collections.api.factory.Maps;
|
import org.eclipse.collections.api.factory.Maps;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,15 +24,19 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2024-11-26
|
* @date 2024-11-26
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service("com.eshore.gringotts.web.domain.confirmation.service.ConfirmationService")
|
||||||
public class ConfirmationService extends SimpleServiceSupport<Confirmation> implements CheckingService {
|
public class ConfirmationService extends SimpleServiceSupport<Confirmation> implements CheckingService {
|
||||||
private final ConfirmationRepository confirmationRepository;
|
private final ConfirmationRepository confirmationRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private final CheckOrderService checkOrderService;
|
||||||
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService) {
|
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
||||||
super(confirmationRepository, userService);
|
super(confirmationRepository, userService);
|
||||||
this.confirmationRepository = confirmationRepository;
|
this.confirmationRepository = confirmationRepository;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
|
this.checkOrderService = checkOrderService;
|
||||||
|
this.mapper = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -38,8 +47,20 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
|
|||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submit(Long id) {
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
confirmationRepository.updateStateById(id, Confirmation.State.CHECKING, userService.currentLoginUser());
|
public void submit(Long id) throws JsonProcessingException {
|
||||||
|
Confirmation confirmation = detailOrThrow(id);
|
||||||
|
log.info("confirmation: {}", confirmation);
|
||||||
|
confirmation.setState(Confirmation.State.CHECKING);
|
||||||
|
checkOrderService.save(new CheckOrder(
|
||||||
|
"confirmation_check",
|
||||||
|
StrUtil.format("数据资源「{}」的确权申请", confirmation.getTarget().getName()),
|
||||||
|
CheckOrder.Type.CONFIRMATION,
|
||||||
|
mapper.writeValueAsString(Maps.immutable.of("confirmationId", confirmation.getId())),
|
||||||
|
"com.eshore.gringotts.web.domain.confirmation.service.ConfirmationService",
|
||||||
|
User.Role.ADMINISTRATOR
|
||||||
|
));
|
||||||
|
save(confirmation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retract(Long id) {
|
public void retract(Long id) {
|
||||||
@@ -47,34 +68,21 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableList<CheckOrder> checkingList() {
|
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
||||||
return Lists.immutable.ofAll(
|
if (StrUtil.equals(order.getKeyword(), "confirmation_check")) {
|
||||||
confirmationRepository.findAll(
|
|
||||||
(root, query, builder) -> builder.equal(root.get("state"), Confirmation.State.CHECKING)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.collect(confirmation -> new CheckOrder(
|
|
||||||
StrUtil.format("资源名为「{}」的确权申请", confirmation.getTarget().getName()),
|
|
||||||
Lists.immutable.of(
|
|
||||||
new CheckOperation("confirmation_check_apply", "通过"),
|
|
||||||
new CheckOperation("confirmation_check_reject", "拒绝", "danger")
|
|
||||||
),
|
|
||||||
Maps.immutable.of("confirmationId", confirmation.getId())
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChecked(String operation, ImmutableMap<String, Object> parameters) {
|
|
||||||
Long id = (Long) parameters.get("confirmationId");
|
Long id = (Long) parameters.get("confirmationId");
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case "confirmation_check_apply":
|
case APPLY:
|
||||||
confirmationRepository.updateStateById(id, Confirmation.State.NORMAL, userService.currentLoginUser());
|
confirmationRepository.updateStateById(id, Confirmation.State.NORMAL, userService.currentLoginUser());
|
||||||
|
checkOrderService.over(order.getId());
|
||||||
break;
|
break;
|
||||||
case "confirmation_check_reject":
|
case REJECT:
|
||||||
confirmationRepository.updateStateById(id, Confirmation.State.DRAFT, userService.currentLoginUser());
|
confirmationRepository.updateStateById(id, Confirmation.State.DRAFT, userService.currentLoginUser());
|
||||||
|
checkOrderService.over(order.getId());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
||||||
public ConfirmationDuplicatedException() {
|
public ConfirmationDuplicatedException() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
|
|||||||
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
||||||
|
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.DataResource;
|
import com.eshore.gringotts.web.domain.resource.entity.DataResource;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.format.CsvResourceFormat;
|
import com.eshore.gringotts.web.domain.resource.entity.format.CsvResourceFormat;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.format.JsonLineResourceFormat;
|
import com.eshore.gringotts.web.domain.resource.entity.format.JsonLineResourceFormat;
|
||||||
@@ -78,6 +79,9 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
|||||||
item.setFormat(dataResource.getFormat().getFormatType().name());
|
item.setFormat(dataResource.getFormat().getFormatType().name());
|
||||||
if (ObjectUtil.isNotNull(dataResource.getConfirmation())) {
|
if (ObjectUtil.isNotNull(dataResource.getConfirmation())) {
|
||||||
item.setConfirmationId(dataResource.getConfirmation().getId());
|
item.setConfirmationId(dataResource.getConfirmation().getId());
|
||||||
|
item.setConfirmationState(dataResource.getConfirmation().getState());
|
||||||
|
} else {
|
||||||
|
item.setConfirmationState(Confirmation.State.NONE);
|
||||||
}
|
}
|
||||||
item.setCreatedUser(dataResource.getCreatedUser().getUsername());
|
item.setCreatedUser(dataResource.getCreatedUser().getUsername());
|
||||||
item.setCreatedTime(dataResource.getCreatedTime());
|
item.setCreatedTime(dataResource.getCreatedTime());
|
||||||
@@ -250,6 +254,7 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
|||||||
private String type;
|
private String type;
|
||||||
private String format;
|
private String format;
|
||||||
private Long confirmationId;
|
private Long confirmationId;
|
||||||
|
private Confirmation.State confirmationState;
|
||||||
private String createdUser;
|
private String createdUser;
|
||||||
private LocalDateTime createdTime;
|
private LocalDateTime createdTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,26 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity;
|
package com.eshore.gringotts.web.domain.resource.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
import com.eshore.gringotts.web.domain.authentication.entity.Authentication;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.format.ResourceFormat;
|
import com.eshore.gringotts.web.domain.resource.entity.format.ResourceFormat;
|
||||||
import com.eshore.gringotts.web.domain.resource.entity.type.ResourceType;
|
import com.eshore.gringotts.web.domain.resource.entity.type.ResourceType;
|
||||||
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
||||||
import javax.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import jakarta.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.EntityListeners;
|
import jakarta.persistence.EntityListeners;
|
||||||
import javax.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
import javax.persistence.ForeignKey;
|
import jakarta.persistence.ForeignKey;
|
||||||
import javax.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import javax.persistence.NamedAttributeNode;
|
import jakarta.persistence.NamedAttributeNode;
|
||||||
import javax.persistence.NamedEntityGraph;
|
import jakarta.persistence.NamedEntityGraph;
|
||||||
import javax.persistence.OneToOne;
|
import jakarta.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import java.util.Set;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -26,7 +29,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString(callSuper = true)
|
||||||
@Entity
|
@Entity
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@@ -45,23 +48,26 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
public class DataResource extends SimpleEntity {
|
public class DataResource extends LogicDeleteEntity {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
@OneToOne(cascade = CascadeType.REMOVE)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private ResourceType type;
|
private ResourceType type;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
@OneToOne(cascade = CascadeType.REMOVE)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private ResourceFormat format;
|
private ResourceFormat format;
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
@OneToOne(cascade = CascadeType.REMOVE)
|
||||||
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private DataFile example;
|
private DataFile example;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
|
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Confirmation confirmation;
|
private Confirmation confirmation;
|
||||||
|
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
|
||||||
|
@ToString.Exclude
|
||||||
|
private Set<Authentication> authentications;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.format;
|
package com.eshore.gringotts.web.domain.resource.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.IdOnlyEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
||||||
import javax.persistence.DiscriminatorColumn;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.DiscriminatorType;
|
import jakarta.persistence.Inheritance;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.InheritanceType;
|
||||||
import javax.persistence.Inheritance;
|
import jakarta.persistence.Table;
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -24,8 +22,7 @@ import lombok.ToString;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_format")
|
@Table(name = Constants.TABLE_PREFIX + "resource_format")
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
|
public abstract class ResourceFormat extends LogicDeleteIdOnlyEntity {
|
||||||
public abstract class ResourceFormat extends IdOnlyEntity {
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
NONE,
|
NONE,
|
||||||
LINE,
|
LINE,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.type;
|
package com.eshore.gringotts.web.domain.resource.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.type;
|
package com.eshore.gringotts.web.domain.resource.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
import javax.persistence.Enumerated;
|
import jakarta.persistence.Enumerated;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package com.eshore.gringotts.web.domain.resource.entity.type;
|
|||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
||||||
import javax.persistence.ConstraintMode;
|
import jakarta.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.ForeignKey;
|
import jakarta.persistence.ForeignKey;
|
||||||
import javax.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import javax.persistence.NamedAttributeNode;
|
import jakarta.persistence.OneToOne;
|
||||||
import javax.persistence.NamedEntityGraph;
|
import jakarta.persistence.Table;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -23,9 +21,6 @@ import lombok.ToString;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_file")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_file")
|
||||||
@NamedEntityGraph(name = "file_resource_type.detail", attributeNodes = {
|
|
||||||
@NamedAttributeNode(value = "file")
|
|
||||||
})
|
|
||||||
public class FileResourceType extends ResourceType {
|
public class FileResourceType extends ResourceType {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.type;
|
package com.eshore.gringotts.web.domain.resource.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ package com.eshore.gringotts.web.domain.resource.entity.type;
|
|||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
|
||||||
import javax.persistence.ConstraintMode;
|
import jakarta.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.ForeignKey;
|
import jakarta.persistence.ForeignKey;
|
||||||
import javax.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import javax.persistence.NamedAttributeNode;
|
import jakarta.persistence.OneToOne;
|
||||||
import javax.persistence.NamedEntityGraph;
|
import jakarta.persistence.Table;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -23,10 +21,6 @@ import lombok.ToString;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_hdfs")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_hdfs")
|
||||||
@NamedEntityGraph(name = "hdfs_resource_type.detail", attributeNodes = {
|
|
||||||
@NamedAttributeNode(value = "coreSite"),
|
|
||||||
@NamedAttributeNode(value = "hdfsSite"),
|
|
||||||
})
|
|
||||||
public class HDFSResourceType extends ResourceType {
|
public class HDFSResourceType extends ResourceType {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.eshore.gringotts.web.domain.resource.entity.type;
|
package com.eshore.gringotts.web.domain.resource.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.IdOnlyEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.Inheritance;
|
import jakarta.persistence.Inheritance;
|
||||||
import javax.persistence.InheritanceType;
|
import jakarta.persistence.InheritanceType;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -21,8 +21,8 @@ import lombok.ToString;
|
|||||||
@ToString
|
@ToString
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type")
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
public abstract class ResourceType extends IdOnlyEntity {
|
public abstract class ResourceType extends LogicDeleteIdOnlyEntity {
|
||||||
public abstract Type getResourceType();
|
public abstract Type getResourceType();
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.eshore.gringotts.web.domain.upload.entity;
|
package com.eshore.gringotts.web.domain.upload.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -21,7 +21,7 @@ import org.hibernate.annotations.DynamicUpdate;
|
|||||||
@Entity
|
@Entity
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@Table(name = Constants.TABLE_PREFIX + "data_file")
|
@Table(name = Constants.TABLE_PREFIX + "data_file")
|
||||||
public class DataFile extends SimpleEntity {
|
public class DataFile extends LogicDeleteEntity {
|
||||||
private String filename;
|
private String filename;
|
||||||
private Long size;
|
private Long size;
|
||||||
private String md5;
|
private String md5;
|
||||||
|
|||||||
@@ -2,19 +2,19 @@ package com.eshore.gringotts.web.domain.user.entity;
|
|||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.ConstraintMode;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EnumType;
|
||||||
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.ForeignKey;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.NamedAttributeNode;
|
||||||
|
import jakarta.persistence.NamedEntityGraph;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ConstraintMode;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.ForeignKey;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|||||||
14
pom.xml
14
pom.xml
@@ -19,12 +19,12 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
<spring-boot.version>2.6.15</spring-boot.version>
|
<spring-boot.version>3.2.1</spring-boot.version>
|
||||||
<spring-cloud.version>2021.0.9</spring-cloud.version>
|
<spring-cloud.version>2023.0.4</spring-cloud.version>
|
||||||
|
|
||||||
<hutool.version>5.8.32</hutool.version>
|
<hutool.version>5.8.32</hutool.version>
|
||||||
<fisco.sdk.version>2.10.0</fisco.sdk.version>
|
<fisco.sdk.version>2.10.0</fisco.sdk.version>
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dtflys.forest</groupId>
|
<groupId>com.dtflys.forest</groupId>
|
||||||
<artifactId>forest-spring-boot-starter</artifactId>
|
<artifactId>forest-spring-boot3-starter</artifactId>
|
||||||
<version>1.5.36</version>
|
<version>1.5.36</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -95,13 +95,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||||
<version>1.39.0</version>
|
<version>1.39.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.blinkfox</groupId>
|
<groupId>com.blinkfox</groupId>
|
||||||
<artifactId>fenix-spring-boot-starter</artifactId>
|
<artifactId>fenix-spring-boot-starter</artifactId>
|
||||||
<version>2.7.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Others -->
|
<!-- Others -->
|
||||||
|
|||||||
Reference in New Issue
Block a user