From be293241a9f7a45393f165da1ffec05bf4045d23 Mon Sep 17 00:00:00 2001 From: zhuibobo Date: Sun, 26 Jul 2026 19:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E6=95=B0=E6=8D=AE=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BizSyncManageController.java | 16 + .../src/api/efcode/biz/index.ts | 10 + .../src/views/efcode/biz/index.vue | 402 +++++++++++++++--- 3 files changed, 369 insertions(+), 59 deletions(-) diff --git a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/businessdatasyn/controller/BizSyncManageController.java b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/businessdatasyn/controller/BizSyncManageController.java index 51ffc461..9376bf7d 100644 --- a/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/businessdatasyn/controller/BizSyncManageController.java +++ b/zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/businessdatasyn/controller/BizSyncManageController.java @@ -145,6 +145,10 @@ public class BizSyncManageController { Page page = recordMapper.selectPage( new Page<>(pageNum, pageSize), new LambdaQueryWrapper() + // 列表页排除两个大 JSON 快照列,避免全量传输拖慢查询 + .select(BizSyncRecord.class, f -> + !"snapshotV1Json".equals(f.getProperty()) + && !"snapshotV2Json".equals(f.getProperty())) .eq(configKey != null && !configKey.isEmpty(), BizSyncRecord::getConfigKey, configKey) .eq(status != null && !status.isEmpty(), BizSyncRecord::getStatus, status) .orderByDesc(BizSyncRecord::getUpdateTime) @@ -152,6 +156,18 @@ public class BizSyncManageController { return R.ok(page); } + /** + * 查询影子记录详情(含 snapshot_v1_json / snapshot_v2_json 完整快照) + */ + @GetMapping("/record/detail/{id}") + public R recordDetail(@PathVariable Long id) { + BizSyncRecord record = recordMapper.selectById(id); + if (record == null) { + return R.fail("记录不存在"); + } + return R.ok(record); + } + /** * 重试死信记录 */ diff --git a/zdxt-web-client/zdxt-admin-plus-ui/src/api/efcode/biz/index.ts b/zdxt-web-client/zdxt-admin-plus-ui/src/api/efcode/biz/index.ts index 23f400a3..ab3a0622 100644 --- a/zdxt-web-client/zdxt-admin-plus-ui/src/api/efcode/biz/index.ts +++ b/zdxt-web-client/zdxt-admin-plus-ui/src/api/efcode/biz/index.ts @@ -74,6 +74,16 @@ export const getRecordList = (params: { configKey?: string; status?: string; pag }); }; +/** + * 查询影子记录详情(含快照JSON) + */ +export const getRecordDetail = (id: number) => { + return request({ + url: '/web/biz-sync/record/detail/' + id, + method: 'get' + }); +}; + /** * 重试死信记录 */ diff --git a/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/biz/index.vue b/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/biz/index.vue index d9721bb3..1c80db24 100644 --- a/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/biz/index.vue +++ b/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/biz/index.vue @@ -9,7 +9,10 @@ import { triggerForceSync, getTaskList, getLogList, - getJobStatus + getJobStatus, + getRecordList, + getRecordDetail, + retryRecord } from '@/api/efcode/biz'; /** @@ -118,6 +121,105 @@ const syncConfigs = ref([ const loading = ref(false); +// ============ Tab 切换 ============ +const activeTab = ref('config'); + +/** Tab 切换:首次进入影子记录页时自动加载 */ +const handleTabChange = (name: string | number) => { + if (name === 'record' && recordList.value.length === 0) { + loadRecordList(); + } +}; + +// ============ 影子记录 Tab ============ +const recordLoading = ref(false); +const recordList = ref([]); +const recordTotal = ref(0); +const recordQuery = reactive({ + configKey: '', + status: '', + pageNum: 1, + pageSize: 20 +}); + +/** 加载影子记录列表(后端按 create_time 倒序) */ +const loadRecordList = async () => { + recordLoading.value = true; + try { + const res: any = await getRecordList(recordQuery); + const data = res.data; + recordList.value = data?.records || []; + recordTotal.value = data?.total || 0; + } catch (e) { + console.error('加载影子记录失败', e); + } finally { + recordLoading.value = false; + } +}; + +/** 影子记录查询(重置到第一页) */ +const handleRecordSearch = () => { + recordQuery.pageNum = 1; + loadRecordList(); +}; + +/** 重试死信记录 */ +const handleRetryRecord = async (row: any) => { + try { + await ElMessageBox.confirm( + `确认重试该死信记录(主键: ${row.pkValue})?`, + '确认', + { type: 'warning' } + ); + const res: any = await retryRecord(row.id); + ElMessage.success(res?.msg || '重试成功'); + loadRecordList(); + } catch (e: any) { + if (e !== 'cancel' && e?.action !== 'cancel') { + ElMessage.error(e?.msg || '重试失败'); + } + } +}; + +/** 影子记录状态标签类型 */ +const recordStatusType = (status: string) => { + switch (status) { + case 'NORMAL': return 'success'; + case 'DEAD': return 'danger'; + default: return 'info'; + } +}; + +// ============ 同步记录详情弹窗 ============ +const recordDetailVisible = ref(false); +const recordDetailLoading = ref(false); +const recordDetail = ref(null); + +/** 格式化 JSON 字符串(美化缩进) */ +const prettyJson = (jsonStr: string) => { + if (!jsonStr) return '(空)'; + try { + return JSON.stringify(JSON.parse(jsonStr), null, 2); + } catch (e) { + return jsonStr; + } +}; + +/** 查看同步记录详情(含快照JSON,按需加载) */ +const handleViewRecordDetail = async (row: any) => { + recordDetailVisible.value = true; + recordDetailLoading.value = true; + recordDetail.value = null; + try { + const res: any = await getRecordDetail(row.id); + recordDetail.value = res?.data || null; + } catch (e: any) { + ElMessage.error(e?.msg || '加载详情失败'); + } finally { + recordDetailLoading.value = false; + } +}; + // ============ 异步任务轮询状态 ============ interface RunningJob { jobId: string; @@ -452,66 +554,175 @@ onUnmounted(() => { - - - - - - - - - - - - - - -