1
0

20 Commits

Author SHA1 Message Date
b774806e58 feat(web): 优化代码分层 2024-12-24 18:18:11 +08:00
bb9f87dbd2 fix(web):优化代码格式
- 修改了 visibleOn 属性的字符串格式,统一使用双引号
- 移除了不必要的反引号,简化了字符串表达式
2024-12-24 14:53:54 +08:00
381c23e94c feat(web): 增加标签展示 2024-12-24 10:07:57 +08:00
30b991cc28 feat(web): 优化页面元素变化 2024-12-23 18:18:01 +08:00
fbb0ce5da3 feat(frontend): 优化打包模式识别 2024-12-20 17:25:25 +08:00
5a0c44ff35 feat(frontend): 优化登陆页面样式 2024-12-20 17:25:25 +08:00
615edb57b8 feat(frontend): 优化页面样式,更现代化 2024-12-20 16:48:59 +08:00
74b0638a07 feat(frontend): 优化数据产品展示和详情查看功能
- 在 constants.js 中更新了信息结构,使用空值合并运算符提高代码健壮性
- 在 main.js 中添加了样式文件导入,提升页面视觉效果
- 在 tab-market.js 中增加了数据产品详情对话框,丰富了产品信息展示内容
2024-12-19 19:03:36 +08:00
91e30fefe4 fix(web): 修正停止脚本中的进程查找命令
- 将 'ps ef' 修改为 'ps -ef',以确保在所有用户进程中查找
- 优化了进程查找逻辑,提高了脚本的准确性和可靠性
2024-12-19 17:25:46 +08:00
d80659ca41 feat(web): 添加应用启动和停止脚本
- 修改 start.sh 脚本,使用 nohup 启动应用并将输出重定向到 run.log
- 新增 stop.sh 脚本,实现应用的平滑停止
2024-12-19 17:19:28 +08:00
997fc4043f fix(web): 更新管理员初始密码
- 将管理员用户的初始密码从 "administrator" 更改为复杂的加密字符串
- 此修改提高了系统的初始安全性,防止使用默认密码访问
2024-12-19 17:19:13 +08:00
0892cda203 fix(web): 优化逻辑删除 2024-12-19 17:06:48 +08:00
981f84ea2b feat(web): 修改删除按钮的禁用逻辑 2024-12-19 10:48:08 +08:00
49caded436 refactor(web): 重构逻辑删除的做法,避免真删除,在业务层解决逻辑删除 2024-12-19 10:44:41 +08:00
43e9306017 refactor(web): 将权限对话框按类型拆分为独立文件- 将 dialog-permission.js拆分为 dialog-confirmation.js 和 dialog-authentication.js
- 更新 resourceList 函数以支持 showMode 参数
- 调整 tab-data.js 和 tab-market.js 以适应新的对话框结构
2024-12-18 16:26:36 +08:00
39e4e03437 feat(web): 更新数据库配置并添加新环境配置
- 新增 dev 和 build 环境配置
- 更新 macOS 环境配置- 添加 MySQL 和 H2 数据库配置
2024-12-18 16:26:15 +08:00
7319335b67 refactor(web): 调整首页 tabs 顺序
- 将 tabData()从倒数第二个位置移动到第二个位置
- 优化了 tabs 的排列顺序,提高了用户体验
2024-12-18 15:04:18 +08:00
3cf56adeac refactor(web): 优化资源对话框布局
- 将 fieldSet 组件替换为 wrapper 组件,以改善布局结构
- 为 wrapper 组件添加 size 属性,设置为 none,以适应不同资源类型的布局需求- 此修改涉及 API、FILE、DATABASE、HDFS 和 FTP资源类型的输入框布局
2024-12-18 15:04:02 +08:00
083a8771d2 feat(web): 更新数据源配置并迁移数据库
- 修改 .idea/dataSources.xml 中的数据源配置,更新为新的 MySQL 数据源
- 更新 DataResourceController 中的属性名称,以适应新的数据库结构
- 修改 CsvResourceFormat、JsonLineResourceFormat 和 JsonResourceFormat 类中的属性名称
- 更新 application.yml 中的数据库配置,使用新的 MySQL 数据源
- 在 pom.xml 中添加 MySQL 连接器依赖,以支持新的数据库
2024-12-18 12:26:06 +08:00
cedb108049 style(web): 优化代码缩进 2024-12-18 11:20:35 +08:00
100 changed files with 5045 additions and 4740 deletions

7
.gitignore vendored
View File

@@ -1,6 +1,3 @@
### Custom
*.db
### Maven template
target/
pom.xml.tag
@@ -255,3 +252,7 @@ Network Trash Folder
Temporary Items
.apdisk
### Custom
*.db
gringotts-web/src/main/resources/static
!gringotts-web/bin

4
.idea/dataSources.xml generated
View File

@@ -13,11 +13,11 @@
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</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>
<synchronize>true</synchronize>
<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>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />

View File

