|
@@ -19,6 +19,7 @@ import com.fdkankan.manage.mapper.IUserMapper;
|
|
|
import com.fdkankan.manage.service.*;
|
|
|
import com.fdkankan.manage.util.Dateutils;
|
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
|
+import com.fdkankan.manage.vo.request.SysUserParam;
|
|
|
import com.fdkankan.manage.vo.request.UserIncrementParam;
|
|
|
import com.fdkankan.manage.vo.request.UserParam;
|
|
|
import com.fdkankan.manage.vo.response.ManageLoginResponse;
|
|
@@ -308,4 +309,23 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
|
|
|
return manageLoginResponse;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updatePassword(SysUserParam param) {
|
|
|
+ if(param.getId() == null || StringUtils.isBlank(param.getOldPassword()) || StringUtils.isBlank(param.getNewPassword())){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ String passwordMd5 = SecurityUtil.MD52(Base64Converter.decode(Base64Converter.subText(param.getOldPassword())));
|
|
|
+ User byId = this.getById(param.getId());
|
|
|
+ if(byId == null){
|
|
|
+ throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
|
+ }
|
|
|
+ if(!byId.getPassword().equals(passwordMd5)){
|
|
|
+ throw new BusinessException(ResultCode.OLD_PASSWORD_ERROR);
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<User> wrapper = new LambdaUpdateWrapper<>();
|
|
|
+ wrapper.eq(User::getId,param.getId());
|
|
|
+ wrapper.set(User::getPassword,passwordMd5);
|
|
|
+ this.update(wrapper);
|
|
|
+ }
|
|
|
}
|