From efce7ce3e63712ecc8b4c3039a73b508fc3ea880 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 28 四月 2025 10:20:37 +0800
Subject: [PATCH] 修改

---
 src/main/java/com/example/client/service/Level3ManageService.java |  266 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 213 insertions(+), 53 deletions(-)

diff --git a/src/main/java/com/example/client/service/Level3ManageService.java b/src/main/java/com/example/client/service/Level3ManageService.java
index ac2ab59..c3153ab 100644
--- a/src/main/java/com/example/client/service/Level3ManageService.java
+++ b/src/main/java/com/example/client/service/Level3ManageService.java
@@ -3,15 +3,14 @@
 import com.example.client.dto.ColumnDto;
 import com.example.client.dto.JComboBoxItem;
 import com.example.client.model.TableButton;
-import com.example.client.utils.CommonTable;
-import com.example.client.utils.GBC;
-import com.example.client.utils.MultiSelectComboBox;
+import com.example.client.utils.*;
 import com.example.server.cabin.service.CabinService;
 import com.example.server.progressTrack.model.DjJdgzNetworkLevel1;
 import com.example.server.progressTrack.model.DjJdgzNetworkLevel3;
 import com.example.server.progressTrack.model.DjJdgzShip;
 import com.example.server.progressTrack.service.*;
 import com.example.server.teamGroup.service.SysTeamGroupClassService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -57,6 +56,7 @@
 
     public JPanel createTable(Integer width, Integer height, JFrame jFrame) {
         JPanel panel = new JPanel();
+        panel.setPreferredSize(new Dimension(width, height));
 
         JPanel topJpanel = new JPanel();
         GridBagLayout layout = new GridBagLayout();
@@ -65,7 +65,7 @@
         topJpanel.setBackground(Color.WHITE);
 
         JPanel centerJpanel = new JPanel();
-        centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100));
+        centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame)));
         centerJpanel.setBackground(Color.WHITE);
         panel.add(topJpanel, BorderLayout.NORTH);
         panel.add(centerJpanel, BorderLayout.CENTER);
@@ -75,7 +75,12 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
         String[] typeList = new String[]{
-                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�"
+                "","鏀规崲瑁�","淇悊","鏀硅繘鎬т慨鐞�","涓嶅瑁呰澶�"
+        };
+        JComboBoxItem[] isealCabin = {
+                new JComboBoxItem(10000L, ""),
+                new JComboBoxItem(0L, "鍚�"),
+                new JComboBoxItem(1L, "鏄�"),
         };
 
         JLabel JLabel0 = new JLabel("宸ョ▼");
@@ -100,6 +105,14 @@
         JComboBox<String> comboBox4 = new JComboBox<>(typeList);
         comboBox4.setPreferredSize(new Dimension(185, 28));
 
+        JLabel JLabel5 = new JLabel("鏄惁褰卞搷灏佽埍");
+        JComboBox<JComboBoxItem> comboBox5 = new JComboBox<>(isealCabin);
+        comboBox5.setPreferredSize(new Dimension(185, 28));
+
+        JLabel JLabel6 = new JLabel("鏄惁鑱旇皟");
+        JComboBox<JComboBoxItem> comboBox6 = new JComboBox<>(isealCabin);
+        comboBox6.setPreferredSize(new Dimension(185, 28));
+
         JTextField sb = new JTextField(16);
         JButton query = new JButton("鏌ヨ");
 