@@ -1,7 +1,6 @@
export const information = {
debug: false,
// baseUrl: '',
baseUrl: 'http://127.0.0.1:20080',
debug: import.meta.env.DEV,
baseUrl: import.meta.env.DEV ? 'http://127.0.0.1:20080' : '',
title: '可信供给中心',
}

View File

@@ -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,
},
}
}
}

View 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,
},
}
}
}

View File

@@ -1,208 +1,2 @@
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";
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,
},
}
}
}
export * from './dialog-confirmation'
export * from './dialog-authentication'

View File

@@ -62,7 +62,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
},
{
visibleOn: "${resourceType === 'API'}",
type: 'fieldSet',
type: 'wrapper',
size: 'none',
body: [
{
type: 'input-text',
@@ -87,7 +88,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
},
{
visibleOn: "${resourceType === 'FILE'}",
type: 'fieldSet',
type: 'wrapper',
size: 'none',
body: [
formInputSingleFileStatic('file', '数据文件'),
{
@@ -105,7 +107,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
},
{
visibleOn: "${resourceType === 'DATABASE'}",
type: 'fieldSet',
type: 'wrapper',
size: 'none',
body: [
{
type: 'select',
@@ -141,7 +144,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
},
{
visibleOn: "${resourceType === 'HDFS'}",
type: 'fieldSet',
type: 'wrapper',
size: 'none',
body: [
formInputSingleFileStatic('coreSiteFile', 'core-site.xml'),
{
@@ -169,7 +173,8 @@ function detailForm(showCreatedUserAndModifiedUser = false) {
},
{
visibleOn: "${resourceType === 'FTP'}",
type: 'fieldSet',
type: 'wrapper',
size: 'none',
body: [
{
type: 'input-text',

View File

@@ -1,4 +1,4 @@
import {horizontalFormOptions, apiPost} from '../constants.js'
import {apiPost, horizontalFormOptions} from '../constants.js'
import {confirmPasswordFormItem, passwordFormItem} from "./dialog-user-item.js";
export function userChangePasswordDialog() {

View File

@@ -99,6 +99,16 @@ function detailForm() {
trimContents: true,
minRows: 2,
maxRows: 2,
maxLength: 100,
},
{
type: 'input-tag',
name: 'tags',
label: '标签',
max: 10,
maxTagLength: 10,
joinValues: false,
extractValue: true,
},
{
type: 'input-rich-text',

View File

@@ -2,7 +2,7 @@
<html lang="zh">
<head>
<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>
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
@@ -20,6 +20,6 @@
<body>
<div id="app"></div>
<script src="/assets/sdk/sdk.js"></script>
<script type="module" src="./main.js"></script>
<script src="./main.js" type="module"></script>
</body>
</html>

View File

@@ -1,13 +1,14 @@
import {apiGet, useAmis} from '../../components/constants.js'
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
import {tabUser} from "./tab-user.js";
import {tabData} from "./tab-data.js";
import {tabSettings} from "./tab-settings.js";
import {tabCheck} from "./tab-check.js";
import {tabPermissions} from "./tab-permissions.js";
import {tabMarket} from "./tab-market.js";
import './style.css'
import {administratorOnly, apiGet, checkerOnly, useAmis, userOnly} from '../../components/constants.js'
import {userChangePasswordDialog} from '../../components/user/dialog-user-change-password.js'
import {tabUser} from './tab-user.js'
import {tabData} from './tab-data.js'
import {tabSettings} from './tab-settings.js'
import {tabCheck} from './tab-check.js'
import {tabPermissions} from './tab-permissions.js'
import {tabMarket} from './tab-market.js'
useAmis(information => {
useAmis((information) => {
return {
id: 'header-service',
className: 'h-full',
@@ -22,22 +23,105 @@ useAmis(information => {
args: {
url: '/pages/login/index.html',
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',
title: information.title,
subTitle: '提供合法合规的数据要素可信供给工具',
toolbar: [
type: 'action',
label: '我的资源',
icon: 'fa fa-database',
level: 'link',
className: "text-bold ${IF(activePage === 'tab', 'text-primary', 'text-white')}",
onEvent: {
click: {
actions: [
{
actionType: 'setValue',
componentId: 'root-page',
args: {
value: {
activePage: 'tab',
}
}
}
]
}
}
},
{
type: 'divider',
direction: 'vertical',
color: '#4d4d4d',
},
{
type: 'dropdown-button',
label: '${username}',
align: 'right',
trigger: 'hover',
btnClassName: 'text-white',
level: 'link',
buttons: [
{
label: '修改密码',
@@ -48,26 +132,69 @@ useAmis(information => {
actionType: 'ajax',
api: apiGet('${base}/user/logout'),
reload: 'header-service',
}
]
}
},
],
},
],
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',
type: 'tabs',
tabsMode: 'vertical',
activeKey: '${tabActiveKey}',
tabs: [
// tabOverview(),
tabMarket(),
tabPermissions(),
tabCheck(),
tabData(),
tabUser(),
tabSettings(),
]
{
hash: 'data',
visibleOn: userOnly,
title: '数据资源',
icon: 'fa fa-database',
reload: true,
body: tabData()
},
{
hash: 'permission',
visibleOn: userOnly,
title: '权属管理',
icon: 'fa fa-key',
reload: true,
body: tabPermissions(),
},
{
hash: 'check',
visibleOn: checkerOnly,
title: '审核审查',
icon: 'fa fa-shield-halved',
reload: true,
body: tabCheck(),
},
{
hash: 'user',
visibleOn: administratorOnly,
title: '用户管理',
icon: 'fa fa-user',
reload: true,
body: tabUser(),
},
{
hash: 'settings',
...tabSettings(),
}
]
],
}
],
},
],
}
})

View File

View File

@@ -1,6 +1,5 @@
import {
apiGet,
checkerOnly,
checkOverMapping,
checkTypeMapping,
crudCommonOptions,
@@ -13,12 +12,7 @@ import {authenticationDetailDialog, confirmationDetailDialog} from "../../compon
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
export function tabCheck() {
return {
visibleOn: checkerOnly,
title: '审核审查',
icon: 'fa fa-shield-halved',
reload: true,
body: [
return [
{
name: 'check_order_list',
type: 'crud',
@@ -37,7 +31,7 @@ export function tabCheck() {
stringField('modifiedUsername', '最后操作人', 100),
operationField('操作', undefined, [
{
visibleOn: `\${type === 'CONFIRMATION' && state === 'CHECKING'}`,
visibleOn: "${type === 'CONFIRMATION' && state === 'CHECKING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -64,14 +58,14 @@ export function tabCheck() {
),
},
{
visibleOn: `\${type === 'CONFIRMATION' && state !== NORMAL}`,
visibleOn: "${type === 'CONFIRMATION' && state !== NORMAL}",
type: 'action',
label: '查看',
level: 'link',
...confirmationDetailDialog('parameters.confirmationId'),
},
{
visibleOn: `\${type === 'AUTHENTICATION' && state === 'CHECKING'}`,
visibleOn: "${type === 'AUTHENTICATION' && state === 'CHECKING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -98,14 +92,14 @@ export function tabCheck() {
),
},
{
visibleOn: `\${type === 'AUTHENTICATION' && state !== NORMAL}`,
visibleOn: "${type === 'AUTHENTICATION' && state !== NORMAL}",
type: 'action',
label: '查看',
level: 'link',
...authenticationDetailDialog('parameters.authenticationId'),
},
{
visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`,
visibleOn: "${type === 'MARKET' && state === 'CHECKING'}",
type: 'action',
label: '处理',
level: 'link',
@@ -132,7 +126,7 @@ export function tabCheck() {
),
},
{
visibleOn: `\${type === 'MARKET' && state !== NORMAL}`,
visibleOn: "${type === 'MARKET' && state !== NORMAL}",
type: 'action',
label: '查看',
level: 'link',
@@ -141,6 +135,5 @@ export function tabCheck() {
]),
],
},
],
}
]
}

View File

@@ -5,18 +5,17 @@ import {
} from "../../components/resource/dialog-resource.js";
import {
apiGet,
arrayInCheck,
arrayOutCheck,
checkState,
crudCommonOptions,
mappingField,
operationField,
permissionStateMapping,
timeField,
userOnly
timeField
} from "../../components/constants.js";
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
export function resourceList() {
export function resourceList(showMode = false) {
return {
type: 'crud',
api: apiGet('${base}/data_resource/list'),
@@ -50,6 +49,7 @@ export function resourceList() {
...resourceDetailDialog(),
},
{
visibleOn: !showMode,
type: 'dropdown-button',
level: 'link',
icon: 'fa fa-ellipsis-h',
@@ -66,8 +66,8 @@ export function resourceList() {
...resourceEditeDialog(),
},
{
disabledOn: arrayInCheck([checkState.checking], 'confirmationState'),
disabledTip: '审查无法删除',
disabledOn: arrayOutCheck([checkState.none, checkState.draft], 'confirmationState'),
disabledTip: '审查或确权成功后无法删除',
tooltipPlacement: 'bottom',
type: 'action',
label: "删除",
@@ -85,10 +85,97 @@ export function resourceList() {
export function tabData() {
return {
visibleOn: userOnly,
title: '数据资源',
icon: 'fa fa-database',
reload: true,
body: resourceList(),
type: 'tabs',
tabs: [
{
title: '资源定义',
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}'),
},
]
},
]),
]
}
}
]
}
}

View File

@@ -1,26 +1,8 @@
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
import {
apiGet,
crudCommonOptions,
mappingField,
operationField,
permissionStateMapping,
timeField
} from "../../components/constants.js";
import {apiGet, crudCommonOptions} from "../../components/constants.js";
import {authenticationAddDialog} from "../../components/permission/dialog-permission.js";
export function tabMarket() {
return {
title: '数据市场',
icon: 'fa fa-store',
reload: true,
body: [
{
type: 'tabs',
tabs: [
{
title: '公开数据',
body: {
type: 'crud',
api: {
...apiGet('${base}/ware/list_public'),
@@ -39,19 +21,58 @@ export function tabMarket() {
'reload',
],
mode: 'cards',
columnsCount: 3,
card: {
header: {
title: '${name}',
subTitle: '${createdTime}',
description: '${description}',
avatar: '${icon}',
avatarClassName: 'pull-left thumb-md avatar b-3x m-r'
},
body: '${TRUNCATE(description, 50)}',
actions: [
{
type: 'action',
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',
@@ -59,95 +80,6 @@ export function tabMarket() {
...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}'),
},
]
},
]),
]
}
},
]
}
]
}
}
}

View File

@@ -12,7 +12,6 @@ import {
stringField,
stringWrapField,
timeField,
userOnly,
} from "../../components/constants.js";
import {
authenticationAddDialog,
@@ -25,11 +24,6 @@ import {
export function tabPermissions() {
return {
visibleOn: userOnly,
title: '权属管理',
icon: 'fa fa-key',
reload: true,
body: {
type: 'tabs',
tabs: [
{
@@ -193,4 +187,3 @@ export function tabPermissions() {
]
}
}
}

View File

@@ -1,5 +1,4 @@
import {
administratorOnly,
apiGet,
copyField,
crudCommonOptions,
@@ -13,12 +12,7 @@ import {userCheckDialog, userDetailDialog} from "../../components/user/dialog-us
import {userAdministratorRegisterDialog} from "../../components/user/dialog-user-register.js";
export function tabUser() {
return {
visibleOn: administratorOnly,
title: '用户管理',
icon: 'fa fa-user',
reload: true,
body: [
return [
{
type: 'crud',
api: apiGet('${base}/user_management/list'),
@@ -80,4 +74,3 @@ export function tabUser() {
}
]
}
}

View File

@@ -4,74 +4,103 @@ import {userRegisterDialog} from '../../components/user/dialog-user-register.js'
useAmis(information => {
return {
type: 'page',
title: information.title,
subTitle: '统一登陆入口',
className: 'h-screen bg-gray-900',
bodyClassName: 'h-full flex items-start mt-20',
body: [
{
type: 'grid',
columns: [
type: 'wrapper',
className: 'relative w-full max-w-md mx-auto',
body: [
{
xs: 0,
sm: 0,
md: 4,
body: [],
type: 'flex',
justify: 'center',
className: 'mb-8',
items: [
{
type: 'avatar',
src: '/logo.svg',
shape: 'square',
size: 64,
fit: 'contain',
className: 'mr-4 bg-transparent'
},
{
xs: 12,
sm: 12,
md: 4,
body: [
type: 'flex',
direction: 'column',
justify: 'center',
items: [
{
type: 'tpl',
tpl: information.title,
className: 'text-2xl font-bold text-white'
},
{
type: 'tpl',
tpl: '统一登录入口',
className: 'text-lg ml-1 mt-1 text-gray-100'
}
]
}
]
},
{
type: 'form',
title: '用户登陆',
className: 'bg-white rounded-xl p-10 shadow-2xl',
api: '${base}/user/login',
redirect: '/pages/index/index.html?token=${token}',
mode: 'horizontal',
horizontal: {
left: 2,
},
actions: [
{
type: 'action',
label: '注册',
...userRegisterDialog(),
},
{
type: 'action',
actionType: 'submit',
label: '登陆',
level: 'primary',
},
],
mode: 'normal',
wrapWithPanel: false,
body: [
{
type: 'input-email',
name: 'username',
label: '邮箱',
label: false,
placeholder: '请输入邮箱',
required: true,
clearable: true,
clearValueOnEmpty: true,
className: 'mb-4',
inputClassName: 'rounded-lg',
},
{
type: 'input-password',
name: 'password',
label: '密码',
placeholder: '请再次输入密码',
label: false,
placeholder: '请输入密码',
required: true,
},
],
},
],
className: 'mb-4',
inputClassName: 'rounded-lg',
},
{
xs: 0,
sm: 0,
md: 4,
body: [],
type: 'flex',
justify: 'space-between',
className: 'mb-4',
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'
}
]
}
]
}
]
}
})

View 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
View 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
View 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

View File

@@ -34,6 +34,10 @@
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>

View File

@@ -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();
}
}

View File

@@ -24,7 +24,7 @@ public abstract class SimpleControllerSupport<ENTITY extends SimpleEntity, SAVE_
protected static final String DETAIL = "/detail/{id}";
protected static final String REMOVE = "/remove/{id}";
private final SimpleServiceSupport<ENTITY> service;
protected final SimpleServiceSupport<ENTITY> service;
public SimpleControllerSupport(SimpleServiceSupport<ENTITY> service) {
this.service = service;

View File

@@ -1,6 +1,10 @@
package com.eshore.gringotts.web.domain.base.service;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
import com.eshore.gringotts.web.domain.entity.CheckOrder;
import com.eshore.gringotts.web.domain.service.UserService;
import javax.persistence.EntityManager;
import org.eclipse.collections.api.map.ImmutableMap;
/**
@@ -9,6 +13,16 @@ import org.eclipse.collections.api.map.ImmutableMap;
* @author lanyuanxiaoyao
* @date 2024-11-28
*/
public interface CheckingService {
void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters);
public abstract class CheckingService<ENTITY extends LogicDeleteEntity> extends LogicDeleteService<ENTITY> {
public CheckingService(SimpleRepository<ENTITY, Long> repository, UserService userService, EntityManager manager) {
super(repository, userService, manager);
}
abstract public void submit(Long id) throws Exception;
abstract public void retract(Long id) throws Exception;
abstract public void onChecked(CheckOrder order, CheckOrder.Operation operation, ImmutableMap<String, Object> parameters);
abstract public ImmutableMap<String, Object> archive(ENTITY entity);
}

View File

@@ -7,13 +7,8 @@ import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
import com.eshore.gringotts.web.domain.service.UserService;
import javax.persistence.EntityManager;
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 lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.list.ImmutableList;
/**
* @author lanyuanxiaoyao
@@ -28,16 +23,11 @@ public abstract class LogicDeleteService<ENTITY extends LogicDeleteEntity> exten
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)
@Override
public void remove(Long id) {
String entityName = ClassUtil.getTypeArgument(this.getClass()).getSimpleName();
Query query = manager.createQuery(StrUtil.format("update {} entity set deleted=true where id=?1", entityName));
Query query = manager.createQuery(StrUtil.format("update {} entity set entity.deleted = true where id = ?1", entityName));
query.setParameter(1, id);
query.executeUpdate();
}

View File

@@ -13,6 +13,8 @@ import org.eclipse.collections.api.set.ImmutableSet;
public interface SimpleService<ENTITY extends SimpleEntity> {
Long save(ENTITY entity) throws Exception;
Long count() throws Exception;
ImmutableList<ENTITY> list() throws Exception;
ImmutableList<ENTITY> list(ImmutableSet<Long> ids) throws Exception;

View File

@@ -64,6 +64,18 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
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
public ImmutableList<ENTITY> list() throws Exception {
return Lists.immutable.ofAll(repository.findAll(
@@ -106,7 +118,7 @@ public abstract class SimpleServiceSupport<ENTITY extends SimpleEntity> implemen
}
@SuppressWarnings("unchecked")
private ImmutableList<Predicate> queryPredicates(Query.Queryable queryable, Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
protected 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();

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.controller;
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
import com.eshore.gringotts.web.domain.base.controller.CheckingController;
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.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.DataFileService;
import com.eshore.gringotts.web.domain.service.DataResourceService;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -17,8 +15,6 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.factory.Sets;
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.RestController;
@@ -29,30 +25,16 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("authentication")
public class AuthenticationController extends SimpleControllerSupport<Authentication, AuthenticationController.SaveItem, AuthenticationController.ListItem, AuthenticationController.DetailItem> {
private final AuthenticationService authenticationService;
public class AuthenticationController extends CheckingController<Authentication, AuthenticationController.SaveItem, AuthenticationController.ListItem, AuthenticationController.DetailItem> {
private final DataResourceService dataResourceService;
private final DataFileService dataFileService;
public AuthenticationController(AuthenticationService service, DataResourceService dataResourceService, DataFileService dataFileService) {
super(service);
this.authenticationService = service;
this.dataResourceService = dataResourceService;
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
protected Authentication fromSaveItem(SaveItem item) throws Exception {
Authentication authentication = new Authentication();

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.controller;
import com.eshore.gringotts.web.configuration.amis.AmisResponse;
import com.eshore.gringotts.web.domain.base.controller.SimpleControllerSupport;
import com.eshore.gringotts.web.domain.base.controller.CheckingController;
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.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.DataFileService;
import com.eshore.gringotts.web.domain.service.DataResourceService;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.factory.Sets;
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.RestController;
@@ -28,30 +24,16 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("confirmation")
public class ConfirmationController extends SimpleControllerSupport<Confirmation, ConfirmationController.SaveItem, ConfirmationController.ListItem, ConfirmationController.DetailItem> {
private final ConfirmationService confirmationService;
public class ConfirmationController extends CheckingController<Confirmation, ConfirmationController.SaveItem, ConfirmationController.ListItem, ConfirmationController.DetailItem> {
private final DataResourceService dataResourceService;
private final DataFileService dataFileService;
public ConfirmationController(ConfirmationService service, ConfirmationService confirmationService, DataResourceService dataResourceService, DataFileService dataFileService) {
public ConfirmationController(ConfirmationService service, DataResourceService dataResourceService, DataFileService dataFileService) {
super(service);
this.confirmationService = confirmationService;
this.dataResourceService = dataResourceService;
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
protected Confirmation fromSaveItem(SaveItem item) throws Exception {
Confirmation confirmation = new Confirmation();

View File

@@ -174,18 +174,18 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
break;
case JSON:
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
item.setJsonSchemaText(jsonFormat.getSchema());
item.setJsonSchema(mapper.readValue(jsonFormat.getSchema(), Map.class));
item.setJsonSchemaText(jsonFormat.getJsonSchema());
item.setJsonSchema(mapper.readValue(jsonFormat.getJsonSchema(), Map.class));
break;
case JSON_LINE:
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
item.setJsonLineSchemaText(jsonLineFormat.getSchema());
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getSchema(), Map.class));
item.setJsonLineSchemaText(jsonLineFormat.getJsonSchema());
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getJsonSchema(), Map.class));
break;
case CSV:
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
item.setCsvSchemaText(csvFormat.getSchema());
item.setCsvSchema(mapper.readValue(csvFormat.getSchema(), Map.class));
item.setCsvSchemaText(csvFormat.getCsvSchema());
item.setCsvSchema(mapper.readValue(csvFormat.getCsvSchema(), Map.class));
break;
}
if (ObjectUtil.isNotNull(dataResource.getExample())) {

View File

@@ -3,21 +3,19 @@ package com.eshore.gringotts.web.domain.controller;
import cn.hutool.core.util.StrUtil;
import com.eshore.gringotts.web.configuration.HostConfiguration;
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.SimpleSaveItem;
import com.eshore.gringotts.web.domain.entity.Ware;
import com.eshore.gringotts.web.domain.service.DataFileService;
import com.eshore.gringotts.web.domain.service.DataResourceService;
import com.eshore.gringotts.web.domain.service.WareService;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.list.ImmutableList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -28,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@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 WareService wareService;
private final DataResourceService dataResourceService;
@@ -47,18 +45,6 @@ public class WareController extends SimpleControllerSupport<Ware, WareController
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
protected Ware fromSaveItem(SaveItem saveItem) {
Ware ware = new Ware();

View File

@@ -5,7 +5,6 @@ import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteEntity;
import java.time.LocalDateTime;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
@@ -23,7 +22,6 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
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 = "modifiedUser"),
})
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "authentication" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
public class Authentication extends CheckingNeededEntity {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
private DataResource target;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@OneToMany(fetch = FetchType.LAZY)
@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT), inverseForeignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@ToString.Exclude
private Set<DataFile> evidences;

View File

@@ -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.LogicDeleteEntity;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
@@ -21,7 +20,6 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
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 = "modifiedUser"),
})
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "confirmation" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
public class Confirmation extends CheckingNeededEntity {
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
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))
@ToString.Exclude
private Set<DataFile> evidences;

View File

@@ -1,15 +1,13 @@
package com.eshore.gringotts.web.domain.entity;
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.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
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
@DynamicUpdate
@Table(name = Constants.TABLE_PREFIX + "data_file")
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "data_file" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
public class DataFile extends LogicDeleteEntity {
public class DataFile extends SimpleEntity {
private String filename;
private Long size;
private String md5;

View File

@@ -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.type.ResourceType;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
@@ -22,7 +21,6 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
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 = "modifiedUser"),
})
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "data_resource" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
public class DataResource extends LogicDeleteEntity {
@Column(nullable = false)
private String name;
private String description;
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@ToString.Exclude
private ResourceType type;
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@ToString.Exclude
private ResourceFormat format;
@@ -65,13 +62,13 @@ public class DataResource extends LogicDeleteEntity {
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@ToString.Exclude
private DataFile example;
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
@OneToOne(fetch = FetchType.EAGER, mappedBy = "target")
@ToString.Exclude
private Confirmation confirmation;
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
@OneToMany(fetch = FetchType.EAGER, mappedBy = "target")
@ToString.Exclude
private Set<Authentication> authentications;
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "resource")
@OneToOne(fetch = FetchType.EAGER, mappedBy = "resource")
@ToString.Exclude
private Ware ware;
}

View File

@@ -21,7 +21,6 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -48,7 +47,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@NamedAttributeNode(value = "createdUser"),
@NamedAttributeNode(value = "modifiedUser"),
})
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "ware" + " set deleted = true where id = ?")
@Where(clause = LogicDeleteEntity.LOGIC_DELETE_CLAUSE)
public class Ware extends CheckingNeededEntity {
@OneToOne(cascade = CascadeType.DETACH, fetch = FetchType.EAGER)

View File

@@ -1,7 +1,5 @@
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.Entity;
import lombok.AllArgsConstructor;
@@ -9,8 +7,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* CSV格式
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
private String schema;
private String csvSchema;
@Override
public Type getFormatType() {

View File

@@ -1,7 +1,5 @@
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.Entity;
import lombok.AllArgsConstructor;
@@ -9,8 +7,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* JSON line格式
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
private String schema;
private String jsonSchema;
@Override
public Type getFormatType() {

View File

@@ -1,7 +1,5 @@
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.Entity;
import lombok.AllArgsConstructor;
@@ -9,8 +7,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* 一个文件就是一个JSON
@@ -25,10 +21,8 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
private String schema;
private String jsonSchema;
@Override
public Type getFormatType() {

View File

@@ -1,14 +1,10 @@
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.Entity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* 无格式,文件每行就是一份数据
@@ -21,8 +17,6 @@ import org.hibernate.annotations.Where;
@ToString
@Entity
@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 {
@Override
public Type getFormatType() {

View File

@@ -1,14 +1,10 @@
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.Entity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* 无格式,整个文件就是一份数据
@@ -21,8 +17,6 @@ import org.hibernate.annotations.Where;
@ToString
@Entity
@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 {
@Override
public Type getFormatType() {

View File

@@ -9,8 +9,6 @@ import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* 资源格式
@@ -24,8 +22,6 @@ import org.hibernate.annotations.Where;
@Entity
@Table(name = Constants.TABLE_PREFIX + "resource_format")
@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 Type getFormatType();

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.entity.type;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@@ -10,8 +9,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Getter
@Setter
@@ -20,8 +17,6 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
@Column(nullable = false)
private String url;

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.entity.type;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -12,8 +11,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Getter
@Setter
@@ -22,8 +19,6 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
@Column(nullable = false)
private String jdbc;

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.entity.type;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import com.eshore.gringotts.web.domain.entity.DataFile;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
@@ -14,8 +13,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Getter
@Setter
@@ -24,8 +21,6 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
@OneToOne
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.entity.type;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@@ -10,8 +9,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Getter
@Setter
@@ -20,8 +17,6 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
@Column(nullable = false)
private String url;

View File

@@ -1,7 +1,6 @@
package com.eshore.gringotts.web.domain.entity.type;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.LogicDeleteIdOnlyEntity;
import com.eshore.gringotts.web.domain.entity.DataFile;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
@@ -14,8 +13,6 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
@Getter
@Setter
@@ -24,8 +21,6 @@ import org.hibernate.annotations.Where;
@NoArgsConstructor
@Entity
@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 {
@OneToOne
@JoinColumn(nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))

View File

@@ -9,8 +9,6 @@ import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
/**
* 资源类型
@@ -24,8 +22,6 @@ import org.hibernate.annotations.Where;
@Entity
@Table(name = Constants.TABLE_PREFIX + "resource_type")
@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 Type getResourceType();

View File

@@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.eshore.gringotts.web.domain.base.entity.CheckingNeededEntity;
import com.eshore.gringotts.web.domain.base.service.CheckingService;
import com.eshore.gringotts.web.domain.base.service.LogicDeleteService;
import com.eshore.gringotts.web.domain.entity.Authentication;
import com.eshore.gringotts.web.domain.entity.Authentication_;
import com.eshore.gringotts.web.domain.entity.CheckOrder;
@@ -33,7 +32,7 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service("com.eshore.gringotts.web.domain.service.AuthenticationService")
public class AuthenticationService extends LogicDeleteService<Authentication> implements CheckingService {
public class AuthenticationService extends CheckingService<Authentication> {
private final AuthenticationRepository authenticationRepository;
private final UserService userService;
private final CheckOrderService checkOrderService;
@@ -84,6 +83,7 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void submit(Long id) throws JsonProcessingException {
Authentication authentication = detailOrThrow(id);
authentication.setState(CheckingNeededEntity.State.OWNER_CHECKING);
@@ -101,6 +101,7 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void retract(Long id) {
Authentication authentication = detailOrThrow(id);
authentication.setState(Authentication.State.DRAFT);
@@ -145,6 +146,11 @@ public class AuthenticationService extends LogicDeleteService<Authentication> im
checkOrderService.save(order);
}
@Override
public ImmutableMap<String, Object> archive(Authentication authentication) {
return null;
}
public static final class AuthenticationDuplicatedException extends RuntimeException {
public AuthenticationDuplicatedException() {
super("数据资源已绑定该账号的授权申请,无法再次申请");

View File

@@ -4,7 +4,6 @@ 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.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;
@@ -13,6 +12,7 @@ import com.eshore.gringotts.web.domain.entity.User;
import com.eshore.gringotts.web.domain.repository.ConfirmationRepository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Join;
@@ -34,13 +34,13 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service("com.eshore.gringotts.web.domain.service.ConfirmationService")
public class ConfirmationService extends SimpleServiceSupport<Confirmation> implements CheckingService {
public class ConfirmationService extends CheckingService<Confirmation> {
private final ConfirmationRepository confirmationRepository;
private final CheckOrderService checkOrderService;
private final ObjectMapper mapper;
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
super(confirmationRepository, userService);
public ConfirmationService(ConfirmationRepository confirmationRepository, UserService userService, EntityManager entityManager, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
super(confirmationRepository, userService, entityManager);
this.confirmationRepository = confirmationRepository;
this.checkOrderService = checkOrderService;
this.mapper = builder.build();
@@ -80,6 +80,7 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void submit(Long id) throws JsonProcessingException {
Confirmation confirmation = detailOrThrow(id);
confirmation.setState(Confirmation.State.CHECKING);
@@ -97,6 +98,7 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void retract(Long id) {
Confirmation confirmation = detailOrThrow(id);
confirmation.setState(CheckingNeededEntity.State.DRAFT);
@@ -128,6 +130,11 @@ public class ConfirmationService extends SimpleServiceSupport<Confirmation> impl
}
}
@Override
public ImmutableMap<String, Object> archive(Confirmation confirmation) {
return null;
}
public static final class ConfirmationDuplicatedException extends RuntimeException {
public ConfirmationDuplicatedException() {
super("数据资源已绑定确权申请,无法再次申请");

View File

@@ -1,6 +1,6 @@
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.Confirmation;
@@ -15,6 +15,7 @@ import com.eshore.gringotts.web.domain.repository.DataResourceRepository;
import com.eshore.gringotts.web.domain.repository.ResourceFormatRepository;
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.CriteriaQuery;
import javax.persistence.criteria.Join;
@@ -34,14 +35,14 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
public class DataResourceService extends SimpleServiceSupport<DataResource> {
public class DataResourceService extends LogicDeleteService<DataResource> {
private final DataResourceRepository dataResourceRepository;
private final ResourceTypeRepository resourceTypeRepository;
private final ResourceFormatRepository resourceFormatRepository;
private final UserService userService;
public DataResourceService(DataResourceRepository repository, ResourceTypeRepository resourceTypeRepository, ResourceFormatRepository resourceFormatRepository, UserService userService) {
super(repository, userService);
public DataResourceService(DataResourceRepository repository, ResourceTypeRepository resourceTypeRepository, ResourceFormatRepository resourceFormatRepository, UserService userService, EntityManager entityManager) {
super(repository, userService, entityManager);
this.dataResourceRepository = repository;
this.resourceTypeRepository = resourceTypeRepository;
this.resourceFormatRepository = resourceFormatRepository;

View File

@@ -45,7 +45,7 @@ public class UserService {
if (userRepository.count() == 0) {
User user = new User();
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.setState(User.State.NORMAL);
user.setCheckedUser(user);

View File

@@ -2,13 +2,13 @@ package com.eshore.gringotts.web.domain.service;
import cn.hutool.core.util.StrUtil;
import com.eshore.gringotts.web.domain.base.service.CheckingService;
import com.eshore.gringotts.web.domain.base.service.SimpleServiceSupport;
import com.eshore.gringotts.web.domain.entity.CheckOrder;
import com.eshore.gringotts.web.domain.entity.User;
import com.eshore.gringotts.web.domain.entity.Ware;
import com.eshore.gringotts.web.domain.repository.WareRepository;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.collections.api.factory.Lists;
@@ -24,13 +24,13 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service("com.eshore.gringotts.web.domain.service.WareService")
public class WareService extends SimpleServiceSupport<Ware> implements CheckingService {
public class WareService extends CheckingService<Ware> {
private final WareRepository wareRepository;
private final CheckOrderService checkOrderService;
private final ObjectMapper mapper;
public WareService(WareRepository repository, UserService userService, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
super(repository, userService);
public WareService(WareRepository repository, UserService userService, EntityManager entityManager, CheckOrderService checkOrderService, Jackson2ObjectMapperBuilder builder) {
super(repository, userService, entityManager);
this.wareRepository = repository;
this.checkOrderService = checkOrderService;
this.mapper = builder.build();
@@ -63,7 +63,13 @@ public class WareService extends SimpleServiceSupport<Ware> implements CheckingS
}
}
@Override
public ImmutableMap<String, Object> archive(Ware ware) {
return null;
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void submit(Long id) throws JsonProcessingException {
Ware ware = detailOrThrow(id);
ware.setState(Ware.State.CHECKING);
@@ -81,6 +87,7 @@ public class WareService extends SimpleServiceSupport<Ware> implements CheckingS
}
@Transactional(rollbackOn = Throwable.class)
@Override
public void retract(Long id) {
Ware ware = detailOrThrow(id);
ware.setState(Ware.State.DRAFT);

View File

@@ -6,10 +6,10 @@ spring:
profiles:
include: common,metrics,encrypt
datasource:
url: jdbc:h2:./database;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
username: lanyuanxiaoyao
password: lanyuanxiaoyao
driver-class-name: org.h2.Driver
url: jdbc:mysql://132.122.1.185:31000/gringotts
username: iap
password: SLvwP6@SM2J*SbUw_iap
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
generate-ddl: true
show-sql: true
@@ -39,7 +39,31 @@ logging:
spring:
config:
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:
upload:
upload-path: /Users/lanyuanxiaoyao/Project/IdeaProjects/gringotts/gringotts-web/target/upload