|
@@ -4,8 +4,6 @@ import cn.iocoder.dashboard.common.pojo.CommonResult;
|
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
|
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
|
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
|
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
|
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
|
-import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum;
|
|
|
|
-import cn.iocoder.dashboard.framework.logger.operatelog.core.util.OperateLogUtils;
|
|
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
|
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
|
|
@@ -19,6 +17,7 @@ import cn.iocoder.dashboard.util.collection.CollectionUtils;
|
|
import cn.iocoder.dashboard.util.collection.MapUtils;
|
|
import cn.iocoder.dashboard.util.collection.MapUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import javax.validation.Valid;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
@@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
|
|
@Api(tags = "操作日志")
|
|
@Api(tags = "操作日志")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/system/operate-log")
|
|
@RequestMapping("/system/operate-log")
|
|
|
|
+@Validated
|
|
public class SysOperateLogController {
|
|
public class SysOperateLogController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private SysOperateLogService operateLogService;
|
|
private SysOperateLogService operateLogService;
|
|
-
|
|
|
|
@Resource
|
|
@Resource
|
|
private SysUserService userService;
|
|
private SysUserService userService;
|
|
|
|
|
|
- @ApiOperation("示例")
|
|
|
|
- @OperateLog(type = OperateTypeEnum.OTHER)
|
|
|
|
- @GetMapping("/demo")
|
|
|
|
- public CommonResult<Boolean> demo() {
|
|
|
|
- // 这里可以调用业务逻辑
|
|
|
|
-
|
|
|
|
- // 补全操作日志的明细
|
|
|
|
- OperateLogUtils.setContent("将编号 1 的数据,xxx 字段修改成了 yyyy");
|
|
|
|
- OperateLogUtils.addExt("orderId", 1);
|
|
|
|
-
|
|
|
|
- // 响应
|
|
|
|
- return success(true);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ApiOperation("查看操作日志分页列表")
|
|
|
|
@GetMapping("/page")
|
|
@GetMapping("/page")
|
|
-// @PreAuthorize("@ss.hasPermi('system:operate-log:query')")
|
|
|
|
- public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Validated SysOperateLogPageReqVO reqVO) {
|
|
|
|
|
|
+ @ApiOperation("查看操作日志分页列表")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
|
|
|
|
+ public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
|
|
PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO);
|
|
PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO);
|
|
|
|
|
|
// 获得拼接需要的数据
|
|
// 获得拼接需要的数据
|
|
@@ -82,10 +68,9 @@ public class SysOperateLogController {
|
|
|
|
|
|
@ApiOperation("导出操作日志")
|
|
@ApiOperation("导出操作日志")
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
|
|
@OperateLog(type = EXPORT)
|
|
@OperateLog(type = EXPORT)
|
|
-// @PreAuthorize("@ss.hasPermi('system:operate-log:export')")
|
|
|
|
- public void exportOperateLog(HttpServletResponse response, @Validated SysOperateLogExportReqVO reqVO)
|
|
|
|
- throws IOException {
|
|
|
|
|
|
+ public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException {
|
|
List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
|
|
List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
|
|
|
|
|
|
// 获得拼接需要的数据
|
|
// 获得拼接需要的数据
|
|
@@ -94,8 +79,7 @@ public class SysOperateLogController {
|
|
// 拼接数据
|
|
// 拼接数据
|
|
List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
|
|
List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
|
|
// 输出
|
|
// 输出
|
|
- ExcelUtils.write(response, "操作日志.xls", "数据列表",
|
|
|
|
- SysOperateLogExcelVO.class, excelDataList);
|
|
|
|
|
|
+ ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|