@@ -117,12 +130,16 @@
         topJpanel.add(JLabel4, new GBC(8, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
         topJpanel.add(comboBox4, new GBC(9, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        topJpanel.add(sb, new GBC(0, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        topJpanel.add(query, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
-        topJpanel.add(btnInsert, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        topJpanel.add(btnImport, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(JLabel5, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(comboBox5, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(JLabel6, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(comboBox6, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        topJpanel.add(btnInsert, new GBC(7, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        topJpanel.add(btnImport, new GBC(8, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null);
+        list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()),Math.toIntExact(isealCabin[0].getId()), null);
         List<TableButton> buttonList = new ArrayList<>();
         buttonList.add(new TableButton("edit", "缂栬緫"));
         buttonList.add(new TableButton("del", "鍒犻櫎"));
@@ -130,22 +147,29 @@
 
         columnDto = new ArrayList<>();
         //columnDto.add(new ColumnDto("ID", "id", -1, null,false));
-        columnDto.add(new ColumnDto("搴忓彿", "", (width - 10) / 10, "autoCreate", false, null, null));
-        columnDto.add(new ColumnDto("宸ョ▼", "ProjectName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", (width - 10) / 10, "dict", false, null, deptList));
-        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", (width - 10) / 10, "dict", false, null, teamList));
-        columnDto.add(new ColumnDto("鑸卞", "cabinId", (width - 10) / 10, "dict", false, null, cabinList));
-        columnDto.add(new ColumnDto("绫诲埆", "type", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("涓�绾х綉缁滃浘鑺傜偣鍚嶇О", "level1NodeName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("浜岀骇缃戠粶鍥捐妭鐐瑰悕绉�", "level2NodeName", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("涓夌骇缃戠粶鍥惧悕绉�", "name", (width - 10) / 10, null, false, null, null));
-        columnDto.add(new ColumnDto("鎿嶄綔", "", (width - 10) / 10, "", true, buttonList, null));
+        columnDto.add(new ColumnDto("搴忓彿", "", 80, "autoCreate", false, null, null));
+        //columnDto.add(new ColumnDto("宸ョ▼", "ProjectName", 150, null, false, null, null));
+        columnDto.add(new ColumnDto("閮ㄩ棬", "deptId", 150, "dict", false, null, deptList));
+        columnDto.add(new ColumnDto("涓撲笟", "teamgroupId", 150, "dict", false, null, teamList));
+        columnDto.add(new ColumnDto("鑸卞", "cabinId", 80, "dict", false, null, cabinList));
+        columnDto.add(new ColumnDto("绫诲埆", "type", 120, null, false, null, null));
+        columnDto.add(new ColumnDto("涓�绾х綉缁滃浘鑺傜偣鍚嶇О", "level1NodeName", 185, null, false, null, null));
+        columnDto.add(new ColumnDto("浜岀骇缃戠粶鍥捐妭鐐瑰悕绉�", "level2NodeName", 185, null, false, null, null));
+        columnDto.add(new ColumnDto("涓夌骇缃戠粶鍥惧悕绉�", "name", 176, null, false, null, null));
+        columnDto.add(new ColumnDto("鏄惁褰卞搷灏佽埍", "isealCabin", 160, "dict", false, null, isealCabin));
+        columnDto.add(new ColumnDto("鏄惁鑱旇皟", "islt", 100, "dict", false, null, isealCabin));
+        columnDto.add(new ColumnDto("鎿嶄綔", "", 190, "", true, buttonList, null));
 
         table = CommonTable.createCommonTable(list, columnDto);
         table.setRowHeight(25);
-        table.setAutoCreateRowSorter(true);
+
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
+        for (int i = 0; i < shipList.size(); i++) {
+            shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId());
+            comboBox.addItem(shipList.get(i).getShipNo());
+        }
+        comboBox.setSelectedItem(shipList.get(0).getShipNo());
         comboBox.addItemListener(new ItemListener() {
             public void itemStateChanged(final ItemEvent event) {
                 String content = comboBox.getSelectedItem().toString();
@@ -153,13 +177,15 @@
                 JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -170,23 +196,24 @@
                 if (e.getStateChange() == ItemEvent.SELECTED) {
                     JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem();
                     if (selectedItem != null) {
-                        long selectedId = selectedItem.getId();
+                        Long selectedId = selectedItem.getId();
 
                         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId);
                         comboBox2.setModel(new DefaultComboBoxModel<>(teamList));
-                        comboBox2.setSelectedIndex(0);
 
                         String content = comboBox.getSelectedItem().toString();
                         JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
                         JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
                         JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                        JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                         String type = comboBox4.getSelectedItem().toString();
+                        JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                         Long shipId = shipMap.get(content);
-                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                        list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
                         CommonTable.refreshTable(list, columnDto, table);
                         table.setRowHeight(25);
-                        table.setAutoCreateRowSorter(true);
+
                         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
                         tableModelListener(list, table, jFrame);
@@ -201,14 +228,17 @@
                 JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
                 JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
 
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -219,14 +249,16 @@
                 JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
                 JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
@@ -237,50 +269,93 @@
                 JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
                 JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
                 JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
                 String type = comboBox4.getSelectedItem().toString();
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
 
                 Long shipId = shipMap.get(content);
-                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
         });
+
+        comboBox5.addItemListener(new ItemListener() {
+            public void itemStateChanged(final ItemEvent event) {
+                String content = comboBox.getSelectedItem().toString();
+                JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
+                JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
+                JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
+                String type = comboBox4.getSelectedItem().toString();
+
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
+                Long shipId = shipMap.get(content);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
+
+                CommonTable.refreshTable(list, columnDto, table);
+                table.setRowHeight(25);
+
+                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+                tableModelListener(list, table, jFrame);
+            }
+        });
+        comboBox6.addItemListener(new ItemListener() {
+            public void itemStateChanged(final ItemEvent event) {
+                String content = comboBox.getSelectedItem().toString();
+                JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem();
+                JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem();
+                JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem();
+                JComboBoxItem isCabin = (JComboBoxItem) comboBox5.getSelectedItem();
+                String type = comboBox4.getSelectedItem().toString();
+
+                JComboBoxItem isLt = (JComboBoxItem) comboBox6.getSelectedItem();
+
+                Long shipId = shipMap.get(content);
+                list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, Math.toIntExact(isCabin.getId()),Math.toIntExact(isLt.getId()),null);
+
+                CommonTable.refreshTable(list, columnDto, table);
+                table.setRowHeight(25);
+
+                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+                tableModelListener(list, table, jFrame);
+            }
+        });
+
 
         query.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                list = level3Service.getList(null, null, null, null, null,sb.getText());
+                list = level3Service.getList(null, null, null, null, null,null,null, sb.getText());
 
                 CommonTable.refreshTable(list, columnDto, table);
                 table.setRowHeight(25);
-                table.setAutoCreateRowSorter(true);
+
                 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                 tableModelListener(list, table, jFrame);
             }
         });
-
-        for (int i = 0; i < shipList.size(); i++) {
-            shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId());
-            comboBox.addItem(shipList.get(i).getShipNo());
-        }
-        comboBox.setSelectedItem(shipList.get(0).getShipNo());
 
         tableModelListener(list, table, jFrame);
 
         btnInsert.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                insert(jFrame);
+                jFrame.setEnabled(false);
+                DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3();
+                insert(jFrame,data);
             }
         });
 
         btnImport.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
+                jFrame.setEnabled(false);
                 importService.FileUpload(columnDto, table, jFrame);
             }
         });
@@ -288,15 +363,26 @@
         JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         scrollPane.setViewportView(table);
         scrollPane.getViewport().setBackground(Color.WHITE);
-        scrollPane.setPreferredSize(new Dimension(width - 20, height - 120));
+        scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(105, jFrame)));
         centerJpanel.add(scrollPane);
+        jFrame.addComponentListener(new ComponentAdapter() {
+            @Override
+            public void componentResized(ComponentEvent e) {
+                centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame)));
+                scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(105, jFrame)));
+                centerJpanel.revalidate();
+                centerJpanel.repaint();
+                scrollPane.revalidate();
+                scrollPane.repaint();
+            }
+        });
 
         return panel;
     }
 
