| | |
| | | import com.zy.asrs.common.domain.dto.PowerDto; |
| | | import com.zy.asrs.common.domain.entity.Parameter; |
| | | import com.zy.asrs.common.domain.enums.HtmlNavIconType; |
| | | import com.zy.asrs.common.domain.enums.LoginSystemType; |
| | | import com.zy.asrs.common.properties.OSinfo; |
| | | import com.zy.asrs.common.properties.SystemProperties; |
| | | import com.zy.asrs.common.sys.entity.*; |
| | |
| | | |
| | | @RequestMapping("/login.action") |
| | | @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "登录") |
| | | public R loginAction(String username, String password){ |
| | | public R loginAction(String username, String password, Boolean wms) { |
| | | if (username.equals("super") && password.equals(Cools.md5(superPwd))) { |
| | | Map<String, Object> res = new HashMap<>(); |
| | | res.put("username", username); |
| | |
| | | LambdaQueryWrapper<User> userWrapper = new LambdaQueryWrapper<>(); |
| | | userWrapper.eq(User::getUsername, username); |
| | | User user = userService.getOne(userWrapper); |
| | | if (Cools.isEmpty(user)){ |
| | | if (Cools.isEmpty(user)) { |
| | | return R.parse(CodeRes.USER_10001); |
| | | } |
| | | if (user.getStatus()!=1){ |
| | | if (user.getStatus() != 1) { |
| | | return R.parse(CodeRes.USER_10002); |
| | | } |
| | | if (!user.getPassword().equals(password)){ |
| | | if (!user.getPassword().equals(password)) { |
| | | return R.parse(CodeRes.USER_10003); |
| | | } |
| | | String system = null;//登陆系统 |
| | | if (wms) { |
| | | system = String.valueOf(LoginSystemType.WMS); |
| | | }else { |
| | | system = String.valueOf(LoginSystemType.WCS); |
| | | } |
| | | String token = Cools.enToken(System.currentTimeMillis() + username, user.getPassword()); |
| | | userLoginService.remove(new LambdaQueryWrapper<UserLogin>().eq(UserLogin::getUserId, user.getId())); |
| | | userLoginService.remove(new LambdaQueryWrapper<UserLogin>().eq(UserLogin::getUserId, user.getId()).eq(UserLogin::getSystem, system)); |
| | | UserLogin userLogin = new UserLogin(); |
| | | userLogin.setUserId(user.getId()); |
| | | userLogin.setToken(token); |
| | | userLogin.setCreateTime(new Date()); |
| | | userLogin.setSystem(system); |
| | | userLoginService.save(userLogin); |
| | | Map<String, Object> res = new HashMap<>(); |
| | | res.put("username", user.getUsername()); |