From 4992e4e60b73a87c3781aabd9367e11e3eaa370e Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 05 二月 2026 16:00:16 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/integrationRecord/IntegrationRecordPanel.jsx                               |    3 
 zy-acs-flow/src/i18n/en.js                                                                      |   11 ++
 zy-acs-flow/src/page/integrationRecord/IntegrationRecordEdit.jsx                                |    7 -
 zy-acs-flow/src/page/integrationRecord/direction.js                                             |   26 ++++++
 zy-acs-flow/src/page/integrationRecord/IntegrationRecordCreate.jsx                              |    7 -
 zy-acs-flow/src/i18n/zh.js                                                                      |   13 +++
 zy-acs-manager/src/main/java/com/zy/acs/manager/common/interceptor/IntegrationRecordAdvice.java |   23 ++---
 zy-acs-flow/src/page/integrationRecord/IntegrationRecordList.jsx                                |   87 +++++++++++++--------
 zy-acs-flow/src/page/integrationRecord/IntegrationRecordDetail.jsx                              |    6 +
 9 files changed, 123 insertions(+), 60 deletions(-)

diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js
index d8a40ea..db04e76 100644
--- a/zy-acs-flow/src/i18n/en.js
+++ b/zy-acs-flow/src/i18n/en.js
@@ -41,6 +41,8 @@
             }
         },
         enums: {
+            success: 'SUCCESS',
+            failure: 'FAILURE',
             statusTrue: 'Enable',
             statusFalse: 'Disable',
             true: 'Yes',
@@ -810,6 +812,15 @@
                 }
             }
         },
+        integrationRecord: {
+            enums: {
+                direction: {
+                    none: 'Unknown',
+                    inbound: 'Inbound',
+                    outbound: 'Outbound',
+                },
+            },
+        },
         map: {
             welcome: 'Welcome to the RCS System. Tip: Left-click to select objects, right-click to pan the view, and use the scroll wheel to zoom the view.',
             devices: {
diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js
index 43bb0ac..fd93f27 100644
--- a/zy-acs-flow/src/i18n/zh.js
+++ b/zy-acs-flow/src/i18n/zh.js
@@ -41,6 +41,8 @@
             }
         },
         enums: {
+            success: '鎴愬姛',
+            failure: '澶辫触',
             statusTrue: '姝e父',
             statusFalse: '绂佺敤',
             true: '鏄�',
@@ -619,7 +621,7 @@
                 response: "鍝嶅簲鍐呭",
                 err: "寮傚父",
                 result: "缁撴灉",
-                costMs: "鑰楁椂(姣)",
+                costMs: "鑰楁椂(ms)",
             },
 
         }
@@ -810,6 +812,15 @@
                 }
             }
         },