-    private void insert(JFrame jFrame) {
+    public void insert(JFrame jFrame,DjJdgzNetworkLevel3 data) {
         JFrame frame1 = new JFrame("鏂板涓夌骇缃戠粶鍥�");
-        frame1.setSize(470, 430);
+        frame1.setSize(500, 500);
         frame1.setResizable(true);
         frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         frame1.setLocationRelativeTo(null);
@@ -316,42 +402,102 @@
         JComboBoxItem[] cabinList = cabinService.getList();
         JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null);
         String[] typeList = new String[]{
-                "鏀硅", "鍔犺", "鎹㈣", "鏀硅繘鎬т慨鐞�"
+                "","鏀规崲瑁�","淇悊","鏀硅繘鎬т慨鐞�","涓嶅瑁呰澶�"
+        };
+        JComboBoxItem[] isealCabin = {
+                new JComboBoxItem(0L, "鍚�"),
+                new JComboBoxItem(1L, "鏄�"),
         };
 
         JLabel JLabel1 = new JLabel("宸ョ▼");
         JComboBox<JComboBoxItem> comboBox0 = new JComboBox<>(projectList);
         comboBox0.setPreferredSize(new Dimension(185, 28));
         comboBox0.setSelectedIndex(-1);
+        if (data.getLevel1NetworkId()!=null){
+            comboBox0.setSelectedItem(BoxIteUtils.GetSelectItemById(projectList, data.getLevel1NetworkId()));
+        }
 
         JLabel JLabel2 = new JLabel("浜岀骇缃戠粶鍥�");
         JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>();
         comboBox1.setPreferredSize(new Dimension(185, 28));
+        if (data.getLevel2NetworkId()!=null){
+            JComboBoxItem[] level2List = level2Service.getLevel2List(data.getLevel1NetworkId());
+            comboBox1.setModel(new DefaultComboBoxModel<>(level2List));
+            comboBox1.setSelectedItem(BoxIteUtils.GetSelectItemById(level2List, data.getLevel2NetworkId()));
+        }
 
         JLabel JLabel3 = new JLabel("浜岀骇缃戠粶鍥捐妭鐐�");
         JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>();
         comboBox2.setPreferredSize(new Dimension(185, 28));
+        if (data.getLevel2NodeId()!=null){
+            JComboBoxItem[] level2NodeList = level2ListService.getNode(data.getLevel2NetworkId());
+            comboBox2.setModel(new DefaultComboBoxModel<>(level2NodeList));
+            comboBox2.setSelectedItem(BoxIteUtils.GetSelectItemById(level2NodeList, data.getLevel2NodeId()));
+        }
 
         JLabel JLabel4 = new JLabel("閮ㄩ棬");
         JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(deptList);
         comboBox3.setPreferredSize(new Dimension(185, 28));
+        if (data.getDeptId()!=null){
+            comboBox3.setSelectedItem(BoxIteUtils.GetSelectItemById(deptList, data.getDeptId()));
+        }
 
         JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId());
 
         JLabel JLabel5 = new JLabel("涓撲笟");
         JComboBox<JComboBoxItem> comboBox4 = new JComboBox<>(teamList1);
         comboBox4.setPreferredSize(new Dimension(185, 28));
