From 77d58298d00c11ade8862ca8acb0fdef5a45322e Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期五, 21 三月 2025 17:39:38 +0800 Subject: [PATCH] 修改 --- src/main/java/com/example/client/Login.java | 39 ++++++++++++++++++++++++++++++++------- 1 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/example/client/Login.java b/src/main/java/com/example/client/Login.java index f19e7c0..be1237b 100644 --- a/src/main/java/com/example/client/Login.java +++ b/src/main/java/com/example/client/Login.java @@ -5,6 +5,7 @@ import com.example.server.user.model.SysUser; import com.example.server.user.service.UserService; import com.example.server.utils.CacheUtils; +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; @@ -47,6 +48,7 @@ String password = "admin"; String site = ""; String teamGroup = ""; + String team = ""; String path = Login.class.getClassLoader().getResource("config.properties").getPath(); InputStream inStream = null; @@ -70,9 +72,10 @@ password = properties.get("password").toString(); site = properties.get("site").toString(); teamGroup = properties.get("teamGroup").toString(); + team = properties.get("team").toString(); } catch (IOException e) { e.printStackTrace(); - }finally { + } finally { if (reader != null) { try { reader.close(); @@ -136,6 +139,8 @@ String finalSite = site; String finalTeamGroup = teamGroup; + String finalTeam = team; + String finalTeamGroup1 = teamGroup; loginButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -144,12 +149,32 @@ String str = String.valueOf(password); //灏哻har鏁扮粍杞寲涓簊tring绫诲瀷 - user = userService.login(name,str); + 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; @@ -158,14 +183,14 @@ 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.setProperty("url", "11"); properties.store(outputStream, "rxkj"); outputStream.close(); } catch (FileNotFoundException ex) { @@ -173,7 +198,7 @@ } catch (IOException ep) { ep.printStackTrace(); } - + user.setBoatfleet(finalTeam); CacheUtils.put("user", "user", user); CacheUtils.put("site", "site", finalSite); CacheUtils.put("teamGroup", "teamGroup", finalTeamGroup); -- Gitblit v1.9.1