+        integrationRecord: {
+            enums: {
+                direction: {
+                    none: '鏈煡',
+                    inbound: '鎺ユ敹',
+                    outbound: '璋冪敤',
+                },
+            },
+        },
         map: {
             welcome: '娆㈣繋浣跨敤 RCS 绯荤粺銆傛彁绀猴細榧犳爣宸﹂敭閫変腑瀵硅薄锛屽彸閿钩绉昏鍥撅紝婊氳疆缂╂斁瑙嗗浘銆�',
             devices: {
diff --git a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordCreate.jsx b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordCreate.jsx
index 0688a52..986cd09 100644
--- a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordCreate.jsx
+++ b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordCreate.jsx
@@ -30,12 +30,14 @@
 import DialogCloseButton from "../components/DialogCloseButton";
 import StatusSelectInput from "../components/StatusSelectInput";
 import MemoInput from "../components/MemoInput";
+import { buildDirectionChoices } from './direction';
 
 const IntegrationRecordCreate = (props) => {
     const { open, setOpen } = props;
 
     const translate = useTranslate();
     const notify = useNotify();
+    const directionChoices = useMemo(() => buildDirectionChoices(translate), [translate]);
 
     const handleClose = (event, reason) => {
         if (reason !== "backdropClick") {
@@ -124,10 +126,7 @@
                                     <SelectInput
                                         label="table.field.integrationRecord.direction"
                                         source="direction"
-                                        choices={[
-                                            { id: 1, name: '琚皟鐢�' },
-                                            { id: 2, name: '璋冪敤澶栭儴' },
-                                        ]}
+                                        choices={directionChoices}
                                     />
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
diff --git a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordDetail.jsx b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordDetail.jsx
index f091719..cccbf19 100644
--- a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordDetail.jsx
+++ b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordDetail.jsx
@@ -1,11 +1,13 @@
 import * as React from 'react';
-import { Labeled } from 'react-admin';
+import { Labeled, useTranslate } from 'react-admin';
 import { Box, Grid, Typography, Card, CardContent, TextField } from '@mui/material';
 import { format } from 'date-fns';
+import { getDirectionLabel } from './direction';
 
 const IntegrationRecordDetail = (props) => {
     const { integration } = props;
     if (!integration) return null;
+    const translate = useTranslate();
 
     const formatTimestamp = (timestamp) => {
         if (!timestamp) return '';
@@ -59,7 +61,7 @@
                         <Grid item xs={6}>
                             <Labeled label="table.field.integrationRecord.direction">
                                 <Typography variant="body2" flexWrap="nowrap">
-                                    {integration.direction$ || ''}
+                                    {getDirectionLabel(translate, integration.direction)}
                                 </Typography>
                             </Labeled>
                         </Grid>
diff --git a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordEdit.jsx b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordEdit.jsx
index bfdaa02..354ca17 100644
--- a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordEdit.jsx
+++ b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordEdit.jsx
@@ -28,6 +28,7 @@
 import CustomerTopToolBar from "../components/EditTopToolBar";
 import MemoInput from "../components/MemoInput";
 import StatusSelectInput from "../components/StatusSelectInput";
+import { buildDirectionChoices } from './direction';
 
 const FormToolbar = () => {
     const { getValues } = useFormContext();
@@ -42,6 +43,7 @@
 
 const IntegrationRecordEdit = () => {
     const translate = useTranslate();
+    const directionChoices = useMemo(() => buildDirectionChoices(translate), [translate]);
 
     return (
         <Edit
@@ -103,10 +105,7 @@
                             <SelectInput
                                 label="table.field.integrationRecord.direction"
                                 source="direction"
-                                choices={[
-                                    { id: 1, name: '琚皟鐢�' },
-                                    { id: 2, name: '璋冪敤澶栭儴' },
-                                ]}
+                                choices={directionChoices}
                                 validate={required()}
                             />
                         </Stack>
diff --git a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordList.jsx b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordList.jsx
index 0fea315..8d6e450 100644
--- a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordList.jsx
+++ b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordList.jsx
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useState, useMemo } from "react";
 import {
     List,
     DatagridConfigurable,
@@ -6,12 +6,11 @@
     TopToolbar,
     SelectColumnsButton,
     FilterButton,
+    useTranslate,
     useRecordContext,
     TextField,
     NumberField,
     DateField,
-    BooleanField,
-    ReferenceField,
     TextInput,
     DateInput,
     SelectInput,
@@ -27,6 +26,7 @@
 import { PAGE_DRAWER_WIDTH, DEFAULT_PAGE_SIZE } from '@/config/setting';
 import { format } from 'date-fns';
 import rowSx from './rowSx';
+import { buildDirectionChoices, getDirectionLabel } from './direction';
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
     '& .css-1vooibu-MuiSvgIcon-root': {
@@ -66,37 +66,36 @@
     },
 }));
 
-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);
+    const directionChoices = useMemo(() => buildDirectionChoices(translate), [translate]);
+    const filters = useMemo(() => [
+        <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={directionChoices}
+            alwaysOn
+        />,
+        // <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: 'common.enums.success' },
+                { id: 0, name: 'common.enums.failure' },
+            ]}
+            alwaysOn
+        />,
+        <TextInput label="common.field.memo" source="memo" />,
+    ], [directionChoices]);
 
     return (
         <Box display="flex">
@@ -138,12 +137,12 @@
                     <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} />
+                    <DirectionField source="direction" label="table.field.integrationRecord.direction" sortable={false} />
                     <FormattedTimestampField source="timestamp" label="table.field.integrationRecord.timestamp" />
                     <TextField source="clientIp" label="table.field.integrationRecord.clientIp" />
                     <TextField source="request" label="table.field.integrationRecord.request" sortable={false} hidden={!!drawerVal} />
                     <TextField source="response" label="table.field.integrationRecord.response" sortable={false} hidden={!!drawerVal} />
-                    <ResultField source="result" label="table.field.integrationRecord.result" />
+                    <ResultField source="result" label="table.field.integrationRecord.result" sortable={false} />
                     <TextField source="err" label="table.field.integrationRecord.err" />
                     <NumberField source="costMs" label="table.field.integrationRecord.costMs" sx={{ fontWeight: 'bold' }} />
 
@@ -178,17 +177,35 @@
 };
 
 const ResultField = ({ source }) => {
+    const translate = useTranslate();
     const record = useRecordContext();
     const val = record?.[source];
     return (
         <>
             {val === 1 ? (
-                <Chip label="success" color="success" variant="outlined" size="small" />
+                <Chip label={translate("common.enums.success")} color="success" variant="outlined" size="small" />
             ) : (
-                <Chip label="error" color="error" variant="outlined" size="small" />
+                <Chip label={translate("common.enums.failure")} color="error" variant="outlined" size="small" />
             )}
         </>
     );
 };
 
+const DirectionField = ({ source }) => {
+    const record = useRecordContext();
+    const translate = useTranslate();
+    const val = record?.[source];
+    if (val === undefined || val === null) {
+        return null;
+    }
+    return (
+        <Chip
+            label={getDirectionLabel(translate, val)}
+            variant="outlined"
+            size="small"
+            color="info"
+        />
+    );
+};
+
 export default IntegrationRecordList;
diff --git a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordPanel.jsx b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordPanel.jsx
index e9dd786..d95319a 100644
--- a/zy-acs-flow/src/page/integrationRecord/IntegrationRecordPanel.jsx
+++ b/zy-acs-flow/src/page/integrationRecord/IntegrationRecordPanel.jsx
@@ -6,6 +6,7 @@
 } from 'react-admin';
 import PanelTypography from "../components/PanelTypography";
 import * as Common from '@/utils/common'
+import { getDirectionLabel } from './direction';
 
 const IntegrationRecordPanel = () => {
     const record = useRecordContext();
@@ -73,7 +74,7 @@
                         <Grid item xs={6}>
                             <PanelTypography
                                 title="table.field.integrationRecord.direction" 
-                                property={record.direction$}
+                                property={getDirectionLabel(translate, record.direction)}
                             />
                         </Grid>
                         <Grid item xs={6}>
diff --git a/zy-acs-flow/src/page/integrationRecord/direction.js b/zy-acs-flow/src/page/integrationRecord/direction.js
new file mode 100644
index 0000000..817f244
--- /dev/null
+++ b/zy-acs-flow/src/page/integrationRecord/direction.js
@@ -0,0 +1,26 @@
+export const DIRECTION_OPTIONS = [
+    { id: 0, labelKey: 'page.integrationRecord.enums.direction.none' },
+    { id: 1, labelKey: 'page.integrationRecord.enums.direction.inbound' },
+    { id: 2, labelKey: 'page.integrationRecord.enums.direction.outbound' },
+];
+
+export const buildDirectionChoices = (translate) =>
+    DIRECTION_OPTIONS.map(option => ({
+        id: option.id,
+        name: translate(option.labelKey),
+    }));
+
+export const getDirectionLabel = (translate, value) => {
+    if (value === null || value === undefined) {
+        return '';
+    }
+    const numericValue = typeof value === 'number' ? value : Number(value);
+    if (Number.isNaN(numericValue)) {
+        return '';
+    }
+    const option = DIRECTION_OPTIONS.find(opt => opt.id === numericValue);
+    if (!option) {
+        return '';
+    }
+    return translate(option.labelKey);
+};
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/interceptor/IntegrationRecordAdvice.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/interceptor/IntegrationRecordAdvice.java
index ab4da06..cc07b4f 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/common/interceptor/IntegrationRecordAdvice.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/common/interceptor/IntegrationRecordAdvice.java
@@ -119,27 +119,24 @@
         return record;
     }
 
-    private void applyResult(IntegrationRecord record, Object body, Exception failure) {
+    private void applyResult(IntegrationRecord record, Object responseBody, Exception failure) {
         if (failure != null) {
-            record.setResult(0);
-            record.setErr(failure.getMessage());
+            record.setErr("Request failed: " + failure.getMessage());
             return;
         }
-        if (!(body instanceof R)) {
-            record.setResult(null);
-            record.setErr(null);
+        if (!(responseBody instanceof R)) {
+            record.setErr("Invalid response body structure. Expected: { code, msg, data }.");
             return;
         }
-        R response = (R) body;
-        Integer code = parseInteger(response.get("code"));
+        R r = (R) responseBody;
+        Integer code = parseInteger(r.get("code"));
         if (code == null) {
-            record.setResult(null);
-            record.setErr(null);
+            record.setErr("Missing or invalid response field: code.");
             return;
         }
-        boolean success = code == 200;
-        record.setResult(success ? 1 : 0);
-        record.setErr(success ? null : String.valueOf(response.get("msg")));
+        if (code == 200) {
+            record.setResult(1);
+        }
     }
 
     private Integer parseInteger(Object codeObj) {

--
Gitblit v1.9.1