Commit d8a52a8c6110bda65f7e83bb7b91607fccfb84f5
1 parent
00935f7d
1. 增加 infra 和 system 包的说明
2. 增加 logger 组件的设计想法
Showing
12 changed files
with
70 additions
and
27 deletions
src/main/java/cn/iocoder/dashboard/framework/logger/package-info.java
0 → 100644
| 1 | +/** | ||
| 2 | + * 日志组件,包括: | ||
| 3 | + * | ||
| 4 | + * 1. 用户操作日志:记录用户的操作,用于对用户的操作的审计与追溯,永久保存。 | ||
| 5 | + * 2. API 日志:包含两类 | ||
| 6 | + * 2.1 API 访问日志:记录用户访问 API 的访问日志,定期归档历史日志。 | ||
| 7 | + * 2.2 API 异常日志:记录用户访问 API 的系统异常,方便日常排查问题与告警。 | ||
| 8 | + * 3. 通用 Logger 日志:将 {@link org.slf4j.Logger} 打印的日志,只满足大于等于 {@link org.slf4j.event.Level} 进行持久化,可以理解成简易的“日志中心”。 | ||
| 9 | + */ | ||
| 10 | +package cn.iocoder.dashboard.framework.logger; |
src/main/java/cn/iocoder/dashboard/modules/infra/package-info.java
0 → 100644
src/main/java/cn/iocoder/dashboard/modules/system/controller/common/SysFileController.java
| @@ -6,6 +6,9 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.common.SysFileDO | @@ -6,6 +6,9 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.common.SysFileDO | ||
| 6 | import cn.iocoder.dashboard.modules.system.service.common.SysFileService; | 6 | import cn.iocoder.dashboard.modules.system.service.common.SysFileService; |
| 7 | import cn.iocoder.dashboard.util.servlet.ServletUtils; | 7 | import cn.iocoder.dashboard.util.servlet.ServletUtils; |
| 8 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 9 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 10 | +import io.swagger.annotations.ApiImplicitParams; | ||
| 11 | +import io.swagger.annotations.ApiOperation; | ||
| 9 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 10 | import org.springframework.http.HttpStatus; | 13 | import org.springframework.http.HttpStatus; |
| 11 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
| @@ -13,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile; | @@ -13,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 13 | 16 | ||
| 14 | import javax.annotation.Resource; | 17 | import javax.annotation.Resource; |
| 15 | import javax.servlet.http.HttpServletResponse; | 18 | import javax.servlet.http.HttpServletResponse; |
| 16 | - | ||
| 17 | import java.io.IOException; | 19 | import java.io.IOException; |
| 18 | 20 | ||
| 19 | import static cn.iocoder.dashboard.common.pojo.CommonResult.success; | 21 | import static cn.iocoder.dashboard.common.pojo.CommonResult.success; |
| @@ -27,12 +29,19 @@ public class SysFileController { | @@ -27,12 +29,19 @@ public class SysFileController { | ||
| 27 | @Resource | 29 | @Resource |
| 28 | private SysFileService fileService; | 30 | private SysFileService fileService; |
| 29 | 31 | ||
| 32 | + @ApiOperation("上传文件") | ||
| 33 | + @ApiImplicitParams({ | ||
| 34 | + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class), | ||
| 35 | + @ApiImplicitParam(name = "path", value = "文件路径", required = true, example = "yudaoyuanma.png", dataTypeClass = Long.class) | ||
| 36 | + }) | ||
| 30 | @PostMapping("/upload") | 37 | @PostMapping("/upload") |
| 31 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, | 38 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, |
| 32 | @RequestParam("path") String path) throws IOException { | 39 | @RequestParam("path") String path) throws IOException { |
| 33 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); | 40 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); |
| 34 | } | 41 | } |
| 35 | 42 | ||
| 43 | + @ApiOperation("下载文件") | ||
| 44 | + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) | ||
| 36 | @GetMapping("/get/{path}") | 45 | @GetMapping("/get/{path}") |
| 37 | public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { | 46 | public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { |
| 38 | SysFileDO file = fileService.getFile(path); | 47 | SysFileDO file = fileService.getFile(path); |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java
| @@ -48,7 +48,7 @@ public class SysDeptController { | @@ -48,7 +48,7 @@ public class SysDeptController { | ||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | @ApiOperation("获得部门信息") | 50 | @ApiOperation("获得部门信息") |
| 51 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 51 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 52 | // @PreAuthorize("@ss.hasPermi('system:dept:query')") | 52 | // @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| 53 | @GetMapping("/get") | 53 | @GetMapping("/get") |
| 54 | public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) { | 54 | public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) { |
| @@ -74,7 +74,7 @@ public class SysDeptController { | @@ -74,7 +74,7 @@ public class SysDeptController { | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | @ApiOperation("删除部门") | 76 | @ApiOperation("删除部门") |
| 77 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 77 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 78 | @PostMapping("delete") | 78 | @PostMapping("delete") |
| 79 | // @PreAuthorize("@ss.hasPermi('system:dept:remove')") | 79 | // @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| 80 | // @Log(title = "部门管理", businessType = BusinessType.DELETE) | 80 | // @Log(title = "部门管理", businessType = BusinessType.DELETE) |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java
| @@ -76,7 +76,7 @@ public class SysPostController { | @@ -76,7 +76,7 @@ public class SysPostController { | ||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | @ApiOperation("获得岗位信息") | 78 | @ApiOperation("获得岗位信息") |
| 79 | - @ApiImplicitParam(name = "id", value = "岗位编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 79 | + @ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 80 | // @PreAuthorize("@ss.hasPermi('system:post:query')") | 80 | // @PreAuthorize("@ss.hasPermi('system:post:query')") |
| 81 | @GetMapping(value = "/get") | 81 | @GetMapping(value = "/get") |
| 82 | public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) { | 82 | public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) { |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java
| @@ -41,7 +41,7 @@ public class SysDictDataController { | @@ -41,7 +41,7 @@ public class SysDictDataController { | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | @ApiOperation("/查询字典数据详细") | 43 | @ApiOperation("/查询字典数据详细") |
| 44 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 44 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 45 | @GetMapping(value = "/get") | 45 | @GetMapping(value = "/get") |
| 46 | // @PreAuthorize("@ss.hasPermi('system:dict:query')") | 46 | // @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| 47 | public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) { | 47 | public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) { |
| @@ -67,7 +67,7 @@ public class SysDictDataController { | @@ -67,7 +67,7 @@ public class SysDictDataController { | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | @ApiOperation("删除字典数据") | 69 | @ApiOperation("删除字典数据") |
| 70 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 70 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 71 | @PostMapping("/delete") | 71 | @PostMapping("/delete") |
| 72 | // @PreAuthorize("@ss.hasPermi('system:dict:remove')") | 72 | // @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| 73 | public CommonResult<Boolean> deleteDictData(Long id) { | 73 | public CommonResult<Boolean> deleteDictData(Long id) { |
| @@ -75,7 +75,7 @@ public class SysDictDataController { | @@ -75,7 +75,7 @@ public class SysDictDataController { | ||
| 75 | return success(true); | 75 | return success(true); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | - // | 78 | + |
| 79 | // @Log(title = "字典类型", businessType = BusinessType.EXPORT) | 79 | // @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| 80 | // @PreAuthorize("@ss.hasPermi('system:dict:export')") | 80 | // @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| 81 | // @GetMapping("/export") | 81 | // @GetMapping("/export") |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java
| @@ -33,7 +33,7 @@ public class SysDictTypeController { | @@ -33,7 +33,7 @@ public class SysDictTypeController { | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | @ApiOperation("/查询字典类型详细") | 35 | @ApiOperation("/查询字典类型详细") |
| 36 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 36 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 37 | @GetMapping(value = "/get") | 37 | @GetMapping(value = "/get") |
| 38 | // @PreAuthorize("@ss.hasPermi('system:dict:query')") | 38 | // @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| 39 | public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) { | 39 | public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) { |
| @@ -59,7 +59,7 @@ public class SysDictTypeController { | @@ -59,7 +59,7 @@ public class SysDictTypeController { | ||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | @ApiOperation("删除字典类型") | 61 | @ApiOperation("删除字典类型") |
| 62 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 62 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 63 | @PostMapping("/delete") | 63 | @PostMapping("/delete") |
| 64 | // @PreAuthorize("@ss.hasPermi('system:dict:remove')") | 64 | // @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| 65 | public CommonResult<Boolean> deleteDictType(Long id) { | 65 | public CommonResult<Boolean> deleteDictType(Long id) { |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java
| 1 | package cn.iocoder.dashboard.modules.system.controller.dict.vo.data; | 1 | package cn.iocoder.dashboard.modules.system.controller.dict.vo.data; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.dashboard.framework.excel.Excel; | 3 | +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; |
| 4 | +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; | ||
| 5 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 5 | 7 | ||
| 8 | +import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; | ||
| 9 | + | ||
| 6 | /** | 10 | /** |
| 7 | * 字典数据 Excel 导出响应 VO | 11 | * 字典数据 Excel 导出响应 VO |
| 8 | */ | 12 | */ |
| 9 | @Data | 13 | @Data |
| 10 | -public class SysDictDataExcelRespVO { | 14 | +public class SysDictDataExcelVO { |
| 11 | 15 | ||
| 12 | - @Excel(name = "字典编码", cellType = Excel.ColumnType.NUMERIC) | 16 | + @ExcelProperty("字典编码") |
| 13 | private Long id; | 17 | private Long id; |
| 14 | 18 | ||
| 15 | - @Excel(name = "字典排序", cellType = Excel.ColumnType.NUMERIC) | 19 | + @ExcelProperty("字典排序") |
| 16 | private Integer sort; | 20 | private Integer sort; |
| 17 | 21 | ||
| 18 | - @Excel(name = "字典标签") | 22 | + @ExcelProperty("字典标签") |
| 19 | private String label; | 23 | private String label; |
| 20 | 24 | ||
| 21 | - @Excel(name = "字典键值") | 25 | + @ExcelProperty("字典键值") |
| 22 | private String value; | 26 | private String value; |
| 23 | 27 | ||
| 24 | - @Excel(name = "字典类型") | 28 | + @ExcelProperty("字典类型") |
| 25 | private String dictType; | 29 | private String dictType; |
| 26 | 30 | ||
| 27 | - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") | 31 | + @ExcelProperty(value = "状态", converter = DictConvert.class) |
| 32 | + @DictFormat(SYS_COMMON_STATUS) | ||
| 28 | private Integer status; | 33 | private Integer status; |
| 29 | 34 | ||
| 30 | } | 35 | } |
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java
| 1 | package cn.iocoder.dashboard.modules.system.controller.dict.vo.type; | 1 | package cn.iocoder.dashboard.modules.system.controller.dict.vo.type; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.dashboard.framework.excel.Excel; | 3 | +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; |
| 4 | +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; | ||
| 5 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 5 | 7 | ||
| 8 | +import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; | ||
| 9 | + | ||
| 6 | /** | 10 | /** |
| 7 | * 字典类型 Excel 导出响应 VO | 11 | * 字典类型 Excel 导出响应 VO |
| 8 | */ | 12 | */ |
| 9 | @Data | 13 | @Data |
| 10 | -public class SysDictTypeExcelRespVO { | 14 | +public class SysDictTypeExcelVO { |
| 11 | 15 | ||
| 12 | - @Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC) | 16 | + @ExcelProperty("字典主键") |
| 13 | private Long id; | 17 | private Long id; |
| 14 | 18 | ||
| 15 | - @Excel(name = "字典名称") | 19 | + @ExcelProperty("字典名称") |
| 16 | private String name; | 20 | private String name; |
| 17 | 21 | ||
| 18 | - @Excel(name = "字典类型") | 22 | + @ExcelProperty("字典类型") |
| 19 | private String type; | 23 | private String type; |
| 20 | 24 | ||
| 21 | - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") | 25 | + @ExcelProperty(value = "状态", converter = DictConvert.class) |
| 26 | + @DictFormat(SYS_COMMON_STATUS) | ||
| 22 | private Integer status; | 27 | private Integer status; |
| 23 | 28 | ||
| 24 | } | 29 | } |
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java
| @@ -34,7 +34,7 @@ public class SysNoticeController { | @@ -34,7 +34,7 @@ public class SysNoticeController { | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | @ApiOperation("获得通知公告") | 36 | @ApiOperation("获得通知公告") |
| 37 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 37 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 38 | // @PreAuthorize("@ss.hasPermi('system:notice:query')") | 38 | // @PreAuthorize("@ss.hasPermi('system:notice:query')") |
| 39 | @GetMapping(value = "/get") | 39 | @GetMapping(value = "/get") |
| 40 | public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { | 40 | public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { |
| @@ -60,7 +60,7 @@ public class SysNoticeController { | @@ -60,7 +60,7 @@ public class SysNoticeController { | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | @ApiOperation("删除通知公告") | 62 | @ApiOperation("删除通知公告") |
| 63 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 63 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 64 | // @PreAuthorize("@ss.hasPermi('system:notice:remove')") | 64 | // @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| 65 | // @Log(title = "通知公告", businessType = BusinessType.DELETE) | 65 | // @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| 66 | @PostMapping("/delete") | 66 | @PostMapping("/delete") |
src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java
| @@ -65,7 +65,7 @@ public class SysUserController { | @@ -65,7 +65,7 @@ public class SysUserController { | ||
| 65 | * 根据用户编号获取详细信息 | 65 | * 根据用户编号获取详细信息 |
| 66 | */ | 66 | */ |
| 67 | @ApiOperation("获得用户详情") | 67 | @ApiOperation("获得用户详情") |
| 68 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 68 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 69 | @GetMapping("/get") | 69 | @GetMapping("/get") |
| 70 | // @PreAuthorize("@ss.hasPermi('system:user:query')") | 70 | // @PreAuthorize("@ss.hasPermi('system:user:query')") |
| 71 | public CommonResult<SysUserRespVO> getInfo(@RequestParam("id") Long id) { | 71 | public CommonResult<SysUserRespVO> getInfo(@RequestParam("id") Long id) { |
| @@ -91,7 +91,7 @@ public class SysUserController { | @@ -91,7 +91,7 @@ public class SysUserController { | ||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | @ApiOperation("删除用户") | 93 | @ApiOperation("删除用户") |
| 94 | - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) | 94 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 95 | @PostMapping("/delete") | 95 | @PostMapping("/delete") |
| 96 | // @PreAuthorize("@ss.hasPermi('system:user:remove')") | 96 | // @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| 97 | // @Log(title = "用户管理", businessType = BusinessType.DELETE) | 97 | // @Log(title = "用户管理", businessType = BusinessType.DELETE) |