|
@@ -3,10 +3,13 @@ package cn.iocoder.yudao.module.system.controller.admin.user;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
|
|
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
|
|
import cn.iocoder.yudao.module.employee.api.EmployeeApi;
|
|
|
import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
|
|
|
+import cn.iocoder.yudao.module.employee.api.dto.EmployeeSaveReqDTO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileResetPasswordReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
|
|
@@ -114,6 +117,13 @@ public class UserProfileController {
|
|
|
throw exception(FILE_IS_EMPTY);
|
|
|
}
|
|
|
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
|
|
+ // 同时更换员工头像
|
|
|
+ // 根据用户ID获取当前登录员工的信息
|
|
|
+ EmployeeRespDTO employee = employeeApi.getEmployeeByUserId(getLoginUserId());
|
|
|
+ employee.setAvatar(avatar);
|
|
|
+ // 创建一个DTO来更新员工信息
|
|
|
+ EmployeeSaveReqDTO updateObj = BeanUtils.toBean(employee, EmployeeSaveReqDTO.class);
|
|
|
+ employeeApi.updateEmployee(updateObj);
|
|
|
return success(avatar);
|
|
|
}
|
|
|
|