From b83bc2ee89d5826b3ab5fe42ac3af5972360b55c Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 27 四月 2026 19:29:48 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/ai/service/impl/AutoTuneSnapshotServiceImpl.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/ai/service/impl/AutoTuneSnapshotServiceImpl.java b/src/main/java/com/zy/ai/service/impl/AutoTuneSnapshotServiceImpl.java
index 176e1b0..8b56cf2 100644
--- a/src/main/java/com/zy/ai/service/impl/AutoTuneSnapshotServiceImpl.java
+++ b/src/main/java/com/zy/ai/service/impl/AutoTuneSnapshotServiceImpl.java
@@ -2,8 +2,11 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.zy.ai.domain.autotune.AutoTuneParameterSnapshot;
+import com.zy.ai.domain.autotune.AutoTuneRuleDefinition;
+import com.zy.ai.domain.autotune.AutoTuneRuleSnapshotItem;
 import com.zy.ai.domain.autotune.AutoTuneSnapshot;
 import com.zy.ai.domain.autotune.AutoTuneStationRuntimeItem;
+import com.zy.ai.domain.autotune.AutoTuneTargetType;
 import com.zy.ai.domain.autotune.AutoTuneTaskSnapshot;
 import com.zy.ai.service.AutoTuneSnapshotService;
 import com.zy.ai.service.FlowTopologySnapshotService;
@@ -86,10 +89,47 @@
         snapshot.setCycleLoadSnapshot(buildCycleLoadSnapshot());
         snapshot.setFlowTopologySnapshot(flowTopologySnapshotService.buildSnapshot(stationRuntimeSnapshot));
         snapshot.setCurrentParameterSnapshot(buildCurrentParameterSnapshot());
+        snapshot.setRuleSnapshot(buildRuleSnapshot());
         snapshot.setSnapshotTime(new Date());
         return snapshot;
     }
 
+    List<AutoTuneRuleSnapshotItem> buildRuleSnapshot() {
+        List<AutoTuneRuleSnapshotItem> result = new ArrayList<>();
+        for (AutoTuneRuleDefinition.Rule rule : AutoTuneRuleDefinition.rules().values()) {
+            AutoTuneRuleSnapshotItem item = new AutoTuneRuleSnapshotItem();
+            item.setTargetType(rule.getTargetType().getCode());
+            item.setTargetKey(rule.getTargetKey());
+            item.setMinValue(rule.getMinValue());
+            item.setMaxValue(rule.getMaxValue());
+            item.setMaxStep(rule.getMaxStep());
+            item.setCooldownMinutes(rule.getCooldownMinutes());
+            item.setDynamicMaxValue(rule.isDynamicMaxValue());
+            item.setDynamicMaxSource(resolveDynamicMaxSource(rule));
+            item.setNote(resolveRuleNote(rule));
+            result.add(item);
+        }
+        return result;
+    }
+
+    private String resolveDynamicMaxSource(AutoTuneRuleDefinition.Rule rule) {
+        if (!AutoTuneTargetType.STATION.equals(rule.getTargetType())) {
+            return null;
+        }
+        if (!"outTaskLimit".equals(rule.getTargetKey())) {
+            return null;
+        }
+        return "currentParameterSnapshot.stationOutBufferCapacities[targetId]";
+    }
+
+    private String resolveRuleNote(AutoTuneRuleDefinition.Rule rule) {
+        if (AutoTuneTargetType.STATION.equals(rule.getTargetType())
+                && "outTaskLimit".equals(rule.getTargetKey())) {
+            return "鍗曟璋冩暣骞呭害涓嶈兘瓒呰繃 maxStep锛涘澶ф椂涓嶅緱瓒呰繃瀵瑰簲绔欑偣 outBufferCapacity銆�";
+        }
+        return "鍗曟璋冩暣骞呭害涓嶈兘瓒呰繃 maxStep銆�";
+    }
+
     private AutoTuneTaskSnapshot buildTaskSnapshot() {
         List<WrkMast> activeTasks = loadActiveTasks();
 

--
Gitblit v1.9.1