Search in sources :

Example 11 with LogOperate

use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.

the class TableResource method getPage.

/**
 * @param pm
 * @return
 */
@GetMapping
@PreAuthorize("@pms.hasPermission('gen_table_view')")
@LogOperate(value = "业务表查看")
public Result getPage(PageModel pm, TableQueryCriteria tableQueryCriteria) {
    QueryWrapper wrapper = QueryWrapperUtil.getWrapper(pm, tableQueryCriteria);
    pm = tableService.page(pm, wrapper);
    return Result.buildOkData(pm);
}
Also used : QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 12 with LogOperate

use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.

the class AccoutResource method updateEmail.

@LogOperate("修改邮箱")
@Operation(summary = "修改邮箱")
@PostMapping(value = "/account/change-email/{code}")
public Result<String> updateEmail(@PathVariable String code, @RequestBody UserEmailDto userEmailDto) {
    // 密码解密
    RSA rsa = new RSA(applicationProperties.getRsa().getPrivateKey(), applicationProperties.getRsa().getPublicKey());
    String password = new String(rsa.decrypt(userEmailDto.getPassword(), KeyType.PrivateKey));
    userEmailDto.setPassword(password);
    emailService.validated(CommonConstants.EMAIL_RESET_EMAIL_CODE + userEmailDto.getEmail(), code);
    userService.updateEmail(SecurityUtil.getUser().getUsername(), userEmailDto);
    return Result.buildOk("修改邮箱成功");
}
Also used : RSA(cn.hutool.crypto.asymmetric.RSA) LogOperate(com.albedo.java.common.log.annotation.LogOperate) Operation(io.swagger.v3.oas.annotations.Operation)

Example 13 with LogOperate

use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.

the class LogLoginResource method download.

@LogOperate(value = "登录日志导出")
@Operation(summary = "登录日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('sys_logOperate_export')")
public void download(LogLoginQueryCriteria logOperateQueryCriteria, HttpServletResponse response) {
    QueryWrapper wrapper = QueryWrapperUtil.getWrapper(logOperateQueryCriteria);
    ExcelUtil<LogLoginDo> util = new ExcelUtil(LogLoginDo.class);
    util.exportExcel(service.list(wrapper), "登录日志", response);
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) LogLoginDo(com.albedo.java.modules.sys.domain.LogLoginDo) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) Operation(io.swagger.v3.oas.annotations.Operation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 14 with LogOperate

use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.

the class RoleResource method saveRoleMenus.

/**
 * 更新角色菜单
 *
 * @param roleMenuDto 角色菜单
 * @return success、false
 */
@PutMapping("/menu")
@LogOperate(value = "角色管理编辑")
@PreAuthorize("@pms.hasPermission('sys_role_edit')")
public Result saveRoleMenus(@Valid @RequestBody RoleMenuDto roleMenuDto) {
    RoleDo roleDo = roleService.getById(roleMenuDto.getRoleId());
    checkLevel(roleDo.getLevel());
    return roleMenuService.saveRoleMenus(roleMenuDto);
}
Also used : RoleDo(com.albedo.java.modules.sys.domain.RoleDo) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 15 with LogOperate

use of com.albedo.java.common.log.annotation.LogOperate in project albedo by somowhere.

the class UserOnlineResource method remove.

@PreAuthorize("@pms.hasPermission('sys_userOnline_del')")
@LogOperate(value = "在线用户删除")
@DeleteMapping
public Result remove(@RequestBody Set<String> ids, HttpServletRequest request) {
    for (String id : ids) {
        UserOnlineDo online = userOnlineService.getById(id);
        if (online == null) {
            return Result.buildFail("用户已下线");
        }
        try {
            SessionInformation sessionInformation = sessionRegistry.getSessionInformation(online.getSessionId());
            if (sessionInformation != null) {
                if (sessionInformation.getSessionId().equals(request.getSession(false).getId())) {
                    return Result.buildFail("当前登陆用户无法删除");
                }
                sessionInformation.expireNow();
                redisTemplate.boundHashOps(RedisSessionRegistry.SESSIONIDS).put(online.getSessionId(), sessionInformation);
            }
        } catch (Exception e) {
        }
        sessionRegistry.removeSessionInformation(online.getSessionId());
        userOnlineService.removeById(online);
    }
    return Result.buildOk("操作成功");
}
Also used : SessionInformation(org.springframework.security.core.session.SessionInformation) UserOnlineDo(com.albedo.java.modules.sys.domain.UserOnlineDo) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

LogOperate (com.albedo.java.common.log.annotation.LogOperate)15 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)11 ExcelUtil (com.albedo.java.common.util.ExcelUtil)4 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)4 Operation (io.swagger.v3.oas.annotations.Operation)4 UserOnlineDo (com.albedo.java.modules.sys.domain.UserOnlineDo)2 GenSchemeDto (com.albedo.java.modules.sys.domain.dto.GenSchemeDto)2 AlipayConfigDo (com.albedo.java.modules.tool.domain.AlipayConfigDo)2 SessionInformation (org.springframework.security.core.session.SessionInformation)2 RSA (cn.hutool.crypto.asymmetric.RSA)1 JobLogExcelVo (com.albedo.java.modules.quartz.domain.vo.JobLogExcelVo)1 LogLoginDo (com.albedo.java.modules.sys.domain.LogLoginDo)1 LogOperateDo (com.albedo.java.modules.sys.domain.LogOperateDo)1 RoleDo (com.albedo.java.modules.sys.domain.RoleDo)1 UserDto (com.albedo.java.modules.sys.domain.dto.UserDto)1 UserExcelVo (com.albedo.java.modules.sys.domain.vo.UserExcelVo)1 DataScope (com.albedo.java.plugins.database.mybatis.datascope.DataScope)1 BigDecimal (java.math.BigDecimal)1