package com.doumee.api.cloud; import com.doumee.api.BaseController; import com.doumee.biz.system.SystemUserBiz; import com.doumee.core.annotation.trace.Trace; import com.doumee.core.model.ApiResponse; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.utils.Constants; import com.doumee.dao.system.dto.UpdatePwdDto; import com.doumee.service.system.SystemLoginService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * @author Eva.Caesar Liu * @date 2023/03/21 14:49 */ @Api(tags = "系统功能") @Trace(exclude = true) @Slf4j @RestController @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/system") public class SystemCloudController extends BaseController { @Autowired private SystemUserBiz systemUserBiz; @Autowired private SystemLoginService systemLoginService; @Trace(withRequestParameters = false) @ApiOperation("修改当前用户密码") @PostMapping("/updatePwd") public ApiResponse updatePwd (@RequestHeader(Constants.HEADER_USER_TOKEN) String token, @Validated @RequestBody UpdatePwdDto dto) { LoginUserInfo userInfo = this.getLoginUser(token); dto.setUserId(userInfo.getId()); dto.setToken(token); dto.setLoginUserInfo(userInfo); systemUserBiz.updatePwd(dto); userInfo.setNeedChangePwd(Constants.ONE); return ApiResponse.success(null); } }