|
|
|
@ -20,11 +20,8 @@ import com.supervision.knowsub.service.UserManageService;
|
|
|
|
|
import com.supervision.knowsub.service.UserRoleRelationManageService;
|
|
|
|
|
import com.supervision.knowsub.util.TokenUtil;
|
|
|
|
|
import com.supervision.knowsub.util.UserUtil;
|
|
|
|
|
import com.supervision.knowsub.vo.user.LoginReqVO;
|
|
|
|
|
import com.supervision.knowsub.vo.user.LoginResVO;
|
|
|
|
|
import com.supervision.knowsub.vo.user.UserInfoReqVo;
|
|
|
|
|
import com.supervision.knowsub.vo.user.*;
|
|
|
|
|
import com.supervision.knowsub.dto.user.UserInfoDTO;
|
|
|
|
|
import com.supervision.knowsub.vo.user.UserStatusReqVo;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -58,6 +55,9 @@ public class UserManageServiceImpl implements UserManageService {
|
|
|
|
|
if (user.isEmpty() || !UserUtil.checkUserPassword(reqVO.getPassword(), user.get().getUserPd())) {
|
|
|
|
|
throw new BusinessException("用户名或密码有误!");
|
|
|
|
|
}
|
|
|
|
|
if (user.get().getStatus() == 1){
|
|
|
|
|
throw new BusinessException("该用户已被停用,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
UserInfo userInfoToken = BeanUtil.copyProperties(user.get(), UserInfo.class);
|
|
|
|
|
// 更新用户最近的登录时间
|
|
|
|
|
systemUserService.lambdaUpdate().set(SystemUser::getRecentLoginTime, LocalDateTime.now()).eq(SystemUser::getId, user.get().getId()).update();
|
|
|
|
@ -146,7 +146,7 @@ public class UserManageServiceImpl implements UserManageService {
|
|
|
|
|
Assert.notEmpty(id, "用户id不能为空");
|
|
|
|
|
SystemUser systemUser = systemUserService.getById(id);
|
|
|
|
|
Assert.notNull(systemUser, "用户不存在");
|
|
|
|
|
Assert.isTrue(systemUser.getStatus() == 0, "该用户已启用,不能删除");
|
|
|
|
|
Assert.isFalse(systemUser.getStatus() == 0, "该用户已启用,不能删除");
|
|
|
|
|
|
|
|
|
|
systemUserService.removeById(id);
|
|
|
|
|
|
|
|
|
@ -185,10 +185,13 @@ public class UserManageServiceImpl implements UserManageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean resetPW(String id) {
|
|
|
|
|
Assert.notEmpty(id, "用户id不能为空");
|
|
|
|
|
return systemUserService.lambdaUpdate().set(SystemUser::getUserPd, UserUtil.signPassword(defaultPassword))
|
|
|
|
|
.eq(SystemUser::getId, id).update();
|
|
|
|
|
public Boolean resetPW(UserPwReqVo userPwReqVo) {
|
|
|
|
|
Assert.notEmpty(userPwReqVo.getId(), "用户id不能为空");
|
|
|
|
|
Assert.notEmpty(userPwReqVo.getPassword(), "密码不能为空");
|
|
|
|
|
|
|
|
|
|
return systemUserService.lambdaUpdate()
|
|
|
|
|
.set(SystemUser::getUserPd, UserUtil.signPassword(userPwReqVo.getPassword()))
|
|
|
|
|
.eq(SystemUser::getId, userPwReqVo.getId()).update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|