From 7f5695dabbe94ec1d5a4d7f6411934453d44d8c4 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 21 Sep 2026 09:53:00 +0800
Subject: [PATCH] refactor(gate): 重命名自定义止损相关字段以提高语义清晰度

---
 src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java
index 480b87c..1c9cd31 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfigPersistenceService.java
@@ -103,6 +103,18 @@
                 .quantity(nvl(dto.getQuantity(), "2"))
                 .maxPositionSize(dto.getMaxPositionSize())
                 .stopLossCount(dto.getStopLossCount())
+                .takeProfitGridSpan(dto.getTakeProfitGridSpan())
+                .priceDriveEnabled(nvl(dto.getPriceDriveEnabled(), true))
+                .rounds(dto.getRounds())
+                .stopLossCountMode(nvl(dto.getStopLossCountMode(), "dual"))
+                .addPositionInterval(dto.getAddPositionInterval() >= 0 ? dto.getAddPositionInterval() : 3)
+                .addPositionQuantity(dto.getAddPositionQuantity() > 0 ? dto.getAddPositionQuantity() : 1)
+                .maxPositionPerSide(dto.getMaxPositionPerSide())
+                .addPositionStartThreshold(dto.getAddPositionStartThreshold() >= 0 ? dto.getAddPositionStartThreshold() : 1)
+                .placeExcessTakeProfit(normalizeTakeProfitMode(dto.getPlaceExcessTakeProfit()))
+                .dualStopLossEnabled(nvl(dto.getDualStopLossEnabled(), false))
+                .longStopLossPrice(dto.getLongStopLossPrice())
+                .shortStopLossPrice(dto.getShortStopLossPrice())
                 .build();
     }
 
@@ -132,4 +144,22 @@
     private static <T> T nvl(T value, T fallback) {
         return value != null ? value : fallback;
     }
+
+    /**
+     * 归一化止盈挂单模式,兼容旧版 boolean 配置(旧 JSON 的 true/false 会被 Jackson 反序列化为字符串)。
+     */
+    private static String normalizeTakeProfitMode(String raw) {
+        if (raw == null || raw.trim().isEmpty()) {
+            return GateConfig.EXCESS_TP_OFF;
+        }
+        switch (raw.trim()) {
+            case "true":
+            case "concentrated":
+                return GateConfig.EXCESS_TP_CONCENTRATED;
+            case "dispersed":
+                return GateConfig.EXCESS_TP_DISPERSED;
+            default:
+                return GateConfig.EXCESS_TP_OFF;
+        }
+    }
 }

--
Gitblit v1.9.1