|
@@ -4,6 +4,7 @@ import com.seecoder.BlueWhale.Exception.BlueWhaleException;
|
|
|
import com.seecoder.BlueWhale.Mapper.UserMapper;
|
|
import com.seecoder.BlueWhale.Mapper.UserMapper;
|
|
|
import com.seecoder.BlueWhale.PO.User;
|
|
import com.seecoder.BlueWhale.PO.User;
|
|
|
import com.seecoder.BlueWhale.Service.UserService;
|
|
import com.seecoder.BlueWhale.Service.UserService;
|
|
|
|
|
+import com.seecoder.BlueWhale.Util.SecurityUtil;
|
|
|
import com.seecoder.BlueWhale.Util.TokenUtil;
|
|
import com.seecoder.BlueWhale.Util.TokenUtil;
|
|
|
import com.seecoder.BlueWhale.VO.UserVO;
|
|
import com.seecoder.BlueWhale.VO.UserVO;
|
|
|
|
|
|
|
@@ -27,6 +28,9 @@ public class UserServiceImpl implements UserService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
TokenUtil tokenUtil;
|
|
TokenUtil tokenUtil;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ SecurityUtil securityUtil;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean register(UserVO userVO) {
|
|
public Boolean register(UserVO userVO) {
|
|
|
User user = userMapper.findByPhone(userVO.getPhone());
|
|
User user = userMapper.findByPhone(userVO.getPhone());
|
|
@@ -37,7 +41,6 @@ public class UserServiceImpl implements UserService {
|
|
|
newUser.setCreateTime(new Date());
|
|
newUser.setCreateTime(new Date());
|
|
|
userMapper.save(newUser);
|
|
userMapper.save(newUser);
|
|
|
return true;
|
|
return true;
|
|
|
- //return null;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -46,12 +49,11 @@ public class UserServiceImpl implements UserService {
|
|
|
if (user == null) {
|
|
if (user == null) {
|
|
|
throw BlueWhaleException.phoneOrPasswordError();
|
|
throw BlueWhaleException.phoneOrPasswordError();
|
|
|
}
|
|
}
|
|
|
- String token = tokenUtil.getToken(user);
|
|
|
|
|
- return token;
|
|
|
|
|
|
|
+ return tokenUtil.getToken(user);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public UserVO getInformation() {
|
|
public UserVO getInformation() {
|
|
|
- return null;
|
|
|
|
|
|
|
+ return securityUtil.getCurrentUser().toVO();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|