Compare commits
29 Commits
80a24513ab
...
flowable
| Author | SHA1 | Date | |
|---|---|---|---|
| e167a4467d | |||
| 2ad3035f87 | |||
| 10b7451f28 | |||
| e2b6b50497 | |||
| 36c8959c01 | |||
| 4242940e6b | |||
| b16dba4ef1 | |||
| 509410de9a | |||
| 0aa9ec738a | |||
| b774806e58 | |||
| bb9f87dbd2 | |||
| 381c23e94c | |||
| 30b991cc28 | |||
| fbb0ce5da3 | |||
| 5a0c44ff35 | |||
| 615edb57b8 | |||
| 74b0638a07 | |||
| 91e30fefe4 | |||
| d80659ca41 | |||
| 997fc4043f | |||
| 0892cda203 | |||
| 981f84ea2b | |||
| 49caded436 | |||
| 43e9306017 | |||
| 39e4e03437 | |||
| 7319335b67 | |||
| 3cf56adeac | |||
| 083a8771d2 | |||
| cedb108049 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,6 +1,3 @@
|
|||||||
### Custom
|
|
||||||
*.db
|
|
||||||
|
|
||||||
### Maven template
|
### Maven template
|
||||||
target/
|
target/
|
||||||
pom.xml.tag
|
pom.xml.tag
|
||||||
@@ -255,3 +252,7 @@ Network Trash Folder
|
|||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
|
### Custom
|
||||||
|
*.db
|
||||||
|
gringotts-web/src/main/resources/static
|
||||||
|
!gringotts-web/bin
|
||||||
4
.idea/dataSources.xml
generated
4
.idea/dataSources.xml
generated
@@ -13,11 +13,11 @@
|
|||||||
</jdbc-additional-properties>
|
</jdbc-additional-properties>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
<data-source source="LOCAL" name="homeless" uuid="9af017b2-2a8b-45b4-899c-ef4fb185b77c">
|
<data-source source="LOCAL" name="gringotts@132.122.1.185" uuid="91feafc5-32a2-4c28-93a7-b39754851328">
|
||||||
<driver-ref>mysql.8</driver-ref>
|
<driver-ref>mysql.8</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:mysql://frp-air.top:43458</jdbc-url>
|
<jdbc-url>jdbc:mysql://132.122.1.185:31000/gringotts</jdbc-url>
|
||||||
<jdbc-additional-properties>
|
<jdbc-additional-properties>
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
|||||||
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
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -2,7 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/gringotts.iml" filepath="$PROJECT_DIR$/gringotts.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/gringotts-web/gringotts-web.iml" filepath="$PROJECT_DIR$/gringotts-web/gringotts-web.iml" />
|
<module fileurl="file://$PROJECT_DIR$/gringotts-web/gringotts-web.iml" filepath="$PROJECT_DIR$/gringotts-web/gringotts-web.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
export const information = {
|
export const information = {
|
||||||
debug: false,
|
debug: import.meta.env.DEV,
|
||||||
// baseUrl: '',
|
baseUrl: import.meta.env.DEV ? 'http://127.0.0.1:20080' : '',
|
||||||
baseUrl: 'http://127.0.0.1:20080',
|
|
||||||
title: '可信供给中心',
|
title: '可信供给中心',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +92,12 @@ export const size100MB = 104857600
|
|||||||
export const size500MB = 524288000
|
export const size500MB = 524288000
|
||||||
export const size1GB = 1073741824
|
export const size1GB = 1073741824
|
||||||
|
|
||||||
export function inputFileFormItemCommonOptions(accept = '*', maxSize = size5MB) {
|
export function inputFileFormItemCommonOptions(accept = '*', maxSize = size5MB, maxLength = undefined) {
|
||||||
return {
|
return {
|
||||||
useChunk: true,
|
useChunk: true,
|
||||||
accept: accept,
|
accept: accept,
|
||||||
maxSize: maxSize,
|
maxSize: maxSize,
|
||||||
|
maxLength: maxLength,
|
||||||
autoUpload: false,
|
autoUpload: false,
|
||||||
drag: true,
|
drag: true,
|
||||||
startChunkApi: apiPost('${base}/upload/start'),
|
startChunkApi: apiPost('${base}/upload/start'),
|
||||||
@@ -262,13 +262,19 @@ export const permissionStateMapping = [
|
|||||||
export const checkTypeMapping = [
|
export const checkTypeMapping = [
|
||||||
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
|
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
|
||||||
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
|
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
|
||||||
mappingItem('上架审查', 'MARKET', 'bg-green-500'),
|
mappingItem('上架审查', 'WARE', 'bg-green-500'),
|
||||||
]
|
]
|
||||||
|
|
||||||
export const checkOverMapping = [
|
export const checkOverMapping = [
|
||||||
mappingItem('进行中', 'CHECKING', 'bg-warning'),
|
mappingItem('进行中', 'RUNNING', 'bg-warning'),
|
||||||
mappingItem('已撤销', 'RETRACT', 'bg-primary'),
|
mappingItem('已撤销', 'TERMINAL', 'bg-primary'),
|
||||||
mappingItem('已办结', 'OVER', 'bg-success'),
|
mappingItem('已办结', 'COMPLETED', 'bg-success'),
|
||||||
|
]
|
||||||
|
|
||||||
|
export const checkActionMapping = [
|
||||||
|
mappingItem('同意', 'APPROVE', 'bg-green-500'),
|
||||||
|
mappingItem('驳回', 'REJECT', 'bg-red-500'),
|
||||||
|
mappingItem('撤回', 'TERMINAL', 'bg-blue-500'),
|
||||||
]
|
]
|
||||||
|
|
||||||
function api(method, url) {
|
function api(method, url) {
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
import './dialog-permission.css'
|
||||||
|
import {
|
||||||
|
apiGet,
|
||||||
|
apiPost,
|
||||||
|
formCreatedUserAndModifiedUser,
|
||||||
|
formInputClearable,
|
||||||
|
formInputMultiFileStatic,
|
||||||
|
horizontalFormOptions,
|
||||||
|
information,
|
||||||
|
inputFileFormItemCommonOptions,
|
||||||
|
size100MB
|
||||||
|
} from "../constants.js";
|
||||||
|
import {resourceList} from "../../pages/index/tab-data.js";
|
||||||
|
import {resourceDetailDialog} from "../resource/dialog-resource.js";
|
||||||
|
|
||||||
|
function detailForm(showCreatedUserAndModifiedUser = false) {
|
||||||
|
return {
|
||||||
|
debug: information.debug,
|
||||||
|
id: 'permission_form',
|
||||||
|
type: 'form',
|
||||||
|
...horizontalFormOptions(),
|
||||||
|
horizontal: {
|
||||||
|
left: 2,
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'hidden',
|
||||||
|
name: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'picker',
|
||||||
|
name: 'targetId',
|
||||||
|
label: '数据资源',
|
||||||
|
required: true,
|
||||||
|
multiple: false,
|
||||||
|
size: 'md',
|
||||||
|
valueField: 'id',
|
||||||
|
labelField: 'name',
|
||||||
|
source: apiGet('${base}/data_resource/list_no_authentication'),
|
||||||
|
pickerSchema: {
|
||||||
|
...resourceList(),
|
||||||
|
},
|
||||||
|
staticSchema: {
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
|
||||||
|
onEvent: {
|
||||||
|
click: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
actionType: 'dialog',
|
||||||
|
...resourceDetailDialog('targetId'),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
placeholder: '请输入确权说明',
|
||||||
|
label: '确权说明',
|
||||||
|
name: 'description',
|
||||||
|
...formInputClearable,
|
||||||
|
},
|
||||||
|
formInputMultiFileStatic('evidenceFiles', '相关材料'),
|
||||||
|
{
|
||||||
|
visibleOn: '${!detail}',
|
||||||
|
type: 'input-file',
|
||||||
|
label: '相关材料',
|
||||||
|
name: 'evidenceFiles',
|
||||||
|
multiple: true,
|
||||||
|
required: true,
|
||||||
|
joinValues: false,
|
||||||
|
...inputFileFormItemCommonOptions(undefined, size100MB),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-datetime-range',
|
||||||
|
name: 'activeTime',
|
||||||
|
extraName: 'expiredTime',
|
||||||
|
label: '授权时间',
|
||||||
|
required: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
shortcuts: [
|
||||||
|
'7dayslater',
|
||||||
|
'14dayslater',
|
||||||
|
'30dayslater',
|
||||||
|
'180dayslater',
|
||||||
|
'365dayslater',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authenticationAddDialog() {
|
||||||
|
let data = {add: true, authentication: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '新增授权申请',
|
||||||
|
size: 'md',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'reset',
|
||||||
|
label: '重置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'submit',
|
||||||
|
label: '确定',
|
||||||
|
level: 'primary',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
body: {
|
||||||
|
...detailForm(),
|
||||||
|
api: apiPost(`\${base}/authentication/save`),
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authenticationDetailDialog(field = 'id', actions = []) {
|
||||||
|
let data = {detail: true, authentication: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '授权申请详情',
|
||||||
|
size: 'md',
|
||||||
|
actions: actions,
|
||||||
|
body: {
|
||||||
|
...detailForm(true),
|
||||||
|
initApi: apiGet(`\${base}/authentication/detail/\${${field}}`),
|
||||||
|
static: true,
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function authenticationEditeDialog(field = 'id') {
|
||||||
|
let data = {edit: true, authentication: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '授权申请详情',
|
||||||
|
size: 'md',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'reset',
|
||||||
|
label: '重置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'submit',
|
||||||
|
label: '确定',
|
||||||
|
level: 'primary',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
body: {
|
||||||
|
...detailForm(),
|
||||||
|
api: apiPost(`\${base}/authentication/save`),
|
||||||
|
initApi: apiGet(`\${base}/authentication/detail/\${${field}}`),
|
||||||
|
data: data,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
152
gringotts-frontend/components/permission/dialog-confirmation.js
Normal file
152
gringotts-frontend/components/permission/dialog-confirmation.js
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
import './dialog-permission.css'
|
||||||
|
import {
|
||||||
|
apiGet,
|
||||||
|
apiPost,
|
||||||
|
formCreatedUserAndModifiedUser,
|
||||||
|
formInputClearable,
|
||||||
|
formInputMultiFileStatic,
|
||||||
|
horizontalFormOptions,
|
||||||
|
information,
|
||||||
|
inputFileFormItemCommonOptions,
|
||||||
|
size100MB
|
||||||
|
} from "../constants.js";
|
||||||
|
import {resourceList} from "../../pages/index/tab-data.js";
|
||||||
|
import {resourceDetailDialog} from "../resource/dialog-resource.js";
|
||||||
|
|
||||||
|
function detailForm(showCreatedUserAndModifiedUser = false) {
|
||||||
|
return {
|
||||||
|
debug: information.debug,
|
||||||
|
id: 'permission_form',
|
||||||
|
type: 'form',
|
||||||
|
...horizontalFormOptions(),
|
||||||
|
horizontal: {
|
||||||
|
left: 2,
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'hidden',
|
||||||
|
name: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'picker',
|
||||||
|
name: 'targetId',
|
||||||
|
label: '数据资源',
|
||||||
|
required: true,
|
||||||
|
multiple: false,
|
||||||
|
size: 'md',
|
||||||
|
valueField: 'id',
|
||||||
|
labelField: 'name',
|
||||||
|
source: apiGet('${base}/data_resource/list_no_confirmation'),
|
||||||
|
pickerSchema: {
|
||||||
|
...resourceList(true),
|
||||||
|
},
|
||||||
|
staticSchema: {
|
||||||
|
type: 'tpl',
|
||||||
|
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
|
||||||
|
onEvent: {
|
||||||
|
click: {
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
actionType: 'dialog',
|
||||||
|
...resourceDetailDialog('targetId'),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
placeholder: '请输入确权说明',
|
||||||
|
label: '确权说明',
|
||||||
|
name: 'description',
|
||||||
|
...formInputClearable,
|
||||||
|
},
|
||||||
|
formInputMultiFileStatic('evidenceFiles', '相关材料'),
|
||||||
|
{
|
||||||
|
visibleOn: '${!detail}',
|
||||||
|
type: 'input-file',
|
||||||
|
label: '相关材料',
|
||||||
|
name: 'evidenceFiles',
|
||||||
|
multiple: true,
|
||||||
|
required: true,
|
||||||
|
joinValues: false,
|
||||||
|
...inputFileFormItemCommonOptions(undefined, size100MB),
|
||||||
|
},
|
||||||
|
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function confirmationAddDialog() {
|
||||||
|
let data = {add: true, confirmation: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '新增确权申请',
|
||||||
|
size: 'md',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'reset',
|
||||||
|
label: '重置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'submit',
|
||||||
|
label: '确定',
|
||||||
|
level: 'primary',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
body: {
|
||||||
|
...detailForm(),
|
||||||
|
api: apiPost(`\${base}/confirmation/save`),
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function confirmationDetailDialog(field = 'id', actions = []) {
|
||||||
|
let data = {detail: true, confirmation: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '确权申请详情',
|
||||||
|
size: 'md',
|
||||||
|
actions: actions,
|
||||||
|
body: {
|
||||||
|
...detailForm(true),
|
||||||
|
initApi: apiGet(`\${base}/confirmation/detail/\${${field}}`),
|
||||||
|
static: true,
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function confirmationEditeDialog(field = 'id') {
|
||||||
|
let data = {edit: true, confirmation: true}
|
||||||
|
return {
|
||||||
|
actionType: 'dialog',
|
||||||
|
dialog: {
|
||||||
|
title: '确权申请详情',
|
||||||
|
size: 'md',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'reset',
|
||||||
|
label: '重置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'submit',
|
||||||
|
label: '确定',
|
||||||
|
level: 'primary',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
body: {
|
||||||
|
...detailForm(),
|
||||||
|
api: apiPost(`\${base}/confirmation/save`),
|
||||||
|
initApi: apiGet(`\${base}/confirmation/detail/\${${field}}`),
|
||||||
|
data: data,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,208 +1,2 @@
|
|||||||
import './dialog-permission.css'
|
export * from './dialog-confirmation'
|
||||||
import {
|
export * from './dialog-authentication'
|
||||||
apiGet,
|
|
||||||
apiPost,
|
|
||||||
formCreatedUserAndModifiedUser,
|
|
||||||
formInputClearable,
|
|
||||||
formInputMultiFileStatic,
|
|
||||||
horizontalFormOptions,
|
|
||||||
information,
|
|
||||||
inputFileFormItemCommonOptions,
|
|
||||||
size100MB
|
|
||||||
} from "../constants.js";
|
|
||||||
import {resourceList} from "../../pages/index/tab-data.js";
|
|
||||||
import {resourceDetailDialog} from "../resource/dialog-resource.js";
|
|
||||||
|
|
||||||
const CONFIRMATION_TYPE = 'confirmation'
|
|
||||||
const AUTHENTICATION_TYPE = 'authentication'
|
|
||||||
|
|
||||||
const CONFIRMATION = {
|
|
||||||
type: 'confirmation',
|
|
||||||
pickerApi: apiGet('${base}/data_resource/list_no_confirmation')
|
|
||||||
}
|
|
||||||
|
|
||||||
const AUTHENTICATION = {
|
|
||||||
type: 'authentication',
|
|
||||||
pickerApi: apiGet('${base}/data_resource/list_no_authentication')
|
|
||||||
}
|
|
||||||
|
|
||||||
function detailForm(pickerApi = apiGet('${base}/data_resource/list'), showCreatedUserAndModifiedUser = false) {
|
|
||||||
return {
|
|
||||||
debug: information.debug,
|
|
||||||
id: 'permission_form',
|
|
||||||
type: 'form',
|
|
||||||
...horizontalFormOptions(),
|
|
||||||
horizontal: {
|
|
||||||
left: 2,
|
|
||||||
},
|
|
||||||
body: [
|
|
||||||
{
|
|
||||||
type: 'hidden',
|
|
||||||
name: 'id',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'picker',
|
|
||||||
name: 'targetId',
|
|
||||||
label: '数据资源',
|
|
||||||
required: true,
|
|
||||||
multiple: false,
|
|
||||||
size: 'md',
|
|
||||||
valueField: 'id',
|
|
||||||
labelField: 'name',
|
|
||||||
source: pickerApi,
|
|
||||||
pickerSchema: {
|
|
||||||
...resourceList(),
|
|
||||||
},
|
|
||||||
staticSchema: {
|
|
||||||
type: 'tpl',
|
|
||||||
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
|
|
||||||
onEvent: {
|
|
||||||
click: {
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
actionType: 'dialog',
|
|
||||||
...resourceDetailDialog('targetId'),
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'textarea',
|
|
||||||
placeholder: '请输入确权说明',
|
|
||||||
label: '确权说明',
|
|
||||||
name: 'description',
|
|
||||||
...formInputClearable,
|
|
||||||
},
|
|
||||||
formInputMultiFileStatic('evidenceFiles', '相关材料'),
|
|
||||||
{
|
|
||||||
visibleOn: '${!detail}',
|
|
||||||
type: 'input-file',
|
|
||||||
label: '相关材料',
|
|
||||||
name: 'evidenceFiles',
|
|
||||||
multiple: true,
|
|
||||||
required: true,
|
|
||||||
joinValues: false,
|
|
||||||
...inputFileFormItemCommonOptions(undefined, size100MB),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: `\${${AUTHENTICATION_TYPE}}`,
|
|
||||||
type: 'input-datetime-range',
|
|
||||||
name: 'activeTime',
|
|
||||||
extraName: 'expiredTime',
|
|
||||||
label: '授权时间',
|
|
||||||
required: true,
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
shortcuts: [
|
|
||||||
'7dayslater',
|
|
||||||
'14dayslater',
|
|
||||||
'30dayslater',
|
|
||||||
'180dayslater',
|
|
||||||
'365dayslater',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function confirmationAddDialog() {
|
|
||||||
return permissionAddDialog(CONFIRMATION)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function authenticationAddDialog() {
|
|
||||||
return permissionAddDialog(AUTHENTICATION)
|
|
||||||
}
|
|
||||||
|
|
||||||
function permissionAddDialog(config) {
|
|
||||||
let data = {add: true}
|
|
||||||
data[config.type] = true
|
|
||||||
return {
|
|
||||||
actionType: 'dialog',
|
|
||||||
dialog: {
|
|
||||||
title: '新增确权申请',
|
|
||||||
size: 'md',
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
type: 'reset',
|
|
||||||
label: '重置',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'submit',
|
|
||||||
label: '确定',
|
|
||||||
level: 'primary',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
body: {
|
|
||||||
...detailForm(config.pickerApi),
|
|
||||||
api: apiPost(`\${base}/${config.type}/save`),
|
|
||||||
data: data,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function confirmationDetailDialog(field = 'id', actions = []) {
|
|
||||||
return permissionDetailDialog(CONFIRMATION, field, actions)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function authenticationDetailDialog(field = 'id', actions = []) {
|
|
||||||
return permissionDetailDialog(AUTHENTICATION, field, actions)
|
|
||||||
}
|
|
||||||
|
|
||||||
function permissionDetailDialog(config, field = 'id', actions = []) {
|
|
||||||
let data = {detail: true}
|
|
||||||
data[config.type] = true
|
|
||||||
return {
|
|
||||||
actionType: 'dialog',
|
|
||||||
dialog: {
|
|
||||||
title: '确权申请详情',
|
|
||||||
size: 'md',
|
|
||||||
actions: actions,
|
|
||||||
body: {
|
|
||||||
...detailForm(config.pickerApi, true),
|
|
||||||
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
|
|
||||||
static: true,
|
|
||||||
data: data,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function confirmationEditeDialog(field = 'id') {
|
|
||||||
return permissionEditeDialog(CONFIRMATION, field)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function authenticationEditeDialog(field = 'id') {
|
|
||||||
return permissionEditeDialog(AUTHENTICATION, field)
|
|
||||||
}
|
|
||||||
|
|
||||||
function permissionEditeDialog(config, field = 'id') {
|
|
||||||
let data = {edit: true}
|
|
||||||
data[config.type] = true
|
|
||||||
return {
|
|
||||||
actionType: 'dialog',
|
|
||||||
dialog: {
|
|
||||||
title: '确权申请详情',
|
|
||||||
size: 'md',
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
type: 'reset',
|
|
||||||
label: '重置',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'submit',
|
|
||||||
label: '确定',
|
|
||||||
level: 'primary',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
body: {
|
|
||||||
...detailForm(config.pickerApi),
|
|
||||||
api: apiPost(`\${base}/${config.type}/save`),
|
|
||||||
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
|
|
||||||
data: data,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${resourceType === 'API'}",
|
visibleOn: "${resourceType === 'API'}",
|
||||||
type: 'fieldSet',
|
type: 'wrapper',
|
||||||
|
size: 'none',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
@@ -87,7 +88,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${resourceType === 'FILE'}",
|
visibleOn: "${resourceType === 'FILE'}",
|
||||||
type: 'fieldSet',
|
type: 'wrapper',
|
||||||
|
size: 'none',
|
||||||
body: [
|
body: [
|
||||||
formInputSingleFileStatic('file', '数据文件'),
|
formInputSingleFileStatic('file', '数据文件'),
|
||||||
{
|
{
|
||||||
@@ -99,13 +101,14 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
required: true,
|
required: true,
|
||||||
joinValues: false,
|
joinValues: false,
|
||||||
...inputFileFormItemCommonOptions('.zip', size1GB),
|
...inputFileFormItemCommonOptions('.zip', size1GB, 1),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${resourceType === 'DATABASE'}",
|
visibleOn: "${resourceType === 'DATABASE'}",
|
||||||
type: 'fieldSet',
|
type: 'wrapper',
|
||||||
|
size: 'none',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@@ -141,7 +144,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${resourceType === 'HDFS'}",
|
visibleOn: "${resourceType === 'HDFS'}",
|
||||||
type: 'fieldSet',
|
type: 'wrapper',
|
||||||
|
size: 'none',
|
||||||
body: [
|
body: [
|
||||||
formInputSingleFileStatic('coreSiteFile', 'core-site.xml'),
|
formInputSingleFileStatic('coreSiteFile', 'core-site.xml'),
|
||||||
{
|
{
|
||||||
@@ -152,7 +156,7 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
required: true,
|
required: true,
|
||||||
joinValues: false,
|
joinValues: false,
|
||||||
...inputFileFormItemCommonOptions('.xml'),
|
...inputFileFormItemCommonOptions('.xml', undefined, 1),
|
||||||
},
|
},
|
||||||
formInputSingleFileStatic('hdfsSiteFile', 'hdfs-site.xml'),
|
formInputSingleFileStatic('hdfsSiteFile', 'hdfs-site.xml'),
|
||||||
{
|
{
|
||||||
@@ -163,13 +167,14 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
multiple: false,
|
multiple: false,
|
||||||
required: true,
|
required: true,
|
||||||
joinValues: false,
|
joinValues: false,
|
||||||
...inputFileFormItemCommonOptions('.xml'),
|
...inputFileFormItemCommonOptions('.xml', undefined, 1),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: "${resourceType === 'FTP'}",
|
visibleOn: "${resourceType === 'FTP'}",
|
||||||
type: 'fieldSet',
|
type: 'wrapper',
|
||||||
|
size: 'none',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
@@ -292,7 +297,7 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
|
|||||||
description: '可以上传用于作为格式示范的样例数据',
|
description: '可以上传用于作为格式示范的样例数据',
|
||||||
multiple: false,
|
multiple: false,
|
||||||
joinValues: false,
|
joinValues: false,
|
||||||
...inputFileFormItemCommonOptions(undefined, size500MB),
|
...inputFileFormItemCommonOptions(undefined, size500MB, 1),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {horizontalFormOptions, apiPost} from '../constants.js'
|
import {apiPost, horizontalFormOptions} from '../constants.js'
|
||||||
import {confirmPasswordFormItem, passwordFormItem} from "./dialog-user-item.js";
|
import {confirmPasswordFormItem, passwordFormItem} from "./dialog-user-item.js";
|
||||||
|
|
||||||
export function userChangePasswordDialog() {
|
export function userChangePasswordDialog() {
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ export function userRegisterDialog() {
|
|||||||
required: true,
|
required: true,
|
||||||
selectFirst: true,
|
selectFirst: true,
|
||||||
options: [
|
options: [
|
||||||
{ label: '数据提供方', value: 'PROVIDER' },
|
{label: '数据提供方', value: 'PROVIDER'},
|
||||||
{ label: '数据使用方', value: 'CUSTOMER' },
|
{label: '数据使用方', value: 'CUSTOMER'},
|
||||||
{ label: '审查监管方', value: 'CHECKER' },
|
{label: '审查监管方', value: 'CHECKER'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -76,9 +76,9 @@ export function userAdministratorRegisterDialog() {
|
|||||||
inline: false,
|
inline: false,
|
||||||
columnsCount: 2,
|
columnsCount: 2,
|
||||||
options: [
|
options: [
|
||||||
{ label: '数据提供方', value: 'PROVIDER' },
|
{label: '数据提供方', value: 'PROVIDER'},
|
||||||
{ label: '数据使用方', value: 'CUSTOMER' },
|
{label: '数据使用方', value: 'CUSTOMER'},
|
||||||
{ label: '审查监管方', value: 'CHECKER' },
|
{label: '审查监管方', value: 'CHECKER'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||||
<title></title>
|
<title></title>
|
||||||
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
|
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
|
||||||
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
|
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
|
||||||
@@ -20,6 +20,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="/assets/sdk/sdk.js"></script>
|
<script src="/assets/sdk/sdk.js"></script>
|
||||||
<script type="module" src="./main.js"></script>
|
<script src="./main.js" type="module"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import {apiGet, useAmis} from '../../components/constants.js'
|
import './style.css'
|
||||||
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
|
import {administratorOnly, apiGet, checkerOnly, useAmis, userOnly} from '../../components/constants.js'
|
||||||
import {tabUser} from "./tab-user.js";
|
import {userChangePasswordDialog} from '../../components/user/dialog-user-change-password.js'
|
||||||
import {tabData} from "./tab-data.js";
|
import {tabUser} from './tab-user.js'
|
||||||
import {tabSettings} from "./tab-settings.js";
|
import {tabData} from './tab-data.js'
|
||||||
import {tabCheck} from "./tab-check.js";
|
import {tabSettings} from './tab-settings.js'
|
||||||
import {tabPermissions} from "./tab-permissions.js";
|
import {tabCheck} from './tab-check.js'
|
||||||
import {tabMarket} from "./tab-market.js";
|
import {tabPermissions} from './tab-permissions.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',
|
||||||
@@ -22,22 +23,105 @@ useAmis(information => {
|
|||||||
args: {
|
args: {
|
||||||
url: '/pages/login/index.html',
|
url: '/pages/login/index.html',
|
||||||
blank: false,
|
blank: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
id: 'root-page',
|
||||||
|
type: 'page',
|
||||||
|
title: {
|
||||||
|
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: [
|
||||||
|
{
|
||||||
|
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',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
body: [
|
|
||||||
{
|
{
|
||||||
type: 'page',
|
type: 'action',
|
||||||
title: information.title,
|
label: '我的资源',
|
||||||
subTitle: '提供合法合规的数据要素可信供给工具',
|
icon: 'fa fa-database',
|
||||||
toolbar: [
|
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: '修改密码',
|
||||||
@@ -48,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: {
|
||||||
|
activePage: 'tab',
|
||||||
|
tabActiveKey: 'data'
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
visibleOn: "${activePage === 'market'}",
|
||||||
|
type: 'wrapper',
|
||||||
|
body: tabMarket(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${activePage === 'tab'}",
|
||||||
className: 'h-full border-0',
|
className: 'h-full border-0',
|
||||||
type: 'tabs',
|
type: 'tabs',
|
||||||
tabsMode: 'vertical',
|
tabsMode: 'vertical',
|
||||||
|
activeKey: '${tabActiveKey}',
|
||||||
tabs: [
|
tabs: [
|
||||||
// tabOverview(),
|
// tabOverview(),
|
||||||
tabMarket(),
|
{
|
||||||
tabPermissions(),
|
hash: 'data',
|
||||||
tabCheck(),
|
visibleOn: userOnly,
|
||||||
tabData(),
|
title: '数据资源',
|
||||||
tabUser(),
|
icon: 'fa fa-database',
|
||||||
tabSettings(),
|
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(),
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
0
gringotts-frontend/pages/index/style.css
Normal file
0
gringotts-frontend/pages/index/style.css
Normal file
@@ -1,32 +1,70 @@
|
|||||||
import {
|
import {
|
||||||
apiGet,
|
apiGet,
|
||||||
checkerOnly,
|
apiPost,
|
||||||
|
checkActionMapping,
|
||||||
checkOverMapping,
|
checkOverMapping,
|
||||||
checkTypeMapping,
|
checkTypeMapping,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
mappingField,
|
mappingField,
|
||||||
operationField,
|
operationField,
|
||||||
|
paginationTemplate,
|
||||||
|
readOnlyDialogOptions,
|
||||||
stringField,
|
stringField,
|
||||||
timeField,
|
timeField,
|
||||||
} from "../../components/constants.js";
|
} from "../../components/constants.js";
|
||||||
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
|
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
|
||||||
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
|
||||||
|
|
||||||
export function tabCheck() {
|
function detailDialog() {
|
||||||
return {
|
return {
|
||||||
visibleOn: checkerOnly,
|
actionType: 'dialog',
|
||||||
title: '审核审查',
|
dialog: {
|
||||||
icon: 'fa fa-shield-halved',
|
title: '详情',
|
||||||
reload: true,
|
size: 'md',
|
||||||
|
...readOnlyDialogOptions(),
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
name: 'check_order_list',
|
type: 'amis',
|
||||||
|
name: 'parameters.snapshot',
|
||||||
|
},
|
||||||
|
{type: 'divider'},
|
||||||
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: apiGet('${base}/check_order/list'),
|
api: apiGet('${base}/check_order/history/${instanceId}'),
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
],
|
],
|
||||||
|
columns: [
|
||||||
|
mappingField('action', '类型', checkActionMapping),
|
||||||
|
stringField('comment', '描述'),
|
||||||
|
timeField('createdTime', '操作时间'),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function tabCheck() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: 'check_order_list',
|
||||||
|
type: 'crud',
|
||||||
|
api: {
|
||||||
|
...apiPost('${base}/check_order/page'),
|
||||||
|
data: {
|
||||||
|
page: {
|
||||||
|
page: '${page|default:1}',
|
||||||
|
size: '${perPage|default:10}',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...crudCommonOptions(),
|
||||||
|
headerToolbar: [
|
||||||
|
'reload',
|
||||||
|
],
|
||||||
|
...paginationTemplate(10),
|
||||||
columns: [
|
columns: [
|
||||||
stringField('description', '描述'),
|
stringField('description', '描述'),
|
||||||
mappingField('type', '类型', checkTypeMapping),
|
mappingField('type', '类型', checkTypeMapping),
|
||||||
@@ -37,7 +75,14 @@ export function tabCheck() {
|
|||||||
stringField('modifiedUsername', '最后操作人', 100),
|
stringField('modifiedUsername', '最后操作人', 100),
|
||||||
operationField('操作', undefined, [
|
operationField('操作', undefined, [
|
||||||
{
|
{
|
||||||
visibleOn: `\${type === 'CONFIRMATION' && state === 'CHECKING'}`,
|
visibleOn: "${state === 'COMPLETED'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '查看',
|
||||||
|
level: 'link',
|
||||||
|
...detailDialog(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${type === 'CONFIRMATION' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '处理',
|
label: '处理',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
@@ -49,7 +94,7 @@ export function tabCheck() {
|
|||||||
label: '同意',
|
label: '同意',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
api: apiGet('${base}/check_order/approve/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -57,21 +102,14 @@ export function tabCheck() {
|
|||||||
label: '拒绝',
|
label: '拒绝',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
api: apiGet('${base}/check_order/reject/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: `\${type === 'CONFIRMATION' && state !== NORMAL}`,
|
visibleOn: "${type === 'AUTHENTICATION' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...confirmationDetailDialog('parameters.confirmationId'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: `\${type === 'AUTHENTICATION' && state === 'CHECKING'}`,
|
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '处理',
|
label: '处理',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
@@ -83,7 +121,7 @@ export function tabCheck() {
|
|||||||
label: '同意',
|
label: '同意',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
api: apiGet('${base}/check_order/approve/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -91,21 +129,14 @@ export function tabCheck() {
|
|||||||
label: '拒绝',
|
label: '拒绝',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
api: apiGet('${base}/check_order/reject/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: `\${type === 'AUTHENTICATION' && state !== NORMAL}`,
|
visibleOn: "${type === 'WARE' && state === 'RUNNING'}",
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...authenticationDetailDialog('parameters.authenticationId'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`,
|
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '处理',
|
label: '处理',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
@@ -117,7 +148,7 @@ export function tabCheck() {
|
|||||||
label: '同意',
|
label: '同意',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'),
|
api: apiGet('${base}/check_order/approve/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -125,22 +156,14 @@ export function tabCheck() {
|
|||||||
label: '拒绝',
|
label: '拒绝',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
close: true,
|
close: true,
|
||||||
api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'),
|
api: apiGet('${base}/check_order/reject/${instanceId}'),
|
||||||
reload: 'check_order_list',
|
reload: 'check_order_list',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
visibleOn: `\${type === 'MARKET' && state !== NORMAL}`,
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...wareDetailDialog('parameters.wareId'),
|
|
||||||
},
|
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,18 +5,17 @@ import {
|
|||||||
} from "../../components/resource/dialog-resource.js";
|
} from "../../components/resource/dialog-resource.js";
|
||||||
import {
|
import {
|
||||||
apiGet,
|
apiGet,
|
||||||
arrayInCheck,
|
|
||||||
arrayOutCheck,
|
arrayOutCheck,
|
||||||
checkState,
|
checkState,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
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";
|
||||||
|
|
||||||
export function resourceList() {
|
export function resourceList(showMode = false) {
|
||||||
return {
|
return {
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: apiGet('${base}/data_resource/list'),
|
api: apiGet('${base}/data_resource/list'),
|
||||||
@@ -50,6 +49,7 @@ export function resourceList() {
|
|||||||
...resourceDetailDialog(),
|
...resourceDetailDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
visibleOn: !showMode,
|
||||||
type: 'dropdown-button',
|
type: 'dropdown-button',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
icon: 'fa fa-ellipsis-h',
|
icon: 'fa fa-ellipsis-h',
|
||||||
@@ -66,8 +66,8 @@ export function resourceList() {
|
|||||||
...resourceEditeDialog(),
|
...resourceEditeDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
disabledOn: arrayInCheck([checkState.checking], 'confirmationState'),
|
disabledOn: arrayOutCheck([checkState.none, checkState.draft], 'confirmationState'),
|
||||||
disabledTip: '审查中无法删除',
|
disabledTip: '审查或确权成功后无法删除',
|
||||||
tooltipPlacement: 'bottom',
|
tooltipPlacement: 'bottom',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: "删除",
|
label: "删除",
|
||||||
@@ -85,10 +85,97 @@ export function resourceList() {
|
|||||||
|
|
||||||
export function tabData() {
|
export function tabData() {
|
||||||
return {
|
return {
|
||||||
visibleOn: userOnly,
|
type: 'tabs',
|
||||||
title: '数据资源',
|
tabs: [
|
||||||
icon: 'fa fa-database',
|
{
|
||||||
reload: true,
|
title: '资源定义',
|
||||||
body: resourceList(),
|
tab: resourceList()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '资源上架',
|
||||||
|
tab: {
|
||||||
|
type: 'crud',
|
||||||
|
api: apiGet('${base}/ware/list'),
|
||||||
|
...crudCommonOptions(),
|
||||||
|
headerToolbar: [
|
||||||
|
'reload',
|
||||||
|
{
|
||||||
|
type: 'action',
|
||||||
|
label: '',
|
||||||
|
icon: 'fa fa-plus',
|
||||||
|
...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',
|
||||||
|
label: '查看',
|
||||||
|
level: 'link',
|
||||||
|
...wareDetailDialog(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${state === 'CHECKING'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '撤销',
|
||||||
|
level: 'link',
|
||||||
|
confirmTitle: '确认撤销',
|
||||||
|
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/retract/${id}'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
||||||
|
type: 'action',
|
||||||
|
label: '提交',
|
||||||
|
level: 'link',
|
||||||
|
confirmTitle: '确认提交',
|
||||||
|
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
||||||
|
actionType: 'ajax',
|
||||||
|
api: apiGet('${base}/ware/submit/${id}'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'dropdown-button',
|
||||||
|
level: 'link',
|
||||||
|
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}'),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,8 @@
|
|||||||
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
|
import {apiGet, crudCommonOptions} from "../../components/constants.js";
|
||||||
import {
|
|
||||||
apiGet,
|
|
||||||
crudCommonOptions,
|
|
||||||
mappingField,
|
|
||||||
operationField,
|
|
||||||
permissionStateMapping,
|
|
||||||
timeField
|
|
||||||
} from "../../components/constants.js";
|
|
||||||
import {authenticationAddDialog} from "../../components/permission/dialog-permission.js";
|
import {authenticationAddDialog} from "../../components/permission/dialog-permission.js";
|
||||||
|
|
||||||
export function tabMarket() {
|
export function tabMarket() {
|
||||||
return {
|
return {
|
||||||
title: '数据市场',
|
|
||||||
icon: 'fa fa-store',
|
|
||||||
reload: true,
|
|
||||||
body: [
|
|
||||||
{
|
|
||||||
type: 'tabs',
|
|
||||||
tabs: [
|
|
||||||
{
|
|
||||||
title: '公开数据',
|
|
||||||
body: {
|
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: {
|
api: {
|
||||||
...apiGet('${base}/ware/list_public'),
|
...apiGet('${base}/ware/list_public'),
|
||||||
@@ -39,19 +21,58 @@ export function tabMarket() {
|
|||||||
'reload',
|
'reload',
|
||||||
],
|
],
|
||||||
mode: 'cards',
|
mode: 'cards',
|
||||||
|
columnsCount: 3,
|
||||||
card: {
|
card: {
|
||||||
header: {
|
header: {
|
||||||
title: '${name}',
|
title: '${name}',
|
||||||
subTitle: '${createdTime}',
|
subTitle: '${createdTime}',
|
||||||
description: '${description}',
|
|
||||||
avatar: '${icon}',
|
avatar: '${icon}',
|
||||||
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
|
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
|
||||||
},
|
},
|
||||||
|
body: '${TRUNCATE(description, 50)}',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '查看',
|
label: '查看',
|
||||||
...wareDetailDialog(),
|
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',
|
type: 'action',
|
||||||
@@ -59,95 +80,6 @@ export function tabMarket() {
|
|||||||
...authenticationAddDialog(),
|
...authenticationAddDialog(),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '我的数据',
|
|
||||||
body: {
|
|
||||||
type: 'crud',
|
|
||||||
api: apiGet('${base}/ware/list'),
|
|
||||||
...crudCommonOptions(),
|
|
||||||
headerToolbar: [
|
|
||||||
'reload',
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '',
|
|
||||||
icon: 'fa fa-plus',
|
|
||||||
...wareAddDialog()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
label: '名称',
|
|
||||||
width: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'description',
|
|
||||||
label: '描述',
|
|
||||||
},
|
|
||||||
mappingField('state', '状态', permissionStateMapping),
|
|
||||||
timeField('createdTime', '创建时间'),
|
|
||||||
operationField('操作', undefined, [
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '查看',
|
|
||||||
level: 'link',
|
|
||||||
...wareDetailDialog(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${state === 'CHECKING'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '撤销',
|
|
||||||
level: 'link',
|
|
||||||
confirmTitle: '确认撤销',
|
|
||||||
confirmText: '确认撤销名称为「${name}」的确权申请吗?',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/retract/${id}'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${state === 'DRAFT' || state === 'REJECT'}",
|
|
||||||
type: 'action',
|
|
||||||
label: '提交',
|
|
||||||
level: 'link',
|
|
||||||
confirmTitle: '确认提交',
|
|
||||||
confirmText: '确认提交名称为「${name}」的确权申请吗?',
|
|
||||||
actionType: 'ajax',
|
|
||||||
api: apiGet('${base}/ware/submit/${id}'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
visibleOn: "${!public}",
|
|
||||||
type: 'dropdown-button',
|
|
||||||
level: 'link',
|
|
||||||
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}'),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,11 +24,6 @@ import {
|
|||||||
|
|
||||||
export function tabPermissions() {
|
export function tabPermissions() {
|
||||||
return {
|
return {
|
||||||
visibleOn: userOnly,
|
|
||||||
title: '权属管理',
|
|
||||||
icon: 'fa fa-key',
|
|
||||||
reload: true,
|
|
||||||
body: {
|
|
||||||
type: 'tabs',
|
type: 'tabs',
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
@@ -192,5 +186,4 @@ export function tabPermissions() {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
administratorOnly,
|
|
||||||
apiGet,
|
apiGet,
|
||||||
copyField,
|
copyField,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
@@ -13,12 +12,7 @@ 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: '用户管理',
|
|
||||||
icon: 'fa fa-user',
|
|
||||||
reload: true,
|
|
||||||
body: [
|
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: apiGet('${base}/user_management/list'),
|
api: apiGet('${base}/user_management/list'),
|
||||||
@@ -79,5 +73,4 @@ export function tabUser() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xs: 12,
|
type: 'flex',
|
||||||
sm: 12,
|
direction: 'column',
|
||||||
md: 4,
|
justify: 'center',
|
||||||
body: [
|
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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'form',
|
type: 'form',
|
||||||
title: '用户登陆',
|
className: 'bg-white rounded-xl p-10 shadow-2xl',
|
||||||
api: '${base}/user/login',
|
api: '${base}/user/login',
|
||||||
redirect: '/pages/index/index.html?token=${token}',
|
redirect: '/pages/index/index.html?token=${token}',
|
||||||
mode: 'horizontal',
|
mode: 'normal',
|
||||||
horizontal: {
|
wrapWithPanel: false,
|
||||||
left: 2,
|
|
||||||
},
|
|
||||||
actions: [
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
label: '注册',
|
|
||||||
...userRegisterDialog(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'action',
|
|
||||||
actionType: 'submit',
|
|
||||||
label: '登陆',
|
|
||||||
level: 'primary',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'input-email',
|
type: 'input-email',
|
||||||
name: 'username',
|
name: 'username',
|
||||||
label: '邮箱',
|
label: false,
|
||||||
placeholder: '请输入邮箱',
|
placeholder: '请输入邮箱',
|
||||||
required: true,
|
required: true,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
clearValueOnEmpty: true,
|
className: 'mb-4',
|
||||||
|
inputClassName: 'rounded-lg',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input-password',
|
type: 'input-password',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
label: '密码',
|
label: false,
|
||||||
placeholder: '请再次输入密码',
|
placeholder: '请输入密码',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
className: 'mb-4',
|
||||||
],
|
inputClassName: 'rounded-lg',
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xs: 0,
|
type: 'flex',
|
||||||
sm: 0,
|
justify: 'space-between',
|
||||||
md: 4,
|
className: 'mb-4',
|
||||||
body: [],
|
items: [
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
label: '注册账号',
|
||||||
|
className: 'text-blue-600 hover:text-blue-700',
|
||||||
|
level: 'link',
|
||||||
|
...userRegisterDialog(),
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
|
type: 'button',
|
||||||
|
label: '忘记密码?',
|
||||||
|
level: 'link',
|
||||||
|
className: 'text-gray-600 hover:text-gray-700'
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
|
type: 'submit',
|
||||||
|
label: '登录',
|
||||||
|
level: 'primary',
|
||||||
|
className: 'w-full rounded-lg',
|
||||||
|
size: 'lg'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
25
gringotts-frontend/pages/test/index.html
Normal file
25
gringotts-frontend/pages/test/index.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||||
|
<title></title>
|
||||||
|
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
|
||||||
|
<link href="/assets/sdk/iconfont.css" rel="stylesheet"/>
|
||||||
|
<style>
|
||||||
|
html, body, #app {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script src="/assets/sdk/sdk.js"></script>
|
||||||
|
<script src="./main.js" type="module"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
133
gringotts-frontend/pages/test/main.js
Normal file
133
gringotts-frontend/pages/test/main.js
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
import {useAmis} from "../../components/constants.js";
|
||||||
|
|
||||||
|
useAmis((information) => {
|
||||||
|
return {
|
||||||
|
"type": "wrapper",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"content": "API资源",
|
||||||
|
"label": "名称"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "标签",
|
||||||
|
"span": 2,
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "tag",
|
||||||
|
"label": "API"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "简介",
|
||||||
|
"span": 3,
|
||||||
|
"content": "API 资源"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"span": 3,
|
||||||
|
"content": "<p>这是API<strong>资源</strong></p>",
|
||||||
|
"label": "内容"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"title": "商品信息"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "wrapper",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"label": "资源名称",
|
||||||
|
"span": 3,
|
||||||
|
"content": "API资源"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"span": 3,
|
||||||
|
"label": "资源描述",
|
||||||
|
"content": "这是API资源"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"span": 3,
|
||||||
|
"content": "API",
|
||||||
|
"label": "资源类型"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"span": 1,
|
||||||
|
"content": "administrator@eshore.com",
|
||||||
|
"label": "用户名"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "密码",
|
||||||
|
"content": "bLiN+,qAss,uo'nxoH_:d@HEdD*WdZWAudq$J'a$5Z#aS>K-*dWN5L-i<m:w/U,R",
|
||||||
|
"span": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"span": 3,
|
||||||
|
"content": "http://baidu.com",
|
||||||
|
"label": "地址"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"title": "资源类型定义",
|
||||||
|
"type": "property"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"label": "格式类型",
|
||||||
|
"span": 3,
|
||||||
|
"content": "文件"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "property",
|
||||||
|
"title": "资源格式定义"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"size": "none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "property",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"label": "创建人",
|
||||||
|
"span": 2,
|
||||||
|
"content": "administrator@eshore.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "创建时间",
|
||||||
|
"content": "2025-01-23 14:24:15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"span": 2,
|
||||||
|
"content": "administrator@eshore.com",
|
||||||
|
"label": "修改人"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "修改时间",
|
||||||
|
"content": "2025-01-23 14:24:15"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"size": "none"
|
||||||
|
}
|
||||||
|
})
|
||||||
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 |
2
gringotts-web/bin/start.sh
Executable file
2
gringotts-web/bin/start.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P"Dp^A47>WSn:Wn].gs/+"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.'
|
||||||
|
nohup /home/iap/gringotts/jdk/jdk-11.0.25+9/bin/java -jar /home/iap/gringotts/gringotts-web-1.0.0-SNAPSHOT.jar --spring.profiles.active=build > run.log 2>&1 &
|
||||||
40
gringotts-web/bin/stop.sh
Executable file
40
gringotts-web/bin/stop.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
original_command="$0"
|
||||||
|
application_name="gringotts-web-1.0.0-SNAPSHOT.jar"
|
||||||
|
|
||||||
|
function get_pid() {
|
||||||
|
ID=$(ps -ef | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{ print $2 }')
|
||||||
|
if [[ -z "$ID" ]]; then
|
||||||
|
ID=$(ps aux | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{print $2}')
|
||||||
|
if [[ -z "$ID" ]]; then
|
||||||
|
ID=$(/home/iap/gringotts/jdk/jdk-11.0.25+9/bin/jps -lmvV | grep "$application_name" | awk '{print $1}')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $ID
|
||||||
|
}
|
||||||
|
|
||||||
|
pid=$(get_pid)
|
||||||
|
|
||||||
|
if [[ -z "$pid" ]]; then
|
||||||
|
echo "Application is already stopped."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Stopping $pid..."
|
||||||
|
kill $pid
|
||||||
|
|
||||||
|
LOOPS=0
|
||||||
|
while (true); do
|
||||||
|
cpid=$(get_pid)
|
||||||
|
if [[ -z "$cpid" ]]; then
|
||||||
|
echo "Oook! cost:$LOOPS"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
LOOPS=$(($LOOPS+1))
|
||||||
|
if [[ $(($LOOPS%15)) -eq 0 ]]; then
|
||||||
|
echo "Wait timeout, try to force kill $pid..."
|
||||||
|
kill -9 $pid
|
||||||
|
fi
|
||||||
|
sleep 1s
|
||||||
|
done
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
<groupId>com.eshore</groupId>
|
<groupId>com.eshore</groupId>
|
||||||
<artifactId>gringotts-forest</artifactId>
|
<artifactId>gringotts-forest</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lanyuanxiaoyao</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-jpa-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
@@ -34,6 +38,10 @@
|
|||||||
<version>${hibernate.version}</version>
|
<version>${hibernate.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.springframework.boot.ApplicationArguments;
|
|||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@@ -21,7 +22,14 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||||||
* @author lanyuanxiaoyao
|
* @author lanyuanxiaoyao
|
||||||
* @date 2024-11-14
|
* @date 2024-11-14
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(scanBasePackages = {"com.eshore.gringotts"})
|
@SpringBootApplication(scanBasePackages = {
|
||||||
|
"com.eshore.gringotts",
|
||||||
|
"com.lanyuanxiaoyao.flowable.jpa"
|
||||||
|
})
|
||||||
|
@EntityScan({
|
||||||
|
"com.eshore.gringotts.web.domain.entity",
|
||||||
|
"com.lanyuanxiaoyao.flowable.jpa.entity"
|
||||||
|
})
|
||||||
@EnableFenix
|
@EnableFenix
|
||||||
@EnableJpaAuditing
|
@EnableJpaAuditing
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.base.controller;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wn
|
||||||
|
* @version 20241224
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public abstract class CheckingController<ENTITY extends CheckingNeededEntity, SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> extends SimpleControllerSupport<ENTITY, SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> {
|
||||||
|
private final CheckingService<ENTITY> checkingService;
|
||||||
|
|
||||||
|
public CheckingController(CheckingService<ENTITY> service) {
|
||||||
|
super(service);
|
||||||
|
this.checkingService = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/submit/{id}")
|
||||||
|
public AmisResponse<Object> submit(@PathVariable Long id) throws Exception {
|
||||||
|
checkingService.submit(id);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/retract/{id}")
|
||||||
|
public AmisResponse<Object> retract(@PathVariable Long id) throws Exception {
|
||||||
|
checkingService.retract(id);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.controller;
|
package com.eshore.gringotts.web.domain.base.controller;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisListResponse;
|
||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
@@ -12,4 +13,8 @@ public interface ListController<LIST_ITEM> {
|
|||||||
AmisResponse<ImmutableList<LIST_ITEM>> list() throws Exception;
|
AmisResponse<ImmutableList<LIST_ITEM>> list() throws Exception;
|
||||||
|
|
||||||
AmisResponse<ImmutableList<LIST_ITEM>> list(Query query) throws Exception;
|
AmisResponse<ImmutableList<LIST_ITEM>> list(Query query) throws Exception;
|
||||||
|
|
||||||
|
AmisListResponse page() throws Exception;
|
||||||
|
|
||||||
|
AmisListResponse page(Query query) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
package com.eshore.gringotts.web.domain.base.controller;
|
package com.eshore.gringotts.web.domain.base.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisListResponse;
|
||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
||||||
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.base.entity.SimpleEntity;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
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.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -21,10 +24,11 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
public abstract class SimpleControllerSupport<ENTITY extends SimpleEntity, SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> implements SimpleController<SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> {
|
public abstract class SimpleControllerSupport<ENTITY extends SimpleEntity, SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> implements SimpleController<SAVE_ITEM, LIST_ITEM, DETAIL_ITEM> {
|
||||||
protected static final String SAVE = "/save";
|
protected static final String SAVE = "/save";
|
||||||
protected static final String LIST = "/list";
|
protected static final String LIST = "/list";
|
||||||
|
protected static final String PAGE = "/page";
|
||||||
protected static final String DETAIL = "/detail/{id}";
|
protected static final String DETAIL = "/detail/{id}";
|
||||||
protected static final String REMOVE = "/remove/{id}";
|
protected static final String REMOVE = "/remove/{id}";
|
||||||
|
|
||||||
private final SimpleServiceSupport<ENTITY> service;
|
protected final SimpleServiceSupport<ENTITY> service;
|
||||||
|
|
||||||
public SimpleControllerSupport(SimpleServiceSupport<ENTITY> service) {
|
public SimpleControllerSupport(SimpleServiceSupport<ENTITY> service) {
|
||||||
this.service = service;
|
this.service = service;
|
||||||
@@ -63,6 +67,44 @@ public abstract class SimpleControllerSupport<ENTITY extends SimpleEntity, SAVE_
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(PAGE)
|
||||||
|
@Override
|
||||||
|
public AmisListResponse page() throws Exception {
|
||||||
|
Page<ENTITY> page = service.page();
|
||||||
|
return AmisResponse.responseListData(
|
||||||
|
page.getContent()
|
||||||
|
.stream()
|
||||||
|
.map(entity -> {
|
||||||
|
try {
|
||||||
|
return toListItem(entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()),
|
||||||
|
page.getTotalElements()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(PAGE)
|
||||||
|
@Override
|
||||||
|
public AmisListResponse page(@RequestBody Query query) throws Exception {
|
||||||
|
Page<ENTITY> page = service.page(query);
|
||||||
|
return AmisResponse.responseListData(
|
||||||
|
page.getContent()
|
||||||
|
.stream()
|
||||||
|
.map(entity -> {
|
||||||
|
try {
|
||||||
|
return toListItem(entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()),
|
||||||
|
page.getTotalElements()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(DETAIL)
|
@GetMapping(DETAIL)
|
||||||
@Override
|
@Override
|
||||||
public AmisResponse<DETAIL_ITEM> detail(@PathVariable Long id) throws Exception {
|
public AmisResponse<DETAIL_ITEM> detail(@PathVariable Long id) throws Exception {
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
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 javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.EntityListeners;
|
import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
import javax.persistence.Enumerated;
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -26,9 +22,7 @@ public class CheckingNeededEntity extends LogicDeleteEntity {
|
|||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private State state = State.DRAFT;
|
private State state = State.DRAFT;
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
|
private String flowableInstanceId;
|
||||||
@ToString.Exclude
|
|
||||||
private CheckOrder order;
|
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
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 org.eclipse.collections.api.map.ImmutableMap;
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 需要审查
|
* 需要审查
|
||||||
@@ -9,6 +11,14 @@ 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 protected Object archive(ENTITY entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,8 @@ import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
|||||||
import com.eshore.gringotts.web.domain.service.UserService;
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
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 javax.transaction.Transactional;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lanyuanxiaoyao
|
* @author lanyuanxiaoyao
|
||||||
@@ -28,16 +23,11 @@ public abstract class LogicDeleteService<ENTITY extends LogicDeleteEntity> exten
|
|||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
return super.listPredicate(root, query, builder).newWith(builder.equal(root.get("deleted"), false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
@Override
|
@Override
|
||||||
public void remove(Long id) {
|
public void remove(Long id) {
|
||||||
String entityName = ClassUtil.getTypeArgument(this.getClass()).getSimpleName();
|
String entityName = ClassUtil.getTypeArgument(this.getClass()).getSimpleName();
|
||||||
Query query = manager.createQuery(StrUtil.format("update {} entity set deleted=true where id=?1", entityName));
|
Query query = manager.createQuery(StrUtil.format("update {} entity set entity.deleted = true where id = ?1", entityName));
|
||||||
query.setParameter(1, id);
|
query.setParameter(1, id);
|
||||||
query.executeUpdate();
|
query.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.eclipse.collections.api.set.ImmutableSet;
|
import org.eclipse.collections.api.set.ImmutableSet;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lanyuanxiaoyao
|
* @author lanyuanxiaoyao
|
||||||
@@ -13,12 +14,18 @@ import org.eclipse.collections.api.set.ImmutableSet;
|
|||||||
public interface SimpleService<ENTITY extends SimpleEntity> {
|
public interface SimpleService<ENTITY extends SimpleEntity> {
|
||||||
Long save(ENTITY entity) throws Exception;
|
Long save(ENTITY entity) throws Exception;
|
||||||
|
|
||||||
|
Long count() throws Exception;
|
||||||
|
|
||||||
ImmutableList<ENTITY> list() throws Exception;
|
ImmutableList<ENTITY> list() throws Exception;
|
||||||
|
|
||||||
ImmutableList<ENTITY> list(ImmutableSet<Long> ids) throws Exception;
|
ImmutableList<ENTITY> list(ImmutableSet<Long> ids) throws Exception;
|
||||||
|
|
||||||
ImmutableList<ENTITY> list(Query query) throws Exception;
|
ImmutableList<ENTITY> list(Query query) throws Exception;
|
||||||
|
|
||||||
|
Page<ENTITY> page() throws Exception;
|
||||||
|
|
||||||
|
Page<ENTITY> page(Query query) throws Exception;
|
||||||
|
|
||||||
Optional<ENTITY> detailOptional(Long id) throws Exception;
|
Optional<ENTITY> detailOptional(Long id) throws Exception;
|
||||||
|
|
||||||
ENTITY detail(Long id) throws Exception;
|
ENTITY detail(Long id) throws Exception;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.eshore.gringotts.web.domain.base.service;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import cn.hutool.core.util.EnumUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
||||||
@@ -12,10 +11,10 @@ import com.eshore.gringotts.web.domain.base.entity.SimpleEntity_;
|
|||||||
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
import com.eshore.gringotts.web.domain.service.UserService;
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import com.eshore.gringotts.web.helper.QueryHelper;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
import javax.persistence.criteria.Path;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
@@ -24,6 +23,8 @@ import org.eclipse.collections.api.factory.Lists;
|
|||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.eclipse.collections.api.list.MutableList;
|
import org.eclipse.collections.api.list.MutableList;
|
||||||
import org.eclipse.collections.api.set.ImmutableSet;
|
import org.eclipse.collections.api.set.ImmutableSet;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,6 +65,18 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
return entity.getId();
|
return entity.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long count() throws Exception {
|
||||||
|
return repository.count(
|
||||||
|
(root, query, builder) ->
|
||||||
|
builder.and(
|
||||||
|
listPredicate(root, query, builder)
|
||||||
|
.reject(ObjectUtil::isNull)
|
||||||
|
.toArray(new Predicate[]{})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableList<ENTITY> list() throws Exception {
|
public ImmutableList<ENTITY> list() throws Exception {
|
||||||
return Lists.immutable.ofAll(repository.findAll(
|
return Lists.immutable.ofAll(repository.findAll(
|
||||||
@@ -87,87 +100,6 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private <Y> Path<Y> column(Root<ENTITY> root, String column) {
|
|
||||||
String[] columns = StrUtil.splitToArray(column, "/");
|
|
||||||
Path<Y> path = root.get(columns[0]);
|
|
||||||
for (int i = 1; i < columns.length; i++) {
|
|
||||||
path = path.get(columns[i]);
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
||||||
private <Y> Object value(Path<Y> column, Object value) {
|
|
||||||
Class<?> javaType = column.getJavaType();
|
|
||||||
if (EnumUtil.isEnum(javaType)) {
|
|
||||||
return EnumUtil.fromString((Class<Enum>) javaType, (String) value);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private ImmutableList<Predicate> queryPredicates(Query.Queryable queryable, Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
MutableList<Predicate> predicates = Lists.mutable.empty();
|
|
||||||
if (ObjectUtil.isEmpty(queryable)) {
|
|
||||||
return predicates.toImmutable();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNullEqual())) {
|
|
||||||
queryable.getNullEqual().forEach(column -> predicates.add(builder.isNull(column(root, column))));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotNullEqual())) {
|
|
||||||
queryable.getNotNullEqual().forEach(column -> predicates.add(builder.isNull(column(root, column))));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getEmpty())) {
|
|
||||||
queryable.getEmpty().forEach(column -> predicates.add(builder.isEmpty(column(root, column))));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotEmpty())) {
|
|
||||||
queryable.getNotEmpty().forEach(column -> predicates.add(builder.isNotEmpty(column(root, column))));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getEqual())) {
|
|
||||||
queryable.getEqual().forEachKeyValue((column, value) -> {
|
|
||||||
Path<Object> path = column(root, column);
|
|
||||||
predicates.add(builder.equal(path, value(path, value)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotEqual())) {
|
|
||||||
queryable.getEqual().forEachKeyValue((column, value) -> {
|
|
||||||
Path<Object> path = column(root, column);
|
|
||||||
predicates.add(builder.notEqual(path, value(path, value)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getLike())) {
|
|
||||||
queryable.getLike().forEachKeyValue((column, value) -> predicates.add(builder.like(column(root, column), value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotLike())) {
|
|
||||||
queryable.getNotLike().forEachKeyValue((column, value) -> predicates.add(builder.notLike(column(root, column), value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getGreat())) {
|
|
||||||
queryable.getGreat().forEachKeyValue((column, value) -> predicates.add(builder.greaterThan(column(root, column), (Comparable<Object>) value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getLess())) {
|
|
||||||
queryable.getLess().forEachKeyValue((column, value) -> predicates.add(builder.lessThan(column(root, column), (Comparable<Object>) value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getGreatEqual())) {
|
|
||||||
queryable.getGreatEqual().forEachKeyValue((column, value) -> predicates.add(builder.greaterThanOrEqualTo(column(root, column), (Comparable<Object>) value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getLessEqual())) {
|
|
||||||
queryable.getLessEqual().forEachKeyValue((column, value) -> predicates.add(builder.lessThanOrEqualTo(column(root, column), (Comparable<Object>) value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getIn())) {
|
|
||||||
queryable.getIn().forEachKeyValue((column, value) -> predicates.add(builder.in(column(root, column)).value(value)));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotIn())) {
|
|
||||||
queryable.getNotIn().forEachKeyValue((column, value) -> predicates.add(builder.in(column(root, column)).value(value).not()));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getBetween())) {
|
|
||||||
queryable.getBetween().forEachKeyValue((column, value) -> predicates.add(builder.between(column(root, column), value.getStart(), value.getEnd())));
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNotEmpty(queryable.getNotBetween())) {
|
|
||||||
queryable.getNotBetween().forEachKeyValue((column, value) -> predicates.add(builder.between(column(root, column), value.getStart(), value.getEnd())));
|
|
||||||
}
|
|
||||||
return predicates.toImmutable();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
protected ImmutableList<Predicate> listPredicate(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
User user = userService.currentLoginUser();
|
User user = userService.currentLoginUser();
|
||||||
if (User.isNotAdministrator(user)) {
|
if (User.isNotAdministrator(user)) {
|
||||||
@@ -181,13 +113,36 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
|
|||||||
return Lists.immutable.ofAll(repository.findAll(
|
return Lists.immutable.ofAll(repository.findAll(
|
||||||
(root, query, builder) -> {
|
(root, query, builder) -> {
|
||||||
MutableList<Predicate> predicates = Lists.mutable.ofAll(listPredicate(root, query, builder));
|
MutableList<Predicate> predicates = Lists.mutable.ofAll(listPredicate(root, query, builder));
|
||||||
predicates.addAllIterable(queryPredicates(listQuery.getQuery(), root, query, builder));
|
predicates.addAllIterable(QueryHelper.queryPredicates(listQuery.getQuery(), root, query, builder));
|
||||||
return builder.and(predicates.reject(ObjectUtil::isNull).toArray(new Predicate[predicates.size()]));
|
return builder.and(predicates.reject(ObjectUtil::isNull).toArray(new Predicate[predicates.size()]));
|
||||||
},
|
},
|
||||||
Sort.by(SimpleEntity_.CREATED_TIME).descending()
|
Sort.by(SimpleEntity_.CREATED_TIME).descending()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ENTITY> page() throws Exception {
|
||||||
|
return repository.findAll(
|
||||||
|
(root, query, builder) -> {
|
||||||
|
MutableList<Predicate> predicates = Lists.mutable.ofAll(listPredicate(root, query, builder));
|
||||||
|
return builder.and(predicates.reject(ObjectUtil::isNull).toArray(new Predicate[predicates.size()]));
|
||||||
|
},
|
||||||
|
PageRequest.of(0, 10, Sort.by(SimpleEntity_.CREATED_TIME).descending())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<ENTITY> page(Query listQuery) throws Exception {
|
||||||
|
return repository.findAll(
|
||||||
|
(root, query, builder) -> {
|
||||||
|
MutableList<Predicate> predicates = Lists.mutable.ofAll(listPredicate(root, query, builder));
|
||||||
|
predicates.addAllIterable(QueryHelper.queryPredicates(listQuery.getQuery(), root, query, builder));
|
||||||
|
return builder.and(predicates.reject(ObjectUtil::isNull).toArray(new Predicate[predicates.size()]));
|
||||||
|
},
|
||||||
|
PageRequest.of(listQuery.getPage().getPage(), listQuery.getPage().getSize(), Sort.by(SimpleEntity_.CREATED_TIME).descending())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ENTITY> detailOptional(Long id) {
|
public Optional<ENTITY> detailOptional(Long id) {
|
||||||
if (ObjectUtil.isNull(id)) {
|
if (ObjectUtil.isNull(id)) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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.CheckingController;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -29,30 +25,16 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("authentication")
|
@RequestMapping("authentication")
|
||||||
public class AuthenticationController extends SimpleControllerSupport<Authentication, AuthenticationController.SaveItem, AuthenticationController.ListItem, AuthenticationController.DetailItem> {
|
public class AuthenticationController extends CheckingController<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();
|
||||||
|
|||||||
@@ -1,20 +1,27 @@
|
|||||||
package com.eshore.gringotts.web.domain.controller;
|
package com.eshore.gringotts.web.domain.controller;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.configuration.amis.AmisListResponse;
|
||||||
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.User;
|
||||||
import com.eshore.gringotts.web.domain.service.CheckOrderService;
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.eshore.gringotts.web.helper.QueryHelper;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableHistory;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
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.list.ImmutableList;
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
import org.springframework.data.domain.Page;
|
||||||
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.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -32,55 +39,112 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("check_order")
|
@RequestMapping("check_order")
|
||||||
public class CheckOrderController implements ListController<CheckOrderController.ListItem> {
|
public class CheckOrderController implements ListController<CheckOrderController.ListItem> {
|
||||||
private final CheckOrderService checkOrderService;
|
private final UserService userService;
|
||||||
private final ObjectMapper mapper;
|
private final SpringFlowableManager flowableManager;
|
||||||
|
|
||||||
public CheckOrderController(CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
public CheckOrderController(UserService userService, SpringFlowableManager flowableManager) {
|
||||||
this.checkOrderService = checkOrderService;
|
this.userService = userService;
|
||||||
this.mapper = builder.build();
|
this.flowableManager = flowableManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Override
|
@Override
|
||||||
public AmisResponse<ImmutableList<CheckOrderController.ListItem>> list() throws Exception {
|
public AmisResponse<ImmutableList<CheckOrderController.ListItem>> list() throws Exception {
|
||||||
return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
|
User user = userService.currentLoginUser();
|
||||||
|
return AmisResponse.responseSuccess(
|
||||||
|
Lists.immutable.ofAll(flowableManager.listInstances(
|
||||||
|
(root, query, builder) -> {
|
||||||
|
if (User.isAdministrator(user)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return builder.or(
|
||||||
|
builder.like(root.get("extra"), user.getRole().name()),
|
||||||
|
builder.like(root.get("extra"), user.getId().toString())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)).collect(this::toListItem)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Override
|
@Override
|
||||||
public AmisResponse<ImmutableList<ListItem>> list(@RequestBody Query query) throws Exception {
|
public AmisResponse<ImmutableList<ListItem>> list(@RequestBody Query listQuery) throws Exception {
|
||||||
return AmisResponse.responseSuccess(checkOrderService.list().collect(this::toListItem));
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Override
|
||||||
|
public AmisListResponse page() throws Exception {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/page")
|
||||||
|
@Override
|
||||||
|
public AmisListResponse page(@RequestBody Query listQuery) throws Exception {
|
||||||
|
User user = userService.currentLoginUser();
|
||||||
|
Page<FlowableInstance> page = flowableManager.listInstances(
|
||||||
|
(root, query, builder) -> {
|
||||||
|
if (User.isAdministrator(user)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return builder.or(
|
||||||
|
builder.like(root.get("extra"), user.getRole().name()),
|
||||||
|
builder.like(root.get("extra"), user.getId().toString())
|
||||||
|
);
|
||||||
|
},
|
||||||
|
QueryHelper.pageable(listQuery)
|
||||||
|
);
|
||||||
|
return AmisListResponse.responseListData(
|
||||||
|
page.getContent()
|
||||||
|
.stream()
|
||||||
|
.map(this::toListItem)
|
||||||
|
.collect(Collectors.toList()),
|
||||||
|
page.getTotalElements()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/approve/{instanceId}")
|
||||||
|
public AmisResponse<Object> approve(@PathVariable String instanceId) {
|
||||||
|
flowableManager.approve(instanceId);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/reject/{instanceId}")
|
||||||
|
public AmisResponse<Object> reject(@PathVariable String instanceId) {
|
||||||
|
flowableManager.reject(instanceId);
|
||||||
|
return AmisResponse.responseSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/history/{instanceId}")
|
||||||
|
public AmisResponse<List<FlowableHistory>> history(@PathVariable String instanceId) {
|
||||||
|
return AmisResponse.responseSuccess(flowableManager.listHistories(instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private ListItem toListItem(CheckOrder order) {
|
private ListItem toListItem(FlowableInstance instance) {
|
||||||
|
FlowableNode node = flowableManager.getNode(instance.getCurrentNodeId());
|
||||||
ListItem item = new ListItem();
|
ListItem item = new ListItem();
|
||||||
item.setCheckOrderId(order.getId());
|
item.setInstanceId(instance.getInstanceId());
|
||||||
item.setDescription(order.getDescription());
|
item.setName(node.getName());
|
||||||
item.setType(order.getType());
|
item.setDescription(node.getDescription());
|
||||||
item.setParameters(mapper.readValue(order.getParameters(), new TypeReference<>() {}));
|
item.setType(instance.getMetadata().getStringOrDefault("type", "unknown"));
|
||||||
item.setState(order.getState());
|
item.setParameters(Maps.immutable.ofAll(instance.getMetadata().getMetadata()));
|
||||||
item.setCreatedUsername(order.getCreatedUser().getUsername());
|
item.setState(instance.getStatus());
|
||||||
item.setCreatedTime(order.getCreatedTime());
|
item.setCreatedUsername(instance.getMetadata().getStringOrDefault("createdUsername", ""));
|
||||||
item.setModifiedUsername(order.getModifiedUser().getUsername());
|
item.setCreatedTime(instance.getCreatedTime());
|
||||||
item.setModifiedTime(order.getModifiedTime());
|
item.setModifiedUsername(instance.getMetadata().getStringOrDefault("modifiedUsername", ""));
|
||||||
|
item.setModifiedTime(instance.getUpdatedTime());
|
||||||
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 String instanceId;
|
||||||
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private CheckOrder.Type type;
|
private String type;
|
||||||
private ImmutableMap<String, Object> parameters;
|
private ImmutableMap<String, Object> parameters;
|
||||||
private CheckOrder.State state;
|
private FlowableInstance.Status state;
|
||||||
private LocalDateTime createdTime;
|
private LocalDateTime createdTime;
|
||||||
private String createdUsername;
|
private String createdUsername;
|
||||||
private LocalDateTime modifiedTime;
|
private LocalDateTime modifiedTime;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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.CheckingController;
|
||||||
import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
import com.eshore.gringotts.web.domain.base.entity.FileInfo;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
||||||
@@ -9,15 +8,12 @@ import com.eshore.gringotts.web.domain.entity.Confirmation;
|
|||||||
import com.eshore.gringotts.web.domain.service.ConfirmationService;
|
import com.eshore.gringotts.web.domain.service.ConfirmationService;
|
||||||
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;
|
||||||
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;
|
||||||
|
|
||||||
@@ -28,30 +24,16 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("confirmation")
|
@RequestMapping("confirmation")
|
||||||
public class ConfirmationController extends SimpleControllerSupport<Confirmation, ConfirmationController.SaveItem, ConfirmationController.ListItem, ConfirmationController.DetailItem> {
|
public class ConfirmationController extends CheckingController<Confirmation, ConfirmationController.SaveItem, ConfirmationController.ListItem, ConfirmationController.DetailItem> {
|
||||||
private final ConfirmationService confirmationService;
|
|
||||||
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.dataResourceService = dataResourceService;
|
this.dataResourceService = dataResourceService;
|
||||||
this.dataFileService = dataFileService;
|
this.dataFileService = dataFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/submit/{id}")
|
|
||||||
public AmisResponse<Object> submit(@PathVariable Long id) throws JsonProcessingException {
|
|
||||||
confirmationService.submit(id);
|
|
||||||
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();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.eshore.gringotts.web.domain.controller;
|
|||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.core.util.URLUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import com.eshore.gringotts.web.configuration.HostConfiguration;
|
import com.eshore.gringotts.web.configuration.HostConfiguration;
|
||||||
import com.eshore.gringotts.web.configuration.UploadConfiguration;
|
import com.eshore.gringotts.web.configuration.UploadConfiguration;
|
||||||
@@ -86,7 +87,7 @@ public class DataFileController {
|
|||||||
response.setHeader("Access-Control-Expose-Headers", "Content-Type");
|
response.setHeader("Access-Control-Expose-Headers", "Content-Type");
|
||||||
response.setHeader("Content-Type", dataFile.getType());
|
response.setHeader("Content-Type", dataFile.getType());
|
||||||
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
response.setHeader("Content-Disposition", StrUtil.format("attachment; filename={}", dataFile.getFilename()));
|
response.setHeader("Content-Disposition", StrUtil.format("attachment; filename={}", URLUtil.encodeAll(dataFile.getFilename())));
|
||||||
IoUtil.copy(new FileInputStream(targetFile), response.getOutputStream());
|
IoUtil.copy(new FileInputStream(targetFile), response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,18 +174,18 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
|||||||
break;
|
break;
|
||||||
case JSON:
|
case JSON:
|
||||||
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
|
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
|
||||||
item.setJsonSchemaText(jsonFormat.getSchema());
|
item.setJsonSchemaText(jsonFormat.getJsonSchema());
|
||||||
item.setJsonSchema(mapper.readValue(jsonFormat.getSchema(), Map.class));
|
item.setJsonSchema(mapper.readValue(jsonFormat.getJsonSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
case JSON_LINE:
|
case JSON_LINE:
|
||||||
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
|
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
|
||||||
item.setJsonLineSchemaText(jsonLineFormat.getSchema());
|
item.setJsonLineSchemaText(jsonLineFormat.getJsonSchema());
|
||||||
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getSchema(), Map.class));
|
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getJsonSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
case CSV:
|
case CSV:
|
||||||
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
|
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
|
||||||
item.setCsvSchemaText(csvFormat.getSchema());
|
item.setCsvSchemaText(csvFormat.getCsvSchema());
|
||||||
item.setCsvSchema(mapper.readValue(csvFormat.getSchema(), Map.class));
|
item.setCsvSchema(mapper.readValue(csvFormat.getCsvSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(dataResource.getExample())) {
|
if (ObjectUtil.isNotNull(dataResource.getExample())) {
|
||||||
|
|||||||
@@ -3,21 +3,20 @@ package com.eshore.gringotts.web.domain.controller;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.eshore.gringotts.web.configuration.HostConfiguration;
|
import com.eshore.gringotts.web.configuration.HostConfiguration;
|
||||||
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
|
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.CheckingController;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleListItem;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleSaveItem;
|
||||||
import com.eshore.gringotts.web.domain.entity.Ware;
|
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.factory.Lists;
|
||||||
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;
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("ware")
|
@RequestMapping("ware")
|
||||||
public class WareController extends SimpleControllerSupport<Ware, WareController.SaveItem, WareController.ListItem, WareController.DetailItem> {
|
public class WareController extends CheckingController<Ware, WareController.SaveItem, WareController.ListItem, WareController.DetailItem> {
|
||||||
private final HostConfiguration hostConfiguration;
|
private final HostConfiguration hostConfiguration;
|
||||||
private final WareService wareService;
|
private final WareService wareService;
|
||||||
private final DataResourceService dataResourceService;
|
private final DataResourceService dataResourceService;
|
||||||
@@ -47,18 +46,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();
|
||||||
@@ -68,6 +55,7 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
ware.setDescription(saveItem.getDescription());
|
ware.setDescription(saveItem.getDescription());
|
||||||
ware.setIcon(dataFileService.detailOrThrow(saveItem.getIconId()));
|
ware.setIcon(dataFileService.detailOrThrow(saveItem.getIconId()));
|
||||||
ware.setContent(saveItem.getContent());
|
ware.setContent(saveItem.getContent());
|
||||||
|
ware.setTags(saveItem.getTags().toList());
|
||||||
return ware;
|
return ware;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +83,7 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
item.setDescription(entity.getDescription());
|
item.setDescription(entity.getDescription());
|
||||||
item.setIconId(entity.getIcon().getId());
|
item.setIconId(entity.getIcon().getId());
|
||||||
item.setContent(entity.getContent());
|
item.setContent(entity.getContent());
|
||||||
|
item.setTags(Lists.immutable.ofAll(entity.getTags()));
|
||||||
item.setIcon(StrUtil.format("{}/upload/download/{}", hostConfiguration.getPrefix(), entity.getIcon().getId()));
|
item.setIcon(StrUtil.format("{}/upload/download/{}", hostConfiguration.getPrefix(), entity.getIcon().getId()));
|
||||||
item.setCreatedTime(entity.getCreatedTime());
|
item.setCreatedTime(entity.getCreatedTime());
|
||||||
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
item.setCreatedUsername(entity.getCreatedUser().getUsername());
|
||||||
@@ -111,6 +100,7 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
|
|||||||
private String description;
|
private String description;
|
||||||
private Long iconId;
|
private Long iconId;
|
||||||
private String content;
|
private String content;
|
||||||
|
private ImmutableList<String> tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
|
|||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -23,7 +22,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@@ -50,13 +48,12 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "authentication" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class Authentication extends CheckingNeededEntity {
|
public class Authentication extends CheckingNeededEntity {
|
||||||
@ManyToOne(fetch = FetchType.EAGER)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
private DataResource target;
|
private DataResource target;
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Set<DataFile> evidences;
|
private Set<DataFile> evidences;
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity;
|
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ConstraintMode;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EntityListeners;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.ForeignKey;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-29
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
@Entity
|
|
||||||
@DynamicUpdate
|
|
||||||
@EntityListeners(AuditingEntityListener.class)
|
|
||||||
@Table(name = Constants.TABLE_PREFIX + "check_order")
|
|
||||||
@NamedEntityGraph(name = "check_order.list", attributeNodes = {
|
|
||||||
@NamedAttributeNode(value = "createdUser"),
|
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
|
||||||
})
|
|
||||||
@NamedEntityGraph(name = "check_order.detail", attributeNodes = {
|
|
||||||
@NamedAttributeNode(value = "createdUser"),
|
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
|
||||||
})
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class CheckOrder extends SimpleEntity {
|
|
||||||
@Column(nullable = false)
|
|
||||||
private String keyword;
|
|
||||||
@Column(nullable = false)
|
|
||||||
private String description;
|
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Type type;
|
|
||||||
/**
|
|
||||||
* JSON 结构 Map<String, Object>
|
|
||||||
*/
|
|
||||||
@Column(nullable = false)
|
|
||||||
private String parameters;
|
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private Target target;
|
|
||||||
@Column(nullable = false)
|
|
||||||
private String targetClass;
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
|
||||||
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
|
||||||
@ToString.Exclude
|
|
||||||
private User targetUser;
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private User.Role targetRole;
|
|
||||||
|
|
||||||
@Column(nullable = false)
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
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 {
|
|
||||||
APPLY,
|
|
||||||
REJECT,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Type {
|
|
||||||
CONFIRMATION,
|
|
||||||
AUTHENTICATION,
|
|
||||||
MARKET,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Target {
|
|
||||||
USER,
|
|
||||||
ROLE,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum State {
|
|
||||||
CHECKING,
|
|
||||||
RETRACT,
|
|
||||||
OVER,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import com.eshore.gringotts.core.Constants;
|
|||||||
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.LogicDeleteEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityListeners;
|
import javax.persistence.EntityListeners;
|
||||||
@@ -21,7 +20,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@@ -48,13 +46,12 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "confirmation" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class Confirmation extends CheckingNeededEntity {
|
public class Confirmation extends CheckingNeededEntity {
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@OneToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
private DataResource target;
|
private DataResource target;
|
||||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Set<DataFile> evidences;
|
private Set<DataFile> evidences;
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity;
|
package com.eshore.gringotts.web.domain.entity;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
@@ -23,9 +21,7 @@ import org.hibernate.annotations.Where;
|
|||||||
@Entity
|
@Entity
|
||||||
@DynamicUpdate
|
@DynamicUpdate
|
||||||
@Table(name = Constants.TABLE_PREFIX + "data_file")
|
@Table(name = Constants.TABLE_PREFIX + "data_file")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "data_file" + " set deleted = true where id = ?")
|
public class DataFile extends SimpleEntity {
|
||||||
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class DataFile extends LogicDeleteEntity {
|
|
||||||
private String filename;
|
private String filename;
|
||||||
private Long size;
|
private Long size;
|
||||||
private String md5;
|
private String md5;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
|||||||
import com.eshore.gringotts.web.domain.entity.format.ResourceFormat;
|
import com.eshore.gringotts.web.domain.entity.format.ResourceFormat;
|
||||||
import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -22,7 +21,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@@ -47,17 +45,16 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "data_resource" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class DataResource extends LogicDeleteEntity {
|
public class DataResource extends LogicDeleteEntity {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private ResourceType type;
|
private ResourceType type;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private ResourceFormat format;
|
private ResourceFormat format;
|
||||||
@@ -65,13 +62,13 @@ public class DataResource extends LogicDeleteEntity {
|
|||||||
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private DataFile example;
|
private DataFile example;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
|
@OneToOne(fetch = FetchType.EAGER, mappedBy = "target")
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Confirmation confirmation;
|
private Confirmation confirmation;
|
||||||
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
|
@OneToMany(fetch = FetchType.EAGER, mappedBy = "target")
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Set<Authentication> authentications;
|
private Set<Authentication> authentications;
|
||||||
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "resource")
|
@OneToOne(fetch = FetchType.EAGER, mappedBy = "resource")
|
||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Ware ware;
|
private Ware ware;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.eshore.gringotts.web.domain.entity;
|
|||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
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.LogicDeleteEntity;
|
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
|
||||||
|
import java.util.List;
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityListeners;
|
import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
@@ -21,7 +24,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
@@ -48,7 +50,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|||||||
@NamedAttributeNode(value = "createdUser"),
|
@NamedAttributeNode(value = "createdUser"),
|
||||||
@NamedAttributeNode(value = "modifiedUser"),
|
@NamedAttributeNode(value = "modifiedUser"),
|
||||||
})
|
})
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "ware" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class Ware extends CheckingNeededEntity {
|
public class Ware extends CheckingNeededEntity {
|
||||||
@OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.EAGER)
|
@OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.EAGER)
|
||||||
@@ -68,4 +69,7 @@ public class Ware extends CheckingNeededEntity {
|
|||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String content;
|
private String content;
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(name = Constants.TABLE_PREFIX + "ware_tag", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
private List<String> tags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.format;
|
package com.eshore.gringotts.web.domain.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -9,8 +7,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSV格式
|
* CSV格式
|
||||||
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("CSV")
|
@DiscriminatorValue("CSV")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class CsvResourceFormat extends ResourceFormat {
|
public class CsvResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String csvSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.format;
|
package com.eshore.gringotts.web.domain.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -9,8 +7,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON line格式
|
* JSON line格式
|
||||||
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("JSON_LINE")
|
@DiscriminatorValue("JSON_LINE")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class JsonLineResourceFormat extends ResourceFormat {
|
public class JsonLineResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String jsonSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.format;
|
package com.eshore.gringotts.web.domain.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -9,8 +7,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一个文件就是一个JSON
|
* 一个文件就是一个JSON
|
||||||
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("JSON")
|
@DiscriminatorValue("JSON")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class JsonResourceFormat extends ResourceFormat {
|
public class JsonResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String jsonSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.format;
|
package com.eshore.gringotts.web.domain.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无格式,文件每行就是一份数据
|
* 无格式,文件每行就是一份数据
|
||||||
@@ -21,8 +17,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@ToString
|
@ToString
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("LINE")
|
@DiscriminatorValue("LINE")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class LineResourceFormat extends ResourceFormat {
|
public class LineResourceFormat extends ResourceFormat {
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.format;
|
package com.eshore.gringotts.web.domain.entity.format;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无格式,整个文件就是一份数据
|
* 无格式,整个文件就是一份数据
|
||||||
@@ -21,8 +17,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@ToString
|
@ToString
|
||||||
@Entity
|
@Entity
|
||||||
@DiscriminatorValue("NONE")
|
@DiscriminatorValue("NONE")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class NoneResourceFormat extends ResourceFormat {
|
public class NoneResourceFormat extends ResourceFormat {
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import javax.persistence.Table;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源格式
|
* 资源格式
|
||||||
@@ -24,8 +22,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_format")
|
@Table(name = Constants.TABLE_PREFIX + "resource_format")
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public abstract class ResourceFormat extends LogicDeleteIdOnlyEntity {
|
public abstract class ResourceFormat extends LogicDeleteIdOnlyEntity {
|
||||||
public abstract Type getFormatType();
|
public abstract Type getFormatType();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.type;
|
package com.eshore.gringotts.web.domain.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -10,8 +9,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -20,8 +17,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_api")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_api")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type_api" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class ApiResourceType extends ResourceType {
|
public class ApiResourceType extends ResourceType {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.type;
|
package com.eshore.gringotts.web.domain.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
@@ -12,8 +11,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -22,8 +19,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_database")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_database")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type_database" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class DatabaseResourceType extends ResourceType {
|
public class DatabaseResourceType extends ResourceType {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String jdbc;
|
private String jdbc;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.type;
|
package com.eshore.gringotts.web.domain.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.DataFile;
|
import com.eshore.gringotts.web.domain.entity.DataFile;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -14,8 +13,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -24,8 +21,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_file")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_file")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type_file" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class FileResourceType extends ResourceType {
|
public class FileResourceType extends ResourceType {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.type;
|
package com.eshore.gringotts.web.domain.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -10,8 +9,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -20,8 +17,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_ftp")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_ftp")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type_ftp" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class FtpResourceType extends ResourceType {
|
public class FtpResourceType extends ResourceType {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.entity.type;
|
package com.eshore.gringotts.web.domain.entity.type;
|
||||||
|
|
||||||
import com.eshore.gringotts.core.Constants;
|
import com.eshore.gringotts.core.Constants;
|
||||||
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
|
|
||||||
import com.eshore.gringotts.web.domain.entity.DataFile;
|
import com.eshore.gringotts.web.domain.entity.DataFile;
|
||||||
import javax.persistence.ConstraintMode;
|
import javax.persistence.ConstraintMode;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@@ -14,8 +13,6 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -24,8 +21,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type_hdfs")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type_hdfs")
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type_hdfs" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public class HDFSResourceType extends ResourceType {
|
public class HDFSResourceType extends ResourceType {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import javax.persistence.Table;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
|
||||||
import org.hibernate.annotations.Where;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源类型
|
* 资源类型
|
||||||
@@ -24,8 +22,6 @@ import org.hibernate.annotations.Where;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = Constants.TABLE_PREFIX + "resource_type")
|
@Table(name = Constants.TABLE_PREFIX + "resource_type")
|
||||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_type" + " set deleted = true where id = ?")
|
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
|
||||||
public abstract class ResourceType extends LogicDeleteIdOnlyEntity {
|
public abstract class ResourceType extends LogicDeleteIdOnlyEntity {
|
||||||
public abstract Type getResourceType();
|
public abstract Type getResourceType();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.flowable;
|
||||||
|
|
||||||
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAccessor;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20250106
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CheckRoleAssessor implements FlowableAccessor {
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
public CheckRoleAssessor(UserService userService) {
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean access(FlowableInstance flowableInstance, FlowableNode flowableNode, FlowableAction flowableAction) {
|
||||||
|
User.Role role = userService.currentLoginUser().getRole();
|
||||||
|
return User.Role.ADMINISTRATOR.equals(role) || User.Role.CHECKER.equals(role);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.eshore.gringotts.web.domain.flowable;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.service.UserService;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAccessor;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20250106
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserAssessor implements FlowableAccessor {
|
||||||
|
public static final String KEY = "user_access_key";
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
public UserAssessor(UserService userService) {
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean access(FlowableInstance flowableInstance, FlowableNode flowableNode, FlowableAction flowableAction) {
|
||||||
|
FlowableMetadata metadata = flowableInstance.getMetadata();
|
||||||
|
return NumberUtil.equals(userService.currentLoginUser().getId(), metadata.getLong(KEY));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,12 @@ import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
|||||||
import com.eshore.gringotts.web.domain.entity.Authentication;
|
import com.eshore.gringotts.web.domain.entity.Authentication;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,4 +30,14 @@ public interface AuthenticationRepository extends SimpleRepository<Authenticatio
|
|||||||
@Override
|
@Override
|
||||||
@EntityGraph(value = "authentication.detail", type = EntityGraph.EntityGraphType.FETCH)
|
@EntityGraph(value = "authentication.detail", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
Optional<Authentication> findOne(Specification<Authentication> specification);
|
Optional<Authentication> findOne(Specification<Authentication> specification);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Authentication confirmation set confirmation.state = ?2 where confirmation.id = ?1 and confirmation.deleted = false")
|
||||||
|
void updateStateById(Long id, Authentication.State state);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Authentication confirmation set confirmation.flowableInstanceId = ?2 where confirmation.id = ?1 and confirmation.deleted = false")
|
||||||
|
void updateInstanceIdById(Long id, String instanceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
package com.eshore.gringotts.web.domain.repository;
|
|
||||||
|
|
||||||
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 java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-29
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("NullableProblems")
|
|
||||||
@Repository
|
|
||||||
public interface CheckOrderRepository extends SimpleRepository<CheckOrder, Long> {
|
|
||||||
@Override
|
|
||||||
@EntityGraph(value = "check_order.list", type = EntityGraph.EntityGraphType.FETCH)
|
|
||||||
List<CheckOrder> findAll(Specification<CheckOrder> specification);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@EntityGraph(value = "check_order.list", type = EntityGraph.EntityGraphType.FETCH)
|
|
||||||
List<CheckOrder> findAll(Specification<CheckOrder> specification, Sort sort);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@EntityGraph(value = "check_order.detail", type = EntityGraph.EntityGraphType.FETCH)
|
|
||||||
Optional<CheckOrder> findOne(Specification<CheckOrder> specification);
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Modifying
|
|
||||||
@Query("update CheckOrder check set check.state = ?2, check.modifiedUser = ?3, check.modifiedTime = current_timestamp where check.id = ?1")
|
|
||||||
void overById(Long id, CheckOrder.State state, User modifiedUser);
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,12 @@ import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
|||||||
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,5 +31,15 @@ public interface ConfirmationRepository extends SimpleRepository<Confirmation, L
|
|||||||
@EntityGraph(value = "confirmation.detail", type = EntityGraph.EntityGraphType.FETCH)
|
@EntityGraph(value = "confirmation.detail", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
Optional<Confirmation> findOne(Specification<Confirmation> specification);
|
Optional<Confirmation> findOne(Specification<Confirmation> specification);
|
||||||
|
|
||||||
Boolean existsByTarget_Id(Long id);
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Confirmation confirmation set confirmation.state = ?2 where confirmation.id = ?1 and confirmation.deleted = false")
|
||||||
|
void updateStateById(Long id, Confirmation.State state);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Confirmation confirmation set confirmation.flowableInstanceId = ?2 where confirmation.id = ?1 and confirmation.deleted = false")
|
||||||
|
void updateInstanceIdById(Long id, String instanceId);
|
||||||
|
|
||||||
|
Boolean existsByTarget_Id(Long targetId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
|
|||||||
import com.eshore.gringotts.web.domain.entity.Ware;
|
import com.eshore.gringotts.web.domain.entity.Ware;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.EntityGraph;
|
import org.springframework.data.jpa.repository.EntityGraph;
|
||||||
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@SuppressWarnings("NullableProblems")
|
@SuppressWarnings("NullableProblems")
|
||||||
@@ -23,4 +26,14 @@ public interface WareRepository extends SimpleRepository<Ware, Long> {
|
|||||||
@Override
|
@Override
|
||||||
@EntityGraph(value = "ware.detail", type = EntityGraph.EntityGraphType.FETCH)
|
@EntityGraph(value = "ware.detail", type = EntityGraph.EntityGraphType.FETCH)
|
||||||
Optional<Ware> findOne(Specification<Ware> specification);
|
Optional<Ware> findOne(Specification<Ware> specification);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Ware ware set ware.state = ?2 where ware.id = ?1 and ware.deleted = false")
|
||||||
|
void updateStateById(Long id, Ware.State state);
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update Ware ware set ware.flowableInstanceId = ?2 where ware.id = ?1 and ware.deleted = false")
|
||||||
|
void updateInstanceIdById(Long id, String instanceId);
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,26 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
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.entity.CheckingNeededEntity;
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.base.service.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.Confirmation;
|
||||||
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.flowable.CheckRoleAssessor;
|
||||||
|
import com.eshore.gringotts.web.domain.flowable.UserAssessor;
|
||||||
import com.eshore.gringotts.web.domain.repository.AuthenticationRepository;
|
import com.eshore.gringotts.web.domain.repository.AuthenticationRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
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.Lists;
|
||||||
import org.eclipse.collections.api.factory.Maps;
|
import org.eclipse.collections.api.factory.Maps;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.springframework.stereotype.Component;
|
||||||
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 +28,38 @@ 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 CheckingService<Authentication> {
|
||||||
|
private static final String AUTHENTICATION_FLOW_ID = "4ba86acd-1420-450b-98f9-0ed41772fe53";
|
||||||
|
|
||||||
private final AuthenticationRepository authenticationRepository;
|
private final AuthenticationRepository authenticationRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final CheckOrderService checkOrderService;
|
private final SpringFlowableManager flowableManager;
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
public AuthenticationService(AuthenticationRepository repository, UserService userService, EntityManager manager, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
public AuthenticationService(AuthenticationRepository repository, UserService userService, EntityManager manager, SpringFlowableManager flowableManager) {
|
||||||
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
|
this.flowableManager = flowableManager;
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Authentication> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
FlowableNode userCheckNode = FlowableNode.builder()
|
||||||
User loginUser = userService.currentLoginUser();
|
.nodeId(AUTHENTICATION_FLOW_ID)
|
||||||
if (User.isAdministrator(loginUser)) {
|
.name("用户审查")
|
||||||
return Lists.immutable.empty();
|
.description("用户审查")
|
||||||
}
|
.listeners(Lists.mutable.of(AuthenticationService.AuthenticationFlowUserCheckListener.class.getName()))
|
||||||
return Lists.immutable.of(builder.or(
|
.accessor(UserAssessor.class.getName())
|
||||||
builder.equal(root.get(Authentication_.createdUser), loginUser),
|
.targets(Maps.mutable.of(
|
||||||
builder.and(
|
FlowableAction.APPROVE, "f087b0e4-0efa-4b26-945f-642436aa4aef"
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
))
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
.build();
|
||||||
),
|
FlowableNode roleCheckNode = FlowableNode.builder()
|
||||||
builder.and(
|
.nodeId("f087b0e4-0efa-4b26-945f-642436aa4aef")
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
.name("授权审查")
|
||||||
builder.equal(root.get(Authentication_.order).get(CheckOrder_.targetUser), loginUser)
|
.description("授权审查")
|
||||||
)
|
.listeners(Lists.mutable.of(AuthenticationService.AuthenticationFlowRoleCheckListener.class.getName()))
|
||||||
));
|
.accessor(CheckRoleAssessor.class.getName())
|
||||||
|
.build();
|
||||||
|
flowableManager.create(userCheckNode, roleCheckNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,66 +79,34 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
|
|||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
@Override
|
||||||
public void submit(Long id) throws JsonProcessingException {
|
public void submit(Long id) {
|
||||||
|
User user = userService.currentLoginUser();
|
||||||
Authentication authentication = detailOrThrow(id);
|
Authentication authentication = detailOrThrow(id);
|
||||||
authentication.setState(CheckingNeededEntity.State.OWNER_CHECKING);
|
String instanceId = flowableManager.start(
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
AUTHENTICATION_FLOW_ID,
|
||||||
"authentication_owner_check",
|
MapUtil.<String, Object>builder()
|
||||||
StrUtil.format("数据资源「{}」的授权申请", authentication.getTarget().getName()),
|
.put("authenticationId", id)
|
||||||
CheckOrder.Type.AUTHENTICATION,
|
.put("type", "AUTHENTICATION")
|
||||||
mapper.writeValueAsString(Maps.immutable.of("authenticationId", authentication.getId())),
|
.put("createdUsername", user.getUsername())
|
||||||
"com.eshore.gringotts.web.domain.service.AuthenticationService",
|
.put("modifiedUsername", user.getUsername())
|
||||||
authentication.getCreatedUser()
|
.put(UserAssessor.KEY, authentication.getTarget().getCreatedUser().getId())
|
||||||
));
|
.build(),
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
authentication.getTarget().getCreatedUser().getId().toString()
|
||||||
authentication.setOrder(order);
|
);
|
||||||
save(authentication);
|
authenticationRepository.updateInstanceIdById(id, instanceId);
|
||||||
}
|
authenticationRepository.updateStateById(id, Confirmation.State.CHECKING);
|
||||||
|
|
||||||
@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
|
@Override
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
public void retract(Long id) {
|
||||||
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
|
||||||
Long id = (Long) parameters.get("authenticationId");
|
|
||||||
Authentication authentication = detailOrThrow(id);
|
Authentication authentication = detailOrThrow(id);
|
||||||
if (StrUtil.equals(order.getKeyword(), "authentication_owner_check")) {
|
flowableManager.terminal(authentication.getFlowableInstanceId());
|
||||||
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) {
|
@Override
|
||||||
case APPLY:
|
protected Object archive(Authentication entity) {
|
||||||
authentication.setState(Authentication.State.NORMAL);
|
return "";
|
||||||
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 {
|
||||||
@@ -150,4 +114,44 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
|
|||||||
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
super("数据资源已绑定该账号的授权申请,无法再次申请");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public static final class AuthenticationFlowUserCheckListener extends FlowableListener.AbstractFlowableListener {
|
||||||
|
private final AuthenticationRepository authenticationRepository;
|
||||||
|
|
||||||
|
public AuthenticationFlowUserCheckListener(AuthenticationRepository authenticationRepository) {
|
||||||
|
this.authenticationRepository = authenticationRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActionComplete(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||||
|
FlowableMetadata metadata = instance.getMetadata();
|
||||||
|
Long authenticationId = metadata.getLong("authenticationId");
|
||||||
|
if (FlowableAction.APPROVE.equals(action)) {
|
||||||
|
instance.setExtra(User.Role.CHECKER.name());
|
||||||
|
} else {
|
||||||
|
authenticationRepository.updateStateById(authenticationId, Confirmation.State.DRAFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public static final class AuthenticationFlowRoleCheckListener extends FlowableListener.AbstractFlowableListener {
|
||||||
|
private final AuthenticationRepository authenticationRepository;
|
||||||
|
|
||||||
|
public AuthenticationFlowRoleCheckListener(AuthenticationRepository authenticationRepository) {
|
||||||
|
this.authenticationRepository = authenticationRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActionComplete(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||||
|
FlowableMetadata metadata = instance.getMetadata();
|
||||||
|
Long authenticationId = metadata.getLong("authenticationId");
|
||||||
|
if (FlowableAction.APPROVE.equals(action)) {
|
||||||
|
authenticationRepository.updateStateById(authenticationId, CheckingNeededEntity.State.NORMAL);
|
||||||
|
} else {
|
||||||
|
authenticationRepository.updateStateById(authenticationId, Confirmation.State.DRAFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
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.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.CheckOrderRepository;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
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 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @date 2024-11-29
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
public class CheckOrderService extends SimpleServiceSupport<CheckOrder> {
|
|
||||||
private final ApplicationContext applicationContext;
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
private final CheckOrderRepository checkOrderRepository;
|
|
||||||
private final UserService userService;
|
|
||||||
|
|
||||||
public CheckOrderService(CheckOrderRepository repository, UserService userService, ApplicationContext applicationContext, Jackson2ObjectMapperBuilder builder) {
|
|
||||||
super(repository, userService);
|
|
||||||
this.applicationContext = applicationContext;
|
|
||||||
this.mapper = builder.build();
|
|
||||||
this.checkOrderRepository = repository;
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<CheckOrder> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
||||||
User user = userService.currentLoginUser();
|
|
||||||
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 {
|
|
||||||
CheckOrder order = detailOrThrow(id);
|
|
||||||
CheckingService service = applicationContext.getBean(order.getTargetClass(), CheckingService.class);
|
|
||||||
if (ObjectUtil.isNull(service)) {
|
|
||||||
throw new RuntimeException(StrUtil.format("名为「{}」的服务未找到", order.getTargetClass()));
|
|
||||||
}
|
|
||||||
ImmutableMap<String, Object> parameters = mapper.readValue(order.getParameters(), new TypeReference<>() {});
|
|
||||||
service.onChecked(order, operation, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void retract(Long id) {
|
|
||||||
checkOrderRepository.overById(id, CheckOrder.State.RETRACT, userService.currentLoginUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void over(Long id) {
|
|
||||||
checkOrderRepository.overById(id, CheckOrder.State.OVER, userService.currentLoginUser());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +1,24 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
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.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
|
||||||
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.DataResource;
|
||||||
import com.eshore.gringotts.web.domain.entity.User;
|
import com.eshore.gringotts.web.domain.entity.User;
|
||||||
|
import com.eshore.gringotts.web.domain.flowable.CheckRoleAssessor;
|
||||||
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.eshore.gringotts.web.helper.AmisHelper;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
|
||||||
import javax.persistence.criteria.Join;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
||||||
import javax.persistence.criteria.JoinType;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
import javax.persistence.criteria.Predicate;
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
import javax.persistence.criteria.Root;
|
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.springframework.stereotype.Component;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,42 +26,69 @@ 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 SimpleServiceSupport<Confirmation> implements CheckingService {
|
public class ConfirmationService extends CheckingService<Confirmation> {
|
||||||
private final ConfirmationRepository confirmationRepository;
|
private static final String CONFIRMATION_FLOW_ID = "69d8ded5-35fd-4f03-b11a-be0ed91a4b8b";
|
||||||
private final CheckOrderService checkOrderService;
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
private final ConfirmationRepository confirmationRepository;
|
||||||
super(confirmationRepository, userService);
|
private final SpringFlowableManager flowableManager;
|
||||||
|
|
||||||
|
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService, EntityManager entityManager, SpringFlowableManager flowableManager) {
|
||||||
|
super(confirmationRepository, userService, entityManager);
|
||||||
this.confirmationRepository = confirmationRepository;
|
this.confirmationRepository = confirmationRepository;
|
||||||
this.checkOrderService = checkOrderService;
|
|
||||||
this.mapper = builder.build();
|
this.flowableManager = flowableManager;
|
||||||
|
FlowableNode node = FlowableNode.builder()
|
||||||
|
.nodeId(CONFIRMATION_FLOW_ID)
|
||||||
|
.name("确权审查")
|
||||||
|
.description("确权审查")
|
||||||
|
.listeners(Lists.mutable.of(ConfirmationService.ConfirmationFlowRoleCheckListener.class.getName()))
|
||||||
|
.accessor(CheckRoleAssessor.class.getName())
|
||||||
|
.build();
|
||||||
|
flowableManager.create(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ImmutableList<Predicate> listPredicate(Root<Confirmation> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
public void submit(Long id) {
|
||||||
User loginUser = userService.currentLoginUser();
|
Confirmation confirmation = detailOrThrow(id);
|
||||||
if (User.isAdministrator(loginUser)) {
|
User user = userService.currentLoginUser();
|
||||||
return Lists.immutable.empty();
|
String instanceId = flowableManager.start(
|
||||||
|
CONFIRMATION_FLOW_ID,
|
||||||
|
MapUtil.<String, Object>builder()
|
||||||
|
.put("confirmationId", id)
|
||||||
|
.put("type", "CONFIRMATION")
|
||||||
|
.put("snapshot", archive(confirmation))
|
||||||
|
.put("createdUsername", user.getUsername())
|
||||||
|
.put("modifiedUsername", user.getUsername())
|
||||||
|
.build(),
|
||||||
|
User.Role.CHECKER.name()
|
||||||
|
);
|
||||||
|
confirmationRepository.updateInstanceIdById(id, instanceId);
|
||||||
|
confirmationRepository.updateStateById(id, Confirmation.State.CHECKING);
|
||||||
}
|
}
|
||||||
Join<Confirmation, CheckOrder> orderJoin = root.join(Confirmation_.order, JoinType.LEFT);
|
|
||||||
return Lists.immutable.of(builder.or(
|
@Override
|
||||||
builder.equal(root.get(Confirmation_.createdUser), loginUser),
|
public void retract(Long id) {
|
||||||
builder.and(
|
Confirmation confirmation = detailOrThrow(id);
|
||||||
builder.isNotNull(orderJoin),
|
flowableManager.terminal(confirmation.getFlowableInstanceId());
|
||||||
builder.or(
|
}
|
||||||
builder.and(
|
|
||||||
builder.equal(orderJoin.get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
@Override
|
||||||
builder.equal(orderJoin.get(CheckOrder_.targetRole), loginUser.getRole())
|
protected Object archive(Confirmation entity) {
|
||||||
),
|
DataResource resource = entity.getTarget();
|
||||||
builder.and(
|
return AmisHelper.wrapper(
|
||||||
builder.equal(orderJoin.get(CheckOrder_.target), CheckOrder.Target.USER),
|
AmisHelper.property(resource),
|
||||||
builder.equal(orderJoin.get(CheckOrder_.targetUser), loginUser)
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(entity),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource.getExample()),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(
|
||||||
|
"确权申请信息",
|
||||||
|
AmisHelper.propertyItem("描述", entity.getDescription()),
|
||||||
|
AmisHelper.propertyItem(entity.getEvidences())
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,58 +99,29 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
|
|||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
|
||||||
public void submit(Long id) throws JsonProcessingException {
|
|
||||||
Confirmation confirmation = detailOrThrow(id);
|
|
||||||
confirmation.setState(Confirmation.State.CHECKING);
|
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
|
||||||
"confirmation_check",
|
|
||||||
StrUtil.format("数据资源「{}」的确权申请", confirmation.getTarget().getName()),
|
|
||||||
CheckOrder.Type.CONFIRMATION,
|
|
||||||
mapper.writeValueAsString(Maps.immutable.of("confirmationId", confirmation.getId())),
|
|
||||||
"com.eshore.gringotts.web.domain.service.ConfirmationService",
|
|
||||||
User.Role.CHECKER
|
|
||||||
));
|
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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 {
|
||||||
public ConfirmationDuplicatedException() {
|
public ConfirmationDuplicatedException() {
|
||||||
super("数据资源已绑定确权申请,无法再次申请");
|
super("数据资源已绑定确权申请,无法再次申请");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public static final class ConfirmationFlowRoleCheckListener extends FlowableListener.AbstractFlowableListener {
|
||||||
|
private final ConfirmationRepository confirmationRepository;
|
||||||
|
|
||||||
|
public ConfirmationFlowRoleCheckListener(ConfirmationRepository confirmationRepository) {
|
||||||
|
this.confirmationRepository = confirmationRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActionComplete(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||||
|
FlowableMetadata metadata = instance.getMetadata();
|
||||||
|
Long confirmationId = metadata.getLong("confirmationId");
|
||||||
|
if (action == FlowableAction.APPROVE) {
|
||||||
|
confirmationRepository.updateStateById(confirmationId, Confirmation.State.NORMAL);
|
||||||
|
} else {
|
||||||
|
confirmationRepository.updateStateById(confirmationId, Confirmation.State.DRAFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
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.Authentication_;
|
||||||
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
import com.eshore.gringotts.web.domain.entity.Confirmation;
|
||||||
@@ -14,7 +14,7 @@ import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
|||||||
import com.eshore.gringotts.web.domain.repository.DataResourceRepository;
|
import com.eshore.gringotts.web.domain.repository.DataResourceRepository;
|
||||||
import com.eshore.gringotts.web.domain.repository.ResourceFormatRepository;
|
import com.eshore.gringotts.web.domain.repository.ResourceFormatRepository;
|
||||||
import com.eshore.gringotts.web.domain.repository.ResourceTypeRepository;
|
import com.eshore.gringotts.web.domain.repository.ResourceTypeRepository;
|
||||||
import com.eshore.gringotts.web.helper.EntityHelper;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
import javax.persistence.criteria.Join;
|
import javax.persistence.criteria.Join;
|
||||||
@@ -34,14 +34,14 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DataResourceService extends SimpleServiceSupport<DataResource> {
|
public class DataResourceService extends LogicDeleteService<DataResource> {
|
||||||
private final DataResourceRepository dataResourceRepository;
|
private final DataResourceRepository dataResourceRepository;
|
||||||
private final ResourceTypeRepository resourceTypeRepository;
|
private final ResourceTypeRepository resourceTypeRepository;
|
||||||
private final ResourceFormatRepository resourceFormatRepository;
|
private final ResourceFormatRepository resourceFormatRepository;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
public DataResourceService(DataResourceRepository repository, ResourceTypeRepository resourceTypeRepository, ResourceFormatRepository resourceFormatRepository, UserService userService) {
|
public DataResourceService(DataResourceRepository repository, ResourceTypeRepository resourceTypeRepository, ResourceFormatRepository resourceFormatRepository, UserService userService, EntityManager entityManager) {
|
||||||
super(repository, userService);
|
super(repository, userService, entityManager);
|
||||||
this.dataResourceRepository = repository;
|
this.dataResourceRepository = repository;
|
||||||
this.resourceTypeRepository = resourceTypeRepository;
|
this.resourceTypeRepository = resourceTypeRepository;
|
||||||
this.resourceFormatRepository = resourceFormatRepository;
|
this.resourceFormatRepository = resourceFormatRepository;
|
||||||
@@ -55,26 +55,8 @@ public class DataResourceService extends SimpleServiceSupport<DataResource> {
|
|||||||
return Lists.immutable.empty();
|
return Lists.immutable.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Subquery<Confirmation> confirmationSubquery = query.subquery(Confirmation.class);
|
|
||||||
Root<Confirmation> confirmationRoot = confirmationSubquery.from(Confirmation.class);
|
|
||||||
confirmationSubquery.select(confirmationRoot)
|
|
||||||
.where(
|
|
||||||
builder.equal(confirmationRoot.get(Confirmation_.target), root),
|
|
||||||
EntityHelper.checkNeededEntityPrediction(confirmationRoot, builder, loginUser)
|
|
||||||
);
|
|
||||||
|
|
||||||
Subquery<Authentication> authenticationSubquery = query.subquery(Authentication.class);
|
|
||||||
Root<Authentication> authenticationRoot = authenticationSubquery.from(Authentication.class);
|
|
||||||
authenticationSubquery.select(authenticationRoot)
|
|
||||||
.where(
|
|
||||||
builder.equal(authenticationRoot.get(Authentication_.target), root),
|
|
||||||
EntityHelper.checkNeededEntityPrediction(authenticationRoot, builder, loginUser)
|
|
||||||
);
|
|
||||||
|
|
||||||
return Lists.immutable.of(builder.or(
|
return Lists.immutable.of(builder.or(
|
||||||
builder.equal(root.get(DataResource_.createdUser), loginUser),
|
builder.equal(root.get(DataResource_.createdUser), loginUser)
|
||||||
builder.exists(confirmationSubquery),
|
|
||||||
builder.exists(authenticationSubquery)
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class UserService {
|
|||||||
if (userRepository.count() == 0) {
|
if (userRepository.count() == 0) {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setUsername("administrator@eshore.com");
|
user.setUsername("administrator@eshore.com");
|
||||||
user.setPassword(encryptPassword("administrator"));
|
user.setPassword(encryptPassword("bLiN+,qAss,uo'nxoH_:d@HEdD*WdZWAudq$J'a$5Z#aS>K-*dWN5L-i<m:w/U,R"));
|
||||||
user.setRole(User.Role.ADMINISTRATOR);
|
user.setRole(User.Role.ADMINISTRATOR);
|
||||||
user.setState(User.State.NORMAL);
|
user.setState(User.State.NORMAL);
|
||||||
user.setCheckedUser(user);
|
user.setCheckedUser(user);
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
package com.eshore.gringotts.web.domain.service;
|
package com.eshore.gringotts.web.domain.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
import com.eshore.gringotts.web.domain.base.service.CheckingService;
|
||||||
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
|
import com.eshore.gringotts.web.domain.entity.DataResource;
|
||||||
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.Ware;
|
import com.eshore.gringotts.web.domain.entity.Ware;
|
||||||
|
import com.eshore.gringotts.web.domain.flowable.UserAssessor;
|
||||||
import com.eshore.gringotts.web.domain.repository.WareRepository;
|
import com.eshore.gringotts.web.domain.repository.WareRepository;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.eshore.gringotts.web.helper.AmisHelper;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableAction;
|
||||||
import javax.transaction.Transactional;
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableInstance;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableListener;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableMetadata;
|
||||||
|
import com.lanyuanxiaoyao.flowable.core.model.FlowableNode;
|
||||||
|
import com.lanyuanxiaoyao.flowable.jpa.SpringFlowableManager;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
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.stereotype.Component;
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,17 +27,28 @@ 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 SimpleServiceSupport<Ware> implements CheckingService {
|
public class WareService extends CheckingService<Ware> {
|
||||||
private final WareRepository wareRepository;
|
private static final String WARE_FLOW_ID = "870e7376-1713-48ed-9e60-e602981c6ecc";
|
||||||
private final CheckOrderService checkOrderService;
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
public WareService(WareRepository repository, UserService userService, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
|
private final WareRepository wareRepository;
|
||||||
super(repository, userService);
|
private final UserService userService;
|
||||||
|
private final SpringFlowableManager flowableManager;
|
||||||
|
|
||||||
|
public WareService(WareRepository repository, UserService userService, EntityManager entityManager, SpringFlowableManager flowableManager) {
|
||||||
|
super(repository, userService, entityManager);
|
||||||
this.wareRepository = repository;
|
this.wareRepository = repository;
|
||||||
this.checkOrderService = checkOrderService;
|
this.userService = userService;
|
||||||
this.mapper = builder.build();
|
|
||||||
|
this.flowableManager = flowableManager;
|
||||||
|
FlowableNode node = FlowableNode.builder()
|
||||||
|
.nodeId(WARE_FLOW_ID)
|
||||||
|
.name("上架审查")
|
||||||
|
.description("上架审查")
|
||||||
|
.listeners(Lists.mutable.of(WareService.WareFlowUserCheckListener.class.getName()))
|
||||||
|
.accessor(UserAssessor.class.getName())
|
||||||
|
.build();
|
||||||
|
flowableManager.create(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableList<Ware> listPublic() {
|
public ImmutableList<Ware> listPublic() {
|
||||||
@@ -42,52 +57,71 @@ public class WareService extends SimpleServiceSupport<Ware> implements CheckingS
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters) {
|
public void submit(Long id) {
|
||||||
if (StrUtil.equals(order.getKeyword(), "ware_check")) {
|
User user = userService.currentLoginUser();
|
||||||
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 ware = detailOrThrow(id);
|
||||||
ware.setState(Ware.State.CHECKING);
|
String instanceId = flowableManager.start(
|
||||||
Long orderId = checkOrderService.save(new CheckOrder(
|
WARE_FLOW_ID,
|
||||||
"ware_check",
|
MapUtil.<String, Object>builder()
|
||||||
StrUtil.format("数据资源「{}」的上架申请", ware.getName()),
|
.put("wareId", id)
|
||||||
CheckOrder.Type.MARKET,
|
.put("type", "WARE")
|
||||||
mapper.writeValueAsString(Maps.immutable.of("wareId", ware.getId())),
|
.put("snapshot", archive(ware))
|
||||||
"com.eshore.gringotts.web.domain.service.WareService",
|
.put("createdUsername", user.getUsername())
|
||||||
User.Role.CHECKER
|
.put("modifiedUsername", user.getUsername())
|
||||||
));
|
.put(UserAssessor.KEY, ware.getResource().getCreatedUser().getId())
|
||||||
CheckOrder order = checkOrderService.detailOrThrow(orderId);
|
.build(),
|
||||||
ware.setOrder(order);
|
ware.getResource().getCreatedUser().getId().toString()
|
||||||
save(ware);
|
);
|
||||||
|
wareRepository.updateInstanceIdById(id, instanceId);
|
||||||
|
wareRepository.updateStateById(id, Ware.State.CHECKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackOn = Throwable.class)
|
@Override
|
||||||
public void retract(Long id) {
|
public void retract(Long id) {
|
||||||
Ware ware = detailOrThrow(id);
|
Ware ware = detailOrThrow(id);
|
||||||
ware.setState(Ware.State.DRAFT);
|
flowableManager.terminal(ware.getFlowableInstanceId());
|
||||||
save(ware);
|
}
|
||||||
|
|
||||||
CheckOrder order = ware.getOrder();
|
@Override
|
||||||
order.setState(CheckOrder.State.RETRACT);
|
protected Object archive(Ware entity) {
|
||||||
checkOrderService.save(order);
|
DataResource resource = entity.getResource();
|
||||||
|
return AmisHelper.wrapper(
|
||||||
|
AmisHelper.property(
|
||||||
|
"商品信息",
|
||||||
|
AmisHelper.propertyItem("名称", entity.getName()),
|
||||||
|
AmisHelper.propertyItem(
|
||||||
|
"标签",
|
||||||
|
Lists.immutable.ofAll(entity.getTags()).collect(AmisHelper::tag)
|
||||||
|
),
|
||||||
|
AmisHelper.propertyItem("简介", entity.getDescription(), 3),
|
||||||
|
AmisHelper.propertyItem("内容", entity.getContent(), 3)
|
||||||
|
),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(entity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public static final class WareFlowUserCheckListener extends FlowableListener.AbstractFlowableListener {
|
||||||
|
private final WareRepository wareRepository;
|
||||||
|
|
||||||
|
public WareFlowUserCheckListener(WareRepository wareRepository) {
|
||||||
|
this.wareRepository = wareRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActionComplete(FlowableInstance instance, FlowableNode node, FlowableAction action) {
|
||||||
|
FlowableMetadata metadata = instance.getMetadata();
|
||||||
|
Long wareId = metadata.getLong("wareId");
|
||||||
|
if (FlowableAction.APPROVE.equals(action)) {
|
||||||
|
wareRepository.updateStateById(wareId, Ware.State.NORMAL);
|
||||||
|
} else {
|
||||||
|
wareRepository.updateStateById(wareId, Ware.State.DRAFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,250 @@
|
|||||||
|
package com.eshore.gringotts.web.helper;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapBuilder;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.DataFile;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.DataResource;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.format.CsvResourceFormat;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.format.JsonLineResourceFormat;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.format.JsonResourceFormat;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.format.ResourceFormat;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.ApiResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.DatabaseResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.FileResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.FtpResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.HDFSResourceType;
|
||||||
|
import com.eshore.gringotts.web.domain.entity.type.ResourceType;
|
||||||
|
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.MutableList;
|
||||||
|
import org.eclipse.collections.api.map.ImmutableMap;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20250108
|
||||||
|
*/
|
||||||
|
public class AmisHelper {
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> wrapper(ImmutableMap<Object, Object>... body) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("type", "wrapper");
|
||||||
|
builder.put("size", "none");
|
||||||
|
builder.put("body", body);
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> divider() {
|
||||||
|
return Maps.immutable.of("type", "divider");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> property(ImmutableMap<Object, Object>... items) {
|
||||||
|
return property(null, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ImmutableList<ImmutableMap<Object, Object>> items) {
|
||||||
|
return property(null, items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public static ImmutableMap<Object, Object> property(String title, ImmutableMap<Object, Object>... items) {
|
||||||
|
return property(title, Lists.immutable.of(items));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(String title, ImmutableList<ImmutableMap<Object, Object>> items) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("type", "property");
|
||||||
|
if (StrUtil.isNotBlank(title)) {
|
||||||
|
builder.put("title", title);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(items)) {
|
||||||
|
builder.put("items", items);
|
||||||
|
}
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(DataResource resource) {
|
||||||
|
return AmisHelper.wrapper(
|
||||||
|
AmisHelper.property(
|
||||||
|
AmisHelper.propertyItem("资源名称", resource.getName(), 3),
|
||||||
|
AmisHelper.propertyItem("资源描述", resource.getDescription(), 3)
|
||||||
|
),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource.getType()),
|
||||||
|
AmisHelper.divider(),
|
||||||
|
AmisHelper.property(resource.getFormat())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ResourceType type) {
|
||||||
|
type = Hibernate.unproxy(type, ResourceType.class);
|
||||||
|
MutableList<ImmutableMap<Object, Object>> items = Lists.mutable.empty();
|
||||||
|
switch (type.getResourceType()) {
|
||||||
|
case API:
|
||||||
|
ApiResourceType apiResourceType = (ApiResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "API", 3));
|
||||||
|
items.add(propertyItem("用户名", apiResourceType.getUsername(), 1));
|
||||||
|
items.add(propertyItem("密码", apiResourceType.getPassword(), 2));
|
||||||
|
items.add(propertyItem("地址", apiResourceType.getUrl(), 3));
|
||||||
|
break;
|
||||||
|
case FILE:
|
||||||
|
FileResourceType fileResourceType = (FileResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "文件", 3));
|
||||||
|
items.add(propertyItem(fileResourceType.getFile()));
|
||||||
|
break;
|
||||||
|
case DATABASE:
|
||||||
|
DatabaseResourceType databaseResourceType = (DatabaseResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "数据库"));
|
||||||
|
items.add(propertyItem("数据库", databaseResourceType.getDatabaseType().name(), 3));
|
||||||
|
items.add(propertyItem("地址", databaseResourceType.getJdbc(), 3));
|
||||||
|
items.add(propertyItem("用户名", databaseResourceType.getUsername(), 1));
|
||||||
|
items.add(propertyItem("密码", databaseResourceType.getPassword(), 2));
|
||||||
|
break;
|
||||||
|
case HDFS:
|
||||||
|
HDFSResourceType hdfsResourceType = (HDFSResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "HDFS"));
|
||||||
|
items.add(propertyItem("core-site", hdfsResourceType.getCoreSite()));
|
||||||
|
items.add(propertyItem("hdfs-site", hdfsResourceType.getHdfsSite()));
|
||||||
|
break;
|
||||||
|
case FTP:
|
||||||
|
FtpResourceType ftpResourceType = (FtpResourceType) type;
|
||||||
|
items.add(propertyItem("资源类型", "FTP"));
|
||||||
|
items.add(propertyItem("地址", ftpResourceType.getUrl(), 3));
|
||||||
|
items.add(propertyItem("用户名", ftpResourceType.getUsername(), 1));
|
||||||
|
items.add(propertyItem("密码", ftpResourceType.getPassword(), 2));
|
||||||
|
items.add(propertyItem("根路径", ftpResourceType.getPath(), 3));
|
||||||
|
items.add(propertyItem("正则匹配过滤", ftpResourceType.getRegexFilter(), 3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return property("资源类型定义", items.toImmutable());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(ResourceFormat format) {
|
||||||
|
format = Hibernate.unproxy(format, ResourceFormat.class);
|
||||||
|
MutableList<ImmutableMap<Object, Object>> items = Lists.mutable.empty();
|
||||||
|
switch (format.getFormatType()) {
|
||||||
|
case NONE:
|
||||||
|
items.add(propertyItem("格式类型", "文件", 3));
|
||||||
|
break;
|
||||||
|
case LINE:
|
||||||
|
items.add(propertyItem("格式类型", "文本行", 3));
|
||||||
|
break;
|
||||||
|
case JSON:
|
||||||
|
JsonResourceFormat jsonResourceFormat = (JsonResourceFormat) format;
|
||||||
|
items.add(propertyItem("格式类型", "Json", 3));
|
||||||
|
items.add(propertyItem("格式详情", editor("json", jsonResourceFormat.getJsonSchema()), 3));
|
||||||
|
break;
|
||||||
|
case JSON_LINE:
|
||||||
|
JsonLineResourceFormat jsonLineResourceFormat = (JsonLineResourceFormat) format;
|
||||||
|
items.add(propertyItem("格式类型", "Json Line", 3));
|
||||||
|
items.add(propertyItem("格式详情", editor("json", jsonLineResourceFormat.getJsonSchema()), 3));
|
||||||
|
break;
|
||||||
|
case CSV:
|
||||||
|
CsvResourceFormat csvResourceFormat = (CsvResourceFormat) format;
|
||||||
|
items.add(propertyItem("格式类型", "CSV文本", 3));
|
||||||
|
items.add(propertyItem("格式详情", editor("json", csvResourceFormat.getCsvSchema()), 3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return property("资源格式定义", items.toImmutable());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(SimpleEntity entity) {
|
||||||
|
return property(
|
||||||
|
propertyItem("创建人", entity.getCreatedUser().getUsername(), 2),
|
||||||
|
propertyItem("创建时间", entity.getCreatedTime()),
|
||||||
|
propertyItem("修改人", entity.getModifiedUser().getUsername(), 2),
|
||||||
|
propertyItem("修改时间", entity.getModifiedTime())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> property(DataFile dataFile) {
|
||||||
|
return property(
|
||||||
|
propertyItem("资源示例", dataFile)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, Object content) {
|
||||||
|
return propertyItem(label, content, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, Object content, Integer span) {
|
||||||
|
MapBuilder<Object, Object> builder = MapUtil.builder();
|
||||||
|
builder.put("label", label);
|
||||||
|
builder.put("content", content);
|
||||||
|
if (ObjectUtil.isNotNull(span)) {
|
||||||
|
builder.put("span", span);
|
||||||
|
}
|
||||||
|
return Maps.immutable.ofMap(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, DataFile dataFile) {
|
||||||
|
return propertyItem(label, Lists.immutable.of(dataFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(DataFile dataFile) {
|
||||||
|
return propertyItem(Lists.immutable.of(dataFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(Iterable<DataFile> dataFiles) {
|
||||||
|
return propertyItem("文件", Lists.immutable.ofAll(dataFiles));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> propertyItem(String label, ImmutableList<DataFile> dataFiles) {
|
||||||
|
return propertyItem(
|
||||||
|
label,
|
||||||
|
flex(dataFiles.collect(file -> ajaxAction(file.getFilename(), "${base}/upload/download/" + file.getId()))),
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> tag(String value) {
|
||||||
|
return Maps.immutable.ofMap(MapUtil.builder()
|
||||||
|
.put("type", "tag")
|
||||||
|
.put("label", value)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> editor(String language, String value) {
|
||||||
|
return Maps.immutable.ofMap(MapUtil.builder()
|
||||||
|
.put("disabled", true)
|
||||||
|
.put("type", "editor")
|
||||||
|
.put("language", language)
|
||||||
|
.put("value", value)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> flex(ImmutableList<ImmutableMap<Object, Object>> items) {
|
||||||
|
return Maps.immutable.ofMap(MapUtil.builder()
|
||||||
|
.put("type", "flex")
|
||||||
|
.put("direction", "column")
|
||||||
|
.put("alignItems", "start")
|
||||||
|
.put("items", items)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> ajaxAction(String label, String url) {
|
||||||
|
return Maps.immutable.ofMap(MapUtil.builder()
|
||||||
|
.put("type", "action")
|
||||||
|
.put("actionType", "ajax")
|
||||||
|
.put("label", label)
|
||||||
|
.put("level", "link")
|
||||||
|
.put("api", apiDownload(url))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImmutableMap<Object, Object> apiDownload(String url) {
|
||||||
|
return Maps.immutable.ofMap(MapUtil.builder()
|
||||||
|
.put("method", "get")
|
||||||
|
.put("url", url)
|
||||||
|
.put("responseType", "blob")
|
||||||
|
.put("headers", MapUtil.builder()
|
||||||
|
.put("token", "${token|default:undefined}")
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,6 @@ 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.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 java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
@@ -28,14 +25,14 @@ public class EntityHelper {
|
|||||||
|
|
||||||
public static Predicate checkNeededEntityPrediction(Root<? extends CheckingNeededEntity> root, CriteriaBuilder builder, User loginUser) {
|
public static Predicate checkNeededEntityPrediction(Root<? extends CheckingNeededEntity> root, CriteriaBuilder builder, User loginUser) {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.and(
|
/* builder.and(
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.ROLE),
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetRole), loginUser.getRole())
|
||||||
),
|
),
|
||||||
builder.and(
|
builder.and(
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.target), CheckOrder.Target.USER),
|
||||||
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetUser), loginUser)
|
builder.equal(root.get(CheckingNeededEntity_.order).get(CheckOrder_.targetUser), loginUser)
|
||||||
)
|
) */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.eshore.gringotts.web.helper;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.EnumUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.eshore.gringotts.web.domain.base.controller.query.Query;
|
||||||
|
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity_;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
import javax.persistence.criteria.Path;
|
||||||
|
import javax.persistence.criteria.Predicate;
|
||||||
|
import javax.persistence.criteria.Root;
|
||||||
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
import org.eclipse.collections.api.list.MutableList;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lanyuanxiaoyao
|
||||||
|
* @version 20250114
|
||||||
|
*/
|
||||||
|
public class QueryHelper {
|
||||||
|
private static <ENTITY, Y> Path<Y> column(Root<ENTITY> root, String column) {
|
||||||
|
String[] columns = StrUtil.splitToArray(column, "/");
|
||||||
|
Path<Y> path = root.get(columns[0]);
|
||||||
|
for (int i = 1; i < columns.length; i++) {
|
||||||
|
path = path.get(columns[i]);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
private static <Y> Object value(Path<Y> column, Object value) {
|
||||||
|
Class<?> javaType = column.getJavaType();
|
||||||
|
if (EnumUtil.isEnum(javaType)) {
|
||||||
|
return EnumUtil.fromString((Class<Enum>) javaType, (String) value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <ENTITY> ImmutableList<Predicate> queryPredicates(Query.Queryable queryable, Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
||||||
|
MutableList<Predicate> predicates = Lists.mutable.empty();
|
||||||
|
if (ObjectUtil.isEmpty(queryable)) {
|
||||||
|
return predicates.toImmutable();
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNullEqual())) {
|
||||||
|
queryable.getNullEqual().forEach(column -> predicates.add(builder.isNull(column(root, column))));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotNullEqual())) {
|
||||||
|
queryable.getNotNullEqual().forEach(column -> predicates.add(builder.isNull(column(root, column))));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getEmpty())) {
|
||||||
|
queryable.getEmpty().forEach(column -> predicates.add(builder.isEmpty(column(root, column))));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotEmpty())) {
|
||||||
|
queryable.getNotEmpty().forEach(column -> predicates.add(builder.isNotEmpty(column(root, column))));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getEqual())) {
|
||||||
|
queryable.getEqual().forEachKeyValue((column, value) -> {
|
||||||
|
Path<Object> path = column(root, column);
|
||||||
|
predicates.add(builder.equal(path, value(path, value)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotEqual())) {
|
||||||
|
queryable.getEqual().forEachKeyValue((column, value) -> {
|
||||||
|
Path<Object> path = column(root, column);
|
||||||
|
predicates.add(builder.notEqual(path, value(path, value)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getLike())) {
|
||||||
|
queryable.getLike().forEachKeyValue((column, value) -> predicates.add(builder.like(column(root, column), value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotLike())) {
|
||||||
|
queryable.getNotLike().forEachKeyValue((column, value) -> predicates.add(builder.notLike(column(root, column), value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getGreat())) {
|
||||||
|
queryable.getGreat().forEachKeyValue((column, value) -> predicates.add(builder.greaterThan(column(root, column), (Comparable<Object>) value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getLess())) {
|
||||||
|
queryable.getLess().forEachKeyValue((column, value) -> predicates.add(builder.lessThan(column(root, column), (Comparable<Object>) value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getGreatEqual())) {
|
||||||
|
queryable.getGreatEqual().forEachKeyValue((column, value) -> predicates.add(builder.greaterThanOrEqualTo(column(root, column), (Comparable<Object>) value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getLessEqual())) {
|
||||||
|
queryable.getLessEqual().forEachKeyValue((column, value) -> predicates.add(builder.lessThanOrEqualTo(column(root, column), (Comparable<Object>) value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getIn())) {
|
||||||
|
queryable.getIn().forEachKeyValue((column, value) -> predicates.add(builder.in(column(root, column)).value(value)));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotIn())) {
|
||||||
|
queryable.getNotIn().forEachKeyValue((column, value) -> predicates.add(builder.in(column(root, column)).value(value).not()));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getBetween())) {
|
||||||
|
queryable.getBetween().forEachKeyValue((column, value) -> predicates.add(builder.between(column(root, column), value.getStart(), value.getEnd())));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(queryable.getNotBetween())) {
|
||||||
|
queryable.getNotBetween().forEachKeyValue((column, value) -> predicates.add(builder.between(column(root, column), value.getStart(), value.getEnd())));
|
||||||
|
}
|
||||||
|
return predicates.toImmutable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Pageable pageable(Query query) {
|
||||||
|
if (ObjectUtil.isNull(query)) {
|
||||||
|
return PageRequest.of(0, 10);
|
||||||
|
}
|
||||||
|
int page = Math.max(query.getPage().getPage() - 1, 0);
|
||||||
|
if (ObjectUtil.isEmpty(query.getSort())) {
|
||||||
|
return org.springframework.data.domain.PageRequest.of(page, query.getPage().getSize(), Sort.by(Sort.Direction.DESC, SimpleEntity_.CREATED_TIME));
|
||||||
|
} else {
|
||||||
|
List<Sort.Order> orders = query.getSort()
|
||||||
|
.collect(sortable -> new Sort.Order(Sort.Direction.fromString(sortable.getDirection().name()), sortable.getColumn()))
|
||||||
|
.toList();
|
||||||
|
return org.springframework.data.domain.PageRequest.of(page, query.getPage().getSize(), Sort.by(orders));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,10 +6,10 @@ spring:
|
|||||||
profiles:
|
profiles:
|
||||||
include: common,metrics,encrypt
|
include: common,metrics,encrypt
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:h2:./database;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
url: jdbc:mysql://132.122.1.185:31000/gringotts
|
||||||
username: lanyuanxiaoyao
|
username: iap
|
||||||
password: lanyuanxiaoyao
|
password: SLvwP6@SM2J*SbUw_iap
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
jpa:
|
jpa:
|
||||||
generate-ddl: true
|
generate-ddl: true
|
||||||
show-sql: true
|
show-sql: true
|
||||||
@@ -39,7 +39,31 @@ logging:
|
|||||||
spring:
|
spring:
|
||||||
config:
|
config:
|
||||||
activate:
|
activate:
|
||||||
on-profile: macOS
|
on-profile: dev
|
||||||
|
datasource:
|
||||||
|
url: jdbc:h2:./database;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
||||||
|
username: lanyuanxiaoyao
|
||||||
|
password: lanyuanxiaoyao
|
||||||
|
driver-class-name: org.h2.Driver
|
||||||
|
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: build
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://132.122.1.185:31000/gringotts
|
||||||
|
username: iap
|
||||||
|
password: SLvwP6@SM2J*SbUw_iap
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
gringotts:
|
||||||
|
upload:
|
||||||
|
upload-path: /home/iap/gringotts/upload
|
||||||
|
---
|
||||||
|
spring:
|
||||||
|
config:
|
||||||
|
activate:
|
||||||
|
on-profile: macos
|
||||||
gringotts:
|
gringotts:
|
||||||
upload:
|
upload:
|
||||||
upload-path: /Users/lanyuanxiaoyao/Project/IdeaProjects/gringotts/gringotts-web/target/upload
|
upload-path: /Users/lanyuanxiaoyao/Project/IdeaProjects/gringotts/gringotts-web/target/upload
|
||||||
|
|||||||
7
pom.xml
7
pom.xml
@@ -60,6 +60,13 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Private Dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lanyuanxiaoyao</groupId>
|
||||||
|
<artifactId>flowable-spring-boot-jpa-starter</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Dependencies -->
|
<!-- Spring Dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user