|
@@ -43,7 +43,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
@Resource
|
|
@Resource
|
|
private CompanyMapper companyMapper;
|
|
private CompanyMapper companyMapper;
|
|
|
|
|
|
- //管理员登录网页端
|
|
|
|
|
|
+ //登录网页端 管理员或负责人可以登录
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg loginAdmin(String username, String password) {
|
|
public HttpRespMsg loginAdmin(String username, String password) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
@@ -56,12 +56,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
//检索到两个及以上账号时
|
|
//检索到两个及以上账号时
|
|
httpRespMsg.setError("账号重名");
|
|
httpRespMsg.setError("账号重名");
|
|
} else if (userList.get(0).getRole() == 0) {
|
|
} else if (userList.get(0).getRole() == 0) {
|
|
- //检索的账号role不是1 即不是管理员时
|
|
|
|
- httpRespMsg.setError("非管理员不能登陆系统");
|
|
|
|
|
|
+ //检索的账号role是0 即是普通员工时
|
|
|
|
+ httpRespMsg.setError("无登录权限");
|
|
} else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
|
|
} else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
|
|
//检测密码正确时
|
|
//检测密码正确时
|
|
UserVO userVO = new UserVO();
|
|
UserVO userVO = new UserVO();
|
|
- System.out.println("userList.get(0):" + userList.get(0));
|
|
|
|
BeanUtils.copyProperties(userList.get(0), userVO);
|
|
BeanUtils.copyProperties(userList.get(0), userVO);
|
|
userVO.setCompanyName(companyMapper.selectById(userVO.getCompanyId()).getCompanyName());
|
|
userVO.setCompanyName(companyMapper.selectById(userVO.getCompanyId()).getCompanyName());
|
|
httpRespMsg.data = userVO;
|
|
httpRespMsg.data = userVO;
|
|
@@ -71,7 +70,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
- //员工登录网页端
|
|
|
|
|
|
+ //登录网页端 所有人都可以登录
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg loginEmployee(String username, String password) {
|
|
public HttpRespMsg loginEmployee(String username, String password) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
@@ -83,9 +82,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
} else if (userList.size() > 1) {
|
|
} else if (userList.size() > 1) {
|
|
//检索到两个及以上账号时
|
|
//检索到两个及以上账号时
|
|
httpRespMsg.setError("账号重名");
|
|
httpRespMsg.setError("账号重名");
|
|
- } else if (userList.get(0).getRole() != 0) {
|
|
|
|
- //检索的账号role不是0 即不是普通用户时
|
|
|
|
- httpRespMsg.setError("管理员无法登陆本端");
|
|
|
|
} else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
|
|
} else if (MD5Util.getPassword(password).equals(userList.get(0).getPassword())) {
|
|
//检测密码正确时
|
|
//检测密码正确时
|
|
httpRespMsg.data = userList.get(0);
|
|
httpRespMsg.data = userList.get(0);
|