jinlin
2025-03-21 77d58298d00c11ade8862ca8acb0fdef5a45322e
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;
@@ -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");