|
@@ -8,17 +8,19 @@ import com.hssx.pcbms.service.UserService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.hssx.pcbms.util.HttpRespMsg;
|
|
import com.hssx.pcbms.util.HttpRespMsg;
|
|
import com.hssx.pcbms.util.MD5Util;
|
|
import com.hssx.pcbms.util.MD5Util;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
- * 服务实现类
|
|
|
|
|
|
+ * 服务实现类
|
|
* </p>
|
|
* </p>
|
|
*
|
|
*
|
|
* @author 吴涛涛
|
|
* @author 吴涛涛
|
|
@@ -31,6 +33,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
@Value("${sysPwd}")
|
|
@Value("${sysPwd}")
|
|
private String sysPwd;
|
|
private String sysPwd;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg login(User user, HttpServletRequest request) {
|
|
public HttpRespMsg login(User user, HttpServletRequest request) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
@@ -41,7 +44,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
//验证用户名是否正确
|
|
//验证用户名是否正确
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
User systemUser = userMapper.selectOne(qw);
|
|
User systemUser = userMapper.selectOne(qw);
|
|
- if(0 == systemUser.getIsPass()){
|
|
|
|
|
|
+ if (0 == systemUser.getIsPass()) {
|
|
msg.setError("账号未审核通过,不支持登录操作");
|
|
msg.setError("账号未审核通过,不支持登录操作");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -66,7 +69,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
QueryWrapper<User> qw = new QueryWrapper<>();
|
|
QueryWrapper<User> qw = new QueryWrapper<>();
|
|
qw.eq("phone", user.getPhone());
|
|
qw.eq("phone", user.getPhone());
|
|
Integer count = userMapper.selectCount(qw);
|
|
Integer count = userMapper.selectCount(qw);
|
|
- if(count > 0){
|
|
|
|
|
|
+ if (count > 0) {
|
|
msg.setError("账号已存在,请勿重复创建");
|
|
msg.setError("账号已存在,请勿重复创建");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -75,4 +78,36 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
userMapper.insert(user);
|
|
userMapper.insert(user);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getList(UserVO userVO) {
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ User user = new User();
|
|
|
|
+ BeanUtils.copyProperties(userVO, user);
|
|
|
|
+ List<User> users = userMapper.selectList(new QueryWrapper<User>(user));
|
|
|
|
+ msg.data = users;
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg updateUser(User user) {
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ User currentUser = userMapper.selectById(user.getId());
|
|
|
|
+ if (currentUser == null) {
|
|
|
|
+ msg.setError("用户未找到,请联系管理员");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if (null != user.getPhone()) {
|
|
|
|
+ if (!currentUser.getPhone().equals(user.getPhone())) {
|
|
|
|
+ //修改手机号
|
|
|
|
+ Integer count = userMapper.selectCount(new QueryWrapper<User>().eq("phone", user.getPhone()));
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ msg.setError("该手机号已被注册,请换用其他手机号");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ userMapper.updateById(user);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|