From a857feef16fdd2ea9295f0be82a8fdaa34f13595 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期四, 24 四月 2025 18:10:30 +0800
Subject: [PATCH] 修改

---
 src/main/java/com/example/client/Login.java |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/example/client/Login.java b/src/main/java/com/example/client/Login.java
index 13cd379..8339a98 100644
--- a/src/main/java/com/example/client/Login.java
+++ b/src/main/java/com/example/client/Login.java
@@ -4,7 +4,8 @@
 import com.example.client.utils.GBC;
 import com.example.server.user.model.SysUser;
 import com.example.server.user.service.UserService;
-import com.example.server.utils.CacheUtils;
+import com.example.server.utils.UserAndSiteUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -139,6 +140,7 @@
         String finalSite = site;
         String finalTeamGroup = teamGroup;
         String finalTeam = team;
+        String finalTeamGroup1 = teamGroup;
         loginButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
@@ -149,10 +151,30 @@
 
                 user = userService.login(name, str);
                 exist = user.getExist();
-
+                Boolean exit2 = true;
+                Boolean exit3 = true;
+                if (StringUtils.isNotBlank(user.getTeamgroup())) {
+                    if (StringUtils.isNotBlank(finalTeamGroup1) && !finalTeamGroup1.equals("null")) {
+                        if (!finalTeamGroup1.contains(user.getTeamgroup())) {
+                            exit2 = false;
+                        }
+                    }
+                }
+                if (user.getNickName().equals("宸ヤ綔缁�")){
+                    if(!"宸ヤ綔缁�".equals(finalSite)){
+                        exit3 = false;
+                    }
+                }
 
                 if (exist) {
-                    System.out.println("鐧诲綍鎴愬姛");
+                    if (!exit2) {
+                        JOptionPane.showMessageDialog(null, "褰撳墠鏈哄櫒涓嶆敮鎸佽涓撲笟鐢ㄦ埛鐧诲綍", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+                        return;
+                    }
+                    if (!exit3) {
+                        JOptionPane.showMessageDialog(null, "褰撳墠鏈哄櫒涓嶆敮鎸佸伐浣滅粍鐢ㄦ埛鐧诲綍", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+                        return;
+                    }
                     try {
                         String path = Login.class.getClassLoader().getResource("config.properties").getPath();
                         OutputStream outputStream = null;
@@ -161,11 +183,12 @@
                             outputStream = new FileOutputStream(path);
                         } else {
                             try {
-                                outputStream = new FileOutputStream("config.properties");
+                                outputStream = new FileOutputStream(configPath);
                             } catch (FileNotFoundException ex) {
                                 ex.printStackTrace();
                             }
                         }
+
                         properties.setProperty("userName", name);
                         properties.setProperty("password", str);
                         properties.store(outputStream, "rxkj");
@@ -175,10 +198,9 @@
                     } catch (IOException ep) {
                         ep.printStackTrace();
                     }
-                    user.setBoatfleet(finalTeam);
-                    CacheUtils.put("user", "user", user);
-                    CacheUtils.put("site", "site", finalSite);
-                    CacheUtils.put("teamGroup", "teamGroup", finalTeamGroup);
+                    user.setBoatFleet(finalTeam);
+                    UserAndSiteUtils.put("user", "user", user);
+                    UserAndSiteUtils.put("site", "site", finalSite);
                     main.Start(role, user.getId());
                     frame.dispose();
                 } else {

--
Gitblit v1.9.1