|
@@ -287,13 +287,19 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void resetPass(Long schoolId, List<Long> ids, User accessUser) {
|
|
|
- String pw = ByteUtil.toHexAscii(SHA256.encode(defPassWd));
|
|
|
+ public void resetPass(Long userId, String passwd, User user) {
|
|
|
+ UserEntity ue = this.getById(userId);
|
|
|
+ if (ue == null) {
|
|
|
+ throw new StatusException("未找到用户信息");
|
|
|
+ }
|
|
|
+ if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(ue.getSchoolId())) {
|
|
|
+ throw new StatusException("非法操作");
|
|
|
+ }
|
|
|
+ String pw = ByteUtil.toHexAscii(SHA256.encode(passwd));
|
|
|
UpdateWrapper<UserEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<UserEntity> lw = wrapper.lambda();
|
|
|
lw.set(UserEntity::getPassword, pw);
|
|
|
- lw.in(UserEntity::getId, ids);
|
|
|
- lw.eq(UserEntity::getSchoolId, schoolId);
|
|
|
+ lw.eq(UserEntity::getId, userId);
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
}
|