Search in sources :

Example 1 with LogOperate

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

the class UserResource method uploadData.

/**
 * @param dataFile
 * @param response
 * @return
 * @throws Exception
 */
@PostMapping(value = "/upload")
@PreAuthorize("@pms.hasPermission('sys_user_upload')")
@LogOperate(value = "用户管理导入")
public ResponseEntity<Result> uploadData(@RequestParam("uploadFile") MultipartFile dataFile, HttpServletResponse response) throws Exception {
    if (dataFile.isEmpty()) {
        return ResponseEntityBuilder.buildFail("上传文件为空");
    }
    ExcelUtil<UserExcelVo> util = new ExcelUtil(UserExcelVo.class);
    List<UserExcelVo> dataList = util.importExcel(dataFile.getInputStream());
    for (UserExcelVo userExcelVo : dataList) {
        if (userExcelVo.getPhone().length() != 11) {
            BigDecimal bd = new BigDecimal(userExcelVo.getPhone());
            userExcelVo.setPhone(bd.toPlainString());
        }
        userService.save(userExcelVo);
    }
    return ResponseEntityBuilder.buildOk("操作成功");
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) UserExcelVo(com.albedo.java.modules.sys.domain.vo.UserExcelVo) BigDecimal(java.math.BigDecimal) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 2 with LogOperate

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

the class AliPayResource method toPayAsPc.

@LogOperate("支付宝PC网页支付")
@Operation(summary = "PC网页支付")
@PostMapping(value = "/toPayAsPC")
public ResponseEntity<String> toPayAsPc(@Validated @RequestBody TradeVo trade) throws Exception {
    AlipayConfigDo aliPay = alipayService.find();
    trade.setOutTradeNo(alipayUtils.getOrderCode());
    String payUrl = alipayService.toPayAsPc(aliPay, trade);
    return ResponseEntity.ok(payUrl);
}
Also used : AlipayConfigDo(com.albedo.java.modules.tool.domain.AlipayConfigDo) LogOperate(com.albedo.java.common.log.annotation.LogOperate) Operation(io.swagger.v3.oas.annotations.Operation)

Example 3 with LogOperate

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

the class DeptResource method findTreeList.

/**
 * 部门树列表信息
 *
 * @return 分页对象
 */
@GetMapping
@PreAuthorize("@pms.hasPermission('sys_dept_view')")
@LogOperate(value = "部门管理查看")
public Result<IPage<DeptVo>> findTreeList(DeptQueryCriteria deptQueryCriteria) {
    DataScope dataScope = SecurityUtil.getDataScope();
    if (!dataScope.isAll()) {
        ArgumentAssert.notEmpty(dataScope.getDeptIds(), "login user deptIds is empty");
        deptQueryCriteria.setDeptIds(dataScope.getDeptIds());
    }
    return Result.buildOkData(deptService.findTreeList(deptQueryCriteria));
}
Also used : DataScope(com.albedo.java.plugins.database.mybatis.datascope.DataScope) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 4 with LogOperate

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

the class LogOperateResource method download.

@LogOperate(value = "操作日志导出")
@GetMapping(value = "/download")
@PreAuthorize("@pms.hasPermission('sys_logOperate_export')")
public void download(LogOperateQueryCriteria logOperateQueryCriteria, HttpServletResponse response) {
    QueryWrapper wrapper = QueryWrapperUtil.getWrapper(logOperateQueryCriteria);
    ExcelUtil<LogOperateDo> util = new ExcelUtil(LogOperateDo.class);
    util.exportExcel(logOperateService.list(wrapper), "操作日志", response);
}
Also used : ExcelUtil(com.albedo.java.common.util.ExcelUtil) LogOperateDo(com.albedo.java.modules.sys.domain.LogOperateDo) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) LogOperate(com.albedo.java.common.log.annotation.LogOperate) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 5 with LogOperate

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

the class UserOnlineResource method batchForceLogout.

@PreAuthorize("@pms.hasPermission('sys_userOnline_logout')")
@LogOperate(value = "在线用户强退")
@PutMapping("/batch-force-logout")
public Result<String> batchForceLogout(@RequestBody Set<String> ids, HttpServletRequest request) {
    for (String id : ids) {
        UserOnlineDo online = userOnlineService.getById(id);
        if (online == null) {
            return Result.buildFail("用户已下线");
        }
        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);
        }
        online.setStatus(OnlineStatus.OFFLINE);
        userOnlineService.updateById(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