|
@@ -17,6 +17,7 @@ import cn.iselab.mooctest.site.web.data.wrapper.ManagerPropertyVOWrapper;
|
|
|
import cn.iselab.mooctest.site.web.data.wrapper.SalesPackageVOWrapper;
|
|
|
import cn.iselab.mooctest.site.web.data.wrapper.UserVOWrapper;
|
|
|
import cn.iselab.mooctest.site.web.exception.HttpBadRequestException;
|
|
|
+import cn.iselab.mooctest.site.web.exception.HttpForbiddenException;
|
|
|
import cn.iselab.mooctest.site.web.exception.HttpInternalServerError;
|
|
|
import cn.iselab.mooctest.site.web.exception.HttpNotFoundException;
|
|
|
import cn.iselab.mooctest.site.web.logic.BaseLogic;
|
|
@@ -118,7 +119,7 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
|
|
|
private UserDTOForMT registerUser(UserVO userVO) {
|
|
|
UserDTOForMT user = Converter.convert(UserDTOForMT.class, userVO);
|
|
|
- user.setAvailable(true);
|
|
|
+ user.setAvailability(1);
|
|
|
user.setPassword(EncryptionUtil.encryptMD5(userVO.getPassword()));
|
|
|
user.setCreateTime(new Timestamp(System.currentTimeMillis()).getTime());
|
|
|
user.setManualCheckValid(true);
|
|
@@ -426,6 +427,9 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
throw new HttpBadRequestException("user not exist");
|
|
|
}
|
|
|
UserDTOForMT user = userService.findByUsername(username);
|
|
|
+ if (user.getAvailability() == -1) {
|
|
|
+ throw new HttpForbiddenException("user has been deleted");
|
|
|
+ }
|
|
|
UserVO u = Converter.convert(UserVO.class, user);
|
|
|
if (roleService.getRolesOfUser(user.getId()).contains(roleService.getRoleByRoleName("manager"))) {
|
|
|
ManagerProperty managerProperty = managerPropertyService.getManagerPropertyByUserId(user.getId());
|
|
@@ -574,14 +578,17 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public UserVO updateUserAvailability(UserVO UserVO) {
|
|
|
- boolean isAvailable = UserVO.getIsAvailable();
|
|
|
- UserDTOForMT user = userService.findByUserId(UserVO.getId());
|
|
|
+ public UserVO updateUserAvailability(UserVO userVO) {
|
|
|
+ Integer availability = userVO.getAvailability();
|
|
|
+ UserDTOForMT user = userService.findByUserId(userVO.getId());
|
|
|
if (user == null) {
|
|
|
throw new HttpBadRequestException("用户不存在");
|
|
|
}
|
|
|
- user.setAvailable(isAvailable);
|
|
|
- UserVO user1 = Converter.copy(UserVO, userService.updateUser(user));
|
|
|
+ if (user.getAvailability() == -1) {
|
|
|
+ throw new HttpForbiddenException("该用户已删除");
|
|
|
+ }
|
|
|
+ user.setAvailability(availability);
|
|
|
+ UserVO user1 = Converter.copy(userVO, userService.updateUser(user));
|
|
|
user1.setPassword("");
|
|
|
return user1;
|
|
|
}
|
|
@@ -593,6 +600,9 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
if (user == null) {
|
|
|
throw new HttpBadRequestException("用户不存在");
|
|
|
}
|
|
|
+ if (user.getAvailability() == -1) {
|
|
|
+ throw new HttpForbiddenException("该用户已删除");
|
|
|
+ }
|
|
|
user.setPassword(EncryptionUtil.encryptMD5(password));
|
|
|
UserVO user1 = Converter.copy(UserVO, userService.updateUser(user));
|
|
|
user1.setPassword("");
|