Compare commits
9 Commits
74b0638a07
...
order
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e962884b1 | |||
| 6dccb0ecad | |||
| b774806e58 | |||
| bb9f87dbd2 | |||
| 381c23e94c | |||
| 30b991cc28 | |||
| fbb0ce5da3 | |||
| 5a0c44ff35 | |||
| 615edb57b8 |
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" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const information = {
|
export const information = {
|
||||||
debug: true,
|
debug: import.meta.env.DEV,
|
||||||
baseUrl: 'http://127.0.0.1:20080',
|
baseUrl: import.meta.env.DEV ? 'http://127.0.0.1:20080' : '',
|
||||||
title: '可信供给中心',
|
title: '可信供给中心',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,8 +16,8 @@ export function useAmis(amisObject) {
|
|||||||
struct,
|
struct,
|
||||||
{
|
{
|
||||||
data: {
|
data: {
|
||||||
debug: information.debug ?? false,
|
debug: information.debug,
|
||||||
base: information.baseUrl ?? '',
|
base: information.baseUrl,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,6 +99,16 @@ function detailForm() {
|
|||||||
trimContents: true,
|
trimContents: true,
|
||||||
minRows: 2,
|
minRows: 2,
|
||||||
maxRows: 2,
|
maxRows: 2,
|
||||||
|
maxLength: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-tag',
|
||||||
|
name: 'tags',
|
||||||
|
label: '标签',
|
||||||
|
max: 10,
|
||||||
|
maxTagLength: 10,
|
||||||
|
joinValues: false,
|
||||||
|
extractValue: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input-rich-text',
|
type: 'input-rich-text',
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import './style.css'
|
import './style.css'
|
||||||
import {apiGet, useAmis} from '../../components/constants.js'
|
import {administratorOnly, apiGet, checkerOnly, useAmis, userOnly} from '../../components/constants.js'
|
||||||
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
|
import {userChangePasswordDialog} from '../../components/user/dialog-user-change-password.js'
|
||||||
import {tabUser} from "./tab-user.js";
|
import {tabUser} from './tab-user.js'
|
||||||
import {tabData} from "./tab-data.js";
|
import {tabData} from './tab-data.js'
|
||||||
import {tabSettings} from "./tab-settings.js";
|
import {tabSettings} from './tab-settings.js'
|
||||||
import {tabCheck} from "./tab-check.js";
|
import {tabCheck} from './tab-check.js'
|
||||||
import {tabPermissions} from "./tab-permissions.js";
|
import {tabPermissions} from './tab-permissions.js'
|
||||||
import {tabMarket} from "./tab-market.js";
|
import {tabMarket} from './tab-market.js'
|
||||||
|
|
||||||
useAmis(information => {
|
useAmis((information) => {
|
||||||
return {
|
return {
|
||||||
id: 'header-service',
|
id: 'header-service',
|
||||||
className: 'h-full',
|
className: 'h-full',
|
||||||
@@ -23,22 +23,105 @@ useAmis(information => {
|
|||||||
args: {
|
args: {
|
||||||
url: '/pages/login/index.html',
|
url: '/pages/login/index.html',
|
||||||
blank: false,
|
blank: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
|
id: 'root-page',
|
||||||
type: 'page',
|
type: 'page',
|
||||||
title: information.title,
|
title: {
|
||||||
subTitle: '提供合法合规的数据要素可信供给工具',
|
type: 'flex',
|
||||||
|
justify: 'flex-start',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: 'avatar',
|
||||||
|
className: 'mr-2 bg-transparent',
|
||||||
|
src: '/logo.svg',
|
||||||
|
shape: 'square',
|
||||||
|
fit: 'contain',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'flex',
|
||||||
|
className: 'w-50',
|
||||||
|
direction: 'column',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: 'tpl',
|
||||||
|
className: 'font-bold text-white',
|
||||||
|
tpl: information.title,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'tpl',
|
||||||
|
className: 'font-bold text-xs text-gray-200',
|
||||||
|
tpl: '提供合法合规的数据要素可信供给工具',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// subTitle: '提供合法合规的数据要素可信供给工具',
|
||||||
|
headerClassName: 'bg-gray-800 text-white',
|
||||||
|
toolbarClassName: 'bg-gray-800',
|
||||||
toolbar: [
|
toolbar: [
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '数据市场',
|
||||||
|
icon: 'fa fa-store',
|
||||||
|
level: 'link',
|
||||||
|
className: "text-bold ${IF(activePage === 'market', 'text-primary', 'text-white')}",
|
||||||
|
onEvent: {
|
||||||
|
click: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
actionType: 'setValue',
|
||||||
|
componentId: 'root-page',
|
||||||
|
args: {
|
||||||
|
value: {
|
||||||
|
activePage: 'market',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '我的资源',
|
||||||
|
icon: 'fa fa-database',
|
||||||
|
level: 'link',
|
||||||
|
className: "text-bold ${IF(activePage === 'tab', 'text-primary', 'text-white')}",
|
||||||
|
onEvent: {
|
||||||
|
click: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
actionType: 'setValue',
|
||||||
|
componentId: 'root-page',
|
||||||
|
args: {
|
||||||
|
value: {
|
||||||
|
activePage: 'tab',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'divider',
|
||||||
|
direction: 'vertical',
|
||||||
|
color: '#4d4d4d',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'dropdown-button',
|
type: 'dropdown-button',
|
||||||
label: '${username}',
|
label: '${username}',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
|
btnClassName: 'text-white',
|
||||||
|
level: 'link',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
label: '修改密码',
|
label: '修改密码',
|
||||||
@@ -49,26 +132,69 @@ useAmis(information => {
|
|||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: apiGet('${base}/user/logout'),
|
api: apiGet('${base}/user/logout'),
|
||||||
reload: 'header-service',
|
reload: 'header-service',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
bodyClassName: 'p-0',
|
bodyClassName: 'p-0',
|
||||||
body: {
|
data: {
|
||||||
className: 'h-full border-0',
|
activePage: 'tab',
|
||||||
type: 'tabs',
|
tabActiveKey: 'data'
|
||||||
tabsMode: 'vertical',
|
|
||||||
tabs: [
|
|
||||||
// tabOverview(),
|
|
||||||
tabMarket(),
|
|
||||||
tabData(),
|
|
||||||
tabPermissions(),
|
|
||||||
tabCheck(),
|
|
||||||
tabUser(),
|
|
||||||
tabSettings(),
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
}
|
body: [
|
||||||
]
|
{
|
||||||
|
visibleOn: "${activePage === 'market'}",
|
||||||
|
type: 'wrapper',
|
||||||
|
body: tabMarket(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${activePage === 'tab'}",
|
||||||
|
className: 'h-full border-0',
|
||||||
|
type: 'tabs',
|
||||||
|
tabsMode: 'vertical',
|
||||||
|
activeKey: '${tabActiveKey}',
|
||||||
|
tabs: [
|
||||||
|
// tabOverview(),
|
||||||
|
{
|
||||||
|
hash: 'data',
|
||||||
|
visibleOn: userOnly,
|
||||||
|
title: '数据资源',
|
||||||
|
icon: 'fa fa-database',
|
||||||
|
reload: true,
|
||||||
|
body: tabData()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hash: 'permission',
|
||||||
|
visibleOn: userOnly,
|
||||||
|
title: '权属管理',
|
||||||
|
icon: 'fa fa-key',
|
||||||
|
reload: true,
|
||||||
|
body: tabPermissions(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hash: 'check',
|
||||||
|
visibleOn: checkerOnly,
|
||||||
|
title: '审核审查',
|
||||||
|
icon: 'fa fa-shield-halved',
|
||||||
|
reload: true,
|
||||||
|
body: tabCheck(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hash: 'user',
|
||||||
|
visibleOn: administratorOnly,
|
||||||
|
title: '用户管理',
|
||||||
|
icon: 'fa fa-user',
|
||||||
|
reload: true,
|
||||||
|
body: tabUser(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hash: 'settings',
|
||||||
|
...tabSettings(),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
apiGet,
|
apiGet,
|
||||||
checkerOnly,
|
|
||||||
checkOverMapping,
|
checkOverMapping,
|
||||||
checkTypeMapping,
|
checkTypeMapping,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
@@ -13,134 +12,128 @@ import {authenticationDetailDialog, confirmationDetailDialog} from "../../compon
|
|||||||
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
||||||
|
|
||||||
export function tabCheck() {
|
export function tabCheck() {
|
||||||
return {
|
return [
|
||||||
visibleOn: checkerOnly,
|
{
|
||||||
title: '审核审查',
|
name: 'check_order_list',
|
||||||
icon: 'fa fa-shield-halved',
|
type: 'crud',
|
||||||
reload: true,
|
api: apiGet('${base}/check_order/list'),
|
||||||
body: [
|
...crudCommonOptions(),
|
||||||
{
|
headerToolbar: [
|
||||||
name: 'check_order_list',
|
'reload',
|
||||||
type: 'crud',
|
],
|
||||||
api: apiGet('${base}/check_order/list'),
|
columns: [
|
||||||
...crudCommonOptions(),
|
stringField('description', '描述'),
|
||||||
headerToolbar: [
|
mappingField('type', '类型', checkTypeMapping),
|
||||||
'reload',
|
mappingField('state', '状态', checkOverMapping),
|
||||||
],
|
timeField('createdTime', '创建时间'),
|
||||||
columns: [
|
stringField('createdUsername', '创建人', 100),
|
||||||
stringField('description', '描述'),
|
timeField('modifiedTime', '最后修改时间'),
|
||||||
mappingField('type', '类型', checkTypeMapping),
|
stringField('modifiedUsername', '最后操作人', 100),
|
||||||
mappingField('state', '状态', checkOverMapping),
|
operationField('操作', undefined, [
|
||||||
timeField('createdTime', '创建时间'),
|
{
|
||||||
stringField('createdUsername', '创建人', 100),
|
visibleOn: "${type === 'CONFIRMATION' && state === 'CHECKING'}",
|
||||||
timeField('modifiedTime', '最后修改时间'),
|
type: 'action',
|
||||||
stringField('modifiedUsername', '最后操作人', 100),
|
label: '处理',
|
||||||
operationField('操作', undefined, [
|
level: 'link',
|
||||||
{
|
...confirmationDetailDialog(
|
||||||
visibleOn: `\${type === 'CONFIRMATION' && state === 'CHECKING'}`,
|
'parameters.confirmationId',
|
||||||
type: 'action',
|
[
|
||||||
label: '处理',
|
{
|
||||||
level: 'link',
|
type: 'action',
|
||||||
...confirmationDetailDialog(
|
label: '同意',
|
||||||
'parameters.confirmationId',
|
actionType: 'ajax',
|
||||||
[
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '同意',
|
},
|
||||||
actionType: 'ajax',
|
{
|
||||||
close: true,
|
type: 'action',
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
label: '拒绝',
|
||||||
reload: 'check_order_list',
|
actionType: 'ajax',
|
||||||
},
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '拒绝',
|
},
|
||||||
actionType: 'ajax',
|
],
|
||||||
close: true,
|
),
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
},
|
||||||
reload: 'check_order_list',
|
{
|
||||||
},
|
visibleOn: "${type === 'CONFIRMATION' && state !== NORMAL}",
|
||||||
],
|
type: 'action',
|
||||||
),
|
label: '查看',
|
||||||
},
|
level: 'link',
|
||||||
{
|
...confirmationDetailDialog('parameters.confirmationId'),
|
||||||
visibleOn: `\${type === 'CONFIRMATION' && state !== NORMAL}`,
|
},
|
||||||
type: 'action',
|
{
|
||||||
label: '查看',
|
visibleOn: "${type === 'AUTHENTICATION' && state === 'CHECKING'}",
|
||||||
level: 'link',
|
type: 'action',
|
||||||
...confirmationDetailDialog('parameters.confirmationId'),
|
label: '处理',
|
||||||
},
|
level: 'link',
|
||||||
{
|
...authenticationDetailDialog(
|
||||||
visibleOn: `\${type === 'AUTHENTICATION' && state === 'CHECKING'}`,
|
'parameters.authenticationId',
|
||||||
type: 'action',
|
[
|
||||||
label: '处理',
|
{
|
||||||
level: 'link',
|
type: 'action',
|
||||||
...authenticationDetailDialog(
|
label: '同意',
|
||||||
'parameters.authenticationId',
|
actionType: 'ajax',
|
||||||
[
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '同意',
|
},
|
||||||
actionType: 'ajax',
|
{
|
||||||
close: true,
|
type: 'action',
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
label: '拒绝',
|
||||||
reload: 'check_order_list',
|
actionType: 'ajax',
|
||||||
},
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '拒绝',
|
},
|
||||||
actionType: 'ajax',
|
],
|
||||||
close: true,
|
),
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
},
|
||||||
reload: 'check_order_list',
|
{
|
||||||
},
|
visibleOn: "${type === 'AUTHENTICATION' && state !== NORMAL}",
|
||||||
],
|
type: 'action',
|
||||||
),
|
label: '查看',
|
||||||
},
|
level: 'link',
|
||||||
{
|
...authenticationDetailDialog('parameters.authenticationId'),
|
||||||
visibleOn: `\${type === 'AUTHENTICATION' && state !== NORMAL}`,
|
},
|
||||||
type: 'action',
|
{
|
||||||
label: '查看',
|
visibleOn: "${type === 'MARKET' && state === 'CHECKING'}",
|
||||||
level: 'link',
|
type: 'action',
|
||||||
...authenticationDetailDialog('parameters.authenticationId'),
|
label: '处理',
|
||||||
},
|
level: 'link',
|
||||||
{
|
...wareDetailDialog(
|
||||||
visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`,
|
'parameters.wareId',
|
||||||
type: 'action',
|
[
|
||||||
label: '处理',
|
{
|
||||||
level: 'link',
|
type: 'action',
|
||||||
...wareDetailDialog(
|
label: '同意',
|
||||||
'parameters.wareId',
|
actionType: 'ajax',
|
||||||
[
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '同意',
|
},
|
||||||
actionType: 'ajax',
|
{
|
||||||
close: true,
|
type: 'action',
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
label: '拒绝',
|
||||||
reload: 'check_order_list',
|
actionType: 'ajax',
|
||||||
},
|
close: true,
|
||||||
{
|
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
||||||
type: 'action',
|
reload: 'check_order_list',
|
||||||
label: '拒绝',
|
},
|
||||||
actionType: 'ajax',
|
],
|
||||||
close: true,
|
),
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
},
|
||||||
reload: 'check_order_list',
|
{
|
||||||
},
|
visibleOn: "${type === 'MARKET' && state !== NORMAL}",
|
||||||
],
|
type: 'action',
|
||||||
),
|
label: '查看',
|
||||||
},
|
level: 'link',
|
||||||
{
|
...wareDetailDialog('parameters.wareId'),
|
||||||
visibleOn: `\${type === 'MARKET' && state !== NORMAL}`,
|
},
|
||||||
type: 'action',
|
]),
|
||||||
label: '查看',
|
],
|
||||||
level: 'link',
|
},
|
||||||
...wareDetailDialog('parameters.wareId'),
|
]
|
||||||
},
|
|
||||||
]),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -11,8 +11,7 @@ import {
|
|||||||
mappingField,
|
mappingField,
|
||||||
operationField,
|
operationField,
|
||||||
permissionStateMapping,
|
permissionStateMapping,
|
||||||
timeField,
|
timeField
|
||||||
userOnly
|
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
|
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
|
||||||
|
|
||||||
@@ -86,101 +85,97 @@ export function resourceList(showMode = false) {
|
|||||||
|
|
||||||
export function tabData() {
|
export function tabData() {
|
||||||
return {
|
return {
|
||||||
visibleOn: userOnly,
|
type: 'tabs',
|
||||||
title: '数据资源',
|
tabs: [
|
||||||
icon: 'fa fa-database',
|
{
|
||||||
reload: true,
|
title: '资源定义',
|
||||||
body: {
|
tab: resourceList()
|
||||||
type: 'tabs',
|
},
|
||||||
tabs: [
|
{
|
||||||
{
|
title: '资源上架',
|
||||||
title: '资源定义',
|
tab: {
|
||||||
tab: resourceList()
|
type: 'crud',
|
||||||
},
|
api: apiGet('${base}/ware/list'),
|
||||||
{
|
...crudCommonOptions(),
|
||||||
title: '资源上架',
|
headerToolbar: [
|
||||||
tab: {
|
'reload',
|
||||||
type: 'crud',
|
{
|
||||||
api: apiGet('${base}/ware/list'),
|
type: 'action',
|
||||||
...crudCommonOptions(),
|
label: '',
|
||||||
headerToolbar: [
|
icon: 'fa fa-plus',
|
||||||
'reload',
|
...wareAddDialog()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
label: '名称',
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
label: '描述',
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: '${TRUNCATE(description, 100)}',
|
||||||
|
},
|
||||||
|
mappingField('state', '状态', permissionStateMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '',
|
label: '查看',
|
||||||
icon: 'fa fa-plus',
|
level: 'link',
|
||||||
...wareAddDialog()
|
...wareDetailDialog(),
|
||||||
},
|
|
||||||
],
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
label: '名称',
|
|
||||||
width: 200,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'description',
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
label: '描述',
|
type: 'action',
|
||||||
|
label: '撤销',
|
||||||
|
level: 'link',
|
||||||
|
confirmTitle: '确认撤销',
|
||||||
|
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/retract/${id}'),
|
||||||
},
|
},
|
||||||
mappingField('state', '状态', permissionStateMapping),
|
{
|
||||||
timeField('createdTime', '创建时间'),
|
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
||||||
operationField('操作', undefined, [
|
type: 'action',
|
||||||
{
|
label: '提交',
|
||||||
type: 'action',
|
level: 'link',
|
||||||
label: '查看',
|
confirmTitle: '确认提交',
|
||||||
level: 'link',
|
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
||||||
...wareDetailDialog(),
|
actionType: 'ajax',
|
||||||
},
|
api: apiGet('${base}/ware/submit/${id}'),
|
||||||
{
|
},
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
{
|
||||||
type: 'action',
|
type: 'dropdown-button',
|
||||||
label: '撤销',
|
level: 'link',
|
||||||
level: 'link',
|
icon: 'fa fa-ellipsis-h',
|
||||||
confirmTitle: '确认撤销',
|
hideCaret: true,
|
||||||
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
trigger: 'hover',
|
||||||
actionType: 'ajax',
|
buttons: [
|
||||||
api: apiGet('${base}/ware/retract/${id}'),
|
{
|
||||||
},
|
disabledOn: "${state !== 'DRAFT'}",
|
||||||
{
|
type: 'action',
|
||||||
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
label: '编辑',
|
||||||
type: 'action',
|
level: 'link',
|
||||||
label: '提交',
|
...wareEditeDialog(),
|
||||||
level: 'link',
|
},
|
||||||
confirmTitle: '确认提交',
|
{
|
||||||
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
disabledOn: "${state === 'CHECKING'}",
|
||||||
actionType: 'ajax',
|
type: 'action',
|
||||||
api: apiGet('${base}/ware/submit/${id}'),
|
label: "删除",
|
||||||
},
|
confirmTitle: '确认删除',
|
||||||
{
|
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
||||||
type: 'dropdown-button',
|
actionType: 'ajax',
|
||||||
level: 'link',
|
api: apiGet('${base}/ware/remove/${id}'),
|
||||||
icon: 'fa fa-ellipsis-h',
|
},
|
||||||
hideCaret: true,
|
]
|
||||||
trigger: 'hover',
|
},
|
||||||
buttons: [
|
]),
|
||||||
{
|
]
|
||||||
disabledOn: "${state !== 'DRAFT'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '编辑',
|
|
||||||
level: 'link',
|
|
||||||
...wareEditeDialog(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
disabledOn: "${state === 'CHECKING'}",
|
|
||||||
type: 'action',
|
|
||||||
label: "删除",
|
|
||||||
confirmTitle: '确认删除',
|
|
||||||
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/remove/${id}'),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,88 +3,83 @@ import {authenticationAddDialog} from "../../components/permission/dialog-permis
|
|||||||
|
|
||||||
export function tabMarket() {
|
export function tabMarket() {
|
||||||
return {
|
return {
|
||||||
title: '数据市场',
|
type: 'crud',
|
||||||
icon: 'fa fa-store',
|
api: {
|
||||||
reload: true,
|
...apiGet('${base}/ware/list_public'),
|
||||||
body: {
|
adaptor: (payload, response, api, context) => {
|
||||||
type: 'crud',
|
payload.data = payload.data.map(i => {
|
||||||
api: {
|
return {
|
||||||
...apiGet('${base}/ware/list_public'),
|
...i,
|
||||||
adaptor: (payload, response, api, context) => {
|
targetId: i.resourceId,
|
||||||
payload.data = payload.data.map(i => {
|
|
||||||
return {
|
|
||||||
...i,
|
|
||||||
targetId: i.resourceId,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return payload
|
|
||||||
}
|
|
||||||
},
|
|
||||||
...crudCommonOptions(),
|
|
||||||
headerToolbar: [
|
|
||||||
'reload',
|
|
||||||
],
|
|
||||||
mode: 'cards',
|
|
||||||
columnsCount: 3,
|
|
||||||
card: {
|
|
||||||
header: {
|
|
||||||
title: '${name}',
|
|
||||||
subTitle: '${createdTime}',
|
|
||||||
avatar: '${icon}',
|
|
||||||
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
|
|
||||||
},
|
|
||||||
body: '${TRUNCATE(description, 50)}',
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
actionType: 'dialog',
|
|
||||||
dialog: {
|
|
||||||
title: '数据产品详情',
|
|
||||||
size: 'md',
|
|
||||||
actions: [],
|
|
||||||
body: {
|
|
||||||
type: 'service',
|
|
||||||
api: apiGet(`\${base}/ware/detail/\${id}`),
|
|
||||||
body: [
|
|
||||||
{
|
|
||||||
type: 'property',
|
|
||||||
title: '产品信息',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
label: '名称',
|
|
||||||
content: '${name}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '归属',
|
|
||||||
content: '${createdUsername}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '创建时间',
|
|
||||||
content: '${createdTime}',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
span: 3,
|
|
||||||
label: '描述',
|
|
||||||
content: '${description}',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: '${content|raw}'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '申请授权',
|
|
||||||
...authenticationAddDialog(),
|
|
||||||
}
|
}
|
||||||
]
|
})
|
||||||
|
return payload
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...crudCommonOptions(),
|
||||||
|
headerToolbar: [
|
||||||
|
'reload',
|
||||||
|
],
|
||||||
|
mode: 'cards',
|
||||||
|
columnsCount: 3,
|
||||||
|
card: {
|
||||||
|
header: {
|
||||||
|
title: '${name}',
|
||||||
|
subTitle: '${createdTime}',
|
||||||
|
avatar: '${icon}',
|
||||||
|
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
|
||||||
},
|
},
|
||||||
|
body: '${TRUNCATE(description, 50)}',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '数据产品详情',
|
||||||
|
size: 'md',
|
||||||
|
actions: [],
|
||||||
|
body: {
|
||||||
|
type: 'service',
|
||||||
|
api: apiGet(`\${base}/ware/detail/\${id}`),
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'property',
|
||||||
|
title: '产品信息',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
label: '名称',
|
||||||
|
content: '${name}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '归属',
|
||||||
|
content: '${createdUsername}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
content: '${createdTime}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
span: 3,
|
||||||
|
label: '描述',
|
||||||
|
content: '${description}',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: '${content|raw}'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '申请授权',
|
||||||
|
...authenticationAddDialog(),
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
stringField,
|
stringField,
|
||||||
stringWrapField,
|
stringWrapField,
|
||||||
timeField,
|
timeField,
|
||||||
userOnly,
|
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
import {
|
import {
|
||||||
authenticationAddDialog,
|
authenticationAddDialog,
|
||||||
@@ -25,172 +24,166 @@ import {
|
|||||||
|
|
||||||
export function tabPermissions() {
|
export function tabPermissions() {
|
||||||
return {
|
return {
|
||||||
visibleOn: userOnly,
|
type: 'tabs',
|
||||||
title: '权属管理',
|
tabs: [
|
||||||
icon: 'fa fa-key',
|
{
|
||||||
reload: true,
|
visibleOn: providerOnly,
|
||||||
body: {
|
title: '确权管理',
|
||||||
type: 'tabs',
|
body: {
|
||||||
tabs: [
|
type: 'crud',
|
||||||
{
|
api: {
|
||||||
visibleOn: providerOnly,
|
...apiGet('${base}/confirmation/list')
|
||||||
title: '确权管理',
|
},
|
||||||
body: {
|
...crudCommonOptions(),
|
||||||
type: 'crud',
|
headerToolbar: [
|
||||||
api: {
|
'reload',
|
||||||
...apiGet('${base}/confirmation/list')
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '',
|
||||||
|
icon: 'fa fa-plus',
|
||||||
|
...confirmationAddDialog()
|
||||||
},
|
},
|
||||||
...crudCommonOptions(),
|
],
|
||||||
headerToolbar: [
|
columns: [
|
||||||
'reload',
|
stringField('name', '名称', 200),
|
||||||
|
stringWrapField('description', '描述'),
|
||||||
|
mappingField('state', '状态', permissionStateMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '',
|
label: '查看',
|
||||||
icon: 'fa fa-plus',
|
level: 'link',
|
||||||
...confirmationAddDialog()
|
...confirmationDetailDialog(),
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
columns: [
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
stringField('name', '名称', 200),
|
type: 'action',
|
||||||
stringWrapField('description', '描述'),
|
label: '撤销',
|
||||||
mappingField('state', '状态', permissionStateMapping),
|
level: 'link',
|
||||||
timeField('createdTime', '创建时间'),
|
confirmTitle: '确认撤销',
|
||||||
operationField('操作', undefined, [
|
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
||||||
{
|
actionType: 'ajax',
|
||||||
type: 'action',
|
api: apiGet('${base}/confirmation/retract/${id}'),
|
||||||
label: '查看',
|
},
|
||||||
level: 'link',
|
{
|
||||||
...confirmationDetailDialog(),
|
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
||||||
},
|
type: 'action',
|
||||||
{
|
label: '提交',
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
level: 'link',
|
||||||
type: 'action',
|
confirmTitle: '确认提交',
|
||||||
label: '撤销',
|
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
||||||
level: 'link',
|
actionType: 'ajax',
|
||||||
confirmTitle: '确认撤销',
|
api: apiGet('${base}/confirmation/submit/${id}'),
|
||||||
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
},
|
||||||
actionType: 'ajax',
|
{
|
||||||
api: apiGet('${base}/confirmation/retract/${id}'),
|
type: 'dropdown-button',
|
||||||
},
|
level: 'link',
|
||||||
{
|
icon: 'fa fa-ellipsis-h',
|
||||||
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
hideCaret: true,
|
||||||
type: 'action',
|
trigger: 'hover',
|
||||||
label: '提交',
|
buttons: [
|
||||||
level: 'link',
|
{
|
||||||
confirmTitle: '确认提交',
|
disabledOn: "${state !== 'DRAFT'}",
|
||||||
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
type: 'action',
|
||||||
actionType: 'ajax',
|
label: '编辑',
|
||||||
api: apiGet('${base}/confirmation/submit/${id}'),
|
level: 'link',
|
||||||
},
|
...confirmationEditeDialog(),
|
||||||
{
|
},
|
||||||
type: 'dropdown-button',
|
{
|
||||||
level: 'link',
|
disabledOn: "${state === 'CHECKING'}",
|
||||||
icon: 'fa fa-ellipsis-h',
|
type: 'action',
|
||||||
hideCaret: true,
|
label: "删除",
|
||||||
trigger: 'hover',
|
confirmTitle: '确认删除',
|
||||||
buttons: [
|
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
||||||
{
|
actionType: 'ajax',
|
||||||
disabledOn: "${state !== 'DRAFT'}",
|
api: apiGet('${base}/confirmation/remove/${id}'),
|
||||||
type: 'action',
|
},
|
||||||
label: '编辑',
|
]
|
||||||
level: 'link',
|
},
|
||||||
...confirmationEditeDialog(),
|
]),
|
||||||
},
|
]
|
||||||
{
|
}
|
||||||
disabledOn: "${state === 'CHECKING'}",
|
},
|
||||||
type: 'action',
|
{
|
||||||
label: "删除",
|
visibleOn: customerOnly,
|
||||||
confirmTitle: '确认删除',
|
title: '授权管理',
|
||||||
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
body: {
|
||||||
actionType: 'ajax',
|
type: 'crud',
|
||||||
api: apiGet('${base}/confirmation/remove/${id}'),
|
api: {
|
||||||
},
|
...apiGet('${base}/authentication/list')
|
||||||
]
|
},
|
||||||
},
|
...crudCommonOptions(),
|
||||||
]),
|
headerToolbar: [
|
||||||
]
|
'reload',
|
||||||
}
|
{
|
||||||
},
|
type: 'action',
|
||||||
{
|
label: '',
|
||||||
visibleOn: customerOnly,
|
icon: 'fa fa-plus',
|
||||||
title: '授权管理',
|
...authenticationAddDialog()
|
||||||
body: {
|
|
||||||
type: 'crud',
|
|
||||||
api: {
|
|
||||||
...apiGet('${base}/authentication/list')
|
|
||||||
},
|
},
|
||||||
...crudCommonOptions(),
|
],
|
||||||
headerToolbar: [
|
columns: [
|
||||||
'reload',
|
stringField('name', '名称', 200),
|
||||||
|
stringWrapField('description', '描述'),
|
||||||
|
mappingField('state', '状态', permissionStateMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '',
|
label: '查看',
|
||||||
icon: 'fa fa-plus',
|
level: 'link',
|
||||||
...authenticationAddDialog()
|
...authenticationDetailDialog(),
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
columns: [
|
visibleOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'),
|
||||||
stringField('name', '名称', 200),
|
type: 'action',
|
||||||
stringWrapField('description', '描述'),
|
label: '撤销',
|
||||||
mappingField('state', '状态', permissionStateMapping),
|
level: 'link',
|
||||||
timeField('createdTime', '创建时间'),
|
confirmTitle: '确认撤销',
|
||||||
operationField('操作', undefined, [
|
confirmText: '确认撤销名称为「${name}」的授权申请吗?',
|
||||||
{
|
actionType: 'ajax',
|
||||||
type: 'action',
|
api: apiGet('${base}/authentication/retract/${id}'),
|
||||||
label: '查看',
|
},
|
||||||
level: 'link',
|
{
|
||||||
...authenticationDetailDialog(),
|
visibleOn: arrayInCheck([checkState.draft], 'state'),
|
||||||
},
|
type: 'action',
|
||||||
{
|
label: '提交',
|
||||||
visibleOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'),
|
level: 'link',
|
||||||
type: 'action',
|
confirmTitle: '确认提交',
|
||||||
label: '撤销',
|
confirmText: '确认提交名称为「${name}」的授权申请吗?',
|
||||||
level: 'link',
|
actionType: 'ajax',
|
||||||
confirmTitle: '确认撤销',
|
api: apiGet('${base}/authentication/submit/${id}'),
|
||||||
confirmText: '确认撤销名称为「${name}」的授权申请吗?',
|
},
|
||||||
actionType: 'ajax',
|
{
|
||||||
api: apiGet('${base}/authentication/retract/${id}'),
|
type: 'dropdown-button',
|
||||||
},
|
level: 'link',
|
||||||
{
|
icon: 'fa fa-ellipsis-h',
|
||||||
visibleOn: arrayInCheck([checkState.draft], 'state'),
|
hideCaret: true,
|
||||||
type: 'action',
|
trigger: 'hover',
|
||||||
label: '提交',
|
buttons: [
|
||||||
level: 'link',
|
{
|
||||||
confirmTitle: '确认提交',
|
disabledOn: arrayOutCheck([checkState.draft], 'state'),
|
||||||
confirmText: '确认提交名称为「${name}」的授权申请吗?',
|
type: 'action',
|
||||||
actionType: 'ajax',
|
label: '编辑',
|
||||||
api: apiGet('${base}/authentication/submit/${id}'),
|
level: 'link',
|
||||||
},
|
...authenticationEditeDialog(),
|
||||||
{
|
},
|
||||||
type: 'dropdown-button',
|
{
|
||||||
level: 'link',
|
disabledOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'),
|
||||||
icon: 'fa fa-ellipsis-h',
|
type: 'action',
|
||||||
hideCaret: true,
|
label: "删除",
|
||||||
trigger: 'hover',
|
confirmTitle: '确认删除',
|
||||||
buttons: [
|
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
||||||
{
|
actionType: 'ajax',
|
||||||
disabledOn: arrayOutCheck([checkState.draft], 'state'),
|
api: apiGet('${base}/authentication/remove/${id}'),
|
||||||
type: 'action',
|
},
|
||||||
label: '编辑',
|
]
|
||||||
level: 'link',
|
},
|
||||||
...authenticationEditeDialog(),
|
]),
|
||||||
},
|
]
|
||||||
{
|
}
|
||||||
disabledOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'),
|
},
|
||||||
type: 'action',
|
]
|
||||||
label: "删除",
|
|
||||||
confirmTitle: '确认删除',
|
|
||||||
confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/authentication/remove/${id}'),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
administratorOnly,
|
|
||||||
apiGet,
|
apiGet,
|
||||||
copyField,
|
copyField,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
@@ -13,71 +12,65 @@ import {userCheckDialog, userDetailDialog} from "../../components/user/dialog-us
|
|||||||
import {userAdministratorRegisterDialog} from "../../components/user/dialog-user-register.js";
|
import {userAdministratorRegisterDialog} from "../../components/user/dialog-user-register.js";
|
||||||
|
|
||||||
export function tabUser() {
|
export function tabUser() {
|
||||||
return {
|
return [
|
||||||
visibleOn: administratorOnly,
|
{
|
||||||
title: '用户管理',
|
type: 'crud',
|
||||||
icon: 'fa fa-user',
|
api: apiGet('${base}/user_management/list'),
|
||||||
reload: true,
|
...crudCommonOptions(),
|
||||||
body: [
|
headerToolbar: [
|
||||||
{
|
'reload',
|
||||||
type: 'crud',
|
{
|
||||||
api: apiGet('${base}/user_management/list'),
|
type: 'action',
|
||||||
...crudCommonOptions(),
|
icon: 'fa fa-plus',
|
||||||
headerToolbar: [
|
tooltip: '新增账号',
|
||||||
'reload',
|
...userAdministratorRegisterDialog(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
copyField(
|
||||||
|
'username',
|
||||||
|
'邮箱',
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
userDetailDialog(),
|
||||||
|
),
|
||||||
|
mappingField('role', '角色', userRoleMapping, 120),
|
||||||
|
mappingField('state', '账号状态', userStateMapping),
|
||||||
|
timeField('createdTime', '创建时间'),
|
||||||
|
timeField('lastLoginTime', '上次登陆时间'),
|
||||||
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
type: 'action',
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
icon: 'fa fa-plus',
|
label: '审核',
|
||||||
tooltip: '新增账号',
|
icon: 'fa fa-fingerprint',
|
||||||
...userAdministratorRegisterDialog(),
|
level: 'primary',
|
||||||
|
size: 'xs',
|
||||||
|
...userCheckDialog(),
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
columns: [
|
visibleOn: "${state === 'NORMAL' && role !== 'ADMINISTRATOR'}",
|
||||||
copyField(
|
label: '禁用',
|
||||||
'username',
|
icon: 'fa fa-ban',
|
||||||
'邮箱',
|
level: 'danger',
|
||||||
undefined,
|
size: 'xs',
|
||||||
undefined,
|
confirmText: '确认禁用账号${username}?',
|
||||||
userDetailDialog(),
|
confirmTitle: '禁用账号',
|
||||||
),
|
actionType: 'ajax',
|
||||||
mappingField('role', '角色', userRoleMapping, 120),
|
api: apiGet('${base}/user_management/disable/${username}'),
|
||||||
mappingField('state', '账号状态', userStateMapping),
|
},
|
||||||
timeField('createdTime', '创建时间'),
|
{
|
||||||
timeField('lastLoginTime', '上次登陆时间'),
|
visibleOn: "${state === 'DISABLED' && role !== 'ADMINISTRATOR'}",
|
||||||
operationField('操作', undefined, [
|
label: '启用',
|
||||||
{
|
icon: 'fa fa-check',
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
level: 'success',
|
||||||
label: '审核',
|
size: 'xs',
|
||||||
icon: 'fa fa-fingerprint',
|
confirmText: '确认启用账号${username}?',
|
||||||
level: 'primary',
|
confirmTitle: '启用账号',
|
||||||
size: 'xs',
|
actionType: 'ajax',
|
||||||
...userCheckDialog(),
|
api: apiGet('${base}/user_management/enable/${username}'),
|
||||||
},
|
}
|
||||||
{
|
]),
|
||||||
visibleOn: "${state === 'NORMAL' && role !== 'ADMINISTRATOR'}",
|
]
|
||||||
label: '禁用',
|
}
|
||||||
icon: 'fa fa-ban',
|
]
|
||||||
level: 'danger',
|
|
||||||
size: 'xs',
|
|
||||||
confirmText: '确认禁用账号${username}?',
|
|
||||||
confirmTitle: '禁用账号',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/user_management/disable/${username}'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${state === 'DISABLED' && role !== 'ADMINISTRATOR'}",
|
|
||||||
label: '启用',
|
|
||||||
icon: 'fa fa-check',
|
|
||||||
level: 'success',
|
|
||||||
size: 'xs',
|
|
||||||
confirmText: '确认启用账号${username}?',
|
|
||||||
confirmTitle: '启用账号',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/user_management/enable/${username}'),
|
|
||||||
}
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,74 +4,103 @@ import {userRegisterDialog} from '../../components/user/dialog-user-register.js'
|
|||||||
useAmis(information => {
|
useAmis(information => {
|
||||||
return {
|
return {
|
||||||
type: 'page',
|
type: 'page',
|
||||||
title: information.title,
|
className: 'h-screen bg-gray-900',
|
||||||
subTitle: '统一登陆入口',
|
bodyClassName: 'h-full flex items-start mt-20',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'grid',
|
type: 'wrapper',
|
||||||
columns: [
|
className: 'relative w-full max-w-md mx-auto',
|
||||||
|
body: [
|
||||||
{
|
{
|
||||||
xs: 0,
|
type: 'flex',
|
||||||
sm: 0,
|
justify: 'center',
|
||||||
md: 4,
|
className: 'mb-8',
|
||||||
body: [],
|
items: [
|
||||||
|
{
|
||||||
|
type: 'avatar',
|
||||||
|
src: '/logo.svg',
|
||||||
|
shape: 'square',
|
||||||
|
size: 64,
|
||||||
|
fit: 'contain',
|
||||||
|
className: 'mr-4 bg-transparent'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'flex',
|
||||||
|
direction: 'column',
|
||||||
|
justify: 'center',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: information.title,
|
||||||
|
className: 'text-2xl font-bold text-white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: '统一登录入口',
|
||||||
|
className: 'text-lg ml-1 mt-1 text-gray-100'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xs: 12,
|
type: 'form',
|
||||||
sm: 12,
|
className: 'bg-white rounded-xl p-10 shadow-2xl',
|
||||||
md: 4,
|
api: '${base}/user/login',
|
||||||
|
redirect: '/pages/index/index.html?token=${token}',
|
||||||
|
mode: 'normal',
|
||||||
|
wrapWithPanel: false,
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'form',
|
type: 'input-email',
|
||||||
title: '用户登陆',
|
name: 'username',
|
||||||
api: '${base}/user/login',
|
label: false,
|
||||||
redirect: '/pages/index/index.html?token=${token}',
|
placeholder: '请输入邮箱',
|
||||||
mode: 'horizontal',
|
required: true,
|
||||||
horizontal: {
|
clearable: true,
|
||||||
left: 2,
|
className: 'mb-4',
|
||||||
},
|
inputClassName: 'rounded-lg',
|
||||||
actions: [
|
},
|
||||||
|
{
|
||||||
|
type: 'input-password',
|
||||||
|
name: 'password',
|
||||||
|
label: false,
|
||||||
|
placeholder: '请输入密码',
|
||||||
|
required: true,
|
||||||
|
className: 'mb-4',
|
||||||
|
inputClassName: 'rounded-lg',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'flex',
|
||||||
|
justify: 'space-between',
|
||||||
|
className: 'mb-4',
|
||||||
|
items: [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'button',
|
||||||
label: '注册',
|
label: '注册账号',
|
||||||
|
className: 'text-blue-600 hover:text-blue-700',
|
||||||
|
level: 'link',
|
||||||
...userRegisterDialog(),
|
...userRegisterDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'button',
|
||||||
actionType: 'submit',
|
label: '忘记密码?',
|
||||||
label: '登陆',
|
level: 'link',
|
||||||
level: 'primary',
|
className: 'text-gray-600 hover:text-gray-700'
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
body: [
|
|
||||||
{
|
|
||||||
type: 'input-email',
|
|
||||||
name: 'username',
|
|
||||||
label: '邮箱',
|
|
||||||
placeholder: '请输入邮箱',
|
|
||||||
required: true,
|
|
||||||
clearable: true,
|
|
||||||
clearValueOnEmpty: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'input-password',
|
|
||||||
name: 'password',
|
|
||||||
label: '密码',
|
|
||||||
placeholder: '请再次输入密码',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
},
|
type: 'submit',
|
||||||
{
|
label: '登录',
|
||||||
xs: 0,
|
level: 'primary',
|
||||||
sm: 0,
|
className: 'w-full rounded-lg',
|
||||||
md: 4,
|
size: 'lg'
|
||||||
body: [],
|
}
|
||||||
},
|
]
|
||||||
],
|
}
|
||||||
},
|
]
|
||||||
],
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
8
gringotts-frontend/public/logo.svg
Normal file
8
gringotts-frontend/public/logo.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1589 1540" width="1589" height="1540">
|
||||||
|
<title>China_Telecom_Logo-svg</title>
|
||||||
|
<style>
|
||||||
|
.s0 { fill: #FFFFFF }
|
||||||
|
</style>
|
||||||
|
<path id="path8564" class="s0"
|
||||||
|
d="m1004.4 258.8c0 0-27.8-30.7-64.4-30.7 0 0-80.2 0-134.7 173.4 0 0-46.5 151.5-46.5 376.4 0 0 0 212 43.6 361.6 0 0 43.5 151.6 106.9 151.6 0 0 44.6 0 82.2-83.2 0 0 37.6-83.2 53.5-219l118.8-29.7c0 0-30.7 252.7-125.8 416.1 0 0-98 164.5-221.8 164.5 0 0-148.5 0-253.4-222.9 0 0-105-222.9-105-539 0 0 0-316 105-540.9 0 0 104.9-223.9 253.4-223.9 0 0 148.6 0 254.5 227.9zm417.8 304.1c0 0-204.9 169.4-531.7 251.6 0 0-327.7 81.3-588.1 27.8 0 0-260.4-55.5-299-215 0 0-32.7-132.8 110.9-279.4 0 0 141.6-145.6 396-242.7l16.9 65.4c0 0-148.5 63.4-230.7 143.6 0 0-84.2 84.2-65.4 156.6 0 0 24.8 92.1 199 119.8 0 0 173.3 26.8 398.1-28.7 0 0 222.7-55.5 365.3-161.5 0 0 140.6-107 116.8-200.1 0 0-19.8-80.2-162.3-114.9l-21.8-85.2c0 0 185.1 6.9 307.9 68.3 0 0 125.7 61.5 151.5 165.5 0 0 40.6 158.5-163.4 328.9z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -12,6 +12,11 @@
|
|||||||
<artifactId>gringotts-web</artifactId>
|
<artifactId>gringotts-web</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lanyuanxiaoyao</groupId>
|
||||||
|
<artifactId>flowable</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.eshore</groupId>
|
<groupId>com.eshore</groupId>
|
||||||
<artifactId>gringotts-configuration</artifactId>
|
<artifactId>gringotts-configuration</artifactId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.entity;
|
package com.eshore.gringotts.web.domain.base.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.EntityListeners;
|
import javax.persistence.EntityListeners;
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.service;
|
package com.eshore.gringotts.web.domain.base.service;
|
||||||
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,6 +13,16 @@ import org.eclipse.collections.api.map.ImmutableMap;
|
|||||||
* @author lanyuanxiaoyao
|
* @author lanyuanxiaoyao
|
||||||
* @date 2024-11-28
|
* @date 2024-11-28
|
||||||
*/
|
*/
|
||||||
public interface CheckingService {
|
public abstract class CheckingService<ENTITY extends LogicDeleteEntity> extends LogicDeleteService<ENTITY> {
|
||||||
void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters);
|
public CheckingService(SimpleRepository<ENTITY, Long> repository, UserService userService, EntityManager manager) {
|
||||||
|
super(repository, userService, manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public void submit(Long id) throws Exception;
|
||||||
|
|
||||||
|
abstract public void retract(Long id) throws Exception;
|
||||||
|
|
||||||
|
abstract public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters);
|
||||||
|
|
||||||
|
abstract public ImmutableMap<String, Object> archive(ENTITY entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.eshore.gringotts.web.domain.controller;
|
package com.eshore.gringotts.web.domain.controller;
|
||||||
|
|
||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
|
||||||
import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
|
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;
|
||||||
@@ -9,7 +8,6 @@ import com.eshore.gringotts.web.domain.entity.Authentication;
|
|||||||
import com.eshore.gringotts.web.domain.service.AuthenticationService;
|
import com.eshore.gringotts.web.domain.service.AuthenticationService;
|
||||||
import com.eshore.gringotts.web.domain.service.DataFileService;
|
import com.eshore.gringotts.web.domain.service.DataFileService;
|
||||||
import com.eshore.gringotts.web.domain.service.DataResourceService;
|
import com.eshore.gringotts.web.domain.service.DataResourceService;
|
||||||
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;
|
||||||
@@ -17,8 +15,6 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Sets;
|
import org.eclipse.collections.api.factory.Sets;
|
||||||
import org.eclipse.collections.api.set.ImmutableSet;
|
import org.eclipse.collections.api.set.ImmutableSet;
|
||||||
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -30,29 +26,15 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("authentication")
|
@RequestMapping("authentication")
|
||||||
public class AuthenticationController extends SimpleControllerSupport<Authentication, AuthenticationController.SaveItem, AuthenticationController.ListItem, AuthenticationController.DetailItem> {
|
public class AuthenticationController extends SimpleControllerSupport<Authentication, AuthenticationController.SaveItem, AuthenticationController.ListItem, AuthenticationController.DetailItem> {
|
||||||
private final AuthenticationService authenticationService;
|
|
||||||
private final DataResourceService dataResourceService;
|
private final DataResourceService dataResourceService;
|
||||||
private final DataFileService dataFileService;
|
private final DataFileService dataFileService;
|
||||||
|
|
||||||
public AuthenticationController(AuthenticationService service, DataResourceService dataResourceService, DataFileService dataFileService) {
|
public AuthenticationController(AuthenticationService service, DataResourceService dataResourceService, DataFileService dataFileService) {
|
||||||
super(service);
|
super(service);
|
||||||
this.authenticationService = service;
|
|
||||||
this.dataResourceService = dataResourceService;
|
this.dataResourceService = dataResourceService;
|
||||||
this.dataFileService = dataFileService;
|
this.dataFileService = dataFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/submit/{id}")
|
|
||||||
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
|
||||||
authenticationService.submit(id);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/retract/{id}")
|
|
||||||
public AmisResponse<Object> retract(@PathVariable Long id) {
|
|
||||||
authenticationService.retract(id);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Authentication fromSaveItem(SaveItem item) throws Exception {
|
protected Authentication fromSaveItem(SaveItem item) throws Exception {
|
||||||
Authentication authentication = new Authentication();
|
Authentication authentication = new Authentication();
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package com.eshore.gringotts.web.domain.controller;
|
|||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.ListController;
|
import com.eshore.gringotts.web.domain.base.controller.ListController;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.CheckOrderNode;
|
||||||
import com.eshore.gringotts.web.domain.service.CheckOrderService;
|
import com.eshore.gringotts.web.domain.service.CheckOrderService;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -52,13 +52,25 @@ public class CheckOrderController implements ListController<CheckOrderController
|
|||||||
return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
|
return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/approve/{id}")
|
||||||
|
public AmisResponse<Object> approve(@PathVariable Long id) {
|
||||||
|
checkOrderService.approve(id);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/reject/{id}")
|
||||||
|
public AmisResponse<Object> reject(@PathVariable Long id) {
|
||||||
|
checkOrderService.reject(id);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private ListItem toListItem(CheckOrder order) {
|
private ListItem toListItem(CheckOrder order) {
|
||||||
ListItem item = new ListItem();
|
ListItem item = new ListItem();
|
||||||
item.setCheckOrderId(order.getId());
|
item.setCheckOrderId(order.getId());
|
||||||
item.setDescription(order.getDescription());
|
item.setDescription(order.getDescription());
|
||||||
item.setType(order.getType());
|
item.setCurrentNode(order.getCurrentNode());
|
||||||
item.setParameters(mapper.readValue(order.getParameters(), new TypeReference<>() {}));
|
item.setParameters(mapper.readValue(order.getContext(), new TypeReference<>() {}));
|
||||||
item.setState(order.getState());
|
item.setState(order.getState());
|
||||||
item.setCreatedUsername(order.getCreatedUser().getUsername());
|
item.setCreatedUsername(order.getCreatedUser().getUsername());
|
||||||
item.setCreatedTime(order.getCreatedTime());
|
item.setCreatedTime(order.getCreatedTime());
|
||||||
@@ -67,18 +79,11 @@ public class CheckOrderController implements ListController<CheckOrderController
|
|||||||
return item;
|
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
|
@Data
|
||||||
public static final class ListItem {
|
public static final class ListItem {
|
||||||
private Long checkOrderId;
|
private Long checkOrderId;
|
||||||
private String description;
|
private String description;
|
||||||
private CheckOrder.Type type;
|
private CheckOrderNode currentNode;
|
||||||
private ImmutableMap<String, Object> parameters;
|
private ImmutableMap<String, Object> parameters;
|
||||||
private CheckOrder.State state;
|
private CheckOrder.State state;
|
||||||
private LocalDateTime createdTime;
|
private LocalDateTime createdTime;
|
||||||
|
|||||||
@@ -33,25 +33,19 @@ public class ConfirmationController extends SimpleControllerSupport<Confirmation
|
|||||||
private final DataResourceService dataResourceService;
|
private final DataResourceService dataResourceService;
|
||||||
private final DataFileService dataFileService;
|
private final DataFileService dataFileService;
|
||||||
|
|
||||||
public ConfirmationController(ConfirmationService service, ConfirmationService confirmationService, DataResourceService dataResourceService, DataFileService dataFileService) {
|
public ConfirmationController(ConfirmationService service, DataResourceService dataResourceService, DataFileService dataFileService) {
|
||||||
super(service);
|
super(service);
|
||||||
this.confirmationService = confirmationService;
|
this.confirmationService = service;
|
||||||
this.dataResourceService = dataResourceService;
|
this.dataResourceService = dataResourceService;
|
||||||
this.dataFileService = dataFileService;
|
this.dataFileService = dataFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/submit/{id}")
|
@GetMapping("submit/{id}")
|
||||||
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
||||||
confirmationService.submit(id);
|
confirmationService.submit(id);
|
||||||
return AmisResponse.responseSuccess();
|
return AmisResponse.responseSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/retract/{id}")
|
|
||||||
public AmisResponse<Object> retract(@PathVariable Long id) {
|
|
||||||
confirmationService.retract(id);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Confirmation fromSaveItem(SaveItem item) throws Exception {
|
protected Confirmation fromSaveItem(SaveItem item) throws Exception {
|
||||||
Confirmation confirmation = new Confirmation();
|
Confirmation confirmation = new Confirmation();
|
||||||
|
|||||||
@@ -10,14 +10,12 @@ import com.eshore.gringotts.web.domain.entity.Ware;
|
|||||||
import com.eshore.gringotts.web.domain.service.DataFileService;
|
import com.eshore.gringotts.web.domain.service.DataFileService;
|
||||||
import com.eshore.gringotts.web.domain.service.DataResourceService;
|
import com.eshore.gringotts.web.domain.service.DataResourceService;
|
||||||
import com.eshore.gringotts.web.domain.service.WareService;
|
import com.eshore.gringotts.web.domain.service.WareService;
|
||||||
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;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -47,18 +45,6 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
return AmisResponse.responseSuccess(wareService.listPublic().collect(this::toListItem));
|
return AmisResponse.responseSuccess(wareService.listPublic().collect(this::toListItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/submit/{id}")
|
|
||||||
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
|
||||||
wareService.submit(id);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/retract/{id}")
|
|
||||||
public AmisResponse<Object> retract(@PathVariable Long id) {
|
|
||||||
wareService.retract(id);
|
|
||||||
return AmisResponse.responseSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Ware fromSaveItem(SaveItem saveItem) {
|
protected Ware fromSaveItem(SaveItem saveItem) {
|
||||||
Ware ware = new Ware();
|
Ware ware = new Ware();
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity;
|
package com.eshore.gringotts.web.domain.entity.order;
|
||||||
|
|
||||||
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 com.eshore.gringotts.web.domain.entity.order.node.CheckOrderNode;
|
||||||
|
import java.util.List;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -13,6 +15,7 @@ import javax.persistence.ForeignKey;
|
|||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.NamedAttributeNode;
|
import javax.persistence.NamedAttributeNode;
|
||||||
import javax.persistence.NamedEntityGraph;
|
import javax.persistence.NamedEntityGraph;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -38,74 +41,34 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@NamedEntityGraph(name = "check_order.detail", attributeNodes = {
|
@NamedEntityGraph(name = "check_order.detail", attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "nodes"),
|
||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class CheckOrder extends SimpleEntity {
|
public class CheckOrder extends SimpleEntity {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String keyword;
|
private String name;
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String description;
|
private String description;
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
private Type type;
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
@ToString.Exclude
|
||||||
|
private CheckOrderNode currentNode;
|
||||||
|
@OneToMany(fetch = FetchType.LAZY, mappedBy = "order")
|
||||||
|
@ToString.Exclude
|
||||||
|
private List<CheckOrderNode> nodes;
|
||||||
/**
|
/**
|
||||||
* JSON 结构 Map<String, Object>
|
* JSON 结构 Map<String, Object>
|
||||||
*/
|
*/
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String parameters;
|
private String context = "{}";
|
||||||
|
|
||||||
@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)
|
@Column(nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private State state = State.CHECKING;
|
private State state = State.CHECKING;
|
||||||
|
|
||||||
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 {
|
public enum Operation {
|
||||||
APPLY,
|
APPLY,
|
||||||
REJECT,
|
REJECT,
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.entity.order.node;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.core.Constants;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.IdOnlyEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.ConstraintMode;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.ForeignKey;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Entity
|
||||||
|
@DynamicUpdate
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Table(name = Constants.TABLE_PREFIX + "check_order_node")
|
||||||
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
|
public abstract class CheckOrderNode extends IdOnlyEntity {
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer sequence;
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
@ToString.Exclude
|
||||||
|
private CheckOrder order;
|
||||||
|
|
||||||
|
public abstract Type getCheckType();
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
USER,
|
||||||
|
ROLE,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.entity.order.node;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.core.Constants;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定用户审核
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = Constants.TABLE_PREFIX + "check_order_node_role")
|
||||||
|
public class RoleCheckOrderNode extends CheckOrderNode {
|
||||||
|
@Column(nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private User.Role target;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type getCheckType() {
|
||||||
|
return Type.ROLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.entity.order.node;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.core.Constants;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import javax.persistence.ConstraintMode;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.ForeignKey;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定用户审核
|
||||||
|
*
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Entity
|
||||||
|
@Table(name = Constants.TABLE_PREFIX + "check_order_node_user")
|
||||||
|
public class UserCheckOrderNode extends CheckOrderNode {
|
||||||
|
@OneToOne(fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
@ToString.Exclude
|
||||||
|
private User target;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type getCheckType() {
|
||||||
|
return Type.USER;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.flowable;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.CheckOrderNode;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.RoleCheckOrderNode;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.UserCheckOrderNode;
|
||||||
|
import com.eshore.gringotts.web.domain.flowable.node.RoleCheckFlowNode;
|
||||||
|
import com.eshore.gringotts.web.domain.flowable.node.UserCheckFlowNode;
|
||||||
|
import com.eshore.gringotts.web.domain.repository.CheckOrderNodeRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.service.CheckOrderService;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.lanyuanxiaoyao.flowable.model.Flow;
|
||||||
|
import com.lanyuanxiaoyao.flowable.model.FlowStatus;
|
||||||
|
import com.lanyuanxiaoyao.flowable.node.FlowNode;
|
||||||
|
import com.lanyuanxiaoyao.flowable.repository.FlowRepository;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FlowDatabaseRepository implements FlowRepository {
|
||||||
|
private final CheckOrderService checkOrderService;
|
||||||
|
private final CheckOrderNodeRepository checkOrderNodeRepository;
|
||||||
|
private final ObjectMapper mapper;
|
||||||
|
|
||||||
|
public FlowDatabaseRepository(CheckOrderService checkOrderService, CheckOrderNodeRepository checkOrderNodeRepository, Jackson2ObjectMapperBuilder builder) {
|
||||||
|
this.checkOrderService = checkOrderService;
|
||||||
|
this.checkOrderNodeRepository = checkOrderNodeRepository;
|
||||||
|
this.mapper = builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private FlowNode mapTo(CheckOrderNode source) {
|
||||||
|
switch (source.getCheckType()) {
|
||||||
|
case USER:
|
||||||
|
return new UserCheckFlowNode(source.getId().toString(), ((UserCheckOrderNode) source).getTarget());
|
||||||
|
case ROLE:
|
||||||
|
return new RoleCheckFlowNode(source.getId().toString(), ((RoleCheckOrderNode) source).getTarget());
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unsupported check type: " + source.getCheckType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CheckOrderNode mapTo(FlowNode source) {
|
||||||
|
return checkOrderNodeRepository.findById(Long.valueOf(source.getNodeId())).orElseThrow(() -> new RuntimeException(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Flow mapTo(CheckOrder order) throws JsonProcessingException {
|
||||||
|
Flow flow = new Flow();
|
||||||
|
flow.setName(order.getName());
|
||||||
|
flow.setDescription(order.getDescription());
|
||||||
|
flow.setNodes(order.getNodes()
|
||||||
|
.stream()
|
||||||
|
.map(this::mapTo)
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
flow.setCurrentNode(mapTo(order.getCurrentNode()).getNodeId());
|
||||||
|
switch (order.getState()) {
|
||||||
|
case CHECKING:
|
||||||
|
flow.setStatus(FlowStatus.PENDING);
|
||||||
|
break;
|
||||||
|
case RETRACT:
|
||||||
|
flow.setStatus(FlowStatus.REJECTED);
|
||||||
|
break;
|
||||||
|
case OVER:
|
||||||
|
flow.setStatus(FlowStatus.APPROVED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
flow.setContextVariables(mapper.readValue(order.getContext(), new TypeReference<>() {}));
|
||||||
|
flow.setCreateTime(order.getCreatedTime());
|
||||||
|
flow.setUpdateTime(order.getModifiedTime());
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mapTo(Flow flow, CheckOrder order) throws JsonProcessingException {
|
||||||
|
order.setName(flow.getName());
|
||||||
|
order.setDescription(flow.getDescription());
|
||||||
|
order.setNodes(Lists.mutable.ofAll(flow.getNodes()).collect(this::mapTo));
|
||||||
|
order.setCurrentNode(mapTo(flow.getCurrentNodeObject()));
|
||||||
|
switch (flow.getStatus()) {
|
||||||
|
case APPROVED:
|
||||||
|
order.setState(CheckOrder.State.OVER);
|
||||||
|
break;
|
||||||
|
case PENDING:
|
||||||
|
order.setState(CheckOrder.State.CHECKING);
|
||||||
|
break;
|
||||||
|
case REJECTED:
|
||||||
|
order.setState(CheckOrder.State.RETRACT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
order.setContext(mapper.writeValueAsString(flow.getContextVariables()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public Flow save(Flow flow) {
|
||||||
|
CheckOrder order = new CheckOrder();
|
||||||
|
mapTo(flow, order);
|
||||||
|
Long id = checkOrderService.save(order);
|
||||||
|
flow.setId(id.toString());
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public Flow update(Flow flow) {
|
||||||
|
CheckOrder order = checkOrderService.detailOrThrow(Long.parseLong(flow.getId()));
|
||||||
|
mapTo(flow, order);
|
||||||
|
checkOrderService.save(order);
|
||||||
|
return flow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public Flow findById(String id) {
|
||||||
|
CheckOrder order = checkOrderService.detailOrThrow(Long.parseLong(id));
|
||||||
|
return mapTo(order);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.flowable.node;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.lanyuanxiaoyao.flowable.node.AbstractFlowNode;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public class RoleCheckFlowNode extends AbstractFlowNode {
|
||||||
|
private final User.Role role;
|
||||||
|
|
||||||
|
public RoleCheckFlowNode(String nodeId, User.Role role) {
|
||||||
|
super(nodeId);
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.flowable.node;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.service.ConfirmationService;
|
||||||
|
import com.lanyuanxiaoyao.flowable.model.FlowContext;
|
||||||
|
import com.lanyuanxiaoyao.flowable.node.AbstractFlowNode;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public class UserCheckFlowNode extends AbstractFlowNode {
|
||||||
|
private final User user;
|
||||||
|
private final ConfirmationService confirmationService;
|
||||||
|
|
||||||
|
public UserCheckFlowNode(String nodeId, User user, ConfirmationService confirmationService) {
|
||||||
|
super(nodeId);
|
||||||
|
this.user = user;
|
||||||
|
this.confirmationService = confirmationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApprove(FlowContext context) {
|
||||||
|
super.onApprove(context);
|
||||||
|
Long confirmationId = context.getVariable("confirmationId", Long.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReject(FlowContext context) {
|
||||||
|
super.onReject(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.repository;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.CheckOrderNode;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20241225
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface CheckOrderNodeRepository extends SimpleRepository<CheckOrderNode, Long> {
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.eshore.gringotts.web.domain.repository;
|
package com.eshore.gringotts.web.domain.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.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|||||||
@@ -1,30 +1,11 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
||||||
import com.eshore.gringotts.web.domain.entity.Authentication;
|
import com.eshore.gringotts.web.domain.entity.Authentication;
|
||||||
import com.eshore.gringotts.web.domain.entity.Authentication_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
|
||||||
import com.eshore.gringotts.web.domain.repository.AuthenticationRepository;
|
import com.eshore.gringotts.web.domain.repository.AuthenticationRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
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.Maps;
|
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,38 +13,15 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2024-12-02
|
* @date 2024-12-02
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("com.eshore.gringotts.web.domain.service.AuthenticationService")
|
@Service
|
||||||
public class AuthenticationService extends LogicDeleteService<Authentication> implements CheckingService {
|
public class AuthenticationService extends LogicDeleteService<Authentication> {
|
||||||
private final AuthenticationRepository authenticationRepository;
|
private final AuthenticationRepository authenticationRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final CheckOrderService checkOrderService;
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
public AuthenticationService(AuthenticationRepository repository, UserService userService, EntityManager manager, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
public AuthenticationService(AuthenticationRepository repository, UserService userService, EntityManager manager) {
|
||||||
super(repository, userService, manager);
|
super(repository, userService, manager);
|
||||||
this.authenticationRepository = repository;
|
this.authenticationRepository = repository;
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.checkOrderService = checkOrderService;
|
|
||||||
this.mapper = builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Authentication> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
User loginUser = userService.currentLoginUser();
|
|
||||||
if (User.isAdministrator(loginUser)) {
|
|
||||||
return Lists.immutable.empty();
|
|
||||||
}
|
|
||||||
return Lists.immutable.of(builder.or(
|
|
||||||
builder.equal(root.get(Authentication_.createdUser), loginUser),
|
|
||||||
builder.and(
|
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
|
||||||
),
|
|
||||||
builder.and(
|
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.targetUser), loginUser)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,68 +41,6 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
|
|||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void submit(Long id) throws JsonProcessingException {
|
|
||||||
Authentication authentication = detailOrThrow(id);
|
|
||||||
authentication.setState(CheckingNeededEntity.State.OWNER_CHECKING);
|
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
|
||||||
"authentication_owner_check",
|
|
||||||
StrUtil.format("数据资源「{}」的授权申请", authentication.getTarget().getName()),
|
|
||||||
CheckOrder.Type.AUTHENTICATION,
|
|
||||||
mapper.writeValueAsString(Maps.immutable.of("authenticationId", authentication.getId())),
|
|
||||||
"com.eshore.gringotts.web.domain.service.AuthenticationService",
|
|
||||||
authentication.getCreatedUser()
|
|
||||||
));
|
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
|
||||||
authentication.setOrder(order);
|
|
||||||
save(authentication);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void retract(Long id) {
|
|
||||||
Authentication authentication = detailOrThrow(id);
|
|
||||||
authentication.setState(Authentication.State.DRAFT);
|
|
||||||
save(authentication);
|
|
||||||
|
|
||||||
CheckOrder order = authentication.getOrder();
|
|
||||||
order.setState(CheckOrder.State.RETRACT);
|
|
||||||
checkOrderService.save(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
|
||||||
Long id = (Long) parameters.get("authenticationId");
|
|
||||||
Authentication authentication = detailOrThrow(id);
|
|
||||||
if (StrUtil.equals(order.getKeyword(), "authentication_owner_check")) {
|
|
||||||
switch (operation) {
|
|
||||||
case APPLY:
|
|
||||||
authentication.setState(Authentication.State.CHECKING);
|
|
||||||
order.setKeyword("authentication_checker_check");
|
|
||||||
order.setTarget(CheckOrder.Target.ROLE);
|
|
||||||
order.setTargetRole(User.Role.CHECKER);
|
|
||||||
break;
|
|
||||||
case REJECT:
|
|
||||||
authentication.setState(Authentication.State.DRAFT);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (StrUtil.equals(order.getKeyword(), "authentication_checker_check")) {
|
|
||||||
switch (operation) {
|
|
||||||
case APPLY:
|
|
||||||
authentication.setState(Authentication.State.NORMAL);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
case REJECT:
|
|
||||||
authentication.setState(Authentication.State.DRAFT);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
save(authentication);
|
|
||||||
checkOrderService.save(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class AuthenticationDuplicatedException extends RuntimeException {
|
public static final class AuthenticationDuplicatedException extends RuntimeException {
|
||||||
public AuthenticationDuplicatedException() {
|
public AuthenticationDuplicatedException() {
|
||||||
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
||||||
|
|||||||
@@ -1,26 +1,12 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.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.base.service.SimpleServiceSupport;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
import com.eshore.gringotts.web.domain.flowable.FlowDatabaseRepository;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
|
||||||
import com.eshore.gringotts.web.domain.repository.CheckOrderRepository;
|
import com.eshore.gringotts.web.domain.repository.CheckOrderRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.lanyuanxiaoyao.flowable.service.FlowService;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import javax.transaction.Transactional;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,53 +16,30 @@ import org.springframework.stereotype.Service;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class CheckOrderService extends SimpleServiceSupport<CheckOrder> {
|
public class CheckOrderService extends SimpleServiceSupport<CheckOrder> {
|
||||||
private final ApplicationContext applicationContext;
|
private final FlowService flowService;
|
||||||
private final ObjectMapper mapper;
|
|
||||||
private final CheckOrderRepository checkOrderRepository;
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public CheckOrderService(CheckOrderRepository repository, UserService userService, ApplicationContext applicationContext, Jackson2ObjectMapperBuilder builder) {
|
public CheckOrderService(CheckOrderRepository repository, UserService userService, FlowDatabaseRepository flowDatabaseRepository) {
|
||||||
super(repository, userService);
|
super(repository, userService);
|
||||||
this.applicationContext = applicationContext;
|
this.flowService = new FlowService(flowDatabaseRepository);
|
||||||
this.mapper = builder.build();
|
|
||||||
this.checkOrderRepository = repository;
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<CheckOrder> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
public void startFlow(CheckOrder order) {
|
||||||
User user = userService.currentLoginUser();
|
startFlow(order.getId());
|
||||||
if (User.isAdministrator(user)) {
|
|
||||||
return Lists.immutable.empty();
|
|
||||||
}
|
|
||||||
return Lists.immutable.of(builder.or(
|
|
||||||
builder.equal(root.get(CheckOrder_.createdUser), user),
|
|
||||||
builder.and(
|
|
||||||
builder.equal(root.get(CheckOrder_.target), CheckOrder.Target.USER),
|
|
||||||
builder.equal(root.get(CheckOrder_.targetUser), user)
|
|
||||||
),
|
|
||||||
builder.and(
|
|
||||||
builder.equal(root.get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
|
||||||
builder.equal(root.get(CheckOrder_.targetRole), user.getRole())
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void operation(Long id, CheckOrder.Operation operation) throws JsonProcessingException {
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
CheckOrder order = detailOrThrow(id);
|
public void startFlow(Long id) {
|
||||||
CheckingService service = applicationContext.getBean(order.getTargetClass(), CheckingService.class);
|
flowService.startFlow(id.toString());
|
||||||
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 retract(Long id) {
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
checkOrderRepository.overById(id, CheckOrder.State.RETRACT, userService.currentLoginUser());
|
public void approve(Long id) {
|
||||||
|
flowService.approve(id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void over(Long id) {
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
checkOrderRepository.overById(id, CheckOrder.State.OVER, userService.currentLoginUser());
|
public void reject(Long id) {
|
||||||
|
flowService.reject(id.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,19 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation_;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.node.RoleCheckOrderNode;
|
||||||
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Join;
|
|
||||||
import javax.persistence.criteria.JoinType;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import javax.transaction.Transactional;
|
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.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.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -34,8 +22,8 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2024-11-26
|
* @date 2024-11-26
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("com.eshore.gringotts.web.domain.service.ConfirmationService")
|
@Service
|
||||||
public class ConfirmationService extends LogicDeleteService<Confirmation> implements CheckingService {
|
public class ConfirmationService extends LogicDeleteService<Confirmation> {
|
||||||
private final ConfirmationRepository confirmationRepository;
|
private final ConfirmationRepository confirmationRepository;
|
||||||
private final CheckOrderService checkOrderService;
|
private final CheckOrderService checkOrderService;
|
||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
@@ -47,31 +35,6 @@ public class ConfirmationService extends LogicDeleteService<Confirmation> implem
|
|||||||
this.mapper = builder.build();
|
this.mapper = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Confirmation> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
User loginUser = userService.currentLoginUser();
|
|
||||||
if (User.isAdministrator(loginUser)) {
|
|
||||||
return Lists.immutable.empty();
|
|
||||||
}
|
|
||||||
Join<Confirmation, CheckOrder> orderJoin = root.join(Confirmation_.order, JoinType.LEFT);
|
|
||||||
return Lists.immutable.of(builder.or(
|
|
||||||
builder.equal(root.get(Confirmation_.createdUser), loginUser),
|
|
||||||
builder.and(
|
|
||||||
builder.isNotNull(orderJoin),
|
|
||||||
builder.or(
|
|
||||||
builder.and(
|
|
||||||
builder.equal(orderJoin.get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
|
||||||
builder.equal(orderJoin.get(CheckOrder_.targetRole), loginUser.getRole())
|
|
||||||
),
|
|
||||||
builder.and(
|
|
||||||
builder.equal(orderJoin.get(CheckOrder_.target), CheckOrder.Target.USER),
|
|
||||||
builder.equal(orderJoin.get(CheckOrder_.targetUser), loginUser)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long save(Confirmation entity) {
|
public Long save(Confirmation entity) {
|
||||||
if (ObjectUtil.isNull(entity.getId()) && confirmationRepository.existsByTarget_Id(entity.getTarget().getId())) {
|
if (ObjectUtil.isNull(entity.getId()) && confirmationRepository.existsByTarget_Id(entity.getTarget().getId())) {
|
||||||
@@ -82,51 +45,15 @@ public class ConfirmationService extends LogicDeleteService<Confirmation> implem
|
|||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
public void submit(Long id) throws JsonProcessingException {
|
public void submit(Long id) throws JsonProcessingException {
|
||||||
Confirmation confirmation = detailOrThrow(id);
|
CheckOrder order = new CheckOrder();
|
||||||
confirmation.setState(Confirmation.State.CHECKING);
|
order.setName("确权申请");
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
order.setDescription("确权申请");
|
||||||
"confirmation_check",
|
order.setNodes(Lists.mutable.of(
|
||||||
StrUtil.format("数据资源「{}」的确权申请", confirmation.getTarget().getName()),
|
new RoleCheckOrderNode(User.Role.CHECKER)
|
||||||
CheckOrder.Type.CONFIRMATION,
|
|
||||||
mapper.writeValueAsString(Maps.immutable.of("confirmationId", confirmation.getId())),
|
|
||||||
"com.eshore.gringotts.web.domain.service.ConfirmationService",
|
|
||||||
User.Role.CHECKER
|
|
||||||
));
|
));
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
order.setContext(mapper.writeValueAsString(Maps.immutable.of("confirmationId", id)));
|
||||||
confirmation.setOrder(order);
|
|
||||||
save(confirmation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void retract(Long id) {
|
|
||||||
Confirmation confirmation = detailOrThrow(id);
|
|
||||||
confirmation.setState(CheckingNeededEntity.State.DRAFT);
|
|
||||||
save(confirmation);
|
|
||||||
|
|
||||||
CheckOrder order = confirmation.getOrder();
|
|
||||||
order.setState(CheckOrder.State.RETRACT);
|
|
||||||
checkOrderService.save(order);
|
checkOrderService.save(order);
|
||||||
}
|
checkOrderService.startFlow(order);
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
|
||||||
if (StrUtil.equals(order.getKeyword(), "confirmation_check")) {
|
|
||||||
Long id = (Long) parameters.get("confirmationId");
|
|
||||||
Confirmation confirmation = detailOrThrow(id);
|
|
||||||
switch (operation) {
|
|
||||||
case APPLY:
|
|
||||||
confirmation.setState(Confirmation.State.NORMAL);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
case REJECT:
|
|
||||||
confirmation.setState(Confirmation.State.DRAFT);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
save(confirmation);
|
|
||||||
checkOrderService.save(order);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
public static final class ConfirmationDuplicatedException extends RuntimeException {
|
||||||
|
|||||||
@@ -1,22 +1,12 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.Ware;
|
import com.eshore.gringotts.web.domain.entity.Ware;
|
||||||
import com.eshore.gringotts.web.domain.repository.WareRepository;
|
import com.eshore.gringotts.web.domain.repository.WareRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
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.factory.Maps;
|
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,17 +14,13 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2024-12-13
|
* @date 2024-12-13
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("com.eshore.gringotts.web.domain.service.WareService")
|
@Service
|
||||||
public class WareService extends LogicDeleteService<Ware> implements CheckingService {
|
public class WareService extends LogicDeleteService<Ware> {
|
||||||
private final WareRepository wareRepository;
|
private final WareRepository wareRepository;
|
||||||
private final CheckOrderService checkOrderService;
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
public WareService(WareRepository repository, UserService userService, EntityManager entityManager, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
public WareService(WareRepository repository, UserService userService, EntityManager entityManager) {
|
||||||
super(repository, userService, entityManager);
|
super(repository, userService, entityManager);
|
||||||
this.wareRepository = repository;
|
this.wareRepository = repository;
|
||||||
this.checkOrderService = checkOrderService;
|
|
||||||
this.mapper = builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableList<Ware> listPublic() {
|
public ImmutableList<Ware> listPublic() {
|
||||||
@@ -42,53 +28,4 @@ public class WareService extends LogicDeleteService<Ware> implements CheckingSer
|
|||||||
wareRepository.findAll((root, query, builder) -> builder.equal(root.get("state"), Ware.State.NORMAL))
|
wareRepository.findAll((root, query, builder) -> builder.equal(root.get("state"), Ware.State.NORMAL))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
@Override
|
|
||||||
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
|
||||||
if (StrUtil.equals(order.getKeyword(), "ware_check")) {
|
|
||||||
Long wareId = (Long) parameters.get("wareId");
|
|
||||||
Ware ware = detailOrThrow(wareId);
|
|
||||||
switch (operation) {
|
|
||||||
case APPLY:
|
|
||||||
ware.setState(Ware.State.NORMAL);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
case REJECT:
|
|
||||||
ware.setState(Ware.State.DRAFT);
|
|
||||||
order.setState(CheckOrder.State.OVER);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
save(ware);
|
|
||||||
checkOrderService.save(order);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void submit(Long id) throws JsonProcessingException {
|
|
||||||
Ware ware = detailOrThrow(id);
|
|
||||||
ware.setState(Ware.State.CHECKING);
|
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
|
||||||
"ware_check",
|
|
||||||
StrUtil.format("数据资源「{}」的上架申请", ware.getName()),
|
|
||||||
CheckOrder.Type.MARKET,
|
|
||||||
mapper.writeValueAsString(Maps.immutable.of("wareId", ware.getId())),
|
|
||||||
"com.eshore.gringotts.web.domain.service.WareService",
|
|
||||||
User.Role.CHECKER
|
|
||||||
));
|
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
|
||||||
ware.setOrder(order);
|
|
||||||
save(ware);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void retract(Long id) {
|
|
||||||
Ware ware = detailOrThrow(id);
|
|
||||||
ware.setState(Ware.State.DRAFT);
|
|
||||||
save(ware);
|
|
||||||
|
|
||||||
CheckOrder order = ware.getOrder();
|
|
||||||
order.setState(CheckOrder.State.RETRACT);
|
|
||||||
checkOrderService.save(order);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package com.eshore.gringotts.web.helper;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity_;
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity_;
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
import com.eshore.gringotts.web.domain.entity.CheckOrder_;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.order.CheckOrder;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
|
|||||||
Reference in New Issue
Block a user