Search in sources :

Example 1 with LoginAuthDto

use of com.paascloud.base.dto.LoginAuthDto in project paascloud-master by paascloud.

the class UacUserPasswordController method modifyUserPwd.

/**
 * 用户修改密码
 *
 * @param userModifyPwdDto the user modify pwd dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyUserPwd")
@LogAnnotation
@ApiOperation(httpMethod = "POST", value = "用户修改密码")
public Wrapper<Integer> modifyUserPwd(@ApiParam(name = "userModifyPwdDto", value = "用户修改密码Dto") @RequestBody UserModifyPwdDto userModifyPwdDto) {
    logger.info("==》vue用户修改密码, userModifyPwdDto={}", userModifyPwdDto);
    logger.info("旧密码 oldPassword = {}", userModifyPwdDto.getOldPassword());
    logger.info("新密码 newPassword = {}", userModifyPwdDto.getNewPassword());
    logger.info("登录名 loginName = {}", userModifyPwdDto.getLoginName());
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    int result = uacUserService.userModifyPwd(userModifyPwdDto, loginAuthDto);
    return handleResult(result);
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with LoginAuthDto

use of com.paascloud.base.dto.LoginAuthDto in project paascloud-master by paascloud.

the class LogAspect method handleLog.

private void handleLog(final JoinPoint joinPoint, final Object result) {
    final Date startTime = this.threadLocal.get();
    final Date endTime = new Date(System.currentTimeMillis());
    HttpServletRequest request = RequestUtil.getRequest();
    final UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
    String requestURI = request.getRequestURI();
    try {
        LogAnnotation relog = giveController(joinPoint);
        LoginAuthDto loginUser = RequestUtil.getLoginUser();
        if (relog == null) {
            return;
        }
        // 获取客户端操作系统
        final String os = userAgent.getOperatingSystem().getName();
        // 获取客户端浏览器
        final String browser = userAgent.getBrowser().getName();
        final String ipAddress = RequestUtil.getRemoteAddr(request);
        OperationLogDto operationLogDto = new OperationLogDto();
        operationLogDto.setClassName(joinPoint.getTarget().getClass().getName());
        operationLogDto.setMethodName(joinPoint.getSignature().getName());
        operationLogDto.setExcuteTime(endTime.getTime() - startTime.getTime());
        operationLogDto.setStartTime(startTime);
        operationLogDto.setEndTime(endTime);
        operationLogDto.setIp(ipAddress);
        operationLogDto.setOs(os);
        operationLogDto.setBrowser(browser);
        operationLogDto.setRequestUrl(requestURI);
        operationLogDto.setGroupId(loginUser.getGroupId());
        operationLogDto.setGroupName(loginUser.getGroupName());
        operationLogDto.setCreatedTime(new Date());
        operationLogDto.setCreator(loginUser.getUserName());
        operationLogDto.setCreatorId(loginUser.getUserId());
        operationLogDto.setLastOperator(loginUser.getUserName());
        operationLogDto.setLastOperatorId(loginUser.getUserId());
        operationLogDto.setLogType(relog.logType().getType());
        operationLogDto.setLogName(relog.logType().getName());
        getControllerMethodDescription(relog, operationLogDto, result, joinPoint);
        threadLocal.remove();
        taskExecutor.execute(() -> this.restTemplate.postForObject("http://paascloud-provider-uac/auth/saveLog", operationLogDto, Integer.class));
    } catch (Exception ex) {
        log.error("获取注解类出现异常={}", ex.getMessage(), ex);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) UserAgent(eu.bitwalker.useragentutils.UserAgent) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) OperationLogDto(com.paascloud.core.annotation.OperationLogDto) Date(java.util.Date)

Example 3 with LoginAuthDto

use of com.paascloud.base.dto.LoginAuthDto in project paascloud-master by paascloud.

the class TpcMqTagController method modifyProducerStatusById.

/**
 * 修改tag状态.
 *
 * @param updateStatusDto the update status dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyStatusById")
@ApiOperation(httpMethod = "POST", value = "修改MQ-Tag状态")
@LogAnnotation
public Wrapper modifyProducerStatusById(@ApiParam(value = "修改tag状态") @RequestBody UpdateStatusDto updateStatusDto) {
    logger.info("修改tag状态 updateStatusDto={}", updateStatusDto);
    Long roleId = updateStatusDto.getId();
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    TpcMqTag tag = new TpcMqTag();
    tag.setId(roleId);
    tag.setStatus(updateStatusDto.getStatus());
    tag.setUpdateInfo(loginAuthDto);
    int result = tpcMqTagService.update(tag);
    return super.handleResult(result);
}
Also used : TpcMqTag(com.paascloud.provider.model.domain.TpcMqTag) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 4 with LoginAuthDto

use of com.paascloud.base.dto.LoginAuthDto in project paascloud-master by paascloud.

the class UacUserTokenServiceImpl method refreshToken.

@Override
public String refreshToken(String accessToken, String refreshToken, HttpServletRequest request) throws HttpProcessException {
    String token;
    Map<String, Object> map = new HashMap<>(2);
    map.put("grant_type", "refresh_token");
    map.put("refresh_token", refreshToken);
    // 插件式配置请求参数(网址、请求参数、编码、client)
    Header[] headers = HttpHeader.custom().contentType(HttpHeader.Headers.APP_FORM_URLENCODED).authorization(request.getHeader(HttpHeaders.AUTHORIZATION)).build();
    HttpConfig config = HttpConfig.custom().headers(headers).url(refreshTokenUrl).map(map);
    token = HttpClientUtil.post(config);
    JSONObject jsonObj = JSON.parseObject(token);
    String accessTokenNew = (String) jsonObj.get("access_token");
    String refreshTokenNew = (String) jsonObj.get("refresh_token");
    String loginName = (String) jsonObj.get("loginName");
    // 更新本次token数据
    UserTokenDto tokenDto = this.getByAccessToken(accessToken);
    tokenDto.setStatus(UacUserTokenStatusEnum.ON_REFRESH.getStatus());
    UacUser uacUser = uacUserService.findUserInfoByLoginName(loginName);
    LoginAuthDto loginAuthDto = new LoginAuthDto(uacUser.getId(), uacUser.getLoginName(), uacUser.getUserName(), uacUser.getGroupId(), uacUser.getGroupName());
    this.updateUacUserToken(tokenDto, loginAuthDto);
    // 创建刷新token
    this.saveUserToken(accessTokenNew, refreshTokenNew, loginAuthDto, request);
    return token;
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) Header(org.apache.http.Header) HttpHeader(com.arronlong.httpclientutil.common.HttpHeader) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) HttpConfig(com.arronlong.httpclientutil.common.HttpConfig) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) UserTokenDto(com.paascloud.base.dto.UserTokenDto)

Example 5 with LoginAuthDto

use of com.paascloud.base.dto.LoginAuthDto in project paascloud-master by paascloud.

the class UacActionMainController method save.

/**
 * 保存权限信息.
 *
 * @param action the action
 *
 * @return the wrapper
 */
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增角色")
@ValidateAnnotation
@LogAnnotation
public Wrapper save(@ApiParam(name = "action", value = "角色信息") @RequestBody UacAction action) {
    LoginAuthDto loginAuthDto = RequestUtil.getLoginUser();
    uacActionService.saveAction(action, loginAuthDto);
    return WrapMapper.ok();
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation) ValidateAnnotation(com.paascloud.core.annotation.ValidateAnnotation)

Aggregations

LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)54 ApiOperation (io.swagger.annotations.ApiOperation)41 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)22 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)5 PostMapping (org.springframework.web.bind.annotation.PostMapping)5 UacUser (com.paascloud.provider.model.domain.UacUser)4 UserTokenDto (com.paascloud.base.dto.UserTokenDto)2 ValidateAnnotation (com.paascloud.core.annotation.ValidateAnnotation)2 UacGroup (com.paascloud.provider.model.domain.UacGroup)2 CartProductVo (com.paascloud.provider.model.vo.CartProductVo)2 UserAgent (eu.bitwalker.useragentutils.UserAgent)2 JSONObject (com.alibaba.fastjson.JSONObject)1 HttpConfig (com.arronlong.httpclientutil.common.HttpConfig)1 HttpHeader (com.arronlong.httpclientutil.common.HttpHeader)1 OperationLogDto (com.paascloud.core.annotation.OperationLogDto)1 MdcBizException (com.paascloud.provider.exceptions.MdcBizException)1 MdcDict (com.paascloud.provider.model.domain.MdcDict)1 MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)1 OmcCart (com.paascloud.provider.model.domain.OmcCart)1 OptAttachment (com.paascloud.provider.model.domain.OptAttachment)1