+        if (data.getTeamgroupId()!=null){
+            JComboBoxItem[] teamList3 = sysTeamGroupClassService.getTeamList(data.getDeptId());
+            comboBox4.setModel(new DefaultComboBoxModel<>(teamList3));
+            comboBox4.setSelectedItem(BoxIteUtils.GetSelectItemById(teamList3, data.getTeamgroupId()));
+        }
 
         JLabel JLabel6 = new JLabel("鑸卞");
         MultiSelectComboBox comboBox5 = new MultiSelectComboBox(cabinList);
         comboBox5.setPreferredSize(new Dimension(200, 25));
+        if (data.getCabinId()!=null){
+            Set<Long> selectedIds = new HashSet<>();
+            String[] idParts = data.getCabinId().split(",");
+            for (String idPart : idParts) {
+                selectedIds.add(Long.parseLong(idPart.trim())); // 灏嗗瓧绗︿覆杞崲涓� Long 绫诲瀷骞舵坊鍔犲埌闆嗗悎涓�
+            }
+
+            // 灏� ID 杞崲涓哄搴旂殑 JComboBoxItem 瀵硅薄
+            Set<JComboBoxItem> selectedItems = new HashSet<>();
+            for (JComboBoxItem item : cabinList) {
+                if (selectedIds.contains(item.getId())) { // 妫�鏌� Long 绫诲瀷鐨� ID 鏄惁鍖归厤
+                    selectedItems.add(item); // 娣诲姞鍒伴�変腑椤归泦鍚�
+                }
+            }
+            comboBox5.setSelectedItems(selectedItems);
+        }
 
         JLabel JLabel7 = new JLabel("绫诲埆");
         JComboBox<String> comboBox6 = new JComboBox<>(typeList);
+        if (data.getType()!=null){
+            comboBox6.setSelectedItem(data.getType());
+        }
 
