|
@@ -23,6 +23,8 @@ import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.validator.routines.EmailValidator;
|
|
import org.apache.commons.validator.routines.EmailValidator;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -237,7 +239,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
@Override
|
|
@Override
|
|
|
public UserVO loginForOauth2(String userName) {
|
|
public UserVO loginForOauth2(String userName) {
|
|
|
User user = userService.findByUsername(userName);
|
|
User user = userService.findByUsername(userName);
|
|
|
- if(user == null){
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
UserVO userVO = userVOWrapper.wrap(user);
|
|
UserVO userVO = userVOWrapper.wrap(user);
|
|
@@ -269,7 +271,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
if (managerPropertyVO.getStatus() != null) {
|
|
if (managerPropertyVO.getStatus() != null) {
|
|
|
managerProperty.setStatus(managerPropertyVO.getStatus());
|
|
managerProperty.setStatus(managerPropertyVO.getStatus());
|
|
|
}
|
|
}
|
|
|
- if (managerPropertyVO.getExpireTime() != null){
|
|
|
|
|
|
|
+ if (managerPropertyVO.getExpireTime() != null) {
|
|
|
managerProperty.setExpireTime(new Timestamp(managerPropertyVO.getExpireTime()));
|
|
managerProperty.setExpireTime(new Timestamp(managerPropertyVO.getExpireTime()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -323,7 +325,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
throw new HttpBadRequestException("Invalid email");
|
|
throw new HttpBadRequestException("Invalid email");
|
|
|
}
|
|
}
|
|
|
User user = userService.findByEmail(userVO.getEmail());
|
|
User user = userService.findByEmail(userVO.getEmail());
|
|
|
- if(user == null){
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
throw new HttpBadRequestException("User doesn't exists");
|
|
throw new HttpBadRequestException("User doesn't exists");
|
|
|
}
|
|
}
|
|
|
emailService.sendForgetPasswordEmail(user);
|
|
emailService.sendForgetPasswordEmail(user);
|
|
@@ -340,7 +342,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
throw new HttpBadRequestException("Invalid mobile captcha");
|
|
throw new HttpBadRequestException("Invalid mobile captcha");
|
|
|
}
|
|
}
|
|
|
User user = userService.findByMobile(mobile);
|
|
User user = userService.findByMobile(mobile);
|
|
|
- if(user==null){
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
throw new HttpBadRequestException("User doesn't exists");
|
|
throw new HttpBadRequestException("User doesn't exists");
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
@@ -372,7 +374,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
throw new HttpBadRequestException("Url expired");
|
|
throw new HttpBadRequestException("Url expired");
|
|
|
}
|
|
}
|
|
|
User user = userService.findByUserId(userId);
|
|
User user = userService.findByUserId(userId);
|
|
|
- if(user==null){
|
|
|
|
|
|
|
+ if (user == null) {
|
|
|
throw new HttpBadRequestException("User doesn't exist!");
|
|
throw new HttpBadRequestException("User doesn't exist!");
|
|
|
}
|
|
}
|
|
|
user.setPassword(EncryptionUtil.encryptMD5(userVO.getPassword()));
|
|
user.setPassword(EncryptionUtil.encryptMD5(userVO.getPassword()));
|
|
@@ -383,7 +385,12 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
throw new HttpInternalServerError("");
|
|
throw new HttpInternalServerError("");
|
|
|
}
|
|
}
|
|
|
return userVO;
|
|
return userVO;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Page<UserVO> getUserListByRoleId(Long roleId, Pageable pageable) {
|
|
|
|
|
+ Page<User> userList = userService.findByRoleId(roleId, pageable);
|
|
|
|
|
+ return userVOWrapper.wrap(userList);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|