From 3ad76f98fa8b4a9d3d95207cfb4ae4706087c964 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期四, 04 十二月 2025 19:14:15 +0800
Subject: [PATCH] 新增20251204

---
 src/set/Sets.java |  126 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 113 insertions(+), 13 deletions(-)

diff --git a/src/set/Sets.java b/src/set/Sets.java
index a5e2863..30829bd 100644
--- a/src/set/Sets.java
+++ b/src/set/Sets.java
@@ -1,4 +1,7 @@
 package set;
+
+import baseStation.BaseStation;
+
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 
@@ -26,21 +29,25 @@
     private JLabel mowerIdLabel;
     private JLabel handheldMarkerLabel;
     private JLabel simCardNumberLabel;
+    private JLabel baseStationSimLabel;
     private JLabel firmwareVersionLabel;
     private JLabel appVersionLabel;
     
     private JButton mowerIdEditBtn;
     private JButton handheldEditBtn;
     private JButton checkUpdateBtn;
+    private JButton systemDebugButton;
     private JButton feedbackButton;
     
     // 鏁版嵁妯″瀷
     private Setsys setData;
+    private final BaseStation baseStation;
     
     public Sets(JFrame parent, Color themeColor) {
         super(parent, "绯荤粺璁剧疆", true);
         this.THEME_COLOR = themeColor;
         this.setData = new Setsys();
+        this.baseStation = new BaseStation();
         initializeUI();
         loadData();
     }
@@ -49,6 +56,7 @@
         super(parent, "绯荤粺璁剧疆", true);
         this.THEME_COLOR = themeColor;
         this.setData = new Setsys();
+        this.baseStation = new BaseStation();
         initializeUI();
         loadData();
     }
@@ -99,9 +107,13 @@
         handheldEditBtn = (JButton) handheldPanel.getClientProperty("editButton");
 
         // 鐗╄仈鍗″彿