+        JLabel JLabel78 = new JLabel("鏄惁褰卞搷灏佽埍");
+        JComboBox<JComboBoxItem> comboBox7 = new JComboBox<>(isealCabin);
+        comboBox7.setPreferredSize(new Dimension(185, 28));
+        if (data.getIsealCabin()!=null){
+            comboBox7.setSelectedItem(BoxIteUtils.GetSelectItemById(isealCabin, Long.valueOf(data.getIsealCabin())));
+        }
+
+        JLabel JLabel789 = new JLabel("鏄惁鑱旇皟");
+        JComboBox<JComboBoxItem> comboBox78 = new JComboBox<>(isealCabin);
+        comboBox78.setPreferredSize(new Dimension(185, 28));
+        if (data.getIslt()!=null){
+            comboBox78.setSelectedItem(BoxIteUtils.GetSelectItemById(isealCabin, Long.valueOf(data.getIslt())));
+        }
 
         JLabel JLabel8 = new JLabel("涓夌骇缃戠粶鍥惧悕绉�");
         JTextField level3Name = new JTextField(16);
+        if (StringUtils.isNotBlank(data.getName())){
+            level3Name.setText(data.getName());
+        }
 
         comboBox0.addItemListener(new ItemListener() {
             @Override
@@ -421,11 +567,16 @@
 
         frame1.add(JLabel7, new GBC(0, 6, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
         frame1.add(comboBox6, new GBC(1, 6, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        frame1.add(JLabel78, new GBC(0, 7, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        frame1.add(comboBox7, new GBC(1, 7, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+        frame1.add(JLabel789, new GBC(0, 8, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        frame1.add(comboBox78, new GBC(1, 8, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        frame1.add(JLabel8, new GBC(0, 7, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
-        frame1.add(level3Name, new GBC(1, 7, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
 
-        frame1.add(btnSave, new GBC(0, 8, 2, 1).setWeight(1, 0));
+        frame1.add(JLabel8, new GBC(0, 9, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+        frame1.add(level3Name, new GBC(1, 9, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+        frame1.add(btnSave, new GBC(0, 10, 2, 1).setWeight(1, 0));
 
         btnSave.addActionListener((e) -> {
             JComboBoxItem level1 = (JComboBoxItem) comboBox0.getSelectedItem();
@@ -433,32 +584,41 @@
             JComboBoxItem level2Node = (JComboBoxItem) comboBox2.getSelectedItem();
             JComboBoxItem dept = (JComboBoxItem) comboBox3.getSelectedItem();
             JComboBoxItem team = (JComboBoxItem) comboBox4.getSelectedItem();
+            JComboBoxItem isealCabinItem = (JComboBoxItem) comboBox7.getSelectedItem();
+            JComboBoxItem iltItem = (JComboBoxItem) comboBox78.getSelectedItem();
             Set<JComboBoxItem> selectedItems = comboBox5.getSelectedItems();
             StringBuilder selectedIds = new StringBuilder();
             for (JComboBoxItem item : selectedItems) {
                 selectedIds.append(item.getId()).append(",");
             }
             String name = level3Name.getText();
-            DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3();
             DjJdgzNetworkLevel1 level1Data = level1Service.get(level1.getId());
             data.setLevel1NetworkId(level1.getId());
             data.setLevel2NetworkId(level2.getId());
             data.setLevel2NodeId(level2Node.getId());
             data.setName(name);
+            data.setIsealCabin(Math.toIntExact(isealCabinItem.getId()));
+            data.setIslt(Math.toIntExact(iltItem.getId()));
             data.setDeptId(dept.getId());
             data.setTeamgroupId(team.getId());
             data.setTeamgroupName(team.getName());
             data.setCabinId(String.valueOf(selectedIds));
             data.setType(comboBox6.getSelectedItem().toString());
-            level3Service.insert(data);
-            list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null);
+            if (data.getId()!=null){
+                level3Service.update(data);
+            }else{
+                level3Service.insert(data);
+            }
+
+            list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()),Math.toIntExact(isealCabin[0].getId()), null);
             CommonTable.refreshTable(list, columnDto, table);
             table.setRowHeight(25);
-            table.setAutoCreateRowSorter(true);
+
             table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
             tableModelListener(list, table, jFrame);
             frame1.dispose();
             jFrame.setEnabled(true);//灏嗕富鐣岄潰鍐嶈缃负鍙搷浣滅殑
+            JOptionPane.showMessageDialog(null, "淇濆瓨鎴愬姛", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
         });
     }
 

--
Gitblit v1.9.1