| | |
| | | |
| | | alter table man_task_log |
| | | add uplink_sts varchar(64) null comment '上行状态' after empty_mk; |
| | | |
| | | CREATE TABLE `man_integration_record` ( |
| | | `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', |
| | | `uuid` VARCHAR(255) DEFAULT NULL COMMENT '编号', |
| | | `namespace` VARCHAR(255) DEFAULT NULL COMMENT '名称空间(*)', |
| | | `url` VARCHAR(255) DEFAULT NULL COMMENT '接口地址', |
| | | `appkey` VARCHAR(255) DEFAULT NULL COMMENT '平台密钥', |
| | | `caller` VARCHAR(255) DEFAULT NULL COMMENT '调用方标识', |
| | | `direction` int(1) NOT NULL DEFAULT 0 COMMENT '方向{1:被调用,2:调用外部}', |
| | | `timestamp` VARCHAR(64) DEFAULT NULL COMMENT '时间戳', |
| | | `client_ip` VARCHAR(64) DEFAULT NULL COMMENT '客户端IP', |
| | | `request` TEXT COMMENT '请求内容', |
| | | `response` TEXT COMMENT '响应内容', |
| | | `err` TEXT COMMENT '异常内容', |
| | | `result` int(1) DEFAULT NULL COMMENT '结果{1:成功,0:失败}', |
| | | `cost_ms` INT(11) DEFAULT NULL COMMENT '耗时', |
| | | `status` int(1) DEFAULT 1 COMMENT '状态{1:正常,0:冻结}', |
| | | `create_time` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', |
| | | `update_time` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', |
| | | `memo` VARCHAR(255) DEFAULT NULL COMMENT '备注', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| | |
| | | mission: 'Mission', |
| | | staReserve: 'Sta Reserve', |
| | | lane: 'Lane', |
| | | integrationRecord: 'Integration', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | entryAngle: "entry angle", |
| | | maximum: "maximum", |
| | | }, |
| | | integrationRecord: { |
| | | uuid: "uuid", |
| | | namespace: "namespace", |
| | | url: "url", |
| | | appkey: "appkey", |
| | | caller: "caller", |
| | | direction: "direction", |
| | | timestamp: "timestamp", |
| | | clientIp: "clientIp", |
| | | request: "request", |
| | | response: "response", |
| | | err: "error", |
| | | result: "result", |
| | | costMs: "costMs", |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | page: { |
| | |
| | | mission: '执行', |
| | | staReserve: '站点预约', |
| | | lane: '巷道管理', |
| | | integrationRecord: '集成交互', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | entryAngle: "车体角度", |
| | | maximum: "承载量", |
| | | }, |
| | | integrationRecord: { |
| | | uuid: "编号", |
| | | namespace: "命名空间", |
| | | url: "接口地址", |
| | | appkey: "密钥", |
| | | caller: "调用方", |
| | | direction: "方向", |
| | | timestamp: "时间戳", |
| | | clientIp: "客户端IP", |
| | | request: "请求内容", |
| | | response: "响应内容", |
| | | err: "异常", |
| | | result: "请求结果", |
| | | costMs: "耗时(毫秒)", |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | page: { |
| | |
| | | import mission from "./mission"; |
| | | import staReserve from './staReserve'; |
| | | import lane from './lane'; |
| | | import integrationRecord from './integrationRecord'; |
| | | |
| | | const ResourceContent = (node) => { |
| | | switch (node.component) { |
| | |
| | | return staReserve; |
| | | case 'lane': |
| | | return lane; |
| | | case 'integrationRecord': |
| | | return integrationRecord; |
| | | default: |
| | | return { |
| | | list: ListGuesser, |
| New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | |
| | | const IntegrationRecordCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const handleSuccess = async (data) => { |
| | | setOpen(false); |
| | | notify('common.response.success'); |
| | | }; |
| | | |
| | | const handleError = async (error) => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <CreateBase |
| | | record={{}} |
| | | transform={(data) => { |
| | | return data; |
| | | }} |
| | | mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} |
| | | > |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {translate('create.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.namespace" |
| | | source="namespace" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.url" |
| | | source="url" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.appkey" |
| | | source="appkey" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.caller" |
| | | source="caller" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.integrationRecord.direction" |
| | | source="direction" |
| | | choices={[ |
| | | { id: 1, name: '被调用' }, |
| | | { id: 2, name: '调用外部' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.timestamp" |
| | | source="timestamp" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.clientIp" |
| | | source="clientIp" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.request" |
| | | source="request" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.response" |
| | | source="response" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.err" |
| | | source="err" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.integrationRecord.result" |
| | | source="result" |
| | | choices={[ |
| | | { id: 1, name: '成功' }, |
| | | { id: 0, name: '失败' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.integrationRecord.costMs" |
| | | source="costMs" |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | </CreateBase> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default IntegrationRecordCreate; |
| New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | | FormDataConsumer, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | SaveButton, |
| | | Toolbar, |
| | | Labeled, |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "../components/EditBaseAside"; |
| | | import CustomerTopToolBar from "../components/EditTopToolBar"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const IntegrationRecordEdit = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.uuid" |
| | | source="uuid" |
| | | parse={v => v} |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.namespace" |
| | | source="namespace" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.url" |
| | | source="url" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.appkey" |
| | | source="appkey" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.caller" |
| | | source="caller" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.integrationRecord.direction" |
| | | source="direction" |
| | | choices={[ |
| | | { id: 1, name: '被调用' }, |
| | | { id: 2, name: '调用外部' }, |
| | | ]} |
| | | validate={required()} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.timestamp" |
| | | source="timestamp" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.clientIp" |
| | | source="clientIp" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.request" |
| | | source="request" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.response" |
| | | source="response" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.integrationRecord.err" |
| | | source="err" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <SelectInput |
| | | label="table.field.integrationRecord.result" |
| | | source="result" |
| | | choices={[ |
| | | { id: 1, name: '成功' }, |
| | | { id: 0, name: '失败' }, |
| | | ]} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.integrationRecord.costMs" |
| | | source="costMs" |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | ) |
| | | } |
| | | |
| | | export default IntegrationRecordEdit; |
| New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import IntegrationRecordCreate from "./IntegrationRecordCreate"; |
| | | import IntegrationRecordPanel from "./IntegrationRecordPanel"; |
| | | import EmptyDataLoader from "../components/EmptyDataLoader"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="uuid" label="table.field.integrationRecord.uuid" />, |
| | | <TextInput source="namespace" label="table.field.integrationRecord.namespace" />, |
| | | <TextInput source="url" label="table.field.integrationRecord.url" />, |
| | | <TextInput source="appkey" label="table.field.integrationRecord.appkey" />, |
| | | <TextInput source="caller" label="table.field.integrationRecord.caller" />, |
| | | <SelectInput source="direction" label="table.field.integrationRecord.direction" |
| | | choices={[ |
| | | { id: 1, name: '被调用' }, |
| | | { id: 2, name: '调用外部' }, |
| | | ]} |
| | | />, |
| | | <TextInput source="timestamp" label="table.field.integrationRecord.timestamp" />, |
| | | <TextInput source="clientIp" label="table.field.integrationRecord.clientIp" />, |
| | | <SelectInput source="result" label="table.field.integrationRecord.result" |
| | | choices={[ |
| | | { id: 1, name: '成功' }, |
| | | { id: 0, name: '失败' }, |
| | | ]} |
| | | />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | ] |
| | | |
| | | const IntegrationRecordList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.integrationRecord"} |
| | | empty={<EmptyDataLoader />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='integrationRecord' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='integrationRecord' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <IntegrationRecordPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.integrationRecord.uuid" /> |
| | | <TextField source="namespace" label="table.field.integrationRecord.namespace" /> |
| | | <TextField source="url" label="table.field.integrationRecord.url" /> |
| | | <TextField source="appkey" label="table.field.integrationRecord.appkey" /> |
| | | <TextField source="caller" label="table.field.integrationRecord.caller" /> |
| | | <TextField source="direction$" label="table.field.integrationRecord.direction" sortable={false} /> |
| | | <TextField source="timestamp" label="table.field.integrationRecord.timestamp" /> |
| | | <TextField source="clientIp" label="table.field.integrationRecord.clientIp" /> |
| | | <TextField source="request" label="table.field.integrationRecord.request" /> |
| | | <TextField source="response" label="table.field.integrationRecord.response" /> |
| | | <TextField source="err" label="table.field.integrationRecord.err" /> |
| | | <TextField source="result$" label="table.field.integrationRecord.result" sortable={false} /> |
| | | <NumberField source="costMs" label="table.field.integrationRecord.costMs" /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <IntegrationRecordCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='IntegrationRecord Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | export default IntegrationRecordList; |
| New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useRecordContext, |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | |
| | | const IntegrationRecordPanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | | <CardContent> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <Typography variant="h6" gutterBottom align="left" sx={{ |
| | | maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | }}> |
| | | {Common.camelToPascalWithSpaces(translate('table.field.integrationRecord.namespace'))}: {record.namespace} |
| | | </Typography> |
| | | {/* inherit, primary, secondary, textPrimary, textSecondary, error */} |
| | | <Typography variant="h6" gutterBottom align="right" > |
| | | ID: {record.id} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} container alignContent="flex-end"> |
| | | <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> |
| | | {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Box height={20}> </Box> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.uuid" |
| | | property={record.uuid} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.namespace" |
| | | property={record.namespace} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.url" |
| | | property={record.url} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.appkey" |
| | | property={record.appkey} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.caller" |
| | | property={record.caller} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.direction" |
| | | property={record.direction$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.timestamp" |
| | | property={record.timestamp} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.clientIp" |
| | | property={record.clientIp} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.request" |
| | | property={record.request} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.response" |
| | | property={record.response} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.err" |
| | | property={record.err} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.result" |
| | | property={record.result$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.integrationRecord.costMs" |
| | | property={record.costMs} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | export default IntegrationRecordPanel; |
| New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import IntegrationRecordList from "./IntegrationRecordList"; |
| | | import IntegrationRecordEdit from "./IntegrationRecordEdit"; |
| | | |
| | | export default { |
| | | list: IntegrationRecordList, |
| | | edit: IntegrationRecordEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.namespace}` |
| | | } |
| | | }; |
| | |
| | | import { styled } from '@mui/material/styles'; |
| | | import StaReserveCreate from "./StaReserveCreate"; |
| | | import StaReservePanel from "./StaReservePanel"; |
| | | import EmptyData from "../components/EmptyData"; |
| | | import EmptyDataLoader from "../components/EmptyDataLoader"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.staReserve"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={<EmptyDataLoader />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | |
| | | // generator.username="sa";priority |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_lane"; |
| | | generator.tableDesc="Lane"; |
| | | generator.table="man_integration_record"; |
| | | generator.tableDesc="Integration Record"; |
| | | generator.packagePath="com.zy.acs.manager.manager"; |
| | | |
| | | generator.build(); |
| New file |
| | |
| | | package com.zy.acs.manager.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.common.utils.ExcelUtil; |
| | | import com.zy.acs.manager.common.annotation.OperationLog; |
| | | import com.zy.acs.manager.common.domain.BaseParam; |
| | | import com.zy.acs.manager.common.domain.KeyValVo; |
| | | import com.zy.acs.manager.common.domain.PageParam; |
| | | import com.zy.acs.manager.manager.entity.IntegrationRecord; |
| | | import com.zy.acs.manager.manager.service.IntegrationRecordService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class IntegrationRecordController extends BaseController { |
| | | |
| | | @Autowired |
| | | private IntegrationRecordService integrationRecordService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @PostMapping("/integrationRecord/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<IntegrationRecord, BaseParam> pageParam = new PageParam<>(baseParam, IntegrationRecord.class); |
| | | return R.ok().add(integrationRecordService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @PostMapping("/integrationRecord/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(integrationRecordService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @PostMapping({"/integrationRecord/many/{ids}", "/integrationRecords/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(integrationRecordService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @GetMapping("/integrationRecord/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(integrationRecordService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:save')") |
| | | @OperationLog("Create Integration Record") |
| | | @PostMapping("/integrationRecord/save") |
| | | public R save(@RequestBody IntegrationRecord integrationRecord) { |
| | | integrationRecord.setCreateTime(new Date()); |
| | | integrationRecord.setUpdateTime(new Date()); |
| | | if (!integrationRecordService.save(integrationRecord)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(integrationRecord); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:update')") |
| | | @OperationLog("Update Integration Record") |
| | | @PostMapping("/integrationRecord/update") |
| | | public R update(@RequestBody IntegrationRecord integrationRecord) { |
| | | integrationRecord.setUpdateTime(new Date()); |
| | | if (!integrationRecordService.updateById(integrationRecord)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(integrationRecord); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:remove')") |
| | | @OperationLog("Delete Integration Record") |
| | | @PostMapping("/integrationRecord/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!integrationRecordService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @PostMapping("/integrationRecord/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<IntegrationRecord> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(IntegrationRecord::getNamespace, condition); |
| | | } |
| | | integrationRecordService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getNamespace())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:integrationRecord:list')") |
| | | @PostMapping("/integrationRecord/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(integrationRecordService.list(), IntegrationRecord.class), response); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.acs.manager.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_integration_record") |
| | | public class IntegrationRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | private String uuid; |
| | | |
| | | /** |
| | | * 名称空间 |
| | | */ |
| | | @ApiModelProperty(value= "名称空间") |
| | | private String namespace; |
| | | |
| | | /** |
| | | * 接口地址 |
| | | */ |
| | | @ApiModelProperty(value= "接口地址") |
| | | private String url; |
| | | |
| | | /** |
| | | * 平台密钥 |
| | | */ |
| | | @ApiModelProperty(value= "平台密钥") |
| | | private String appkey; |
| | | |
| | | /** |
| | | * 调用方标识 |
| | | */ |
| | | @ApiModelProperty(value= "调用方标识") |
| | | private String caller; |
| | | |
| | | /** |
| | | * 方向 1: 被调用 2: 调用外部 |
| | | */ |
| | | @ApiModelProperty(value= "方向 1: 被调用 2: 调用外部 ") |
| | | private Integer direction; |
| | | |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | @ApiModelProperty(value= "时间戳") |
| | | private String timestamp; |
| | | |
| | | /** |
| | | * 客户端IP |
| | | */ |
| | | @ApiModelProperty(value= "客户端IP") |
| | | private String clientIp; |
| | | |
| | | /** |
| | | * 请求内容 |
| | | */ |
| | | @ApiModelProperty(value= "请求内容") |
| | | private String request; |
| | | |
| | | /** |
| | | * 响应内容 |
| | | */ |
| | | @ApiModelProperty(value= "响应内容") |
| | | private String response; |
| | | |
| | | /** |
| | | * 异常内容 |
| | | */ |
| | | @ApiModelProperty(value= "异常内容") |
| | | private String err; |
| | | |
| | | /** |
| | | * 结果 1: 成功 0: 失败 |
| | | */ |
| | | @ApiModelProperty(value= "结果 1: 成功 0: 失败 ") |
| | | private Integer result; |
| | | |
| | | /** |
| | | * 耗时 |
| | | */ |
| | | @ApiModelProperty(value= "耗时") |
| | | private Integer costMs; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 冻结 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public IntegrationRecord() {} |
| | | |
| | | public IntegrationRecord(String uuid,String namespace,String url,String appkey,String caller,Integer direction,String timestamp,String clientIp,String request,String response,String err,Integer result,Integer costMs,Integer status,Date createTime,Date updateTime,String memo) { |
| | | this.uuid = uuid; |
| | | this.namespace = namespace; |
| | | this.url = url; |
| | | this.appkey = appkey; |
| | | this.caller = caller; |
| | | this.direction = direction; |
| | | this.timestamp = timestamp; |
| | | this.clientIp = clientIp; |
| | | this.request = request; |
| | | this.response = response; |
| | | this.err = err; |
| | | this.result = result; |
| | | this.costMs = costMs; |
| | | this.status = status; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // IntegrationRecord integrationRecord = new IntegrationRecord( |
| | | // null, // 编号 |
| | | // null, // 名称空间 |
| | | // null, // 接口地址 |
| | | // null, // 平台密钥 |
| | | // null, // 调用方标识 |
| | | // null, // 方向[非空] |
| | | // null, // 时间戳 |
| | | // null, // 客户端IP |
| | | // null, // 请求内容 |
| | | // null, // 响应内容 |
| | | // null, // 异常内容 |
| | | // null, // 结果 |
| | | // null, // 耗时 |
| | | // null, // 状态 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public Boolean getResultBool(){ |
| | | if (null == this.result){ return null; } |
| | | switch (this.result){ |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | | return false; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | | return false; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.acs.manager.manager.mapper; |
| | | |
| | | import com.zy.acs.manager.manager.entity.IntegrationRecord; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface IntegrationRecordMapper extends BaseMapper<IntegrationRecord> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.acs.manager.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.acs.manager.manager.entity.IntegrationRecord; |
| | | |
| | | public interface IntegrationRecordService extends IService<IntegrationRecord> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.acs.manager.manager.service.impl; |
| | | |
| | | import com.zy.acs.manager.manager.mapper.IntegrationRecordMapper; |
| | | import com.zy.acs.manager.manager.entity.IntegrationRecord; |
| | | import com.zy.acs.manager.manager.service.IntegrationRecordService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("integrationRecordService") |
| | | public class IntegrationRecordServiceImpl extends ServiceImpl<IntegrationRecordMapper, IntegrationRecord> implements IntegrationRecordService { |
| | | |
| | | } |
| New file |
| | |
| | | -- save integrationRecord record |
| | | -- mysql |
| | | -- SwapHorizontalCircle |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.integrationRecord', '0', '/manager/integrationRecord', 'integrationRecord', '0' , '5', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query Integration Record', '', '1', 'manager:integrationRecord:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete Integration Record', '', '1', 'manager:integrationRecord:remove', '3', '1', '1'); |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.acs.manager.manager.mapper.IntegrationRecordMapper"> |
| | | |
| | | </mapper> |