1. 增加 infra 和 system 包的说明

2. 增加 logger 组件的设计想法
This commit is contained in:
YunaiV 2021-01-15 00:22:24 +08:00
parent 00935f7d69
commit d8a52a8c61
14 changed files with 110 additions and 67 deletions

View File

@ -0,0 +1,10 @@
/**
* 日志组件包括
*
* 1. 用户操作日志记录用户的操作用于对用户的操作的审计与追溯永久保存
* 2. API 日志包含两类
* 2.1 API 访问日志记录用户访问 API 的访问日志定期归档历史日志
* 2.2 API 异常日志记录用户访问 API 的系统异常方便日常排查问题与告警
* 3. 通用 Logger 日志 {@link org.slf4j.Logger} 打印的日志只满足大于等于 {@link org.slf4j.event.Level} 进行持久化可以理解成简易的日志中心
*/
package cn.iocoder.dashboard.framework.logger;

View File

@ -0,0 +1,7 @@
/**
* infra 包下我们放基础设施的运维与管理支撑上层的通用与核心业务
* 例如说定时任务的管理服务器的信息等等
*
* 缩写inf
*/
package cn.iocoder.dashboard.modules.infra;

View File

@ -6,6 +6,9 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.common.SysFileDO
import cn.iocoder.dashboard.modules.system.service.common.SysFileService;
import cn.iocoder.dashboard.util.servlet.ServletUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@ -13,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@ -27,12 +29,19 @@ public class SysFileController {
@Resource
private SysFileService fileService;
@ApiOperation("上传文件")
@ApiImplicitParams({
@ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class),
@ApiImplicitParam(name = "path", value = "文件路径", required = true, example = "yudaoyuanma.png", dataTypeClass = Long.class)
})
@PostMapping("/upload")
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file,
@RequestParam("path") String path) throws IOException {
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
}
@ApiOperation("下载文件")
@ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class)
@GetMapping("/get/{path}")
public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException {
SysFileDO file = fileService.getFile(path);

View File

@ -48,7 +48,7 @@ public class SysDeptController {
}
@ApiOperation("获得部门信息")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping("/get")
public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) {
@ -74,7 +74,7 @@ public class SysDeptController {
}
@ApiOperation("删除部门")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PostMapping("delete")
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
// @Log(title = "部门管理", businessType = BusinessType.DELETE)

View File

@ -76,7 +76,7 @@ public class SysPostController {
}
@ApiOperation("获得岗位信息")
@ApiImplicitParam(name = "id", value = "岗位编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/get")
public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) {

View File

@ -41,7 +41,7 @@ public class SysDictDataController {
}
@ApiOperation("/查询字典数据详细")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@GetMapping(value = "/get")
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) {
@ -67,7 +67,7 @@ public class SysDictDataController {
}
@ApiOperation("删除字典数据")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PostMapping("/delete")
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
public CommonResult<Boolean> deleteDictData(Long id) {
@ -75,7 +75,7 @@ public class SysDictDataController {
return success(true);
}
//
// @Log(title = "字典类型", businessType = BusinessType.EXPORT)
// @PreAuthorize("@ss.hasPermi('system:dict:export')")
// @GetMapping("/export")

View File

@ -33,7 +33,7 @@ public class SysDictTypeController {
}
@ApiOperation("/查询字典类型详细")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@GetMapping(value = "/get")
// @PreAuthorize("@ss.hasPermi('system:dict:query')")
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
@ -59,7 +59,7 @@ public class SysDictTypeController {
}
@ApiOperation("删除字典类型")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PostMapping("/delete")
// @PreAuthorize("@ss.hasPermi('system:dict:remove')")
public CommonResult<Boolean> deleteDictType(Long id) {

View File

@ -1,30 +0,0 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.data;
import cn.iocoder.dashboard.framework.excel.Excel;
import lombok.Data;
/**
* 字典数据 Excel 导出响应 VO
*/
@Data
public class SysDictDataExcelRespVO {
@Excel(name = "字典编码", cellType = Excel.ColumnType.NUMERIC)
private Long id;
@Excel(name = "字典排序", cellType = Excel.ColumnType.NUMERIC)
private Integer sort;
@Excel(name = "字典标签")
private String label;
@Excel(name = "字典键值")
private String value;
@Excel(name = "字典类型")
private String dictType;
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.data;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS;
/**
* 字典数据 Excel 导出响应 VO
*/
@Data
public class SysDictDataExcelVO {
@ExcelProperty("字典编码")
private Long id;
@ExcelProperty("字典排序")
private Integer sort;
@ExcelProperty("字典标签")
private String label;
@ExcelProperty("字典键值")
private String value;
@ExcelProperty("字典类型")
private String dictType;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS)
private Integer status;
}

View File

@ -1,24 +0,0 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import cn.iocoder.dashboard.framework.excel.Excel;
import lombok.Data;
/**
* 字典类型 Excel 导出响应 VO
*/
@Data
public class SysDictTypeExcelRespVO {
@Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC)
private Long id;
@Excel(name = "字典名称")
private String name;
@Excel(name = "字典类型")
private String type;
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private Integer status;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS;
/**
* 字典类型 Excel 导出响应 VO
*/
@Data
public class SysDictTypeExcelVO {
@ExcelProperty("字典主键")
private Long id;
@ExcelProperty("字典名称")
private String name;
@ExcelProperty("字典类型")
private String type;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(SYS_COMMON_STATUS)
private Integer status;
}

View File

@ -34,7 +34,7 @@ public class SysNoticeController {
}
@ApiOperation("获得通知公告")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/get")
public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
@ -60,7 +60,7 @@ public class SysNoticeController {
}
@ApiOperation("删除通知公告")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermi('system:notice:remove')")
// @Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping("/delete")

View File

@ -65,7 +65,7 @@ public class SysUserController {
* 根据用户编号获取详细信息
*/
@ApiOperation("获得用户详情")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@GetMapping("/get")
// @PreAuthorize("@ss.hasPermi('system:user:query')")
public CommonResult<SysUserRespVO> getInfo(@RequestParam("id") Long id) {
@ -91,7 +91,7 @@ public class SysUserController {
}
@ApiOperation("删除用户")
@ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PostMapping("/delete")
// @PreAuthorize("@ss.hasPermi('system:user:remove')")
// @Log(title = "用户管理", businessType = BusinessType.DELETE)

View File

@ -0,0 +1,7 @@
/**
* system 包下我们放通用业务支撑上层的核心业务
* 例如说用户部门权限数据字典等等
*
* 缩写sys
*/
package cn.iocoder.dashboard.modules.system;