-        JPanel simCardPanel = createSettingItemPanel("鐗╄仈鍗″彿", 
+        JPanel simCardPanel = createSettingItemPanel("鍓茶崏鏈虹墿鑱旂綉鍗″彿", 
             setData.getSimCardNumber() != null ? setData.getSimCardNumber() : "鏈缃�", false);
         simCardNumberLabel = (JLabel) simCardPanel.getClientProperty("valueLabel");
+
+        JPanel baseStationSimPanel = createSettingItemPanel("鍩哄噯绔欑墿鑱旂綉鍗″彿",
+            resolveBaseStationSimCard(), false);
+        baseStationSimLabel = (JLabel) baseStationSimPanel.getClientProperty("valueLabel");
         
         // 鍥轰欢鐗堟湰
         JPanel firmwarePanel = createSettingItemPanel("鍥轰欢鐗堟湰", 
@@ -115,10 +127,12 @@
         
         addRowWithSpacing(panel, mowerIdPanel);
         addRowWithSpacing(panel, handheldPanel);
-        addRowWithSpacing(panel, simCardPanel);
-        addRowWithSpacing(panel, firmwarePanel);
-        addRowWithSpacing(panel, feedbackPanel);
-        panel.add(appVersionPanel);
+    addRowWithSpacing(panel, simCardPanel);
+    addRowWithSpacing(panel, baseStationSimPanel);
+    addRowWithSpacing(panel, firmwarePanel);
+    addRowWithSpacing(panel, feedbackPanel);
+    addRowWithSpacing(panel, appVersionPanel);
+    panel.add(createDebugPanel());
         
         return panel;
     }
@@ -209,14 +223,14 @@
         gbc.anchor = GridBagConstraints.EAST;
         panel.add(appVersionLabel, gbc);
 
-        checkUpdateBtn = new JButton("妫�鏌ユ洿鏂�");
-        checkUpdateBtn.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
-        checkUpdateBtn.setBackground(THEME_COLOR);
-        checkUpdateBtn.setForeground(Color.WHITE);
-        checkUpdateBtn.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 12));
-        checkUpdateBtn.setPreferredSize(new Dimension(90, 25));
-        checkUpdateBtn.setMinimumSize(new Dimension(90, 25));
-        checkUpdateBtn.setMaximumSize(new Dimension(90, 25));
+    checkUpdateBtn = new JButton("妫�鏌ユ洿鏂�");
+    checkUpdateBtn.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
+    checkUpdateBtn.setBackground(THEME_COLOR);
+    checkUpdateBtn.setForeground(Color.WHITE);
+    checkUpdateBtn.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
+    checkUpdateBtn.setPreferredSize(new Dimension(100, 28));
+    checkUpdateBtn.setMinimumSize(new Dimension(100, 28));
+    checkUpdateBtn.setMaximumSize(new Dimension(100, 28));
         checkUpdateBtn.setFocusPainted(false);
 
         checkUpdateBtn.addMouseListener(new MouseAdapter() {
@@ -242,6 +256,62 @@
         return panel;
     }
 
+    private JPanel createDebugPanel() {
+        JPanel panel = new JPanel(new GridBagLayout());
+        panel.setBackground(PANEL_BACKGROUND);
+        panel.setAlignmentX(Component.LEFT_ALIGNMENT);
+        panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, ROW_HEIGHT));
+        panel.setPreferredSize(new Dimension(Integer.MAX_VALUE, ROW_HEIGHT));
+        panel.setMinimumSize(new Dimension(0, ROW_HEIGHT));
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        JLabel titleLabel = new JLabel("绯荤粺璋冭瘯");
+        titleLabel.setFont(new Font("寰蒋闆呴粦", Font.BOLD, 14));
+        titleLabel.setForeground(Color.BLACK);
+        titleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.weightx = 0;
+        gbc.anchor = GridBagConstraints.EAST;
+        gbc.insets = new Insets(0, 0, 0, 12);
+        panel.add(titleLabel, gbc);
+
+        systemDebugButton = new JButton("绯荤粺璋冭瘯");
+        systemDebugButton.setFont(new Font("寰蒋闆呴粦", Font.PLAIN, 12));
+        systemDebugButton.setBackground(new Color(
+            Math.max(THEME_COLOR.getRed() - 20, 0),
+            Math.max(THEME_COLOR.getGreen() - 20, 0),
+            Math.max(THEME_COLOR.getBlue() - 20, 0)));
+        systemDebugButton.setForeground(Color.WHITE);
+        systemDebugButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
+        systemDebugButton.setPreferredSize(new Dimension(100, 28));
+        systemDebugButton.setMinimumSize(new Dimension(100, 28));
+        systemDebugButton.setMaximumSize(new Dimension(100, 28));
+        systemDebugButton.setFocusPainted(false);
+
+        systemDebugButton.addMouseListener(new MouseAdapter() {
+            public void mouseEntered(MouseEvent e) {
+                systemDebugButton.setBackground(THEME_COLOR);
+            }
+            public void mouseExited(MouseEvent e) {
+                systemDebugButton.setBackground(new Color(
+                    Math.max(THEME_COLOR.getRed() - 20, 0),
+                    Math.max(THEME_COLOR.getGreen() - 20, 0),
+                    Math.max(THEME_COLOR.getBlue() - 20, 0)));
+            }
+        });
+
+        gbc = new GridBagConstraints();
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        gbc.weightx = 1.0;
+        gbc.anchor = GridBagConstraints.EAST;
+        panel.add(systemDebugButton, gbc);
+
+        return panel;
+    }
+
     private JPanel createFeedbackPanel() {
         JPanel panel = new JPanel(new GridBagLayout());
         panel.setBackground(PANEL_BACKGROUND);
@@ -333,6 +403,7 @@
     private void loadData() {
         // 浠嶴etsys绫诲姞杞芥暟鎹�
         setData.initializeFromProperties();
+        baseStation.load();
         updateDisplay();
     }
     
@@ -351,6 +422,10 @@
             simCardNumberLabel.setText(setData.getSimCardNumber() != null ? 
                 setData.getSimCardNumber() : "鏈缃�");
         }
+
+        if (baseStationSimLabel != null) {
+            baseStationSimLabel.setText(resolveBaseStationSimCard());
+        }
         
         // 鏇存柊鍥轰欢鐗堟湰鏄剧ず
         if (firmwareVersionLabel != null) {
@@ -364,6 +439,21 @@
                 setData.getAppVersion() : "鏈缃�");
         }
     }
+
+    private String resolveBaseStationSimCard() {
+        if (baseStation == null) {
+            return "鏈缃�";
+        }
+        String value = baseStation.getIotSimCardNumber();
+        if (value == null) {
+            return "鏈缃�";
+        }
+        String trimmed = value.trim();
+        if (trimmed.isEmpty() || "-1".equals(trimmed)) {
+            return "鏈缃�";
+        }
+        return trimmed;
+    }
     
     private void setupEventHandlers() {
         // 鍓茶崏鏈虹紪鍙风紪杈戞寜閽簨浠�
@@ -383,6 +473,10 @@
         if (feedbackButton != null) {
             feedbackButton.addActionListener(e -> showFeedbackDialog());
         }
+
+        if (systemDebugButton != null) {
+            systemDebugButton.addActionListener(e -> openSystemDebugDialog());
+        }
         
     }
     
@@ -609,6 +703,12 @@
         timer.setRepeats(false);
         timer.start();
     }
+
+    private void openSystemDebugDialog() {
+        debug dialog = new debug(this, THEME_COLOR);
+        dialog.setLocationRelativeTo(this);
+        dialog.setVisible(true);
+    }
     
     @Override
     public void setVisible(boolean visible) {

--
Gitblit v1.10.0