Commit 47b77d7360caf4b12098cfd2d6888bcef1ca7ef0

Authored by 芋道源码
Committed by Gitee
2 parents a5c59c60 30fef09e

!774 简化 system 和 infra 大模块模块的 VO

Merge pull request !774 from 芋道源码/feature/vo-optimize
Showing 337 changed files with 2447 additions and 6200 deletions

Too many changes.

To preserve performance only 100 of 337 files are displayed.

yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLogFrameworkServiceImpl.java
@@ -21,7 +21,7 @@ public class OperateLogFrameworkServiceImpl implements OperateLogFrameworkServic @@ -21,7 +21,7 @@ public class OperateLogFrameworkServiceImpl implements OperateLogFrameworkServic
21 @Override 21 @Override
22 @Async 22 @Async
23 public void createOperateLog(OperateLog operateLog) { 23 public void createOperateLog(OperateLog operateLog) {
24 - OperateLogCreateReqDTO reqDTO = BeanUtil.copyProperties(operateLog, OperateLogCreateReqDTO.class); 24 + OperateLogCreateReqDTO reqDTO = BeanUtil.toBean(operateLog, OperateLogCreateReqDTO.class);
25 operateLogApi.createOperateLog(reqDTO); 25 operateLogApi.createOperateLog(reqDTO);
26 } 26 }
27 27
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
@@ -28,7 +28,7 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { @@ -28,7 +28,7 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> {
28 28
29 default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) { 29 default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
30 // 特殊:不分页,直接查询全部 30 // 特殊:不分页,直接查询全部
31 - if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageNo())) { 31 + if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) {
32 List<T> list = selectList(queryWrapper); 32 List<T> list = selectList(queryWrapper);
33 return new PageResult<>(list, (long) list.size()); 33 return new PageResult<>(list, (long) list.size());
34 } 34 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.config; 1 package cn.iocoder.yudao.module.infra.controller.admin.config;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 6 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 7 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
@@ -38,15 +39,15 @@ public class ConfigController { @@ -38,15 +39,15 @@ public class ConfigController {
38 @PostMapping("/create") 39 @PostMapping("/create")
39 @Operation(summary = "创建参数配置") 40 @Operation(summary = "创建参数配置")
40 @PreAuthorize("@ss.hasPermission('infra:config:create')") 41 @PreAuthorize("@ss.hasPermission('infra:config:create')")
41 - public CommonResult<Long> createConfig(@Valid @RequestBody ConfigCreateReqVO reqVO) {  
42 - return success(configService.createConfig(reqVO)); 42 + public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
  43 + return success(configService.createConfig(createReqVO));
43 } 44 }
44 45
45 @PutMapping("/update") 46 @PutMapping("/update")
46 @Operation(summary = "修改参数配置") 47 @Operation(summary = "修改参数配置")
47 @PreAuthorize("@ss.hasPermission('infra:config:update')") 48 @PreAuthorize("@ss.hasPermission('infra:config:update')")
48 - public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigUpdateReqVO reqVO) {  
49 - configService.updateConfig(reqVO); 49 + public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
  50 + configService.updateConfig(updateReqVO);
50 return success(true); 51 return success(true);
51 } 52 }
52 53
@@ -84,8 +85,8 @@ public class ConfigController { @@ -84,8 +85,8 @@ public class ConfigController {
84 @GetMapping("/page") 85 @GetMapping("/page")
85 @Operation(summary = "获取参数配置分页") 86 @Operation(summary = "获取参数配置分页")
86 @PreAuthorize("@ss.hasPermission('infra:config:query')") 87 @PreAuthorize("@ss.hasPermission('infra:config:query')")
87 - public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO reqVO) {  
88 - PageResult<ConfigDO> page = configService.getConfigPage(reqVO); 88 + public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO pageReqVO) {
  89 + PageResult<ConfigDO> page = configService.getConfigPage(pageReqVO);
89 return success(ConfigConvert.INSTANCE.convertPage(page)); 90 return success(ConfigConvert.INSTANCE.convertPage(page));
90 } 91 }
91 92
@@ -93,13 +94,13 @@ public class ConfigController { @@ -93,13 +94,13 @@ public class ConfigController {
93 @Operation(summary = "导出参数配置") 94 @Operation(summary = "导出参数配置")
94 @PreAuthorize("@ss.hasPermission('infra:config:export')") 95 @PreAuthorize("@ss.hasPermission('infra:config:export')")
95 @OperateLog(type = EXPORT) 96 @OperateLog(type = EXPORT)
96 - public void exportConfig(@Valid ConfigExportReqVO reqVO, 97 + public void exportConfig(@Valid ConfigPageReqVO exportReqVO,
97 HttpServletResponse response) throws IOException { 98 HttpServletResponse response) throws IOException {
98 - List<ConfigDO> list = configService.getConfigList(reqVO);  
99 - // 拼接数据  
100 - List<ConfigExcelVO> datas = ConfigConvert.INSTANCE.convertList(list); 99 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  100 + List<ConfigDO> list = configService.getConfigPage(exportReqVO).getList();
101 // 输出 101 // 输出
102 - ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas); 102 + ExcelUtils.write(response, "参数配置.xls", "数据", ConfigRespVO.class,
  103 + ConfigConvert.INSTANCE.convertList(list));
103 } 104 }
104 105
105 } 106 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.config.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -  
7 -import javax.validation.constraints.NotBlank;  
8 -import javax.validation.constraints.Size;  
9 -  
10 -@Schema(description = "管理后台 - 参数配置创建 Request VO")  
11 -@Data  
12 -@EqualsAndHashCode(callSuper = true)  
13 -public class ConfigCreateReqVO extends ConfigBaseVO {  
14 -  
15 - @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username")  
16 - @NotBlank(message = "参数键名长度不能为空")  
17 - @Size(max = 100, message = "参数键名长度不能超过100个字符")  
18 - private String key;  
19 -  
20 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExcelVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.config.vo;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -import java.time.LocalDateTime;  
10 -  
11 -/**  
12 - * 参数配置 Excel 导出响应 VO  
13 - */  
14 -@Data  
15 -public class ConfigExcelVO {  
16 -  
17 - @ExcelProperty("参数配置序号")  
18 - private Long id;  
19 -  
20 - @ExcelProperty("参数键名")  
21 - private String configKey;  
22 -  
23 - @ExcelProperty("参数分类")  
24 - private String category;  
25 -  
26 - @ExcelProperty("参数名称")  
27 - private String name;  
28 -  
29 - @ExcelProperty("参数键值")  
30 - private String value;  
31 -  
32 - @ExcelProperty(value = "参数类型", converter = DictConvert.class)  
33 - @DictFormat(DictTypeConstants.CONFIG_TYPE)  
34 - private Integer type;  
35 -  
36 - @ExcelProperty(value = "是否可见", converter = DictConvert.class)  
37 - @DictFormat(DictTypeConstants.BOOLEAN_STRING)  
38 - private Boolean visible;  
39 -  
40 - @ExcelProperty("备注")  
41 - private String remark;  
42 -  
43 - @ExcelProperty("创建时间")  
44 - private LocalDateTime createTime;  
45 -  
46 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.config.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import java.time.LocalDateTime;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -@Schema(description = "管理后台 - 参数配置导出 Request VO")  
12 -@Data  
13 -public class ConfigExportReqVO {  
14 -  
15 - @Schema(description = "参数名称", example = "模糊匹配")  
16 - private String name;  
17 -  
18 - @Schema(description = "参数键名,模糊匹配", example = "yunai.db.username")  
19 - private String key;  
20 -  
21 - @Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", example = "1")  
22 - private Integer type;  
23 -  
24 - @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]")  
25 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
26 - private LocalDateTime[] createTime;  
27 -  
28 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.config.vo; 1 package cn.iocoder.yudao.module.infra.controller.admin.config.vo;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 9 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 10
7 -import javax.validation.constraints.NotBlank;  
8 -import javax.validation.constraints.Size;  
9 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
10 12
11 @Schema(description = "管理后台 - 参数配置信息 Response VO") 13 @Schema(description = "管理后台 - 参数配置信息 Response VO")
12 @Data 14 @Data
13 -@EqualsAndHashCode(callSuper = true)  
14 -public class ConfigRespVO extends ConfigBaseVO { 15 +@ExcelIgnoreUnannotated
  16 +public class ConfigRespVO {
15 17
16 @Schema(description = "参数配置序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "参数配置序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + @ExcelProperty("参数配置序号")
17 private Long id; 20 private Long id;
18 21
  22 + @Schema(description = "参数分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "biz")
  23 + @ExcelProperty("参数分类")
  24 + private String category;
  25 +
  26 + @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数据库名")
  27 + @ExcelProperty("参数名称")
  28 + private String name;
  29 +
19 @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username") 30 @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username")
20 - @NotBlank(message = "参数键名长度不能为空")  
21 - @Size(max = 100, message = "参数键名长度不能超过100个字符") 31 + @ExcelProperty("参数键名")
22 private String key; 32 private String key;
23 33
  34 + @Schema(description = "参数键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  35 + @ExcelProperty("参数键值")
  36 + private String value;
  37 +
24 @Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 38 @Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  39 + @ExcelProperty(value = "参数类型", converter = DictConvert.class)
  40 + @DictFormat(DictTypeConstants.CONFIG_TYPE)
25 private Integer type; 41 private Integer type;
26 42
  43 + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
  44 + @ExcelProperty(value = "是否可见", converter = DictConvert.class)
  45 + @DictFormat(DictTypeConstants.BOOLEAN_STRING)
  46 + private Boolean visible;
  47 +
  48 + @Schema(description = "备注", example = "备注一下很帅气!")
  49 + @ExcelProperty("备注")
  50 + private String remark;
  51 +
27 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") 52 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
  53 + @ExcelProperty("创建时间")
28 private LocalDateTime createTime; 54 private LocalDateTime createTime;
29 55
30 } 56 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigBaseVO.java renamed to yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigSaveReqVO.java
@@ -8,26 +8,31 @@ import javax.validation.constraints.NotEmpty; @@ -8,26 +8,31 @@ import javax.validation.constraints.NotEmpty;
8 import javax.validation.constraints.NotNull; 8 import javax.validation.constraints.NotNull;
9 import javax.validation.constraints.Size; 9 import javax.validation.constraints.Size;
10 10
11 -/**  
12 - * 参数配置 Base VO,提供给添加、修改、详细的子 VO 使用  
13 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
14 - */ 11 +@Schema(description = "管理后台 - 参数配置创建/修改 Request VO")
15 @Data 12 @Data
16 -public class ConfigBaseVO { 13 +public class ConfigSaveReqVO {
  14 +
  15 + @Schema(description = "参数配置序号", example = "1024")
  16 + private Long id;
17 17
18 @Schema(description = "参数分组", requiredMode = Schema.RequiredMode.REQUIRED, example = "biz") 18 @Schema(description = "参数分组", requiredMode = Schema.RequiredMode.REQUIRED, example = "biz")
19 @NotEmpty(message = "参数分组不能为空") 19 @NotEmpty(message = "参数分组不能为空")
20 - @Size(max = 50, message = "参数名称不能超过50个字符") 20 + @Size(max = 50, message = "参数名称不能超过 50 个字符")
21 private String category; 21 private String category;
22 22
23 @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数据库名") 23 @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数据库名")
24 @NotBlank(message = "参数名称不能为空") 24 @NotBlank(message = "参数名称不能为空")
25 - @Size(max = 100, message = "参数名称不能超过100个字符") 25 + @Size(max = 100, message = "参数名称不能超过 100 个字符")
26 private String name; 26 private String name;
27 27
  28 + @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username")
  29 + @NotBlank(message = "参数键名长度不能为空")
  30 + @Size(max = 100, message = "参数键名长度不能超过 100 个字符")
  31 + private String key;
  32 +
28 @Schema(description = "参数键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 33 @Schema(description = "参数键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
29 @NotBlank(message = "参数键值不能为空") 34 @NotBlank(message = "参数键值不能为空")
30 - @Size(max = 500, message = "参数键值长度不能超过500个字符") 35 + @Size(max = 500, message = "参数键值长度不能超过 500 个字符")
31 private String value; 36 private String value;
32 37
33 @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") 38 @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.config.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 -  
8 -import javax.validation.constraints.NotNull;  
9 -  
10 -@Schema(description = "管理后台 - 参数配置创建 Request VO")  
11 -@Data  
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class ConfigUpdateReqVO extends ConfigBaseVO {  
15 -  
16 - @Schema(description = "参数配置序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
17 - @NotNull(message = "参数配置编号不能为空")  
18 - private Long id;  
19 -  
20 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/DataSourceConfigController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.db; 1 package cn.iocoder.yudao.module.infra.controller.admin.db;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCreateReqVO; 4 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigRespVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigRespVO;
6 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;  
7 -import cn.iocoder.yudao.module.infra.convert.db.DataSourceConfigConvert; 6 +import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
9 import cn.iocoder.yudao.module.infra.service.db.DataSourceConfigService; 8 import cn.iocoder.yudao.module.infra.service.db.DataSourceConfigService;
10 -import io.swagger.v3.oas.annotations.tags.Tag;  
11 -import io.swagger.v3.oas.annotations.Parameter;  
12 import io.swagger.v3.oas.annotations.Operation; 9 import io.swagger.v3.oas.annotations.Operation;
  10 +import io.swagger.v3.oas.annotations.Parameter;
  11 +import io.swagger.v3.oas.annotations.tags.Tag;
13 import org.springframework.security.access.prepost.PreAuthorize; 12 import org.springframework.security.access.prepost.PreAuthorize;
14 import org.springframework.validation.annotation.Validated; 13 import org.springframework.validation.annotation.Validated;
15 import org.springframework.web.bind.annotation.*; 14 import org.springframework.web.bind.annotation.*;
@@ -32,14 +31,14 @@ public class DataSourceConfigController { @@ -32,14 +31,14 @@ public class DataSourceConfigController {
32 @PostMapping("/create") 31 @PostMapping("/create")
33 @Operation(summary = "创建数据源配置") 32 @Operation(summary = "创建数据源配置")
34 @PreAuthorize("@ss.hasPermission('infra:data-source-config:create')") 33 @PreAuthorize("@ss.hasPermission('infra:data-source-config:create')")
35 - public CommonResult<Long> createDataSourceConfig(@Valid @RequestBody DataSourceConfigCreateReqVO createReqVO) { 34 + public CommonResult<Long> createDataSourceConfig(@Valid @RequestBody DataSourceConfigSaveReqVO createReqVO) {
36 return success(dataSourceConfigService.createDataSourceConfig(createReqVO)); 35 return success(dataSourceConfigService.createDataSourceConfig(createReqVO));
37 } 36 }
38 37
39 @PutMapping("/update") 38 @PutMapping("/update")
40 @Operation(summary = "更新数据源配置") 39 @Operation(summary = "更新数据源配置")
41 @PreAuthorize("@ss.hasPermission('infra:data-source-config:update')") 40 @PreAuthorize("@ss.hasPermission('infra:data-source-config:update')")
42 - public CommonResult<Boolean> updateDataSourceConfig(@Valid @RequestBody DataSourceConfigUpdateReqVO updateReqVO) { 41 + public CommonResult<Boolean> updateDataSourceConfig(@Valid @RequestBody DataSourceConfigSaveReqVO updateReqVO) {
43 dataSourceConfigService.updateDataSourceConfig(updateReqVO); 42 dataSourceConfigService.updateDataSourceConfig(updateReqVO);
44 return success(true); 43 return success(true);
45 } 44 }
@@ -58,8 +57,8 @@ public class DataSourceConfigController { @@ -58,8 +57,8 @@ public class DataSourceConfigController {
58 @Parameter(name = "id", description = "编号", required = true, example = "1024") 57 @Parameter(name = "id", description = "编号", required = true, example = "1024")
59 @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')") 58 @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')")
60 public CommonResult<DataSourceConfigRespVO> getDataSourceConfig(@RequestParam("id") Long id) { 59 public CommonResult<DataSourceConfigRespVO> getDataSourceConfig(@RequestParam("id") Long id) {
61 - DataSourceConfigDO dataSourceConfig = dataSourceConfigService.getDataSourceConfig(id);  
62 - return success(DataSourceConfigConvert.INSTANCE.convert(dataSourceConfig)); 60 + DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(id);
  61 + return success(BeanUtils.toBean(config, DataSourceConfigRespVO.class));
63 } 62 }
64 63
65 @GetMapping("/list") 64 @GetMapping("/list")
@@ -67,7 +66,7 @@ public class DataSourceConfigController { @@ -67,7 +66,7 @@ public class DataSourceConfigController {
67 @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')") 66 @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')")
68 public CommonResult<List<DataSourceConfigRespVO>> getDataSourceConfigList() { 67 public CommonResult<List<DataSourceConfigRespVO>> getDataSourceConfigList() {
69 List<DataSourceConfigDO> list = dataSourceConfigService.getDataSourceConfigList(); 68 List<DataSourceConfigDO> list = dataSourceConfigService.getDataSourceConfigList();
70 - return success(DataSourceConfigConvert.INSTANCE.convertList(list)); 69 + return success(BeanUtils.toBean(list, DataSourceConfigRespVO.class));
71 } 70 }
72 71
73 } 72 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.db.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.*;  
5 -import javax.validation.constraints.*;  
6 -  
7 -@Schema(description = "管理后台 - 数据源配置创建 Request VO")  
8 -@Data  
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 -public class DataSourceConfigCreateReqVO extends DataSourceConfigBaseVO {  
12 -  
13 - @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")  
14 - @NotNull(message = "密码不能为空")  
15 - private String password;  
16 -  
17 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.db.vo; 1 package cn.iocoder.yudao.module.infra.controller.admin.db.vo;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 -import lombok.*; 4 +import lombok.Data;
5 5
6 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
7 7
8 @Schema(description = "管理后台 - 数据源配置 Response VO") 8 @Schema(description = "管理后台 - 数据源配置 Response VO")
9 @Data 9 @Data
10 -@EqualsAndHashCode(callSuper = true)  
11 -@ToString(callSuper = true)  
12 -public class DataSourceConfigRespVO extends DataSourceConfigBaseVO { 10 +public class DataSourceConfigRespVO {
13 11
14 @Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 12 @Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
15 private Integer id; 13 private Integer id;
16 14
  15 + @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
  16 + private String name;
  17 +
  18 + @Schema(description = "数据源连接", requiredMode = Schema.RequiredMode.REQUIRED, example = "jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro")
  19 + private String url;
  20 +
  21 + @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "root")
  22 + private String username;
  23 +
17 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 24 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
18 private LocalDateTime createTime; 25 private LocalDateTime createTime;
19 26
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigBaseVO.java renamed to yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigSaveReqVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.db.vo; 1 package cn.iocoder.yudao.module.infra.controller.admin.db.vo;
  2 +
2 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
3 import lombok.*; 4 import lombok.*;
4 import javax.validation.constraints.*; 5 import javax.validation.constraints.*;
5 6
6 -/**  
7 -* 数据源配置 Base VO,提供给添加、修改、详细的子 VO 使用  
8 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
9 -*/ 7 +@Schema(description = "管理后台 - 数据源配置创建/修改 Request VO")
10 @Data 8 @Data
11 -public class DataSourceConfigBaseVO { 9 +public class DataSourceConfigSaveReqVO {
  10 +
  11 + @Schema(description = "主键编号", example = "1024")
  12 + private Long id;
12 13
13 @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") 14 @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
14 @NotNull(message = "数据源名称不能为空") 15 @NotNull(message = "数据源名称不能为空")
@@ -22,4 +23,8 @@ public class DataSourceConfigBaseVO { @@ -22,4 +23,8 @@ public class DataSourceConfigBaseVO {
22 @NotNull(message = "用户名不能为空") 23 @NotNull(message = "用户名不能为空")
23 private String username; 24 private String username;
24 25
  26 + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
  27 + @NotNull(message = "密码不能为空")
  28 + private String password;
  29 +
25 } 30 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.db.vo;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.*;  
5 -import javax.validation.constraints.*;  
6 -  
7 -@Schema(description = "管理后台 - 数据源配置更新 Request VO")  
8 -@Data  
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 -public class DataSourceConfigUpdateReqVO extends DataSourceConfigBaseVO {  
12 -  
13 - @Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
14 - @NotNull(message = "主键编号不能为空")  
15 - private Long id;  
16 -  
17 - @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")  
18 - @NotNull(message = "密码不能为空")  
19 - private String password;  
20 -  
21 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java
@@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.infra.controller.admin.file; @@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.infra.controller.admin.file;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigCreateReqVO; 5 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
7 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigRespVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigRespVO;
8 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigUpdateReqVO;  
9 -import cn.iocoder.yudao.module.infra.convert.file.FileConfigConvert; 8 +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
11 import cn.iocoder.yudao.module.infra.service.file.FileConfigService; 10 import cn.iocoder.yudao.module.infra.service.file.FileConfigService;
12 -import io.swagger.v3.oas.annotations.tags.Tag;  
13 -import io.swagger.v3.oas.annotations.Parameter;  
14 import io.swagger.v3.oas.annotations.Operation; 11 import io.swagger.v3.oas.annotations.Operation;
  12 +import io.swagger.v3.oas.annotations.Parameter;
  13 +import io.swagger.v3.oas.annotations.tags.Tag;
15 import org.springframework.security.access.prepost.PreAuthorize; 14 import org.springframework.security.access.prepost.PreAuthorize;
16 import org.springframework.validation.annotation.Validated; 15 import org.springframework.validation.annotation.Validated;
17 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
@@ -33,14 +32,14 @@ public class FileConfigController { @@ -33,14 +32,14 @@ public class FileConfigController {
33 @PostMapping("/create") 32 @PostMapping("/create")
34 @Operation(summary = "创建文件配置") 33 @Operation(summary = "创建文件配置")
35 @PreAuthorize("@ss.hasPermission('infra:file-config:create')") 34 @PreAuthorize("@ss.hasPermission('infra:file-config:create')")
36 - public CommonResult<Long> createFileConfig(@Valid @RequestBody FileConfigCreateReqVO createReqVO) { 35 + public CommonResult<Long> createFileConfig(@Valid @RequestBody FileConfigSaveReqVO createReqVO) {
37 return success(fileConfigService.createFileConfig(createReqVO)); 36 return success(fileConfigService.createFileConfig(createReqVO));
38 } 37 }
39 38
40 @PutMapping("/update") 39 @PutMapping("/update")
41 @Operation(summary = "更新文件配置") 40 @Operation(summary = "更新文件配置")
42 @PreAuthorize("@ss.hasPermission('infra:file-config:update')") 41 @PreAuthorize("@ss.hasPermission('infra:file-config:update')")
43 - public CommonResult<Boolean> updateFileConfig(@Valid @RequestBody FileConfigUpdateReqVO updateReqVO) { 42 + public CommonResult<Boolean> updateFileConfig(@Valid @RequestBody FileConfigSaveReqVO updateReqVO) {
44 fileConfigService.updateFileConfig(updateReqVO); 43 fileConfigService.updateFileConfig(updateReqVO);
45 return success(true); 44 return success(true);
46 } 45 }
@@ -67,8 +66,8 @@ public class FileConfigController { @@ -67,8 +66,8 @@ public class FileConfigController {
67 @Parameter(name = "id", description = "编号", required = true, example = "1024") 66 @Parameter(name = "id", description = "编号", required = true, example = "1024")
68 @PreAuthorize("@ss.hasPermission('infra:file-config:query')") 67 @PreAuthorize("@ss.hasPermission('infra:file-config:query')")
69 public CommonResult<FileConfigRespVO> getFileConfig(@RequestParam("id") Long id) { 68 public CommonResult<FileConfigRespVO> getFileConfig(@RequestParam("id") Long id) {
70 - FileConfigDO fileConfig = fileConfigService.getFileConfig(id);  
71 - return success(FileConfigConvert.INSTANCE.convert(fileConfig)); 69 + FileConfigDO config = fileConfigService.getFileConfig(id);
  70 + return success(BeanUtils.toBean(config, FileConfigRespVO.class));
72 } 71 }
73 72
74 @GetMapping("/page") 73 @GetMapping("/page")
@@ -76,7 +75,7 @@ public class FileConfigController { @@ -76,7 +75,7 @@ public class FileConfigController {
76 @PreAuthorize("@ss.hasPermission('infra:file-config:query')") 75 @PreAuthorize("@ss.hasPermission('infra:file-config:query')")
77 public CommonResult<PageResult<FileConfigRespVO>> getFileConfigPage(@Valid FileConfigPageReqVO pageVO) { 76 public CommonResult<PageResult<FileConfigRespVO>> getFileConfigPage(@Valid FileConfigPageReqVO pageVO) {
78 PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(pageVO); 77 PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(pageVO);
79 - return success(FileConfigConvert.INSTANCE.convertPage(pageResult)); 78 + return success(BeanUtils.toBean(pageResult, FileConfigRespVO.class));
80 } 79 }
81 80
82 @GetMapping("/test") 81 @GetMapping("/test")
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java
@@ -4,17 +4,17 @@ import cn.hutool.core.io.IoUtil; @@ -4,17 +4,17 @@ import cn.hutool.core.io.IoUtil;
4 import cn.hutool.core.util.StrUtil; 4 import cn.hutool.core.util.StrUtil;
5 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
6 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  7 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7 import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; 8 import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 9 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
9 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO; 10 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
10 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileRespVO; 11 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileRespVO;
11 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileUploadReqVO; 12 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileUploadReqVO;
12 -import cn.iocoder.yudao.module.infra.convert.file.FileConvert;  
13 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; 13 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
14 import cn.iocoder.yudao.module.infra.service.file.FileService; 14 import cn.iocoder.yudao.module.infra.service.file.FileService;
15 -import io.swagger.v3.oas.annotations.tags.Tag;  
16 -import io.swagger.v3.oas.annotations.Parameter;  
17 import io.swagger.v3.oas.annotations.Operation; 15 import io.swagger.v3.oas.annotations.Operation;
  16 +import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.tags.Tag;
18 import lombok.extern.slf4j.Slf4j; 18 import lombok.extern.slf4j.Slf4j;
19 import org.springframework.http.HttpStatus; 19 import org.springframework.http.HttpStatus;
20 import org.springframework.security.access.prepost.PreAuthorize; 20 import org.springframework.security.access.prepost.PreAuthorize;
@@ -86,7 +86,7 @@ public class FileController { @@ -86,7 +86,7 @@ public class FileController {
86 @PreAuthorize("@ss.hasPermission('infra:file:query')") 86 @PreAuthorize("@ss.hasPermission('infra:file:query')")
87 public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) { 87 public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
88 PageResult<FileDO> pageResult = fileService.getFilePage(pageVO); 88 PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
89 - return success(FileConvert.INSTANCE.convertPage(pageResult)); 89 + return success(BeanUtils.toBean(pageResult, FileRespVO.class));
90 } 90 }
91 91
92 } 92 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigBaseVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -  
6 -import javax.validation.constraints.NotNull;  
7 -  
8 -/**  
9 -* 文件配置 Base VO,提供给添加、修改、详细的子 VO 使用  
10 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
11 -*/  
12 -@Data  
13 -public class FileConfigBaseVO {  
14 -  
15 - @Schema(description = "配置名", requiredMode = Schema.RequiredMode.REQUIRED, example = "S3 - 阿里云")  
16 - @NotNull(message = "配置名不能为空")  
17 - private String name;  
18 -  
19 - @Schema(description = "备注", example = "我是备注")  
20 - private String remark;  
21 -  
22 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java
@@ -27,4 +27,4 @@ public class FileConfigPageReqVO extends PageParam { @@ -27,4 +27,4 @@ public class FileConfigPageReqVO extends PageParam {
27 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) 27 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
28 private LocalDateTime[] createTime; 28 private LocalDateTime[] createTime;
29 29
30 -} 30 -}
  31 +}
31 \ No newline at end of file 32 \ No newline at end of file
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java
@@ -3,32 +3,31 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config; @@ -3,32 +3,31 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;
3 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; 3 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig;
4 import io.swagger.v3.oas.annotations.media.Schema; 4 import io.swagger.v3.oas.annotations.media.Schema;
5 import lombok.Data; 5 import lombok.Data;
6 -import lombok.EqualsAndHashCode;  
7 -import lombok.ToString;  
8 6
9 -import javax.validation.constraints.NotNull;  
10 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
11 8
12 @Schema(description = "管理后台 - 文件配置 Response VO") 9 @Schema(description = "管理后台 - 文件配置 Response VO")
13 @Data 10 @Data
14 -@EqualsAndHashCode(callSuper = true)  
15 -@ToString(callSuper = true)  
16 -public class FileConfigRespVO extends FileConfigBaseVO { 11 +public class FileConfigRespVO {
17 12
18 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 13 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
19 private Long id; 14 private Long id;
20 15
  16 + @Schema(description = "配置名", requiredMode = Schema.RequiredMode.REQUIRED, example = "S3 - 阿里云")
  17 + private String name;
  18 +
21 @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 19 @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
22 - @NotNull(message = "存储器不能为空")  
23 private Integer storage; 20 private Integer storage;
24 21
25 @Schema(description = "是否为主配置", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") 22 @Schema(description = "是否为主配置", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
26 - @NotNull(message = "是否为主配置不能为空")  
27 private Boolean master; 23 private Boolean master;
28 24
29 @Schema(description = "存储配置", requiredMode = Schema.RequiredMode.REQUIRED) 25 @Schema(description = "存储配置", requiredMode = Schema.RequiredMode.REQUIRED)
30 private FileClientConfig config; 26 private FileClientConfig config;
31 27
  28 + @Schema(description = "备注", example = "我是备注")
  29 + private String remark;
  30 +
32 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 31 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
33 private LocalDateTime createTime; 32 private LocalDateTime createTime;
34 33
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigCreateReqVO.java renamed to yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigSaveReqVO.java 100755 → 100644
@@ -2,17 +2,20 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config; @@ -2,17 +2,20 @@ package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 5
8 import javax.validation.constraints.NotNull; 6 import javax.validation.constraints.NotNull;
9 import java.util.Map; 7 import java.util.Map;
10 8
11 -@Schema(description = "管理后台 - 文件配置创建 Request VO") 9 +@Schema(description = "管理后台 - 文件配置创建/修改 Request VO")
12 @Data 10 @Data
13 -@EqualsAndHashCode(callSuper = true)  
14 -@ToString(callSuper = true)  
15 -public class FileConfigCreateReqVO extends FileConfigBaseVO { 11 +public class FileConfigSaveReqVO {
  12 +
  13 + @Schema(description = "编号", example = "1")
  14 + private Long id;
  15 +
  16 + @Schema(description = "配置名", requiredMode = Schema.RequiredMode.REQUIRED, example = "S3 - 阿里云")
  17 + @NotNull(message = "配置名不能为空")
  18 + private String name;
16 19
17 @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 20 @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
18 @NotNull(message = "存储器不能为空") 21 @NotNull(message = "存储器不能为空")
@@ -22,4 +25,7 @@ public class FileConfigCreateReqVO extends FileConfigBaseVO { @@ -22,4 +25,7 @@ public class FileConfigCreateReqVO extends FileConfigBaseVO {
22 @NotNull(message = "存储配置不能为空") 25 @NotNull(message = "存储配置不能为空")
23 private Map<String, Object> config; 26 private Map<String, Object> config;
24 27
  28 + @Schema(description = "备注", example = "我是备注")
  29 + private String remark;
  30 +
25 } 31 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.file.vo.config;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 -  
8 -import javax.validation.constraints.NotNull;  
9 -import java.util.Map;  
10 -  
11 -@Schema(description = "管理后台 - 文件配置更新 Request VO")  
12 -@Data  
13 -@EqualsAndHashCode(callSuper = true)  
14 -@ToString(callSuper = true)  
15 -public class FileConfigUpdateReqVO extends FileConfigBaseVO {  
16 -  
17 - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")  
18 - @NotNull(message = "编号不能为空")  
19 - private Long id;  
20 -  
21 - @Schema(description = "存储配置,配置是动态参数,所以使用 Map 接收", requiredMode = Schema.RequiredMode.REQUIRED)  
22 - @NotNull(message = "存储配置不能为空")  
23 - private Map<String, Object> config;  
24 -  
25 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.job; 1 package cn.iocoder.yudao.module.infra.controller.admin.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7 import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; 9 import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
8 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*;  
9 -import cn.iocoder.yudao.module.infra.convert.job.JobConvert; 10 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
  11 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobRespVO;
  12 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobSaveReqVO;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; 13 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
11 import cn.iocoder.yudao.module.infra.service.job.JobService; 14 import cn.iocoder.yudao.module.infra.service.job.JobService;
12 -import io.swagger.v3.oas.annotations.tags.Tag; 15 +import io.swagger.v3.oas.annotations.Operation;
13 import io.swagger.v3.oas.annotations.Parameter; 16 import io.swagger.v3.oas.annotations.Parameter;
14 import io.swagger.v3.oas.annotations.Parameters; 17 import io.swagger.v3.oas.annotations.Parameters;
15 -import io.swagger.v3.oas.annotations.Operation; 18 +import io.swagger.v3.oas.annotations.tags.Tag;
16 import org.quartz.SchedulerException; 19 import org.quartz.SchedulerException;
17 import org.springframework.security.access.prepost.PreAuthorize; 20 import org.springframework.security.access.prepost.PreAuthorize;
18 import org.springframework.validation.annotation.Validated; 21 import org.springframework.validation.annotation.Validated;
@@ -23,7 +26,6 @@ import javax.servlet.http.HttpServletResponse; @@ -23,7 +26,6 @@ import javax.servlet.http.HttpServletResponse;
23 import javax.validation.Valid; 26 import javax.validation.Valid;
24 import java.io.IOException; 27 import java.io.IOException;
25 import java.time.LocalDateTime; 28 import java.time.LocalDateTime;
26 -import java.util.Collection;  
27 import java.util.Collections; 29 import java.util.Collections;
28 import java.util.List; 30 import java.util.List;
29 31
@@ -42,7 +44,7 @@ public class JobController { @@ -42,7 +44,7 @@ public class JobController {
42 @PostMapping("/create") 44 @PostMapping("/create")
43 @Operation(summary = "创建定时任务") 45 @Operation(summary = "创建定时任务")
44 @PreAuthorize("@ss.hasPermission('infra:job:create')") 46 @PreAuthorize("@ss.hasPermission('infra:job:create')")
45 - public CommonResult<Long> createJob(@Valid @RequestBody JobCreateReqVO createReqVO) 47 + public CommonResult<Long> createJob(@Valid @RequestBody JobSaveReqVO createReqVO)
46 throws SchedulerException { 48 throws SchedulerException {
47 return success(jobService.createJob(createReqVO)); 49 return success(jobService.createJob(createReqVO));
48 } 50 }
@@ -50,7 +52,7 @@ public class JobController { @@ -50,7 +52,7 @@ public class JobController {
50 @PutMapping("/update") 52 @PutMapping("/update")
51 @Operation(summary = "更新定时任务") 53 @Operation(summary = "更新定时任务")
52 @PreAuthorize("@ss.hasPermission('infra:job:update')") 54 @PreAuthorize("@ss.hasPermission('infra:job:update')")
53 - public CommonResult<Boolean> updateJob(@Valid @RequestBody JobUpdateReqVO updateReqVO) 55 + public CommonResult<Boolean> updateJob(@Valid @RequestBody JobSaveReqVO updateReqVO)
54 throws SchedulerException { 56 throws SchedulerException {
55 jobService.updateJob(updateReqVO); 57 jobService.updateJob(updateReqVO);
56 return success(true); 58 return success(true);
@@ -94,16 +96,7 @@ public class JobController { @@ -94,16 +96,7 @@ public class JobController {
94 @PreAuthorize("@ss.hasPermission('infra:job:query')") 96 @PreAuthorize("@ss.hasPermission('infra:job:query')")
95 public CommonResult<JobRespVO> getJob(@RequestParam("id") Long id) { 97 public CommonResult<JobRespVO> getJob(@RequestParam("id") Long id) {
96 JobDO job = jobService.getJob(id); 98 JobDO job = jobService.getJob(id);
97 - return success(JobConvert.INSTANCE.convert(job));  
98 - }  
99 -  
100 - @GetMapping("/list")  
101 - @Operation(summary = "获得定时任务列表")  
102 - @Parameter(name = "ids", description = "编号列表", required = true)  
103 - @PreAuthorize("@ss.hasPermission('infra:job:query')")  
104 - public CommonResult<List<JobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) {  
105 - List<JobDO> list = jobService.getJobList(ids);  
106 - return success(JobConvert.INSTANCE.convertList(list)); 99 + return success(BeanUtils.toBean(job, JobRespVO.class));
107 } 100 }
108 101
109 @GetMapping("/page") 102 @GetMapping("/page")
@@ -111,19 +104,20 @@ public class JobController { @@ -111,19 +104,20 @@ public class JobController {
111 @PreAuthorize("@ss.hasPermission('infra:job:query')") 104 @PreAuthorize("@ss.hasPermission('infra:job:query')")
112 public CommonResult<PageResult<JobRespVO>> getJobPage(@Valid JobPageReqVO pageVO) { 105 public CommonResult<PageResult<JobRespVO>> getJobPage(@Valid JobPageReqVO pageVO) {
113 PageResult<JobDO> pageResult = jobService.getJobPage(pageVO); 106 PageResult<JobDO> pageResult = jobService.getJobPage(pageVO);
114 - return success(JobConvert.INSTANCE.convertPage(pageResult)); 107 + return success(BeanUtils.toBean(pageResult, JobRespVO.class));
115 } 108 }
116 109
117 @GetMapping("/export-excel") 110 @GetMapping("/export-excel")
118 @Operation(summary = "导出定时任务 Excel") 111 @Operation(summary = "导出定时任务 Excel")
119 @PreAuthorize("@ss.hasPermission('infra:job:export')") 112 @PreAuthorize("@ss.hasPermission('infra:job:export')")
120 @OperateLog(type = EXPORT) 113 @OperateLog(type = EXPORT)
121 - public void exportJobExcel(@Valid JobExportReqVO exportReqVO, 114 + public void exportJobExcel(@Valid JobPageReqVO exportReqVO,
122 HttpServletResponse response) throws IOException { 115 HttpServletResponse response) throws IOException {
123 - List<JobDO> list = jobService.getJobList(exportReqVO); 116 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  117 + List<JobDO> list = jobService.getJobPage(exportReqVO).getList();
124 // 导出 Excel 118 // 导出 Excel
125 - List<JobExcelVO> datas = JobConvert.INSTANCE.convertList02(list);  
126 - ExcelUtils.write(response, "定时任务.xls", "数据", JobExcelVO.class, datas); 119 + ExcelUtils.write(response, "定时任务.xls", "数据", JobRespVO.class,
  120 + BeanUtils.toBean(list, JobRespVO.class));
127 } 121 }
128 122
129 @GetMapping("/get_next_times") 123 @GetMapping("/get_next_times")
@@ -133,8 +127,9 @@ public class JobController { @@ -133,8 +127,9 @@ public class JobController {
133 @Parameter(name = "count", description = "数量", example = "5") 127 @Parameter(name = "count", description = "数量", example = "5")
134 }) 128 })
135 @PreAuthorize("@ss.hasPermission('infra:job:query')") 129 @PreAuthorize("@ss.hasPermission('infra:job:query')")
136 - public CommonResult<List<LocalDateTime>> getJobNextTimes(@RequestParam("id") Long id,  
137 - @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { 130 + public CommonResult<List<LocalDateTime>> getJobNextTimes(
  131 + @RequestParam("id") Long id,
  132 + @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) {
138 JobDO job = jobService.getJob(id); 133 JobDO job = jobService.getJob(id);
139 if (job == null) { 134 if (job == null) {
140 return success(Collections.emptyList()); 135 return success(Collections.emptyList());
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobLogController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.job; 1 package cn.iocoder.yudao.module.infra.controller.admin.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7 -import cn.iocoder.yudao.framework.operatelog.core.util.OperateLogUtils;  
8 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO;  
9 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;  
10 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 9 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
11 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO; 10 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO;
12 -import cn.iocoder.yudao.module.infra.convert.job.JobLogConvert;  
13 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 11 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
14 import cn.iocoder.yudao.module.infra.service.job.JobLogService; 12 import cn.iocoder.yudao.module.infra.service.job.JobLogService;
15 -import io.swagger.v3.oas.annotations.tags.Tag;  
16 -import io.swagger.v3.oas.annotations.Parameter;  
17 import io.swagger.v3.oas.annotations.Operation; 13 import io.swagger.v3.oas.annotations.Operation;
  14 +import io.swagger.v3.oas.annotations.Parameter;
  15 +import io.swagger.v3.oas.annotations.tags.Tag;
18 import org.springframework.security.access.prepost.PreAuthorize; 16 import org.springframework.security.access.prepost.PreAuthorize;
19 import org.springframework.validation.annotation.Validated; 17 import org.springframework.validation.annotation.Validated;
20 import org.springframework.web.bind.annotation.GetMapping; 18 import org.springframework.web.bind.annotation.GetMapping;
@@ -26,7 +24,6 @@ import javax.annotation.Resource; @@ -26,7 +24,6 @@ import javax.annotation.Resource;
26 import javax.servlet.http.HttpServletResponse; 24 import javax.servlet.http.HttpServletResponse;
27 import javax.validation.Valid; 25 import javax.validation.Valid;
28 import java.io.IOException; 26 import java.io.IOException;
29 -import java.util.Collection;  
30 import java.util.List; 27 import java.util.List;
31 28
32 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 29 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -47,16 +44,7 @@ public class JobLogController { @@ -47,16 +44,7 @@ public class JobLogController {
47 @PreAuthorize("@ss.hasPermission('infra:job:query')") 44 @PreAuthorize("@ss.hasPermission('infra:job:query')")
48 public CommonResult<JobLogRespVO> getJobLog(@RequestParam("id") Long id) { 45 public CommonResult<JobLogRespVO> getJobLog(@RequestParam("id") Long id) {
49 JobLogDO jobLog = jobLogService.getJobLog(id); 46 JobLogDO jobLog = jobLogService.getJobLog(id);
50 - return success(JobLogConvert.INSTANCE.convert(jobLog));  
51 - }  
52 -  
53 - @GetMapping("/list")  
54 - @Operation(summary = "获得定时任务日志列表")  
55 - @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")  
56 - @PreAuthorize("@ss.hasPermission('infra:job:query')")  
57 - public CommonResult<List<JobLogRespVO>> getJobLogList(@RequestParam("ids") Collection<Long> ids) {  
58 - List<JobLogDO> list = jobLogService.getJobLogList(ids);  
59 - return success(JobLogConvert.INSTANCE.convertList(list)); 47 + return success(BeanUtils.toBean(jobLog, JobLogRespVO.class));
60 } 48 }
61 49
62 @GetMapping("/page") 50 @GetMapping("/page")
@@ -64,19 +52,20 @@ public class JobLogController { @@ -64,19 +52,20 @@ public class JobLogController {
64 @PreAuthorize("@ss.hasPermission('infra:job:query')") 52 @PreAuthorize("@ss.hasPermission('infra:job:query')")
65 public CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@Valid JobLogPageReqVO pageVO) { 53 public CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@Valid JobLogPageReqVO pageVO) {
66 PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(pageVO); 54 PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(pageVO);
67 - return success(JobLogConvert.INSTANCE.convertPage(pageResult)); 55 + return success(BeanUtils.toBean(pageResult, JobLogRespVO.class));
68 } 56 }
69 57
70 @GetMapping("/export-excel") 58 @GetMapping("/export-excel")
71 @Operation(summary = "导出定时任务日志 Excel") 59 @Operation(summary = "导出定时任务日志 Excel")
72 @PreAuthorize("@ss.hasPermission('infra:job:export')") 60 @PreAuthorize("@ss.hasPermission('infra:job:export')")
73 @OperateLog(type = EXPORT) 61 @OperateLog(type = EXPORT)
74 - public void exportJobLogExcel(@Valid JobLogExportReqVO exportReqVO, 62 + public void exportJobLogExcel(@Valid JobLogPageReqVO exportReqVO,
75 HttpServletResponse response) throws IOException { 63 HttpServletResponse response) throws IOException {
76 - List<JobLogDO> list = jobLogService.getJobLogList(exportReqVO); 64 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  65 + List<JobLogDO> list = jobLogService.getJobLogPage(exportReqVO).getList();
77 // 导出 Excel 66 // 导出 Excel
78 - List<JobLogExcelVO> datas = JobLogConvert.INSTANCE.convertList02(list);  
79 - ExcelUtils.write(response, "任务日志.xls", "数据", JobLogExcelVO.class, datas); 67 + ExcelUtils.write(response, "任务日志.xls", "数据", JobLogRespVO.class,
  68 + BeanUtils.toBean(list, JobLogRespVO.class));
80 } 69 }
81 70
82 -} 71 -}
  72 +}
83 \ No newline at end of file 73 \ No newline at end of file
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 -  
8 -import javax.validation.constraints.NotNull;  
9 -  
10 -@Schema(description = "管理后台 - 定时任务创建 Request VO")  
11 -@Data  
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class JobCreateReqVO extends JobBaseVO {  
15 -  
16 - @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob")  
17 - @NotNull(message = "处理器的名字不能为空")  
18 - private String handlerName;  
19 -  
20 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -import java.time.LocalDateTime;  
10 -  
11 -/**  
12 - * 定时任务 Excel VO  
13 - *  
14 - * @author 芋道源码  
15 - */  
16 -@Data  
17 -public class JobExcelVO {  
18 -  
19 - @ExcelProperty("任务编号")  
20 - private Long id;  
21 -  
22 - @ExcelProperty("任务名称")  
23 - private String name;  
24 -  
25 - @ExcelProperty(value = "任务状态", converter = DictConvert.class)  
26 - @DictFormat(DictTypeConstants.JOB_STATUS)  
27 - private Integer status;  
28 -  
29 - @ExcelProperty("处理器的名字")  
30 - private String handlerName;  
31 -  
32 - @ExcelProperty("处理器的参数")  
33 - private String handlerParam;  
34 -  
35 - @ExcelProperty("CRON 表达式")  
36 - private String cronExpression;  
37 -  
38 - @ExcelProperty("最后一次执行的开始时间")  
39 - private LocalDateTime executeBeginTime;  
40 -  
41 - @ExcelProperty("最后一次执行的结束时间")  
42 - private LocalDateTime executeEndTime;  
43 -  
44 - @ExcelProperty("上一次触发时间")  
45 - private LocalDateTime firePrevTime;  
46 -  
47 - @ExcelProperty("下一次触发时间")  
48 - private LocalDateTime fireNextTime;  
49 -  
50 - @ExcelProperty("监控超时时间")  
51 - private Integer monitorTimeout;  
52 -  
53 - @ExcelProperty("创建时间")  
54 - private LocalDateTime createTime;  
55 -  
56 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -  
6 -@Schema(description = "管理后台 - 定时任务 Excel 导出 Request VO-参数和 JobPageReqVO 是一致的")  
7 -@Data  
8 -public class JobExportReqVO {  
9 -  
10 - @Schema(description = "任务名称-模糊匹配", example = "测试任务")  
11 - private String name;  
12 -  
13 - @Schema(description = "任务状态-参见 JobStatusEnum 枚举", example = "1")  
14 - private Integer status;  
15 -  
16 - @Schema(description = "处理器的名字-模糊匹配", example = "UserSessionTimeoutJob")  
17 - private String handlerName;  
18 -  
19 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job; 1 package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 9 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 10
8 import javax.validation.constraints.NotNull; 11 import javax.validation.constraints.NotNull;
9 import java.time.LocalDateTime; 12 import java.time.LocalDateTime;
10 13
11 @Schema(description = "管理后台 - 定时任务 Response VO") 14 @Schema(description = "管理后台 - 定时任务 Response VO")
12 @Data 15 @Data
13 -@EqualsAndHashCode(callSuper = true)  
14 -@ToString(callSuper = true)  
15 -public class JobRespVO extends JobBaseVO { 16 +@ExcelIgnoreUnannotated
  17 +public class JobRespVO {
16 18
17 @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 19 @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  20 + @ExcelProperty("任务编号")
18 private Long id; 21 private Long id;
19 22
  23 + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试任务")
  24 + @ExcelProperty("任务名称")
  25 + private String name;
  26 +
20 @Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 27 @Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  28 + @ExcelProperty(value = "任务状态", converter = DictConvert.class)
  29 + @DictFormat(DictTypeConstants.JOB_STATUS)
21 private Integer status; 30 private Integer status;
22 31
23 @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob") 32 @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob")
24 - @NotNull(message = "处理器的名字不能为空") 33 + @ExcelProperty("处理器的名字")
25 private String handlerName; 34 private String handlerName;
26 35
  36 + @Schema(description = "处理器的参数", example = "yudao")
  37 + @ExcelProperty("处理器的参数")
  38 + private String handlerParam;
  39 +
  40 + @Schema(description = "CRON 表达式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0/10 * * * * ? *")
  41 + @ExcelProperty("CRON 表达式")
  42 + private String cronExpression;
  43 +
  44 + @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
  45 + @NotNull(message = "重试次数不能为空")
  46 + private Integer retryCount;
  47 +
  48 + @Schema(description = "重试间隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
  49 + private Integer retryInterval;
  50 +
  51 + @Schema(description = "监控超时时间", example = "1000")
  52 + @ExcelProperty("监控超时时间")
  53 + private Integer monitorTimeout;
  54 +
27 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 55 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  56 + @ExcelProperty("创建时间")
28 private LocalDateTime createTime; 57 private LocalDateTime createTime;
29 58
30 } 59 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobBaseVO.java renamed to yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobSaveReqVO.java
@@ -3,24 +3,29 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job; @@ -3,24 +3,29 @@ package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
5 5
  6 +import javax.validation.constraints.NotEmpty;
6 import javax.validation.constraints.NotNull; 7 import javax.validation.constraints.NotNull;
7 8
8 -/**  
9 -* 定时任务 Base VO,提供给添加、修改、详细的子 VO 使用  
10 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
11 -*/ 9 +@Schema(description = "管理后台 - 定时任务创建/修改 Request VO")
12 @Data 10 @Data
13 -public class JobBaseVO { 11 +public class JobSaveReqVO {
  12 +
  13 + @Schema(description = "任务编号", example = "1024")
  14 + private Long id;
14 15
15 @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试任务") 16 @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试任务")
16 - @NotNull(message = "任务名称不能为空") 17 + @NotEmpty(message = "任务名称不能为空")
17 private String name; 18 private String name;
18 19
  20 + @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob")
  21 + @NotEmpty(message = "处理器的名字不能为空")
  22 + private String handlerName;
  23 +
19 @Schema(description = "处理器的参数", example = "yudao") 24 @Schema(description = "处理器的参数", example = "yudao")
20 private String handlerParam; 25 private String handlerParam;
21 26
22 @Schema(description = "CRON 表达式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0/10 * * * * ? *") 27 @Schema(description = "CRON 表达式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0/10 * * * * ? *")
23 - @NotNull(message = "CRON 表达式不能为空") 28 + @NotEmpty(message = "CRON 表达式不能为空")
24 private String cronExpression; 29 private String cronExpression;
25 30
26 @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") 31 @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.job;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 -  
8 -import javax.validation.constraints.NotNull;  
9 -  
10 -@Schema(description = "管理后台 - 定时任务更新 Request VO")  
11 -@Data  
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class JobUpdateReqVO extends JobBaseVO {  
15 -  
16 - @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
17 - @NotNull(message = "任务编号不能为空")  
18 - private Long id;  
19 -  
20 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import javax.validation.constraints.NotNull;  
8 -import java.time.LocalDateTime;  
9 -  
10 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
11 -  
12 -/**  
13 -* 定时任务日志 Base VO,提供给添加、修改、详细的子 VO 使用  
14 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
15 -*/  
16 -@Data  
17 -public class JobLogBaseVO {  
18 -  
19 - @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
20 - @NotNull(message = "任务编号不能为空")  
21 - private Long jobId;  
22 -  
23 - @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob")  
24 - @NotNull(message = "处理器的名字不能为空")  
25 - private String handlerName;  
26 -  
27 - @Schema(description = "处理器的参数", example = "yudao")  
28 - private String handlerParam;  
29 -  
30 - @Schema(description = "第几次执行", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")  
31 - @NotNull(message = "第几次执行不能为空")  
32 - private Integer executeIndex;  
33 -  
34 - @Schema(description = "开始执行时间", requiredMode = Schema.RequiredMode.REQUIRED)  
35 - @NotNull(message = "开始执行时间不能为空")  
36 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
37 - private LocalDateTime beginTime;  
38 -  
39 - @Schema(description = "结束执行时间")  
40 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
41 - private LocalDateTime endTime;  
42 -  
43 - @Schema(description = "执行时长", example = "123")  
44 - private Integer duration;  
45 -  
46 - @Schema(description = "任务状态,参见 JobLogStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")  
47 - @NotNull(message = "任务状态不能为空")  
48 - private Integer status;  
49 -  
50 - @Schema(description = "结果数据", example = "执行成功")  
51 - private String result;  
52 -  
53 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -import java.time.LocalDateTime;  
10 -  
11 -/**  
12 - * 定时任务 Excel VO  
13 - *  
14 - * @author 芋艿  
15 - */  
16 -@Data  
17 -public class JobLogExcelVO {  
18 -  
19 - @ExcelProperty("日志编号")  
20 - private Long id;  
21 -  
22 - @ExcelProperty("任务编号")  
23 - private Long jobId;  
24 -  
25 - @ExcelProperty("处理器的名字")  
26 - private String handlerName;  
27 -  
28 - @ExcelProperty("处理器的参数")  
29 - private String handlerParam;  
30 -  
31 - @ExcelProperty("第几次执行")  
32 - private Integer executeIndex;  
33 -  
34 - @ExcelProperty("开始执行时间")  
35 - private LocalDateTime beginTime;  
36 -  
37 - @ExcelProperty("结束执行时间")  
38 - private LocalDateTime endTime;  
39 -  
40 - @ExcelProperty("执行时长")  
41 - private Integer duration;  
42 -  
43 - @ExcelProperty(value = "任务状态", converter = DictConvert.class)  
44 - @DictFormat(DictTypeConstants.JOB_STATUS)  
45 - private Integer status;  
46 -  
47 - @ExcelProperty("结果数据")  
48 - private String result;  
49 -  
50 - @ExcelProperty("创建时间")  
51 - private LocalDateTime createTime;  
52 -  
53 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import java.time.LocalDateTime;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -@Schema(description = "管理后台 - 定时任务 Excel 导出 Request VO,参数和 JobLogPageReqVO 是一致的")  
12 -@Data  
13 -public class JobLogExportReqVO {  
14 -  
15 - @Schema(description = "任务编号", example = "10")  
16 - private Long jobId;  
17 -  
18 - @Schema(description = "处理器的名字,模糊匹配")  
19 - private String handlerName;  
20 -  
21 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
22 - @Schema(description = "开始执行时间")  
23 - private LocalDateTime beginTime;  
24 -  
25 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
26 - @Schema(description = "结束执行时间")  
27 - private LocalDateTime endTime;  
28 -  
29 - @Schema(description = "任务状态,参见 JobLogStatusEnum 枚举")  
30 - private Integer status;  
31 -  
32 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log; 1 package cn.iocoder.yudao.module.infra.controller.admin.job.vo.log;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 9 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 10
8 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
9 12
10 @Schema(description = "管理后台 - 定时任务日志 Response VO") 13 @Schema(description = "管理后台 - 定时任务日志 Response VO")
11 @Data 14 @Data
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class JobLogRespVO extends JobLogBaseVO { 15 +@ExcelIgnoreUnannotated
  16 +public class JobLogRespVO {
15 17
16 @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + @ExcelProperty("日志编号")
17 private Long id; 20 private Long id;
18 21
  22 + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  23 + @ExcelProperty("任务编号")
  24 + private Long jobId;
  25 +
  26 + @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob")
  27 + @ExcelProperty("处理器的名字")
  28 + private String handlerName;
  29 +
  30 + @Schema(description = "处理器的参数", example = "yudao")
  31 + @ExcelProperty("处理器的参数")
  32 + private String handlerParam;
  33 +
  34 + @Schema(description = "第几次执行", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  35 + @ExcelProperty("第几次执行")
  36 + private Integer executeIndex;
  37 +
  38 + @Schema(description = "开始执行时间", requiredMode = Schema.RequiredMode.REQUIRED)
  39 + @ExcelProperty("开始执行时间")
  40 + private LocalDateTime beginTime;
  41 +
  42 + @Schema(description = "结束执行时间")
  43 + @ExcelProperty("结束执行时间")
  44 + private LocalDateTime endTime;
  45 +
  46 + @Schema(description = "执行时长", example = "123")
  47 + @ExcelProperty("执行时长")
  48 + private Integer duration;
  49 +
  50 + @Schema(description = "任务状态,参见 JobLogStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  51 + @ExcelProperty(value = "任务状态", converter = DictConvert.class)
  52 + @DictFormat(DictTypeConstants.JOB_STATUS)
  53 + private Integer status;
  54 +
  55 + @Schema(description = "结果数据", example = "执行成功")
  56 + @ExcelProperty("结果数据")
  57 + private String result;
  58 +
19 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 59 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  60 + @ExcelProperty("创建时间")
20 private LocalDateTime createTime; 61 private LocalDateTime createTime;
21 62
22 } 63 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.logger; 1 package cn.iocoder.yudao.module.infra.controller.admin.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO;  
8 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;  
9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO; 10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
11 -import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert;  
12 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; 11 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
13 import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService; 12 import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
14 -import io.swagger.v3.oas.annotations.tags.Tag;  
15 import io.swagger.v3.oas.annotations.Operation; 13 import io.swagger.v3.oas.annotations.Operation;
  14 +import io.swagger.v3.oas.annotations.tags.Tag;
16 import org.springframework.security.access.prepost.PreAuthorize; 15 import org.springframework.security.access.prepost.PreAuthorize;
17 import org.springframework.validation.annotation.Validated; 16 import org.springframework.validation.annotation.Validated;
18 import org.springframework.web.bind.annotation.GetMapping; 17 import org.springframework.web.bind.annotation.GetMapping;
@@ -40,21 +39,22 @@ public class ApiAccessLogController { @@ -40,21 +39,22 @@ public class ApiAccessLogController {
40 @GetMapping("/page") 39 @GetMapping("/page")
41 @Operation(summary = "获得API 访问日志分页") 40 @Operation(summary = "获得API 访问日志分页")
42 @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") 41 @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')")
43 - public CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@Valid ApiAccessLogPageReqVO pageVO) {  
44 - PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO);  
45 - return success(ApiAccessLogConvert.INSTANCE.convertPage(pageResult)); 42 + public CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@Valid ApiAccessLogPageReqVO pageReqVO) {
  43 + PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageReqVO);
  44 + return success(BeanUtils.toBean(pageResult, ApiAccessLogRespVO.class));
46 } 45 }
47 46
48 @GetMapping("/export-excel") 47 @GetMapping("/export-excel")
49 @Operation(summary = "导出API 访问日志 Excel") 48 @Operation(summary = "导出API 访问日志 Excel")
50 @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") 49 @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')")
51 @OperateLog(type = EXPORT) 50 @OperateLog(type = EXPORT)
52 - public void exportApiAccessLogExcel(@Valid ApiAccessLogExportReqVO exportReqVO, 51 + public void exportApiAccessLogExcel(@Valid ApiAccessLogPageReqVO exportReqVO,
53 HttpServletResponse response) throws IOException { 52 HttpServletResponse response) throws IOException {
54 - List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); 53 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  54 + List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogPage(exportReqVO).getList();
55 // 导出 Excel 55 // 导出 Excel
56 - List<ApiAccessLogExcelVO> datas = ApiAccessLogConvert.INSTANCE.convertList02(list);  
57 - ExcelUtils.write(response, "API 访问日志.xls", "数据", ApiAccessLogExcelVO.class, datas); 56 + ExcelUtils.write(response, "API 访问日志.xls", "数据", ApiAccessLogRespVO.class,
  57 + BeanUtils.toBean(list, ApiAccessLogRespVO.class));
58 } 58 }
59 59
60 } 60 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java
1 package cn.iocoder.yudao.module.infra.controller.admin.logger; 1 package cn.iocoder.yudao.module.infra.controller.admin.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO;  
8 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;  
9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO; 10 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
11 -import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;  
12 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 11 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
13 import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService; 12 import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService;
14 -import io.swagger.v3.oas.annotations.tags.Tag; 13 +import io.swagger.v3.oas.annotations.Operation;
15 import io.swagger.v3.oas.annotations.Parameter; 14 import io.swagger.v3.oas.annotations.Parameter;
16 import io.swagger.v3.oas.annotations.Parameters; 15 import io.swagger.v3.oas.annotations.Parameters;
17 -import io.swagger.v3.oas.annotations.Operation; 16 +import io.swagger.v3.oas.annotations.tags.Tag;
18 import org.springframework.security.access.prepost.PreAuthorize; 17 import org.springframework.security.access.prepost.PreAuthorize;
19 import org.springframework.validation.annotation.Validated; 18 import org.springframework.validation.annotation.Validated;
20 import org.springframework.web.bind.annotation.*; 19 import org.springframework.web.bind.annotation.*;
@@ -54,21 +53,22 @@ public class ApiErrorLogController { @@ -54,21 +53,22 @@ public class ApiErrorLogController {
54 @GetMapping("/page") 53 @GetMapping("/page")
55 @Operation(summary = "获得 API 错误日志分页") 54 @Operation(summary = "获得 API 错误日志分页")
56 @PreAuthorize("@ss.hasPermission('infra:api-error-log:query')") 55 @PreAuthorize("@ss.hasPermission('infra:api-error-log:query')")
57 - public CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@Valid ApiErrorLogPageReqVO pageVO) {  
58 - PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageVO);  
59 - return success(ApiErrorLogConvert.INSTANCE.convertPage(pageResult)); 56 + public CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@Valid ApiErrorLogPageReqVO pageReqVO) {
  57 + PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageReqVO);
  58 + return success(BeanUtils.toBean(pageResult, ApiErrorLogRespVO.class));
60 } 59 }
61 60
62 @GetMapping("/export-excel") 61 @GetMapping("/export-excel")
63 @Operation(summary = "导出 API 错误日志 Excel") 62 @Operation(summary = "导出 API 错误日志 Excel")
64 @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')") 63 @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')")
65 @OperateLog(type = EXPORT) 64 @OperateLog(type = EXPORT)
66 - public void exportApiErrorLogExcel(@Valid ApiErrorLogExportReqVO exportReqVO, 65 + public void exportApiErrorLogExcel(@Valid ApiErrorLogPageReqVO exportReqVO,
67 HttpServletResponse response) throws IOException { 66 HttpServletResponse response) throws IOException {
68 - List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO); 67 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  68 + List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogPage(exportReqVO).getList();
69 // 导出 Excel 69 // 导出 Excel
70 - List<ApiErrorLogExcelVO> datas = ApiErrorLogConvert.INSTANCE.convertList02(list);  
71 - ExcelUtils.write(response, "API 错误日志.xls", "数据", ApiErrorLogExcelVO.class, datas); 70 + ExcelUtils.write(response, "API 错误日志.xls", "数据", ApiErrorLogRespVO.class,
  71 + BeanUtils.toBean(list, ApiErrorLogRespVO.class));
72 } 72 }
73 73
74 } 74 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import javax.validation.constraints.NotNull;  
8 -import java.time.LocalDateTime;  
9 -  
10 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
11 -  
12 -/**  
13 -* API 访问日志 Base VO,提供给添加、修改、详细的子 VO 使用  
14 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
15 -*/  
16 -@Data  
17 -public class ApiAccessLogBaseVO {  
18 -  
19 - @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "66600cb6-7852-11eb-9439-0242ac130002")  
20 - @NotNull(message = "链路追踪编号不能为空")  
21 - private String traceId;  
22 -  
23 - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")  
24 - @NotNull(message = "用户编号不能为空")  
25 - private Long userId;  
26 -  
27 - @Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")  
28 - @NotNull(message = "用户类型不能为空")  
29 - private Integer userType;  
30 -  
31 - @Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "dashboard")  
32 - @NotNull(message = "应用名不能为空")  
33 - private String applicationName;  
34 -  
35 - @Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")  
36 - @NotNull(message = "请求方法名不能为空")  
37 - private String requestMethod;  
38 -  
39 - @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/xxx/yyy")  
40 - @NotNull(message = "请求地址不能为空")  
41 - private String requestUrl;  
42 -  
43 - @Schema(description = "请求参数")  
44 - private String requestParams;  
45 -  
46 - @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")  
47 - @NotNull(message = "用户 IP不能为空")  
48 - private String userIp;  
49 -  
50 - @Schema(description = "浏览器 UA", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")  
51 - @NotNull(message = "浏览器 UA不能为空")  
52 - private String userAgent;  
53 -  
54 - @Schema(description = "开始请求时间", requiredMode = Schema.RequiredMode.REQUIRED)  
55 - @NotNull(message = "开始请求时间不能为空")  
56 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
57 - private LocalDateTime beginTime;  
58 -  
59 - @Schema(description = "结束请求时间", requiredMode = Schema.RequiredMode.REQUIRED)  
60 - @NotNull(message = "结束请求时间不能为空")  
61 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
62 - private LocalDateTime endTime;  
63 -  
64 - @Schema(description = "执行时长", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")  
65 - @NotNull(message = "执行时长不能为空")  
66 - private Integer duration;  
67 -  
68 - @Schema(description = "结果码", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")  
69 - @NotNull(message = "结果码不能为空")  
70 - private Integer resultCode;  
71 -  
72 - @Schema(description = "结果提示", example = "芋道源码,牛逼!")  
73 - private String resultMsg;  
74 -  
75 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.system.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -import java.time.LocalDateTime;  
10 -  
11 -/**  
12 - * API 访问日志 Excel VO  
13 - *  
14 - * @author 芋道源码  
15 - */  
16 -@Data  
17 -public class ApiAccessLogExcelVO {  
18 -  
19 - @ExcelProperty("日志主键")  
20 - private Long id;  
21 -  
22 - @ExcelProperty("链路追踪编号")  
23 - private String traceId;  
24 -  
25 - @ExcelProperty("用户编号")  
26 - private Long userId;  
27 -  
28 - @ExcelProperty(value = "用户类型", converter = DictConvert.class)  
29 - @DictFormat(DictTypeConstants.USER_TYPE)  
30 - private Integer userType;  
31 -  
32 - @ExcelProperty("应用名")  
33 - private String applicationName;  
34 -  
35 - @ExcelProperty("请求方法名")  
36 - private String requestMethod;  
37 -  
38 - @ExcelProperty("请求地址")  
39 - private String requestUrl;  
40 -  
41 - @ExcelProperty("请求参数")  
42 - private String requestParams;  
43 -  
44 - @ExcelProperty("用户 IP")  
45 - private String userIp;  
46 -  
47 - @ExcelProperty("浏览器 UA")  
48 - private String userAgent;  
49 -  
50 - @ExcelProperty("开始请求时间")  
51 - private LocalDateTime beginTime;  
52 -  
53 - @ExcelProperty("结束请求时间")  
54 - private LocalDateTime endTime;  
55 -  
56 - @ExcelProperty("执行时长")  
57 - private Integer duration;  
58 -  
59 - @ExcelProperty("结果码")  
60 - private Integer resultCode;  
61 -  
62 - @ExcelProperty("结果提示")  
63 - private String resultMsg;  
64 -  
65 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import java.time.LocalDateTime;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -@Schema(description = "管理后台 - API 访问日志 Excel 导出 Request VO,参数和 ApiAccessLogPageReqVO 是一致的")  
12 -@Data  
13 -public class ApiAccessLogExportReqVO {  
14 -  
15 - @Schema(description = "用户编号", example = "666")  
16 - private Long userId;  
17 -  
18 - @Schema(description = "用户类型", example = "2")  
19 - private Integer userType;  
20 -  
21 - @Schema(description = "应用名", example = "dashboard")  
22 - private String applicationName;  
23 -  
24 - @Schema(description = "请求地址,模糊匹配", example = "/xxx/yyy")  
25 - private String requestUrl;  
26 -  
27 - @Schema(description = "开始时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]")  
28 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
29 - private LocalDateTime[] beginTime;  
30 -  
31 - @Schema(description = "执行时长,大于等于,单位:毫秒", example = "100")  
32 - private Integer duration;  
33 -  
34 - @Schema(description = "结果码", example = "0")  
35 - private Integer resultCode;  
36 -  
37 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog; 1 package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 9 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 10
8 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
9 12
10 @Schema(description = "管理后台 - API 访问日志 Response VO") 13 @Schema(description = "管理后台 - API 访问日志 Response VO")
11 @Data 14 @Data
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { 15 +@ExcelIgnoreUnannotated
  16 +public class ApiAccessLogRespVO {
15 17
16 @Schema(description = "日志主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "日志主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + @ExcelProperty("日志主键")
17 private Long id; 20 private Long id;
18 21
  22 + @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "66600cb6-7852-11eb-9439-0242ac130002")
  23 + @ExcelProperty("链路追踪编号")
  24 + private String traceId;
  25 +
  26 + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
  27 + @ExcelProperty("用户编号")
  28 + private Long userId;
  29 +
  30 + @Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
  31 + @ExcelProperty(value = "用户类型", converter = DictConvert.class)
  32 + @DictFormat(DictTypeConstants.USER_TYPE)
  33 + private Integer userType;
  34 +
  35 + @Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "dashboard")
  36 + @ExcelProperty("应用名")
  37 + private String applicationName;
  38 +
  39 + @Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")
  40 + @ExcelProperty("请求方法名")
  41 + private String requestMethod;
  42 +
  43 + @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/xxx/yyy")
  44 + @ExcelProperty("请求地址")
  45 + private String requestUrl;
  46 +
  47 + @Schema(description = "请求参数")
  48 + @ExcelProperty("请求参数")
  49 + private String requestParams;
  50 +
  51 + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
  52 + @ExcelProperty("用户 IP")
  53 + private String userIp;
  54 +
  55 + @Schema(description = "浏览器 UA", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")
  56 + @ExcelProperty("浏览器 UA")
  57 + private String userAgent;
  58 +
  59 + @Schema(description = "开始请求时间", requiredMode = Schema.RequiredMode.REQUIRED)
  60 + @ExcelProperty("开始请求时间")
  61 + private LocalDateTime beginTime;
  62 +
  63 + @Schema(description = "结束请求时间", requiredMode = Schema.RequiredMode.REQUIRED)
  64 + @ExcelProperty("结束请求时间")
  65 + private LocalDateTime endTime;
  66 +
  67 + @Schema(description = "执行时长", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  68 + @ExcelProperty("执行时长")
  69 + private Integer duration;
  70 +
  71 + @Schema(description = "结果码", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  72 + @ExcelProperty("结果码")
  73 + private Integer resultCode;
  74 +
  75 + @Schema(description = "结果提示", example = "芋道源码,牛逼!")
  76 + @ExcelProperty("结果提示")
  77 + private String resultMsg;
  78 +
19 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) 79 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
20 private LocalDateTime createTime; 80 private LocalDateTime createTime;
21 81
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;  
2 -import io.swagger.v3.oas.annotations.media.Schema;  
3 -import lombok.Data;  
4 -import org.springframework.format.annotation.DateTimeFormat;  
5 -  
6 -import javax.validation.constraints.NotNull;  
7 -import java.time.LocalDateTime;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -/**  
12 -* API 错误日志 Base VO,提供给添加、修改、详细的子 VO 使用  
13 -* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
14 -*/  
15 -@Data  
16 -public class ApiErrorLogBaseVO {  
17 -  
18 - @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "66600cb6-7852-11eb-9439-0242ac130002")  
19 - @NotNull(message = "链路追踪编号不能为空")  
20 - private String traceId;  
21 -  
22 - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")  
23 - @NotNull(message = "用户编号不能为空")  
24 - private Integer userId;  
25 -  
26 - @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")  
27 - @NotNull(message = "用户类型不能为空")  
28 - private Integer userType;  
29 -  
30 - @Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "dashboard")  
31 - @NotNull(message = "应用名不能为空")  
32 - private String applicationName;  
33 -  
34 - @Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")  
35 - @NotNull(message = "请求方法名不能为空")  
36 - private String requestMethod;  
37 -  
38 - @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/xx/yy")  
39 - @NotNull(message = "请求地址不能为空")  
40 - private String requestUrl;  
41 -  
42 - @Schema(description = "请求参数", requiredMode = Schema.RequiredMode.REQUIRED)  
43 - @NotNull(message = "请求参数不能为空")  
44 - private String requestParams;  
45 -  
46 - @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")  
47 - @NotNull(message = "用户 IP不能为空")  
48 - private String userIp;  
49 -  
50 - @Schema(description = "浏览器 UA", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")  
51 - @NotNull(message = "浏览器 UA不能为空")  
52 - private String userAgent;  
53 -  
54 - @Schema(description = "异常发生时间", requiredMode = Schema.RequiredMode.REQUIRED)  
55 - @NotNull(message = "异常发生时间不能为空")  
56 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
57 - private LocalDateTime exceptionTime;  
58 -  
59 - @Schema(description = "异常名", requiredMode = Schema.RequiredMode.REQUIRED)  
60 - @NotNull(message = "异常名不能为空")  
61 - private String exceptionName;  
62 -  
63 - @Schema(description = "异常导致的消息", requiredMode = Schema.RequiredMode.REQUIRED)  
64 - @NotNull(message = "异常导致的消息不能为空")  
65 - private String exceptionMessage;  
66 -  
67 - @Schema(description = "异常导致的根消息", requiredMode = Schema.RequiredMode.REQUIRED)  
68 - @NotNull(message = "异常导致的根消息不能为空")  
69 - private String exceptionRootCauseMessage;  
70 -  
71 - @Schema(description = "异常的栈轨迹", requiredMode = Schema.RequiredMode.REQUIRED)  
72 - @NotNull(message = "异常的栈轨迹不能为空")  
73 - private String exceptionStackTrace;  
74 -  
75 - @Schema(description = "异常发生的类全名", requiredMode = Schema.RequiredMode.REQUIRED)  
76 - @NotNull(message = "异常发生的类全名不能为空")  
77 - private String exceptionClassName;  
78 -  
79 - @Schema(description = "异常发生的类文件", requiredMode = Schema.RequiredMode.REQUIRED)  
80 - @NotNull(message = "异常发生的类文件不能为空")  
81 - private String exceptionFileName;  
82 -  
83 - @Schema(description = "异常发生的方法名", requiredMode = Schema.RequiredMode.REQUIRED)  
84 - @NotNull(message = "异常发生的方法名不能为空")  
85 - private String exceptionMethodName;  
86 -  
87 - @Schema(description = "异常发生的方法所在行", requiredMode = Schema.RequiredMode.REQUIRED)  
88 - @NotNull(message = "异常发生的方法所在行不能为空")  
89 - private Integer exceptionLineNumber;  
90 -  
91 - @Schema(description = "处理状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")  
92 - @NotNull(message = "处理状态不能为空")  
93 - private Integer processStatus;  
94 -  
95 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -import java.time.LocalDateTime;  
10 -  
11 -/**  
12 - * API 错误日志 Excel VO  
13 - *  
14 - * @author 芋道源码  
15 - */  
16 -@Data  
17 -public class ApiErrorLogExcelVO {  
18 -  
19 - @ExcelProperty("编号")  
20 - private Integer id;  
21 -  
22 - @ExcelProperty("链路追踪编号")  
23 - private String traceId;  
24 -  
25 - @ExcelProperty("用户编号")  
26 - private Integer userId;  
27 -  
28 - @ExcelProperty(value = "用户类型", converter = DictConvert.class)  
29 - @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE)  
30 - private Integer userType;  
31 -  
32 - @ExcelProperty("应用名")  
33 - private String applicationName;  
34 -  
35 - @ExcelProperty("请求方法名")  
36 - private String requestMethod;  
37 -  
38 - @ExcelProperty("请求地址")  
39 - private String requestUrl;  
40 -  
41 - @ExcelProperty("请求参数")  
42 - private String requestParams;  
43 -  
44 - @ExcelProperty("用户 IP")  
45 - private String userIp;  
46 -  
47 - @ExcelProperty("浏览器 UA")  
48 - private String userAgent;  
49 -  
50 - @ExcelProperty("异常发生时间")  
51 - private LocalDateTime exceptionTime;  
52 -  
53 - @ExcelProperty("异常名")  
54 - private String exceptionName;  
55 -  
56 - @ExcelProperty("异常导致的消息")  
57 - private String exceptionMessage;  
58 -  
59 - @ExcelProperty("异常导致的根消息")  
60 - private String exceptionRootCauseMessage;  
61 -  
62 - @ExcelProperty("异常的栈轨迹")  
63 - private String exceptionStackTrace;  
64 -  
65 - @ExcelProperty("异常发生的类全名")  
66 - private String exceptionClassName;  
67 -  
68 - @ExcelProperty("异常发生的类文件")  
69 - private String exceptionFileName;  
70 -  
71 - @ExcelProperty("异常发生的方法名")  
72 - private String exceptionMethodName;  
73 -  
74 - @ExcelProperty("异常发生的方法所在行")  
75 - private Integer exceptionLineNumber;  
76 -  
77 - @ExcelProperty("创建时间")  
78 - private LocalDateTime createTime;  
79 -  
80 - @ExcelProperty(value = "处理状态", converter = DictConvert.class)  
81 - @DictFormat(DictTypeConstants.API_ERROR_LOG_PROCESS_STATUS)  
82 - private Integer processStatus;  
83 -  
84 - @ExcelProperty("处理时间")  
85 - private LocalDateTime processTime;  
86 -  
87 - @ExcelProperty("处理用户编号")  
88 - private Integer processUserId;  
89 -  
90 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import org.springframework.format.annotation.DateTimeFormat;  
6 -  
7 -import java.time.LocalDateTime;  
8 -  
9 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
10 -  
11 -@Schema(description = "管理后台 - API 错误日志 Excel 导出 Request VO,参数和 ApiErrorLogPageReqVO 是一致的")  
12 -@Data  
13 -public class ApiErrorLogExportReqVO {  
14 -  
15 - @Schema(description = "用户编号", example = "666")  
16 - private Long userId;  
17 -  
18 - @Schema(description = "用户类型", example = "1")  
19 - private Integer userType;  
20 -  
21 - @Schema(description = "应用名", example = "dashboard")  
22 - private String applicationName;  
23 -  
24 - @Schema(description = "请求地址", example = "/xx/yy")  
25 - private String requestUrl;  
26 -  
27 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
28 - @Schema(description = "异常发生时间")  
29 - private LocalDateTime[] exceptionTime;  
30 -  
31 - @Schema(description = "处理状态", example = "0")  
32 - private Integer processStatus;  
33 -  
34 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java
1 package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; 1 package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 9 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 -import lombok.ToString;  
7 10
8 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
9 12
10 @Schema(description = "管理后台 - API 错误日志 Response VO") 13 @Schema(description = "管理后台 - API 错误日志 Response VO")
11 @Data 14 @Data
12 -@EqualsAndHashCode(callSuper = true)  
13 -@ToString(callSuper = true)  
14 -public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { 15 +@ExcelIgnoreUnannotated
  16 +public class ApiErrorLogRespVO {
15 17
16 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + @ExcelProperty("编号")
17 private Integer id; 20 private Integer id;
18 21
19 - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)  
20 - private LocalDateTime createTime; 22 + @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "66600cb6-7852-11eb-9439-0242ac130002")
  23 + @ExcelProperty("链路追踪编号")
  24 + private String traceId;
  25 +
  26 + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "666")
  27 + @ExcelProperty("用户编号")
  28 + private Integer userId;
  29 +
  30 + @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  31 + @ExcelProperty(value = "用户类型", converter = DictConvert.class)
  32 + @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE)
  33 + private Integer userType;
  34 +
  35 + @Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "dashboard")
  36 + @ExcelProperty("应用名")
  37 + private String applicationName;
  38 +
  39 + @Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET")
  40 + @ExcelProperty("请求方法名")
  41 + private String requestMethod;
  42 +
  43 + @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/xx/yy")
  44 + @ExcelProperty("请求地址")
  45 + private String requestUrl;
  46 +
  47 + @Schema(description = "请求参数", requiredMode = Schema.RequiredMode.REQUIRED)
  48 + @ExcelProperty("请求参数")
  49 + private String requestParams;
  50 +
  51 + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
  52 + @ExcelProperty("用户 IP")
  53 + private String userIp;
  54 +
  55 + @Schema(description = "浏览器 UA", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0")
  56 + @ExcelProperty("浏览器 UA")
  57 + private String userAgent;
  58 +
  59 + @Schema(description = "异常发生时间", requiredMode = Schema.RequiredMode.REQUIRED)
  60 + @ExcelProperty("异常发生时间")
  61 + private LocalDateTime exceptionTime;
  62 +
  63 + @Schema(description = "异常名", requiredMode = Schema.RequiredMode.REQUIRED)
  64 + @ExcelProperty("异常名")
  65 + private String exceptionName;
  66 +
  67 + @Schema(description = "异常导致的消息", requiredMode = Schema.RequiredMode.REQUIRED)
  68 + @ExcelProperty("异常导致的消息")
  69 + private String exceptionMessage;
  70 +
  71 + @Schema(description = "异常导致的根消息", requiredMode = Schema.RequiredMode.REQUIRED)
  72 + @ExcelProperty("异常导致的根消息")
  73 + private String exceptionRootCauseMessage;
  74 +
  75 + @Schema(description = "异常的栈轨迹", requiredMode = Schema.RequiredMode.REQUIRED)
  76 + @ExcelProperty("异常的栈轨迹")
  77 + private String exceptionStackTrace;
  78 +
  79 + @Schema(description = "异常发生的类全名", requiredMode = Schema.RequiredMode.REQUIRED)
  80 + @ExcelProperty("异常发生的类全名")
  81 + private String exceptionClassName;
  82 +
  83 + @Schema(description = "异常发生的类文件", requiredMode = Schema.RequiredMode.REQUIRED)
  84 + @ExcelProperty("异常发生的类文件")
  85 + private String exceptionFileName;
  86 +
  87 + @Schema(description = "异常发生的方法名", requiredMode = Schema.RequiredMode.REQUIRED)
  88 + @ExcelProperty("异常发生的方法名")
  89 + private String exceptionMethodName;
  90 +
  91 + @Schema(description = "异常发生的方法所在行", requiredMode = Schema.RequiredMode.REQUIRED)
  92 + @ExcelProperty("异常发生的方法所在行")
  93 + private Integer exceptionLineNumber;
  94 +
  95 + @Schema(description = "处理状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
  96 + @ExcelProperty(value = "处理状态", converter = DictConvert.class)
  97 + @DictFormat(DictTypeConstants.API_ERROR_LOG_PROCESS_STATUS)
  98 + private Integer processStatus;
21 99
22 @Schema(description = "处理时间", requiredMode = Schema.RequiredMode.REQUIRED) 100 @Schema(description = "处理时间", requiredMode = Schema.RequiredMode.REQUIRED)
  101 + @ExcelProperty("处理时间")
23 private LocalDateTime processTime; 102 private LocalDateTime processTime;
24 103
25 @Schema(description = "处理用户编号", example = "233") 104 @Schema(description = "处理用户编号", example = "233")
  105 + @ExcelProperty("处理用户编号")
26 private Integer processUserId; 106 private Integer processUserId;
27 107
  108 + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
  109 + @ExcelProperty("创建时间")
  110 + private LocalDateTime createTime;
  111 +
28 } 112 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/config/ConfigConvert.java
1 package cn.iocoder.yudao.module.infra.convert.config; 1 package cn.iocoder.yudao.module.infra.convert.config;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO; 4 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO;
7 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; 5 +import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
9 import org.mapstruct.Mapper; 7 import org.mapstruct.Mapper;
10 import org.mapstruct.Mapping; 8 import org.mapstruct.Mapping;
@@ -19,15 +17,12 @@ public interface ConfigConvert { @@ -19,15 +17,12 @@ public interface ConfigConvert {
19 17
20 PageResult<ConfigRespVO> convertPage(PageResult<ConfigDO> page); 18 PageResult<ConfigRespVO> convertPage(PageResult<ConfigDO> page);
21 19
  20 + List<ConfigRespVO> convertList(List<ConfigDO> list);
  21 +
22 @Mapping(source = "configKey", target = "key") 22 @Mapping(source = "configKey", target = "key")
23 ConfigRespVO convert(ConfigDO bean); 23 ConfigRespVO convert(ConfigDO bean);
24 24
25 @Mapping(source = "key", target = "configKey") 25 @Mapping(source = "key", target = "configKey")
26 - ConfigDO convert(ConfigCreateReqVO bean);  
27 -  
28 - ConfigDO convert(ConfigUpdateReqVO bean);  
29 -  
30 - @Mapping(source = "configKey", target = "key")  
31 - List<ConfigExcelVO> convertList(List<ConfigDO> list); 26 + ConfigDO convert(ConfigSaveReqVO bean);
32 27
33 } 28 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/db/DataSourceConfigConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.db;  
2 -  
3 -import java.util.*;  
4 -  
5 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
6 -  
7 -import org.mapstruct.Mapper;  
8 -import org.mapstruct.factory.Mappers;  
9 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.*;  
10 -import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;  
11 -  
12 -/**  
13 - * 数据源配置 Convert  
14 - *  
15 - * @author 芋道源码  
16 - */  
17 -@Mapper  
18 -public interface DataSourceConfigConvert {  
19 -  
20 - DataSourceConfigConvert INSTANCE = Mappers.getMapper(DataSourceConfigConvert.class);  
21 -  
22 - DataSourceConfigDO convert(DataSourceConfigCreateReqVO bean);  
23 -  
24 - DataSourceConfigDO convert(DataSourceConfigUpdateReqVO bean);  
25 -  
26 - DataSourceConfigRespVO convert(DataSourceConfigDO bean);  
27 -  
28 - List<DataSourceConfigRespVO> convertList(List<DataSourceConfigDO> list);  
29 -  
30 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConfigConvert.java
1 package cn.iocoder.yudao.module.infra.convert.file; 1 package cn.iocoder.yudao.module.infra.convert.file;
2 2
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigRespVO;  
6 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigUpdateReqVO; 3 +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 4 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
8 import org.mapstruct.Mapper; 5 import org.mapstruct.Mapper;
9 import org.mapstruct.Mapping; 6 import org.mapstruct.Mapping;
10 import org.mapstruct.factory.Mappers; 7 import org.mapstruct.factory.Mappers;
11 8
12 -import java.util.List;  
13 -  
14 /** 9 /**
15 * 文件配置 Convert 10 * 文件配置 Convert
16 * 11 *
@@ -22,15 +17,6 @@ public interface FileConfigConvert { @@ -22,15 +17,6 @@ public interface FileConfigConvert {
22 FileConfigConvert INSTANCE = Mappers.getMapper(FileConfigConvert.class); 17 FileConfigConvert INSTANCE = Mappers.getMapper(FileConfigConvert.class);
23 18
24 @Mapping(target = "config", ignore = true) 19 @Mapping(target = "config", ignore = true)
25 - FileConfigDO convert(FileConfigCreateReqVO bean);  
26 -  
27 - @Mapping(target = "config", ignore = true)  
28 - FileConfigDO convert(FileConfigUpdateReqVO bean);  
29 -  
30 - FileConfigRespVO convert(FileConfigDO bean);  
31 -  
32 - List<FileConfigRespVO> convertList(List<FileConfigDO> list);  
33 -  
34 - PageResult<FileConfigRespVO> convertPage(PageResult<FileConfigDO> page); 20 + FileConfigDO convert(FileConfigSaveReqVO bean);
35 21
36 } 22 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.file;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileRespVO;  
5 -import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;  
6 -import org.mapstruct.Mapper;  
7 -import org.mapstruct.factory.Mappers;  
8 -  
9 -@Mapper  
10 -public interface FileConvert {  
11 -  
12 - FileConvert INSTANCE = Mappers.getMapper(FileConvert.class);  
13 -  
14 - FileRespVO convert(FileDO bean);  
15 -  
16 - PageResult<FileRespVO> convertPage(PageResult<FileDO> page);  
17 -  
18 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.job;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExcelVO;  
6 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobRespVO;  
7 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;  
8 -import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;  
9 -import org.mapstruct.Mapper;  
10 -import org.mapstruct.factory.Mappers;  
11 -  
12 -import java.util.List;  
13 -  
14 -/**  
15 - * 定时任务 Convert  
16 - *  
17 - * @author 芋道源码  
18 - */  
19 -@Mapper  
20 -public interface JobConvert {  
21 -  
22 - JobConvert INSTANCE = Mappers.getMapper(JobConvert.class);  
23 -  
24 - JobDO convert(JobCreateReqVO bean);  
25 -  
26 - JobDO convert(JobUpdateReqVO bean);  
27 -  
28 - JobRespVO convert(JobDO bean);  
29 -  
30 - List<JobRespVO> convertList(List<JobDO> list);  
31 -  
32 - PageResult<JobRespVO> convertPage(PageResult<JobDO> page);  
33 -  
34 - List<JobExcelVO> convertList02(List<JobDO> list);  
35 -  
36 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.job;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO;  
6 -import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;  
7 -import org.mapstruct.Mapper;  
8 -import org.mapstruct.factory.Mappers;  
9 -  
10 -import java.util.List;  
11 -  
12 -/**  
13 - * 定时任务日志 Convert  
14 - *  
15 - * @author 芋艿  
16 - */  
17 -@Mapper  
18 -public interface JobLogConvert {  
19 -  
20 - JobLogConvert INSTANCE = Mappers.getMapper(JobLogConvert.class);  
21 -  
22 - JobLogRespVO convert(JobLogDO bean);  
23 -  
24 - List<JobLogRespVO> convertList(List<JobLogDO> list);  
25 -  
26 - PageResult<JobLogRespVO> convertPage(PageResult<JobLogDO> page);  
27 -  
28 - List<JobLogExcelVO> convertList02(List<JobLogDO> list);  
29 -  
30 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.logger;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO;  
6 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;  
7 -import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;  
8 -import org.mapstruct.Mapper;  
9 -import org.mapstruct.factory.Mappers;  
10 -  
11 -import java.util.List;  
12 -  
13 -/**  
14 - * API 访问日志 Convert  
15 - *  
16 - * @author 芋道源码  
17 - */  
18 -@Mapper  
19 -public interface ApiAccessLogConvert {  
20 -  
21 - ApiAccessLogConvert INSTANCE = Mappers.getMapper(ApiAccessLogConvert.class);  
22 -  
23 - ApiAccessLogRespVO convert(ApiAccessLogDO bean);  
24 -  
25 - List<ApiAccessLogRespVO> convertList(List<ApiAccessLogDO> list);  
26 -  
27 - PageResult<ApiAccessLogRespVO> convertPage(PageResult<ApiAccessLogDO> page);  
28 -  
29 - List<ApiAccessLogExcelVO> convertList02(List<ApiAccessLogDO> list);  
30 -  
31 - ApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean);  
32 -  
33 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java deleted
1 -package cn.iocoder.yudao.module.infra.convert.logger;  
2 -  
3 -import cn.iocoder.yudao.framework.common.pojo.PageResult;  
4 -import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO;  
6 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;  
7 -import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;  
8 -import org.mapstruct.Mapper;  
9 -import org.mapstruct.factory.Mappers;  
10 -  
11 -import java.util.List;  
12 -  
13 -/**  
14 - * API 错误日志 Convert  
15 - *  
16 - * @author 芋道源码  
17 - */  
18 -@Mapper  
19 -public interface ApiErrorLogConvert {  
20 -  
21 - ApiErrorLogConvert INSTANCE = Mappers.getMapper(ApiErrorLogConvert.class);  
22 -  
23 - ApiErrorLogRespVO convert(ApiErrorLogDO bean);  
24 -  
25 - PageResult<ApiErrorLogRespVO> convertPage(PageResult<ApiErrorLogDO> page);  
26 -  
27 - List<ApiErrorLogExcelVO> convertList02(List<ApiErrorLogDO> list);  
28 -  
29 - ApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean);  
30 -  
31 -}  
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigMapper.java
@@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.infra.dal.mysql.config; @@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.infra.dal.mysql.config;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;  
7 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
9 import org.apache.ibatis.annotations.Mapper; 8 import org.apache.ibatis.annotations.Mapper;
10 9
11 -import java.util.List;  
12 -  
13 @Mapper 10 @Mapper
14 public interface ConfigMapper extends BaseMapperX<ConfigDO> { 11 public interface ConfigMapper extends BaseMapperX<ConfigDO> {
15 12
@@ -25,12 +22,4 @@ public interface ConfigMapper extends BaseMapperX&lt;ConfigDO&gt; { @@ -25,12 +22,4 @@ public interface ConfigMapper extends BaseMapperX&lt;ConfigDO&gt; {
25 .betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime())); 22 .betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime()));
26 } 23 }
27 24
28 - default List<ConfigDO> selectList(ConfigExportReqVO reqVO) {  
29 - return selectList(new LambdaQueryWrapperX<ConfigDO>()  
30 - .likeIfPresent(ConfigDO::getName, reqVO.getName())  
31 - .likeIfPresent(ConfigDO::getConfigKey, reqVO.getKey())  
32 - .eqIfPresent(ConfigDO::getType, reqVO.getType())  
33 - .betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime()));  
34 - }  
35 -  
36 } 25 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;  
7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
9 import org.apache.ibatis.annotations.Delete; 8 import org.apache.ibatis.annotations.Delete;
@@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper; @@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
11 import org.apache.ibatis.annotations.Param; 10 import org.apache.ibatis.annotations.Param;
12 11
13 import java.time.LocalDateTime; 12 import java.time.LocalDateTime;
14 -import java.util.List;  
15 13
16 /** 14 /**
17 * 任务日志 Mapper 15 * 任务日志 Mapper
@@ -32,17 +30,6 @@ public interface JobLogMapper extends BaseMapperX&lt;JobLogDO&gt; { @@ -32,17 +30,6 @@ public interface JobLogMapper extends BaseMapperX&lt;JobLogDO&gt; {
32 ); 30 );
33 } 31 }
34 32
35 - default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {  
36 - return selectList(new LambdaQueryWrapperX<JobLogDO>()  
37 - .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId())  
38 - .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName())  
39 - .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime())  
40 - .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime())  
41 - .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus())  
42 - .orderByDesc(JobLogDO::getId) // ID 倒序  
43 - );  
44 - }  
45 -  
46 /** 33 /**
47 * 物理删除指定时间之前的日志 34 * 物理删除指定时间之前的日志
48 * 35 *
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java
1 package cn.iocoder.yudao.module.infra.dal.mysql.job; 1 package cn.iocoder.yudao.module.infra.dal.mysql.job;
2 2
3 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;  
5 -import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;  
6 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
8 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
  7 +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
9 import org.apache.ibatis.annotations.Mapper; 8 import org.apache.ibatis.annotations.Mapper;
10 9
11 -import java.util.List;  
12 -  
13 /** 10 /**
14 * 定时任务 Mapper 11 * 定时任务 Mapper
15 * 12 *
@@ -30,12 +27,4 @@ public interface JobMapper extends BaseMapperX&lt;JobDO&gt; { @@ -30,12 +27,4 @@ public interface JobMapper extends BaseMapperX&lt;JobDO&gt; {
30 ); 27 );
31 } 28 }
32 29
33 - default List<JobDO> selectList(JobExportReqVO reqVO) {  
34 - return selectList(new LambdaQueryWrapperX<JobDO>()  
35 - .likeIfPresent(JobDO::getName, reqVO.getName())  
36 - .eqIfPresent(JobDO::getStatus, reqVO.getStatus())  
37 - .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName())  
38 - );  
39 - }  
40 -  
41 } 30 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger; @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;  
7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
9 import org.apache.ibatis.annotations.Delete; 8 import org.apache.ibatis.annotations.Delete;
@@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper; @@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
11 import org.apache.ibatis.annotations.Param; 10 import org.apache.ibatis.annotations.Param;
12 11
13 import java.time.LocalDateTime; 12 import java.time.LocalDateTime;
14 -import java.util.List;  
15 13
16 /** 14 /**
17 * API 访问日志 Mapper 15 * API 访问日志 Mapper
@@ -34,19 +32,6 @@ public interface ApiAccessLogMapper extends BaseMapperX&lt;ApiAccessLogDO&gt; { @@ -34,19 +32,6 @@ public interface ApiAccessLogMapper extends BaseMapperX&lt;ApiAccessLogDO&gt; {
34 ); 32 );
35 } 33 }
36 34
37 - default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) {  
38 - return selectList(new LambdaQueryWrapperX<ApiAccessLogDO>()  
39 - .eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())  
40 - .eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())  
41 - .eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())  
42 - .likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())  
43 - .betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())  
44 - .geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())  
45 - .eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())  
46 - .orderByDesc(ApiAccessLogDO::getId)  
47 - );  
48 - }  
49 -  
50 /** 35 /**
51 * 物理删除指定时间之前的日志 36 * 物理删除指定时间之前的日志
52 * 37 *
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger; @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;  
7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
9 import org.apache.ibatis.annotations.Delete; 8 import org.apache.ibatis.annotations.Delete;
@@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper; @@ -11,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
11 import org.apache.ibatis.annotations.Param; 10 import org.apache.ibatis.annotations.Param;
12 11
13 import java.time.LocalDateTime; 12 import java.time.LocalDateTime;
14 -import java.util.List;  
15 13
16 /** 14 /**
17 * API 错误日志 Mapper 15 * API 错误日志 Mapper
@@ -33,18 +31,6 @@ public interface ApiErrorLogMapper extends BaseMapperX&lt;ApiErrorLogDO&gt; { @@ -33,18 +31,6 @@ public interface ApiErrorLogMapper extends BaseMapperX&lt;ApiErrorLogDO&gt; {
33 ); 31 );
34 } 32 }
35 33
36 - default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) {  
37 - return selectList(new LambdaQueryWrapperX<ApiErrorLogDO>()  
38 - .eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())  
39 - .eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())  
40 - .eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())  
41 - .likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())  
42 - .betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())  
43 - .eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())  
44 - .orderByDesc(ApiErrorLogDO::getId)  
45 - );  
46 - }  
47 -  
48 /** 34 /**
49 * 物理删除指定时间之前的日志 35 * 物理删除指定时间之前的日志
50 * 36 *
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java
1 package cn.iocoder.yudao.module.infra.service.config; 1 package cn.iocoder.yudao.module.infra.service.config;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; 4 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
7 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; 5 +import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
9 7
10 import javax.validation.Valid; 8 import javax.validation.Valid;
11 -import java.util.List;  
12 9
13 /** 10 /**
14 * 参数配置 Service 接口 11 * 参数配置 Service 接口
@@ -20,17 +17,17 @@ public interface ConfigService { @@ -20,17 +17,17 @@ public interface ConfigService {
20 /** 17 /**
21 * 创建参数配置 18 * 创建参数配置
22 * 19 *
23 - * @param reqVO 创建信息 20 + * @param createReqVO 创建信息
24 * @return 配置编号 21 * @return 配置编号
25 */ 22 */
26 - Long createConfig(@Valid ConfigCreateReqVO reqVO); 23 + Long createConfig(@Valid ConfigSaveReqVO createReqVO);
27 24
28 /** 25 /**
29 * 更新参数配置 26 * 更新参数配置
30 * 27 *
31 - * @param reqVO 更新信息 28 + * @param updateReqVO 更新信息
32 */ 29 */
33 - void updateConfig(@Valid ConfigUpdateReqVO reqVO); 30 + void updateConfig(@Valid ConfigSaveReqVO updateReqVO);
34 31
35 /** 32 /**
36 * 删除参数配置 33 * 删除参数配置
@@ -63,13 +60,4 @@ public interface ConfigService { @@ -63,13 +60,4 @@ public interface ConfigService {
63 */ 60 */
64 PageResult<ConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO); 61 PageResult<ConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO);
65 62
66 - /**  
67 - * 获得参数配置列表  
68 - *  
69 - * @param reqVO 列表  
70 - * @return 列表  
71 - */  
72 - List<ConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO);  
73 -  
74 -  
75 } 63 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.config; 1 package cn.iocoder.yudao.module.infra.service.config;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;  
6 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;  
7 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; 4 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
8 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; 5 +import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
9 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; 6 import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
11 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; 8 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
@@ -16,7 +13,6 @@ import org.springframework.stereotype.Service; @@ -16,7 +13,6 @@ import org.springframework.stereotype.Service;
16 import org.springframework.validation.annotation.Validated; 13 import org.springframework.validation.annotation.Validated;
17 14
18 import javax.annotation.Resource; 15 import javax.annotation.Resource;
19 -import java.util.List;  
20 16
21 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 17 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
22 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; 18 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
@@ -33,22 +29,26 @@ public class ConfigServiceImpl implements ConfigService { @@ -33,22 +29,26 @@ public class ConfigServiceImpl implements ConfigService {
33 private ConfigMapper configMapper; 29 private ConfigMapper configMapper;
34 30
35 @Override 31 @Override
36 - public Long createConfig(ConfigCreateReqVO reqVO) {  
37 - // 校验正确性  
38 - validateConfigForCreateOrUpdate(null, reqVO.getKey()); 32 + public Long createConfig(ConfigSaveReqVO createReqVO) {
  33 + // 校验参数配置 key 的唯一性
  34 + validateConfigKeyUnique(null, createReqVO.getKey());
  35 +
39 // 插入参数配置 36 // 插入参数配置
40 - ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO); 37 + ConfigDO config = ConfigConvert.INSTANCE.convert(createReqVO);
41 config.setType(ConfigTypeEnum.CUSTOM.getType()); 38 config.setType(ConfigTypeEnum.CUSTOM.getType());
42 configMapper.insert(config); 39 configMapper.insert(config);
43 return config.getId(); 40 return config.getId();
44 } 41 }
45 42
46 @Override 43 @Override
47 - public void updateConfig(ConfigUpdateReqVO reqVO) {  
48 - // 校验正确性  
49 - validateConfigForCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key 44 + public void updateConfig(ConfigSaveReqVO updateReqVO) {
  45 + // 校验自己存在
  46 + validateConfigExists(updateReqVO.getId());
  47 + // 校验参数配置 key 的唯一性
  48 + validateConfigKeyUnique(updateReqVO.getId(), updateReqVO.getKey());
  49 +
50 // 更新参数配置 50 // 更新参数配置
51 - ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO); 51 + ConfigDO updateObj = ConfigConvert.INSTANCE.convert(updateReqVO);
52 configMapper.updateById(updateObj); 52 configMapper.updateById(updateObj);
53 } 53 }
54 54
@@ -75,22 +75,8 @@ public class ConfigServiceImpl implements ConfigService { @@ -75,22 +75,8 @@ public class ConfigServiceImpl implements ConfigService {
75 } 75 }
76 76
77 @Override 77 @Override
78 - public PageResult<ConfigDO> getConfigPage(ConfigPageReqVO reqVO) {  
79 - return configMapper.selectPage(reqVO);  
80 - }  
81 -  
82 - @Override  
83 - public List<ConfigDO> getConfigList(ConfigExportReqVO reqVO) {  
84 - return configMapper.selectList(reqVO);  
85 - }  
86 -  
87 - private void validateConfigForCreateOrUpdate(Long id, String key) {  
88 - // 校验自己存在  
89 - validateConfigExists(id);  
90 - // 校验参数配置 key 的唯一性  
91 - if (StrUtil.isNotEmpty(key)) {  
92 - validateConfigKeyUnique(id, key);  
93 - } 78 + public PageResult<ConfigDO> getConfigPage(ConfigPageReqVO pageReqVO) {
  79 + return configMapper.selectPage(pageReqVO);
94 } 80 }
95 81
96 @VisibleForTesting 82 @VisibleForTesting
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigService.java
1 package cn.iocoder.yudao.module.infra.service.db; 1 package cn.iocoder.yudao.module.infra.service.db;
2 2
3 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCreateReqVO;  
4 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO; 3 +import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
5 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; 4 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
6 5
7 import javax.validation.Valid; 6 import javax.validation.Valid;
@@ -20,14 +19,14 @@ public interface DataSourceConfigService { @@ -20,14 +19,14 @@ public interface DataSourceConfigService {
20 * @param createReqVO 创建信息 19 * @param createReqVO 创建信息
21 * @return 编号 20 * @return 编号
22 */ 21 */
23 - Long createDataSourceConfig(@Valid DataSourceConfigCreateReqVO createReqVO); 22 + Long createDataSourceConfig(@Valid DataSourceConfigSaveReqVO createReqVO);
24 23
25 /** 24 /**
26 * 更新数据源配置 25 * 更新数据源配置
27 * 26 *
28 * @param updateReqVO 更新信息 27 * @param updateReqVO 更新信息
29 */ 28 */
30 - void updateDataSourceConfig(@Valid DataSourceConfigUpdateReqVO updateReqVO); 29 + void updateDataSourceConfig(@Valid DataSourceConfigSaveReqVO updateReqVO);
31 30
32 /** 31 /**
33 * 删除数据源配置 32 * 删除数据源配置
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.db; 1 package cn.iocoder.yudao.module.infra.service.db;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
3 import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils; 4 import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils;
4 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO;  
6 -import cn.iocoder.yudao.module.infra.convert.db.DataSourceConfigConvert; 5 +import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
8 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper; 7 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
9 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; 8 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
@@ -35,21 +34,21 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { @@ -35,21 +34,21 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
35 private DynamicDataSourceProperties dynamicDataSourceProperties; 34 private DynamicDataSourceProperties dynamicDataSourceProperties;
36 35
37 @Override 36 @Override
38 - public Long createDataSourceConfig(DataSourceConfigCreateReqVO createReqVO) {  
39 - DataSourceConfigDO dataSourceConfig = DataSourceConfigConvert.INSTANCE.convert(createReqVO);  
40 - validateConnectionOK(dataSourceConfig); 37 + public Long createDataSourceConfig(DataSourceConfigSaveReqVO createReqVO) {
  38 + DataSourceConfigDO config = BeanUtils.toBean(createReqVO, DataSourceConfigDO.class);
  39 + validateConnectionOK(config);
41 40
42 // 插入 41 // 插入
43 - dataSourceConfigMapper.insert(dataSourceConfig); 42 + dataSourceConfigMapper.insert(config);
44 // 返回 43 // 返回
45 - return dataSourceConfig.getId(); 44 + return config.getId();
46 } 45 }
47 46
48 @Override 47 @Override
49 - public void updateDataSourceConfig(DataSourceConfigUpdateReqVO updateReqVO) { 48 + public void updateDataSourceConfig(DataSourceConfigSaveReqVO updateReqVO) {
50 // 校验存在 49 // 校验存在
51 validateDataSourceConfigExists(updateReqVO.getId()); 50 validateDataSourceConfigExists(updateReqVO.getId());
52 - DataSourceConfigDO updateObj = DataSourceConfigConvert.INSTANCE.convert(updateReqVO); 51 + DataSourceConfigDO updateObj = BeanUtils.toBean(updateReqVO, DataSourceConfigDO.class);
53 validateConnectionOK(updateObj); 52 validateConnectionOK(updateObj);
54 53
55 // 更新 54 // 更新
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java
@@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.infra.service.file; @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.infra.service.file;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.file.core.client.FileClient; 4 import cn.iocoder.yudao.framework.file.core.client.FileClient;
5 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigCreateReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
7 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigUpdateReqVO; 6 +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
9 8
10 import javax.validation.Valid; 9 import javax.validation.Valid;
@@ -22,14 +21,14 @@ public interface FileConfigService { @@ -22,14 +21,14 @@ public interface FileConfigService {
22 * @param createReqVO 创建信息 21 * @param createReqVO 创建信息
23 * @return 编号 22 * @return 编号
24 */ 23 */
25 - Long createFileConfig(@Valid FileConfigCreateReqVO createReqVO); 24 + Long createFileConfig(@Valid FileConfigSaveReqVO createReqVO);
26 25
27 /** 26 /**
28 * 更新文件配置 27 * 更新文件配置
29 * 28 *
30 * @param updateReqVO 更新信息 29 * @param updateReqVO 更新信息
31 */ 30 */
32 - void updateFileConfig(@Valid FileConfigUpdateReqVO updateReqVO); 31 + void updateFileConfig(@Valid FileConfigSaveReqVO updateReqVO);
33 32
34 /** 33 /**
35 * 更新文件配置为 Master 34 * 更新文件配置为 Master
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
@@ -4,14 +4,14 @@ import cn.hutool.core.io.resource.ResourceUtil; @@ -4,14 +4,14 @@ import cn.hutool.core.io.resource.ResourceUtil;
4 import cn.hutool.core.util.IdUtil; 4 import cn.hutool.core.util.IdUtil;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 import cn.iocoder.yudao.framework.common.util.json.JsonUtils; 6 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
  7 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7 import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; 8 import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
8 import cn.iocoder.yudao.framework.file.core.client.FileClient; 9 import cn.iocoder.yudao.framework.file.core.client.FileClient;
9 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; 10 import cn.iocoder.yudao.framework.file.core.client.FileClientConfig;
10 import cn.iocoder.yudao.framework.file.core.client.FileClientFactory; 11 import cn.iocoder.yudao.framework.file.core.client.FileClientFactory;
11 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum; 12 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum;
12 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigCreateReqVO;  
13 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; 13 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
14 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigUpdateReqVO; 14 +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
15 import cn.iocoder.yudao.module.infra.convert.file.FileConfigConvert; 15 import cn.iocoder.yudao.module.infra.convert.file.FileConfigConvert;
16 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 16 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
17 import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper; 17 import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper;
@@ -63,7 +63,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -63,7 +63,7 @@ public class FileConfigServiceImpl implements FileConfigService {
63 return fileClientFactory.getFileClient(null == config ? id : config.getId()); 63 return fileClientFactory.getFileClient(null == config ? id : config.getId());
64 } 64 }
65 65
66 - }); 66 + });
67 67
68 @Resource 68 @Resource
69 private FileClientFactory fileClientFactory; 69 private FileClientFactory fileClientFactory;
@@ -75,7 +75,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -75,7 +75,7 @@ public class FileConfigServiceImpl implements FileConfigService {
75 private Validator validator; 75 private Validator validator;
76 76
77 @Override 77 @Override
78 - public Long createFileConfig(FileConfigCreateReqVO createReqVO) { 78 + public Long createFileConfig(FileConfigSaveReqVO createReqVO) {
79 FileConfigDO fileConfig = FileConfigConvert.INSTANCE.convert(createReqVO) 79 FileConfigDO fileConfig = FileConfigConvert.INSTANCE.convert(createReqVO)
80 .setConfig(parseClientConfig(createReqVO.getStorage(), createReqVO.getConfig())) 80 .setConfig(parseClientConfig(createReqVO.getStorage(), createReqVO.getConfig()))
81 .setMaster(false); // 默认非 master 81 .setMaster(false); // 默认非 master
@@ -84,7 +84,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -84,7 +84,7 @@ public class FileConfigServiceImpl implements FileConfigService {
84 } 84 }
85 85
86 @Override 86 @Override
87 - public void updateFileConfig(FileConfigUpdateReqVO updateReqVO) { 87 + public void updateFileConfig(FileConfigSaveReqVO updateReqVO) {
88 // 校验存在 88 // 校验存在
89 FileConfigDO config = validateFileConfigExists(updateReqVO.getId()); 89 FileConfigDO config = validateFileConfigExists(updateReqVO.getId());
90 // 更新 90 // 更新
@@ -126,7 +126,7 @@ public class FileConfigServiceImpl implements FileConfigService { @@ -126,7 +126,7 @@ public class FileConfigServiceImpl implements FileConfigService {
126 // 校验存在 126 // 校验存在
127 FileConfigDO config = validateFileConfigExists(id); 127 FileConfigDO config = validateFileConfigExists(id);
128 if (Boolean.TRUE.equals(config.getMaster())) { 128 if (Boolean.TRUE.equals(config.getMaster())) {
129 - throw exception(FILE_CONFIG_DELETE_FAIL_MASTER); 129 + throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
130 } 130 }
131 // 删除 131 // 删除
132 fileConfigMapper.deleteById(id); 132 fileConfigMapper.deleteById(id);
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java
@@ -2,13 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job; @@ -2,13 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService; 4 import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService;
5 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
8 7
9 -import java.util.Collection;  
10 -import java.util.List;  
11 -  
12 /** 8 /**
13 * Job 日志 Service 接口 9 * Job 日志 Service 接口
14 * 10 *
@@ -25,14 +21,6 @@ public interface JobLogService extends JobLogFrameworkService { @@ -25,14 +21,6 @@ public interface JobLogService extends JobLogFrameworkService {
25 JobLogDO getJobLog(Long id); 21 JobLogDO getJobLog(Long id);
26 22
27 /** 23 /**
28 - * 获得定时任务列表  
29 - *  
30 - * @param ids 编号  
31 - * @return 定时任务列表  
32 - */  
33 - List<JobLogDO> getJobLogList(Collection<Long> ids);  
34 -  
35 - /**  
36 * 获得定时任务分页 24 * 获得定时任务分页
37 * 25 *
38 * @param pageReqVO 分页查询 26 * @param pageReqVO 分页查询
@@ -41,14 +29,6 @@ public interface JobLogService extends JobLogFrameworkService { @@ -41,14 +29,6 @@ public interface JobLogService extends JobLogFrameworkService {
41 PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO); 29 PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO);
42 30
43 /** 31 /**
44 - * 获得定时任务列表, 用于 Excel 导出  
45 - *  
46 - * @param exportReqVO 查询条件  
47 - * @return 定时任务分页  
48 - */  
49 - List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO);  
50 -  
51 - /**  
52 * 清理 exceedDay 天前的任务日志 32 * 清理 exceedDay 天前的任务日志
53 * 33 *
54 * @param exceedDay 超过多少天就进行清理 34 * @param exceedDay 超过多少天就进行清理
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.job; 1 package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;  
5 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 4 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
6 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 5 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
7 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; 6 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper;
@@ -13,8 +12,6 @@ import org.springframework.validation.annotation.Validated; @@ -13,8 +12,6 @@ import org.springframework.validation.annotation.Validated;
13 12
14 import javax.annotation.Resource; 13 import javax.annotation.Resource;
15 import java.time.LocalDateTime; 14 import java.time.LocalDateTime;
16 -import java.util.Collection;  
17 -import java.util.List;  
18 15
19 /** 16 /**
20 * Job 日志 Service 实现类 17 * Job 日志 Service 实现类
@@ -30,8 +27,10 @@ public class JobLogServiceImpl implements JobLogService { @@ -30,8 +27,10 @@ public class JobLogServiceImpl implements JobLogService {
30 private JobLogMapper jobLogMapper; 27 private JobLogMapper jobLogMapper;
31 28
32 @Override 29 @Override
33 - public Long createJobLog(Long jobId, LocalDateTime beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) {  
34 - JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) 30 + public Long createJobLog(Long jobId, LocalDateTime beginTime,
  31 + String jobHandlerName, String jobHandlerParam, Integer executeIndex) {
  32 + JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName)
  33 + .handlerParam(jobHandlerParam).executeIndex(executeIndex)
35 .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build(); 34 .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build();
36 jobLogMapper.insert(log); 35 jobLogMapper.insert(log);
37 return log.getId(); 36 return log.getId();
@@ -42,7 +41,8 @@ public class JobLogServiceImpl implements JobLogService { @@ -42,7 +41,8 @@ public class JobLogServiceImpl implements JobLogService {
42 public void updateJobLogResultAsync(Long logId, LocalDateTime endTime, Integer duration, boolean success, String result) { 41 public void updateJobLogResultAsync(Long logId, LocalDateTime endTime, Integer duration, boolean success, String result) {
43 try { 42 try {
44 JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration) 43 JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration)
45 - .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()).result(result).build(); 44 + .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus())
  45 + .result(result).build();
46 jobLogMapper.updateById(updateObj); 46 jobLogMapper.updateById(updateObj);
47 } catch (Exception ex) { 47 } catch (Exception ex) {
48 log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", 48 log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]",
@@ -73,18 +73,8 @@ public class JobLogServiceImpl implements JobLogService { @@ -73,18 +73,8 @@ public class JobLogServiceImpl implements JobLogService {
73 } 73 }
74 74
75 @Override 75 @Override
76 - public List<JobLogDO> getJobLogList(Collection<Long> ids) {  
77 - return jobLogMapper.selectBatchIds(ids);  
78 - }  
79 -  
80 - @Override  
81 public PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO) { 76 public PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO) {
82 return jobLogMapper.selectPage(pageReqVO); 77 return jobLogMapper.selectPage(pageReqVO);
83 } 78 }
84 79
85 - @Override  
86 - public List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO) {  
87 - return jobLogMapper.selectList(exportReqVO);  
88 - }  
89 -  
90 } 80 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java
1 package cn.iocoder.yudao.module.infra.service.job; 1 package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;  
5 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; 4 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
7 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; 5 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobSaveReqVO;
8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
9 import org.quartz.SchedulerException; 7 import org.quartz.SchedulerException;
10 8
@@ -25,14 +23,14 @@ public interface JobService { @@ -25,14 +23,14 @@ public interface JobService {
25 * @param createReqVO 创建信息 23 * @param createReqVO 创建信息
26 * @return 编号 24 * @return 编号
27 */ 25 */
28 - Long createJob(@Valid JobCreateReqVO createReqVO) throws SchedulerException; 26 + Long createJob(@Valid JobSaveReqVO createReqVO) throws SchedulerException;
29 27
30 /** 28 /**
31 * 更新定时任务 29 * 更新定时任务
32 * 30 *
33 * @param updateReqVO 更新信息 31 * @param updateReqVO 更新信息
34 */ 32 */
35 - void updateJob(@Valid JobUpdateReqVO updateReqVO) throws SchedulerException; 33 + void updateJob(@Valid JobSaveReqVO updateReqVO) throws SchedulerException;
36 34
37 /** 35 /**
38 * 更新定时任务的状态 36 * 更新定时任务的状态
@@ -80,12 +78,4 @@ public interface JobService { @@ -80,12 +78,4 @@ public interface JobService {
80 */ 78 */
81 PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO); 79 PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO);
82 80
83 - /**  
84 - * 获得定时任务列表, 用于 Excel 导出  
85 - *  
86 - * @param exportReqVO 查询条件  
87 - * @return 定时任务分页  
88 - */  
89 - List<JobDO> getJobList(JobExportReqVO exportReqVO);  
90 -  
91 } 81 }
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.job; 1 package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
4 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; 5 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
5 import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; 6 import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
6 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;  
7 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;  
8 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
9 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;  
10 -import cn.iocoder.yudao.module.infra.convert.job.JobConvert; 8 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobSaveReqVO;
11 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
12 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; 10 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
13 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; 11 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
@@ -21,8 +19,8 @@ import java.util.Collection; @@ -21,8 +19,8 @@ import java.util.Collection;
21 import java.util.List; 19 import java.util.List;
22 20
23 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 21 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
24 -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;  
25 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny; 22 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny;
  23 +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
26 24
27 /** 25 /**
28 * 定时任务 Service 实现类 26 * 定时任务 Service 实现类
@@ -41,14 +39,14 @@ public class JobServiceImpl implements JobService { @@ -41,14 +39,14 @@ public class JobServiceImpl implements JobService {
41 39
42 @Override 40 @Override
43 @Transactional(rollbackFor = Exception.class) 41 @Transactional(rollbackFor = Exception.class)
44 - public Long createJob(JobCreateReqVO createReqVO) throws SchedulerException { 42 + public Long createJob(JobSaveReqVO createReqVO) throws SchedulerException {
45 validateCronExpression(createReqVO.getCronExpression()); 43 validateCronExpression(createReqVO.getCronExpression());
46 // 校验唯一性 44 // 校验唯一性
47 if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { 45 if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) {
48 throw exception(JOB_HANDLER_EXISTS); 46 throw exception(JOB_HANDLER_EXISTS);
49 } 47 }
50 // 插入 48 // 插入
51 - JobDO job = JobConvert.INSTANCE.convert(createReqVO); 49 + JobDO job = BeanUtils.toBean(createReqVO, JobDO.class);
52 job.setStatus(JobStatusEnum.INIT.getStatus()); 50 job.setStatus(JobStatusEnum.INIT.getStatus());
53 fillJobMonitorTimeoutEmpty(job); 51 fillJobMonitorTimeoutEmpty(job);
54 jobMapper.insert(job); 52 jobMapper.insert(job);
@@ -66,7 +64,7 @@ public class JobServiceImpl implements JobService { @@ -66,7 +64,7 @@ public class JobServiceImpl implements JobService {
66 64
67 @Override 65 @Override
68 @Transactional(rollbackFor = Exception.class) 66 @Transactional(rollbackFor = Exception.class)
69 - public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException { 67 + public void updateJob(JobSaveReqVO updateReqVO) throws SchedulerException {
70 validateCronExpression(updateReqVO.getCronExpression()); 68 validateCronExpression(updateReqVO.getCronExpression());
71 // 校验存在 69 // 校验存在
72 JobDO job = validateJobExists(updateReqVO.getId()); 70 JobDO job = validateJobExists(updateReqVO.getId());
@@ -75,7 +73,7 @@ public class JobServiceImpl implements JobService { @@ -75,7 +73,7 @@ public class JobServiceImpl implements JobService {
75 throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); 73 throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS);
76 } 74 }
77 // 更新 75 // 更新
78 - JobDO updateObj = JobConvert.INSTANCE.convert(updateReqVO); 76 + JobDO updateObj = BeanUtils.toBean(updateReqVO, JobDO.class);
79 fillJobMonitorTimeoutEmpty(updateObj); 77 fillJobMonitorTimeoutEmpty(updateObj);
80 jobMapper.updateById(updateObj); 78 jobMapper.updateById(updateObj);
81 79
@@ -159,11 +157,6 @@ public class JobServiceImpl implements JobService { @@ -159,11 +157,6 @@ public class JobServiceImpl implements JobService {
159 return jobMapper.selectPage(pageReqVO); 157 return jobMapper.selectPage(pageReqVO);
160 } 158 }
161 159
162 - @Override  
163 - public List<JobDO> getJobList(JobExportReqVO exportReqVO) {  
164 - return jobMapper.selectList(exportReqVO);  
165 - }  
166 -  
167 private static void fillJobMonitorTimeoutEmpty(JobDO job) { 160 private static void fillJobMonitorTimeoutEmpty(JobDO job) {
168 if (job.getMonitorTimeout() == null) { 161 if (job.getMonitorTimeout() == null) {
169 job.setMonitorTimeout(0); 162 job.setMonitorTimeout(0);
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java
@@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.infra.service.logger; @@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
8 7
9 -import java.util.List;  
10 -  
11 /** 8 /**
12 * API 访问日志 Service 接口 9 * API 访问日志 Service 接口
13 * 10 *
@@ -31,14 +28,6 @@ public interface ApiAccessLogService { @@ -31,14 +28,6 @@ public interface ApiAccessLogService {
31 PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO); 28 PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO);
32 29
33 /** 30 /**
34 - * 获得 API 访问日志列表, 用于 Excel 导出  
35 - *  
36 - * @param exportReqVO 查询条件  
37 - * @return API 访问日志分页  
38 - */  
39 - List<ApiAccessLogDO> getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO);  
40 -  
41 - /**  
42 * 清理 exceedDay 天前的访问日志 31 * 清理 exceedDay 天前的访问日志
43 * 32 *
44 * @param exceedDay 超过多少天就进行清理 33 * @param exceedDay 超过多少天就进行清理
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 5 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
7 -import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert;  
8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
9 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; 8 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper;
10 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +12,6 @@ import org.springframework.validation.annotation.Validated; @@ -13,7 +12,6 @@ import org.springframework.validation.annotation.Validated;
13 12
14 import javax.annotation.Resource; 13 import javax.annotation.Resource;
15 import java.time.LocalDateTime; 14 import java.time.LocalDateTime;
16 -import java.util.List;  
17 15
18 /** 16 /**
19 * API 访问日志 Service 实现类 17 * API 访问日志 Service 实现类
@@ -30,7 +28,7 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService { @@ -30,7 +28,7 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
30 28
31 @Override 29 @Override
32 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) { 30 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
33 - ApiAccessLogDO apiAccessLog = ApiAccessLogConvert.INSTANCE.convert(createDTO); 31 + ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
34 apiAccessLogMapper.insert(apiAccessLog); 32 apiAccessLogMapper.insert(apiAccessLog);
35 } 33 }
36 34
@@ -40,11 +38,6 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService { @@ -40,11 +38,6 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
40 } 38 }
41 39
42 @Override 40 @Override
43 - public List<ApiAccessLogDO> getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO) {  
44 - return apiAccessLogMapper.selectList(exportReqVO);  
45 - }  
46 -  
47 - @Override  
48 @SuppressWarnings("DuplicatedCode") 41 @SuppressWarnings("DuplicatedCode")
49 public Integer cleanAccessLog(Integer exceedDay, Integer deleteLimit) { 42 public Integer cleanAccessLog(Integer exceedDay, Integer deleteLimit) {
50 int count = 0; 43 int count = 0;
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java
@@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.infra.service.logger; @@ -2,12 +2,9 @@ package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
8 7
9 -import java.util.List;  
10 -  
11 /** 8 /**
12 * API 错误日志 Service 接口 9 * API 错误日志 Service 接口
13 * 10 *
@@ -31,14 +28,6 @@ public interface ApiErrorLogService { @@ -31,14 +28,6 @@ public interface ApiErrorLogService {
31 PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO); 28 PageResult<ApiErrorLogDO> getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO);
32 29
33 /** 30 /**
34 - * 获得 API 错误日志列表, 用于 Excel 导出  
35 - *  
36 - * @param exportReqVO 查询条件  
37 - * @return API 错误日志分页  
38 - */  
39 - List<ApiErrorLogDO> getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO);  
40 -  
41 - /**  
42 * 更新 API 错误日志已处理 31 * 更新 API 错误日志已处理
43 * 32 *
44 * @param id API 日志编号 33 * @param id API 日志编号
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
4 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 5 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
5 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
7 -import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;  
8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 7 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
9 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; 8 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
10 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; 9 import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
@@ -14,11 +13,9 @@ import org.springframework.validation.annotation.Validated; @@ -14,11 +13,9 @@ import org.springframework.validation.annotation.Validated;
14 13
15 import javax.annotation.Resource; 14 import javax.annotation.Resource;
16 import java.time.LocalDateTime; 15 import java.time.LocalDateTime;
17 -import java.util.List;  
18 16
19 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 17 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
20 -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND;  
21 -import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED; 18 +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
22 19
23 /** 20 /**
24 * API 错误日志 Service 实现类 21 * API 错误日志 Service 实现类
@@ -35,7 +32,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -35,7 +32,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
35 32
36 @Override 33 @Override
37 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) { 34 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
38 - ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO) 35 + ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
39 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); 36 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
40 apiErrorLogMapper.insert(apiErrorLog); 37 apiErrorLogMapper.insert(apiErrorLog);
41 } 38 }
@@ -46,11 +43,6 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -46,11 +43,6 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
46 } 43 }
47 44
48 @Override 45 @Override
49 - public List<ApiErrorLogDO> getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO) {  
50 - return apiErrorLogMapper.selectList(exportReqVO);  
51 - }  
52 -  
53 - @Override  
54 public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { 46 public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
55 ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); 47 ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
56 if (errorLog == null) { 48 if (errorLog == null) {
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImplTest.java
@@ -4,10 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -4,10 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; 4 import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
6 import cn.iocoder.yudao.framework.test.core.util.RandomUtils; 6 import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
7 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;  
8 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;  
9 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
10 -import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; 8 +import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
11 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
12 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; 10 import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
13 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; 11 import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
@@ -15,7 +13,6 @@ import org.junit.jupiter.api.Test; @@ -15,7 +13,6 @@ import org.junit.jupiter.api.Test;
15 import org.springframework.context.annotation.Import; 13 import org.springframework.context.annotation.Import;
16 14
17 import javax.annotation.Resource; 15 import javax.annotation.Resource;
18 -import java.util.List;  
19 import java.util.function.Consumer; 16 import java.util.function.Consumer;
20 17
21 import static cn.hutool.core.util.RandomUtil.randomEle; 18 import static cn.hutool.core.util.RandomUtil.randomEle;
@@ -40,7 +37,8 @@ public class ConfigServiceImplTest extends BaseDbUnitTest { @@ -40,7 +37,8 @@ public class ConfigServiceImplTest extends BaseDbUnitTest {
40 @Test 37 @Test
41 public void testCreateConfig_success() { 38 public void testCreateConfig_success() {
42 // 准备参数 39 // 准备参数
43 - ConfigCreateReqVO reqVO = randomPojo(ConfigCreateReqVO.class); 40 + ConfigSaveReqVO reqVO = randomPojo(ConfigSaveReqVO.class)
  41 + .setId(null); // 防止 id 被赋值,导致唯一性校验失败
44 42
45 // 调用 43 // 调用
46 Long configId = configService.createConfig(reqVO); 44 Long configId = configService.createConfig(reqVO);
@@ -48,7 +46,7 @@ public class ConfigServiceImplTest extends BaseDbUnitTest { @@ -48,7 +46,7 @@ public class ConfigServiceImplTest extends BaseDbUnitTest {
48 assertNotNull(configId); 46 assertNotNull(configId);
49 // 校验记录的属性是否正确 47 // 校验记录的属性是否正确
50 ConfigDO config = configMapper.selectById(configId); 48 ConfigDO config = configMapper.selectById(configId);
51 - assertPojoEquals(reqVO, config); 49 + assertPojoEquals(reqVO, config, "id");
52 assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); 50 assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType());
53 } 51 }
54 52
@@ -58,7 +56,7 @@ public class ConfigServiceImplTest extends BaseDbUnitTest { @@ -58,7 +56,7 @@ public class ConfigServiceImplTest extends BaseDbUnitTest {
58 ConfigDO dbConfig = randomConfigDO(); 56 ConfigDO dbConfig = randomConfigDO();
59 configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 57 configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
60 // 准备参数 58 // 准备参数
61 - ConfigUpdateReqVO reqVO = randomPojo(ConfigUpdateReqVO.class, o -> { 59 + ConfigSaveReqVO reqVO = randomPojo(ConfigSaveReqVO.class, o -> {
62 o.setId(dbConfig.getId()); // 设置更新的 ID 60 o.setId(dbConfig.getId()); // 设置更新的 ID
63 }); 61 });
64 62
@@ -179,38 +177,6 @@ public class ConfigServiceImplTest extends BaseDbUnitTest { @@ -179,38 +177,6 @@ public class ConfigServiceImplTest extends BaseDbUnitTest {
179 } 177 }
180 178
181 @Test 179 @Test
182 - public void testGetConfigList() {  
183 - // mock 数据  
184 - ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到  
185 - o.setName("芋艿");  
186 - o.setConfigKey("yunai");  
187 - o.setType(ConfigTypeEnum.SYSTEM.getType());  
188 - o.setCreateTime(buildTime(2021, 2, 1));  
189 - });  
190 - configMapper.insert(dbConfig);  
191 - // 测试 name 不匹配  
192 - configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setName("土豆")));  
193 - // 测试 key 不匹配  
194 - configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setConfigKey("tudou")));  
195 - // 测试 type 不匹配  
196 - configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType())));  
197 - // 测试 createTime 不匹配  
198 - configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1))));  
199 - // 准备参数  
200 - ConfigExportReqVO reqVO = new ConfigExportReqVO();  
201 - reqVO.setName("艿");  
202 - reqVO.setKey("nai");  
203 - reqVO.setType(ConfigTypeEnum.SYSTEM.getType());  
204 - reqVO.setCreateTime(buildBetweenTime(2021, 1, 15, 2021, 2, 15));  
205 -  
206 - // 调用  
207 - List<ConfigDO> list = configService.getConfigList(reqVO);  
208 - // 断言  
209 - assertEquals(1, list.size());  
210 - assertPojoEquals(dbConfig, list.get(0));  
211 - }  
212 -  
213 - @Test  
214 public void testGetConfig() { 180 public void testGetConfig() {
215 // mock 数据 181 // mock 数据
216 ConfigDO dbConfig = randomConfigDO(); 182 ConfigDO dbConfig = randomConfigDO();
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/db/DataSourceConfigServiceImplTest.java
@@ -6,8 +6,7 @@ import cn.hutool.crypto.symmetric.AES; @@ -6,8 +6,7 @@ import cn.hutool.crypto.symmetric.AES;
6 import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler; 6 import cn.iocoder.yudao.framework.mybatis.core.type.EncryptTypeHandler;
7 import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils; 7 import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils;
8 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 8 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
9 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigCreateReqVO;  
10 -import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigUpdateReqVO; 9 +import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
11 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO; 10 import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
12 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper; 11 import cn.iocoder.yudao.module.infra.dal.mysql.db.DataSourceConfigMapper;
13 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; 12 import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
@@ -70,7 +69,8 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -70,7 +69,8 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
70 public void testCreateDataSourceConfig_success() { 69 public void testCreateDataSourceConfig_success() {
71 try (MockedStatic<JdbcUtils> databaseUtilsMock = mockStatic(JdbcUtils.class)) { 70 try (MockedStatic<JdbcUtils> databaseUtilsMock = mockStatic(JdbcUtils.class)) {
72 // 准备参数 71 // 准备参数
73 - DataSourceConfigCreateReqVO reqVO = randomPojo(DataSourceConfigCreateReqVO.class); 72 + DataSourceConfigSaveReqVO reqVO = randomPojo(DataSourceConfigSaveReqVO.class)
  73 + .setId(null); // 避免 id 被设置
74 // mock 方法 74 // mock 方法
75 databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()), 75 databaseUtilsMock.when(() -> JdbcUtils.isConnectionOK(eq(reqVO.getUrl()),
76 eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true); 76 eq(reqVO.getUsername()), eq(reqVO.getPassword()))).thenReturn(true);
@@ -81,7 +81,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -81,7 +81,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
81 assertNotNull(dataSourceConfigId); 81 assertNotNull(dataSourceConfigId);
82 // 校验记录的属性是否正确 82 // 校验记录的属性是否正确
83 DataSourceConfigDO dataSourceConfig = dataSourceConfigMapper.selectById(dataSourceConfigId); 83 DataSourceConfigDO dataSourceConfig = dataSourceConfigMapper.selectById(dataSourceConfigId);
84 - assertPojoEquals(reqVO, dataSourceConfig); 84 + assertPojoEquals(reqVO, dataSourceConfig, "id");
85 } 85 }
86 } 86 }
87 87
@@ -92,7 +92,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -92,7 +92,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
92 DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class); 92 DataSourceConfigDO dbDataSourceConfig = randomPojo(DataSourceConfigDO.class);
93 dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据 93 dataSourceConfigMapper.insert(dbDataSourceConfig);// @Sql: 先插入出一条存在的数据
94 // 准备参数 94 // 准备参数
95 - DataSourceConfigUpdateReqVO reqVO = randomPojo(DataSourceConfigUpdateReqVO.class, o -> { 95 + DataSourceConfigSaveReqVO reqVO = randomPojo(DataSourceConfigSaveReqVO.class, o -> {
96 o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID 96 o.setId(dbDataSourceConfig.getId()); // 设置更新的 ID
97 }); 97 });
98 // mock 方法 98 // mock 方法
@@ -110,7 +110,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest { @@ -110,7 +110,7 @@ public class DataSourceConfigServiceImplTest extends BaseDbUnitTest {
110 @Test 110 @Test
111 public void testUpdateDataSourceConfig_notExists() { 111 public void testUpdateDataSourceConfig_notExists() {
112 // 准备参数 112 // 准备参数
113 - DataSourceConfigUpdateReqVO reqVO = randomPojo(DataSourceConfigUpdateReqVO.class); 113 + DataSourceConfigSaveReqVO reqVO = randomPojo(DataSourceConfigSaveReqVO.class);
114 114
115 // 调用, 并断言异常 115 // 调用, 并断言异常
116 assertServiceException(() -> dataSourceConfigService.updateDataSourceConfig(reqVO), DATA_SOURCE_CONFIG_NOT_EXISTS); 116 assertServiceException(() -> dataSourceConfigService.updateDataSourceConfig(reqVO), DATA_SOURCE_CONFIG_NOT_EXISTS);
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java
@@ -11,9 +11,8 @@ import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClient; @@ -11,9 +11,8 @@ import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClient;
11 import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig; 11 import cn.iocoder.yudao.framework.file.core.client.local.LocalFileClientConfig;
12 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum; 12 import cn.iocoder.yudao.framework.file.core.enums.FileStorageEnum;
13 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 13 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
14 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigCreateReqVO;  
15 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO; 14 import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
16 -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigUpdateReqVO; 15 +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
17 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; 16 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
18 import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper; 17 import cn.iocoder.yudao.module.infra.dal.mysql.file.FileConfigMapper;
19 import lombok.Data; 18 import lombok.Data;
@@ -41,10 +40,10 @@ import static org.mockito.ArgumentMatchers.eq; @@ -41,10 +40,10 @@ import static org.mockito.ArgumentMatchers.eq;
41 import static org.mockito.Mockito.*; 40 import static org.mockito.Mockito.*;
42 41
43 /** 42 /**
44 -* {@link FileConfigServiceImpl} 的单元测试类  
45 -*  
46 -* @author 芋道源码  
47 -*/ 43 + * {@link FileConfigServiceImpl} 的单元测试类
  44 + *
  45 + * @author 芋道源码
  46 + */
48 @Import(FileConfigServiceImpl.class) 47 @Import(FileConfigServiceImpl.class)
49 public class FileConfigServiceImplTest extends BaseDbUnitTest { 48 public class FileConfigServiceImplTest extends BaseDbUnitTest {
50 49
@@ -64,8 +63,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -64,8 +63,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
64 // 准备参数 63 // 准备参数
65 Map<String, Object> config = MapUtil.<String, Object>builder().put("basePath", "/yunai") 64 Map<String, Object> config = MapUtil.<String, Object>builder().put("basePath", "/yunai")
66 .put("domain", "https://www.iocoder.cn").build(); 65 .put("domain", "https://www.iocoder.cn").build();
67 - FileConfigCreateReqVO reqVO = randomPojo(FileConfigCreateReqVO.class,  
68 - o -> o.setStorage(FileStorageEnum.LOCAL.getStorage()).setConfig(config)); 66 + FileConfigSaveReqVO reqVO = randomPojo(FileConfigSaveReqVO.class,
  67 + o -> o.setStorage(FileStorageEnum.LOCAL.getStorage()).setConfig(config))
  68 + .setId(null); // 避免 id 被赋值
69 69
70 // 调用 70 // 调用
71 Long fileConfigId = fileConfigService.createFileConfig(reqVO); 71 Long fileConfigId = fileConfigService.createFileConfig(reqVO);
@@ -73,7 +73,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -73,7 +73,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
73 assertNotNull(fileConfigId); 73 assertNotNull(fileConfigId);
74 // 校验记录的属性是否正确 74 // 校验记录的属性是否正确
75 FileConfigDO fileConfig = fileConfigMapper.selectById(fileConfigId); 75 FileConfigDO fileConfig = fileConfigMapper.selectById(fileConfigId);
76 - assertPojoEquals(reqVO, fileConfig, "config"); 76 + assertPojoEquals(reqVO, fileConfig, "id", "config");
77 assertFalse(fileConfig.getMaster()); 77 assertFalse(fileConfig.getMaster());
78 assertEquals("/yunai", ((LocalFileClientConfig) fileConfig.getConfig()).getBasePath()); 78 assertEquals("/yunai", ((LocalFileClientConfig) fileConfig.getConfig()).getBasePath());
79 assertEquals("https://www.iocoder.cn", ((LocalFileClientConfig) fileConfig.getConfig()).getDomain()); 79 assertEquals("https://www.iocoder.cn", ((LocalFileClientConfig) fileConfig.getConfig()).getDomain());
@@ -88,8 +88,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -88,8 +88,9 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
88 .setConfig(new LocalFileClientConfig().setBasePath("/yunai").setDomain("https://www.iocoder.cn"))); 88 .setConfig(new LocalFileClientConfig().setBasePath("/yunai").setDomain("https://www.iocoder.cn")));
89 fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据 89 fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据
90 // 准备参数 90 // 准备参数
91 - FileConfigUpdateReqVO reqVO = randomPojo(FileConfigUpdateReqVO.class, o -> { 91 + FileConfigSaveReqVO reqVO = randomPojo(FileConfigSaveReqVO.class, o -> {
92 o.setId(dbFileConfig.getId()); // 设置更新的 ID 92 o.setId(dbFileConfig.getId()); // 设置更新的 ID
  93 + o.setStorage(FileStorageEnum.LOCAL.getStorage());
93 Map<String, Object> config = MapUtil.<String, Object>builder().put("basePath", "/yunai2") 94 Map<String, Object> config = MapUtil.<String, Object>builder().put("basePath", "/yunai2")
94 .put("domain", "https://doc.iocoder.cn").build(); 95 .put("domain", "https://doc.iocoder.cn").build();
95 o.setConfig(config); 96 o.setConfig(config);
@@ -109,7 +110,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -109,7 +110,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
109 @Test 110 @Test
110 public void testUpdateFileConfig_notExists() { 111 public void testUpdateFileConfig_notExists() {
111 // 准备参数 112 // 准备参数
112 - FileConfigUpdateReqVO reqVO = randomPojo(FileConfigUpdateReqVO.class); 113 + FileConfigSaveReqVO reqVO = randomPojo(FileConfigSaveReqVO.class);
113 114
114 // 调用, 并断言异常 115 // 调用, 并断言异常
115 assertServiceException(() -> fileConfigService.updateFileConfig(reqVO), FILE_CONFIG_NOT_EXISTS); 116 assertServiceException(() -> fileConfigService.updateFileConfig(reqVO), FILE_CONFIG_NOT_EXISTS);
@@ -148,8 +149,8 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -148,8 +149,8 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
148 149
149 // 调用 150 // 调用
150 fileConfigService.deleteFileConfig(id); 151 fileConfigService.deleteFileConfig(id);
151 - // 校验数据不存在了  
152 - assertNull(fileConfigMapper.selectById(id)); 152 + // 校验数据不存在了
  153 + assertNull(fileConfigMapper.selectById(id));
153 // 验证 cache 154 // 验证 cache
154 assertNull(fileConfigService.getClientCache().getIfPresent(id)); 155 assertNull(fileConfigService.getClientCache().getIfPresent(id));
155 } 156 }
@@ -177,30 +178,30 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -177,30 +178,30 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
177 178
178 @Test 179 @Test
179 public void testGetFileConfigPage() { 180 public void testGetFileConfigPage() {
180 - // mock 数据  
181 - FileConfigDO dbFileConfig = randomFileConfigDO().setName("芋道源码")  
182 - .setStorage(FileStorageEnum.LOCAL.getStorage());  
183 - dbFileConfig.setCreateTime(LocalDateTimeUtil.parse("2020-01-23", DatePattern.NORM_DATE_PATTERN));// 等会查询到  
184 - fileConfigMapper.insert(dbFileConfig);  
185 - // 测试 name 不匹配  
186 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setName("源码")));  
187 - // 测试 storage 不匹配  
188 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage())));  
189 - // 测试 createTime 不匹配  
190 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(LocalDateTimeUtil.parse("2020-11-23", DatePattern.NORM_DATE_PATTERN))));  
191 - // 准备参数  
192 - FileConfigPageReqVO reqVO = new FileConfigPageReqVO();  
193 - reqVO.setName("芋道");  
194 - reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());  
195 - reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 1, 1),  
196 - buildTime(2020, 1, 24)}));  
197 -  
198 - // 调用  
199 - PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);  
200 - // 断言  
201 - assertEquals(1, pageResult.getTotal());  
202 - assertEquals(1, pageResult.getList().size());  
203 - assertPojoEquals(dbFileConfig, pageResult.getList().get(0)); 181 + // mock 数据
  182 + FileConfigDO dbFileConfig = randomFileConfigDO().setName("芋道源码")
  183 + .setStorage(FileStorageEnum.LOCAL.getStorage());
  184 + dbFileConfig.setCreateTime(LocalDateTimeUtil.parse("2020-01-23", DatePattern.NORM_DATE_PATTERN));// 等会查询到
  185 + fileConfigMapper.insert(dbFileConfig);
  186 + // 测试 name 不匹配
  187 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setName("源码")));
  188 + // 测试 storage 不匹配
  189 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage())));
  190 + // 测试 createTime 不匹配
  191 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(LocalDateTimeUtil.parse("2020-11-23", DatePattern.NORM_DATE_PATTERN))));
  192 + // 准备参数
  193 + FileConfigPageReqVO reqVO = new FileConfigPageReqVO();
  194 + reqVO.setName("芋道");
  195 + reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());
  196 + reqVO.setCreateTime((new LocalDateTime[]{buildTime(2020, 1, 1),
  197 + buildTime(2020, 1, 24)}));
  198 +
  199 + // 调用
  200 + PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);
  201 + // 断言
  202 + assertEquals(1, pageResult.getTotal());
  203 + assertEquals(1, pageResult.getList().size());
  204 + assertPojoEquals(dbFileConfig, pageResult.getList().get(0));
204 } 205 }
205 206
206 @Test 207 @Test
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImplTest.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.job; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.service.job;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 4 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
5 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;  
6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; 5 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
7 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; 6 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
8 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; 7 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper;
@@ -12,14 +11,11 @@ import org.springframework.context.annotation.Import; @@ -12,14 +11,11 @@ import org.springframework.context.annotation.Import;
12 11
13 import javax.annotation.Resource; 12 import javax.annotation.Resource;
14 import java.time.LocalDateTime; 13 import java.time.LocalDateTime;
15 -import java.util.Collection;  
16 -import java.util.List;  
17 14
18 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 15 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
19 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; 16 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
20 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 17 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
21 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; 18 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
22 -import static java.util.Collections.singleton;  
23 import static org.junit.jupiter.api.Assertions.assertEquals; 19 import static org.junit.jupiter.api.Assertions.assertEquals;
24 import static org.junit.jupiter.api.Assertions.assertNotNull; 20 import static org.junit.jupiter.api.Assertions.assertNotNull;
25 21
@@ -111,23 +107,6 @@ public class JobLogServiceImplTest extends BaseDbUnitTest { @@ -111,23 +107,6 @@ public class JobLogServiceImplTest extends BaseDbUnitTest {
111 } 107 }
112 108
113 @Test 109 @Test
114 - public void testGetJobLogList() {  
115 - // mock 数据  
116 - JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> o.setExecuteIndex(1));  
117 - jobLogMapper.insert(dbJobLog);  
118 - // 测试 handlerName 不匹配  
119 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> {}));  
120 - // 准备参数  
121 - Collection<Long> ids = singleton(dbJobLog.getId());  
122 -  
123 - // 调用  
124 - List<JobLogDO> list = jobLogService.getJobLogList(ids);  
125 - // 断言  
126 - assertEquals(1, list.size());  
127 - assertPojoEquals(dbJobLog, list.get(0));  
128 - }  
129 -  
130 - @Test  
131 public void testGetJobPage() { 110 public void testGetJobPage() {
132 // mock 数据 111 // mock 数据
133 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { 112 JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {
@@ -164,40 +143,4 @@ public class JobLogServiceImplTest extends BaseDbUnitTest { @@ -164,40 +143,4 @@ public class JobLogServiceImplTest extends BaseDbUnitTest {
164 assertPojoEquals(dbJobLog, pageResult.getList().get(0)); 143 assertPojoEquals(dbJobLog, pageResult.getList().get(0));
165 } 144 }
166 145
167 - @Test  
168 - public void testGetJobList_export() {  
169 - // mock 数据  
170 - JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> {  
171 - o.setExecuteIndex(1);  
172 - o.setHandlerName("handlerName 单元测试");  
173 - o.setStatus(JobLogStatusEnum.SUCCESS.getStatus());  
174 - o.setBeginTime(buildTime(2021, 1, 8));  
175 - o.setEndTime(buildTime(2021, 1, 8));  
176 - });  
177 - jobLogMapper.insert(dbJobLog);  
178 - // 测试 jobId 不匹配  
179 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setJobId(randomLongId())));  
180 - // 测试 handlerName 不匹配  
181 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())));  
182 - // 测试 beginTime 不匹配  
183 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setBeginTime(buildTime(2021, 1, 7))));  
184 - // 测试 endTime 不匹配  
185 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9))));  
186 - // 测试 status 不匹配  
187 - jobLogMapper.insert(cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus())));  
188 - // 准备参数  
189 - JobLogExportReqVO reqVo = new JobLogExportReqVO();  
190 - reqVo.setJobId(dbJobLog.getJobId());  
191 - reqVo.setHandlerName("单元");  
192 - reqVo.setBeginTime(dbJobLog.getBeginTime());  
193 - reqVo.setEndTime(dbJobLog.getEndTime());  
194 - reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus());  
195 -  
196 - // 调用  
197 - List<JobLogDO> list = jobLogService.getJobLogList(reqVo);  
198 - // 断言  
199 - assertEquals(1, list.size());  
200 - assertPojoEquals(dbJobLog, list.get(0));  
201 - }  
202 -  
203 } 146 }
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImplTest.java
@@ -3,10 +3,8 @@ package cn.iocoder.yudao.module.infra.service.job; @@ -3,10 +3,8 @@ package cn.iocoder.yudao.module.infra.service.job;
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; 4 import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
6 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;  
7 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;  
8 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; 6 import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
9 -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; 7 +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobSaveReqVO;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
11 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; 9 import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
12 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; 10 import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
@@ -16,17 +14,13 @@ import org.springframework.boot.test.mock.mockito.MockBean; @@ -16,17 +14,13 @@ import org.springframework.boot.test.mock.mockito.MockBean;
16 import org.springframework.context.annotation.Import; 14 import org.springframework.context.annotation.Import;
17 15
18 import javax.annotation.Resource; 16 import javax.annotation.Resource;
19 -import java.util.Collection;  
20 -import java.util.List;  
21 17
22 -import static cn.hutool.core.util.RandomUtil.randomEle;  
23 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; 18 import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
24 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 19 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
25 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; 20 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException;
26 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; 21 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
27 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; 22 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString;
28 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; 23 import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
29 -import static java.util.Collections.singletonList;  
30 import static org.junit.jupiter.api.Assertions.*; 24 import static org.junit.jupiter.api.Assertions.*;
31 import static org.mockito.ArgumentMatchers.eq; 25 import static org.mockito.ArgumentMatchers.eq;
32 import static org.mockito.Mockito.verify; 26 import static org.mockito.Mockito.verify;
@@ -44,7 +38,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -44,7 +38,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
44 @Test 38 @Test
45 public void testCreateJob_cronExpressionValid() { 39 public void testCreateJob_cronExpressionValid() {
46 // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 40 // 准备参数。Cron 表达式为 String 类型,默认随机字符串。
47 - JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class); 41 + JobSaveReqVO reqVO = randomPojo(JobSaveReqVO.class);
48 42
49 // 调用,并断言异常 43 // 调用,并断言异常
50 assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); 44 assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID);
@@ -53,7 +47,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -53,7 +47,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
53 @Test 47 @Test
54 public void testCreateJob_jobHandlerExists() throws SchedulerException { 48 public void testCreateJob_jobHandlerExists() throws SchedulerException {
55 // 准备参数 指定 Cron 表达式 49 // 准备参数 指定 Cron 表达式
56 - JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 50 + JobSaveReqVO reqVO = randomPojo(JobSaveReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
57 51
58 // 调用 52 // 调用
59 jobService.createJob(reqVO); 53 jobService.createJob(reqVO);
@@ -64,7 +58,8 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -64,7 +58,8 @@ public class JobServiceImplTest extends BaseDbUnitTest {
64 @Test 58 @Test
65 public void testCreateJob_success() throws SchedulerException { 59 public void testCreateJob_success() throws SchedulerException {
66 // 准备参数 指定 Cron 表达式 60 // 准备参数 指定 Cron 表达式
67 - JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 61 + JobSaveReqVO reqVO = randomPojo(JobSaveReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"))
  62 + .setId(null);
68 63
69 // 调用 64 // 调用
70 Long jobId = jobService.createJob(reqVO); 65 Long jobId = jobService.createJob(reqVO);
@@ -72,7 +67,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -72,7 +67,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
72 assertNotNull(jobId); 67 assertNotNull(jobId);
73 // 校验记录的属性是否正确 68 // 校验记录的属性是否正确
74 JobDO job = jobMapper.selectById(jobId); 69 JobDO job = jobMapper.selectById(jobId);
75 - assertPojoEquals(reqVO, job); 70 + assertPojoEquals(reqVO, job, "id");
76 assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus()); 71 assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus());
77 // 校验调用 72 // 校验调用
78 verify(schedulerManager).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), 73 verify(schedulerManager).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()),
@@ -82,7 +77,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -82,7 +77,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
82 @Test 77 @Test
83 public void testUpdateJob_jobNotExists(){ 78 public void testUpdateJob_jobNotExists(){
84 // 准备参数 79 // 准备参数
85 - JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); 80 + JobSaveReqVO reqVO = randomPojo(JobSaveReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *"));
86 81
87 // 调用,并断言异常 82 // 调用,并断言异常
88 assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); 83 assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS);
@@ -94,7 +89,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -94,7 +89,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
94 JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.INIT.getStatus())); 89 JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.INIT.getStatus()));
95 jobMapper.insert(job); 90 jobMapper.insert(job);
96 // 准备参数 91 // 准备参数
97 - JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { 92 + JobSaveReqVO updateReqVO = randomPojo(JobSaveReqVO.class, o -> {
98 o.setId(job.getId()); 93 o.setId(job.getId());
99 o.setCronExpression("0 0/1 * * * ? *"); 94 o.setCronExpression("0 0/1 * * * ? *");
100 }); 95 });
@@ -110,7 +105,7 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -110,7 +105,7 @@ public class JobServiceImplTest extends BaseDbUnitTest {
110 JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())); 105 JobDO job = randomPojo(JobDO.class, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()));
111 jobMapper.insert(job); 106 jobMapper.insert(job);
112 // 准备参数 107 // 准备参数
113 - JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { 108 + JobSaveReqVO updateReqVO = randomPojo(JobSaveReqVO.class, o -> {
114 o.setId(job.getId()); 109 o.setId(job.getId());
115 o.setCronExpression("0 0/1 * * * ? *"); 110 o.setCronExpression("0 0/1 * * * ? *");
116 }); 111 });
@@ -201,25 +196,6 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -201,25 +196,6 @@ public class JobServiceImplTest extends BaseDbUnitTest {
201 } 196 }
202 197
203 @Test 198 @Test
204 - public void testGetJobList() {  
205 - // mock 数据  
206 - JobDO dbJob = randomPojo(JobDO.class, o -> {  
207 - o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围  
208 - });  
209 - jobMapper.insert(dbJob);  
210 - // 测试 id 不匹配  
211 - jobMapper.insert(cloneIgnoreId(dbJob, o -> {}));  
212 -  
213 - // 准备参数  
214 - Collection<Long> ids = singletonList(dbJob.getId());  
215 - // 调用  
216 - List<JobDO> list = jobService.getJobList(ids);  
217 - // 断言  
218 - assertEquals(1, list.size());  
219 - assertPojoEquals(dbJob, list.get(0));  
220 - }  
221 -  
222 - @Test  
223 public void testGetJobPage() { 199 public void testGetJobPage() {
224 // mock 数据 200 // mock 数据
225 JobDO dbJob = randomPojo(JobDO.class, o -> { 201 JobDO dbJob = randomPojo(JobDO.class, o -> {
@@ -249,34 +225,6 @@ public class JobServiceImplTest extends BaseDbUnitTest { @@ -249,34 +225,6 @@ public class JobServiceImplTest extends BaseDbUnitTest {
249 } 225 }
250 226
251 @Test 227 @Test
252 - public void testGetJobList_export() {  
253 - // mock 数据  
254 - JobDO dbJob = randomPojo(JobDO.class, o -> {  
255 - o.setName("定时任务测试");  
256 - o.setHandlerName("handlerName 单元测试");  
257 - o.setStatus(JobStatusEnum.INIT.getStatus());  
258 - });  
259 - jobMapper.insert(dbJob);  
260 - // 测试 name 不匹配  
261 - jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setName("土豆")));  
262 - // 测试 status 不匹配  
263 - jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus())));  
264 - // 测试 handlerName 不匹配  
265 - jobMapper.insert(cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())));  
266 - // 准备参数  
267 - JobExportReqVO reqVo = new JobExportReqVO();  
268 - reqVo.setName("定时");  
269 - reqVo.setStatus(JobStatusEnum.INIT.getStatus());  
270 - reqVo.setHandlerName("单元");  
271 -  
272 - // 调用  
273 - List<JobDO> list = jobService.getJobList(reqVo);  
274 - // 断言  
275 - assertEquals(1, list.size());  
276 - assertPojoEquals(dbJob, list.get(0));  
277 - }  
278 -  
279 - @Test  
280 public void testGetJob() { 228 public void testGetJob() {
281 // mock 数据 229 // mock 数据
282 JobDO dbJob = randomPojo(JobDO.class); 230 JobDO dbJob = randomPojo(JobDO.class);
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java
@@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstant @@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstant
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
7 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 7 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
8 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;  
9 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 8 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
10 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; 9 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
11 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; 10 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper;
@@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test; @@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test;
13 import org.springframework.context.annotation.Import; 12 import org.springframework.context.annotation.Import;
14 13
15 import javax.annotation.Resource; 14 import javax.annotation.Resource;
16 -import java.util.List;  
17 15
18 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; 16 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
19 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime; 17 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildTime;
@@ -76,49 +74,6 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { @@ -76,49 +74,6 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest {
76 } 74 }
77 75
78 @Test 76 @Test
79 - public void testGetApiAccessLogList() {  
80 - ApiAccessLogDO apiAccessLogDO = randomPojo(ApiAccessLogDO.class, o -> {  
81 - o.setUserId(2233L);  
82 - o.setUserType(UserTypeEnum.ADMIN.getValue());  
83 - o.setApplicationName("yudao-test");  
84 - o.setRequestUrl("foo");  
85 - o.setBeginTime(buildTime(2021, 3, 13));  
86 - o.setDuration(1000);  
87 - o.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());  
88 - });  
89 - apiAccessLogMapper.insert(apiAccessLogDO);  
90 - // 测试 userId 不匹配  
91 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserId(3344L)));  
92 - // 测试 userType 不匹配  
93 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));  
94 - // 测试 applicationName 不匹配  
95 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setApplicationName("test")));  
96 - // 测试 requestUrl 不匹配  
97 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setRequestUrl("bar")));  
98 - // 测试 beginTime 不匹配:构造一个早期时间 2021-02-06 00:00:00  
99 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setBeginTime(buildTime(2021, 2, 6))));  
100 - // 测试 duration 不匹配  
101 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setDuration(100)));  
102 - // 测试 resultCode 不匹配  
103 - apiAccessLogMapper.insert(cloneIgnoreId(apiAccessLogDO, o -> o.setResultCode(2)));  
104 - // 准备参数  
105 - ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO();  
106 - reqVO.setUserId(2233L);  
107 - reqVO.setUserType(UserTypeEnum.ADMIN.getValue());  
108 - reqVO.setApplicationName("yudao-test");  
109 - reqVO.setRequestUrl("foo");  
110 - reqVO.setBeginTime(buildBetweenTime(2021, 3, 13, 2021, 3, 13));  
111 - reqVO.setDuration(1000);  
112 - reqVO.setResultCode(GlobalErrorCodeConstants.SUCCESS.getCode());  
113 -  
114 - // 调用  
115 - List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(reqVO);  
116 - // 断言,只查到了一条符合条件的  
117 - assertEquals(1, list.size());  
118 - assertPojoEquals(apiAccessLogDO, list.get(0));  
119 - }  
120 -  
121 - @Test  
122 public void testCreateApiAccessLog() { 77 public void testCreateApiAccessLog() {
123 // 准备参数 78 // 准备参数
124 ApiAccessLogCreateReqDTO createDTO = randomPojo(ApiAccessLogCreateReqDTO.class); 79 ApiAccessLogCreateReqDTO createDTO = randomPojo(ApiAccessLogCreateReqDTO.class);
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java
@@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; @@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 5 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
6 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 6 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
7 -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;  
8 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; 7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
9 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; 8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
10 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; 9 import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper;
@@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test; @@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test;
13 import org.springframework.context.annotation.Import; 12 import org.springframework.context.annotation.Import;
14 13
15 import javax.annotation.Resource; 14 import javax.annotation.Resource;
16 -import java.util.List;  
17 15
18 import static cn.hutool.core.util.RandomUtil.randomEle; 16 import static cn.hutool.core.util.RandomUtil.randomEle;
19 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; 17 import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime;
@@ -79,46 +77,6 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { @@ -79,46 +77,6 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest {
79 } 77 }
80 78
81 @Test 79 @Test
82 - public void testGetApiErrorLogList() {  
83 - // mock 数据  
84 - ApiErrorLogDO apiErrorLogDO = randomPojo(ApiErrorLogDO.class, o -> {  
85 - o.setUserId(2233L);  
86 - o.setUserType(UserTypeEnum.ADMIN.getValue());  
87 - o.setApplicationName("yudao-test");  
88 - o.setRequestUrl("foo");  
89 - o.setExceptionTime(buildTime(2021, 3, 13));  
90 - o.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());  
91 - });  
92 - apiErrorLogMapper.insert(apiErrorLogDO);  
93 - // 测试 userId 不匹配  
94 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, o -> o.setUserId(3344L)));  
95 - // 测试 userType 不匹配  
96 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue())));  
97 - // 测试 applicationName 不匹配  
98 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setApplicationName("test")));  
99 - // 测试 requestUrl 不匹配  
100 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setRequestUrl("bar")));  
101 - // 测试 exceptionTime 不匹配:构造一个早期时间 2021-02-06 00:00:00  
102 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6))));  
103 - // 测试 progressStatus 不匹配  
104 - apiErrorLogMapper.insert(cloneIgnoreId(apiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus())));  
105 - // 准备参数  
106 - ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO();  
107 - reqVO.setUserId(2233L);  
108 - reqVO.setUserType(UserTypeEnum.ADMIN.getValue());  
109 - reqVO.setApplicationName("yudao-test");  
110 - reqVO.setRequestUrl("foo");  
111 - reqVO.setExceptionTime(buildBetweenTime(2021, 3, 1, 2021, 3, 31));  
112 - reqVO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());  
113 -  
114 - // 调用  
115 - List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(reqVO);  
116 - // 断言,只查到了一条符合条件的  
117 - assertEquals(1, list.size());  
118 - assertPojoEquals(apiErrorLogDO, list.get(0));  
119 - }  
120 -  
121 - @Test  
122 public void testCreateApiErrorLog() { 80 public void testCreateApiErrorLog() {
123 // 准备参数 81 // 准备参数
124 ApiErrorLogCreateReqDTO createDTO = randomPojo(ApiErrorLogCreateReqDTO.class); 82 ApiErrorLogCreateReqDTO createDTO = randomPojo(ApiErrorLogCreateReqDTO.class);
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/permission/DataScopeEnum.java
1 package cn.iocoder.yudao.module.system.enums.permission; 1 package cn.iocoder.yudao.module.system.enums.permission;
2 2
  3 +import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
3 import lombok.AllArgsConstructor; 4 import lombok.AllArgsConstructor;
4 import lombok.Getter; 5 import lombok.Getter;
5 6
  7 +import java.util.Arrays;
  8 +
6 /** 9 /**
7 * 数据范围枚举类 10 * 数据范围枚举类
8 * 11 *
@@ -12,7 +15,7 @@ import lombok.Getter; @@ -12,7 +15,7 @@ import lombok.Getter;
12 */ 15 */
13 @Getter 16 @Getter
14 @AllArgsConstructor 17 @AllArgsConstructor
15 -public enum DataScopeEnum { 18 +public enum DataScopeEnum implements IntArrayValuable {
16 19
17 ALL(1), // 全部数据权限 20 ALL(1), // 全部数据权限
18 21
@@ -27,4 +30,11 @@ public enum DataScopeEnum { @@ -27,4 +30,11 @@ public enum DataScopeEnum {
27 */ 30 */
28 private final Integer scope; 31 private final Integer scope;
29 32
  33 + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DataScopeEnum::getScope).toArray();
  34 +
  35 + @Override
  36 + public int[] array() {
  37 + return ARRAYS;
  38 + }
  39 +
30 } 40 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java
1 package cn.iocoder.yudao.module.system.api.dept; 1 package cn.iocoder.yudao.module.system.api.dept;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
3 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; 4 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
4 -import cn.iocoder.yudao.module.system.convert.dept.DeptConvert;  
5 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; 5 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
6 import cn.iocoder.yudao.module.system.service.dept.DeptService; 6 import cn.iocoder.yudao.module.system.service.dept.DeptService;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
@@ -24,13 +24,13 @@ public class DeptApiImpl implements DeptApi { @@ -24,13 +24,13 @@ public class DeptApiImpl implements DeptApi {
24 @Override 24 @Override
25 public DeptRespDTO getDept(Long id) { 25 public DeptRespDTO getDept(Long id) {
26 DeptDO dept = deptService.getDept(id); 26 DeptDO dept = deptService.getDept(id);
27 - return DeptConvert.INSTANCE.convert03(dept); 27 + return BeanUtils.toBean(dept, DeptRespDTO.class);
28 } 28 }
29 29
30 @Override 30 @Override
31 public List<DeptRespDTO> getDeptList(Collection<Long> ids) { 31 public List<DeptRespDTO> getDeptList(Collection<Long> ids) {
32 List<DeptDO> depts = deptService.getDeptList(ids); 32 List<DeptDO> depts = deptService.getDeptList(ids);
33 - return DeptConvert.INSTANCE.convertList03(depts); 33 + return BeanUtils.toBean(depts, DeptRespDTO.class);
34 } 34 }
35 35
36 @Override 36 @Override
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java
1 package cn.iocoder.yudao.module.system.api.dict; 1 package cn.iocoder.yudao.module.system.api.dict;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
3 import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; 4 import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
4 -import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert;  
5 import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; 5 import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
6 import cn.iocoder.yudao.module.system.service.dict.DictDataService; 6 import cn.iocoder.yudao.module.system.service.dict.DictDataService;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
@@ -28,13 +28,13 @@ public class DictDataApiImpl implements DictDataApi { @@ -28,13 +28,13 @@ public class DictDataApiImpl implements DictDataApi {
28 @Override 28 @Override
29 public DictDataRespDTO getDictData(String dictType, String value) { 29 public DictDataRespDTO getDictData(String dictType, String value) {
30 DictDataDO dictData = dictDataService.getDictData(dictType, value); 30 DictDataDO dictData = dictDataService.getDictData(dictType, value);
31 - return DictDataConvert.INSTANCE.convert02(dictData); 31 + return BeanUtils.toBean(dictData, DictDataRespDTO.class);
32 } 32 }
33 33
34 @Override 34 @Override
35 public DictDataRespDTO parseDictData(String dictType, String label) { 35 public DictDataRespDTO parseDictData(String dictType, String label) {
36 DictDataDO dictData = dictDataService.parseDictData(dictType, label); 36 DictDataDO dictData = dictDataService.parseDictData(dictType, label);
37 - return DictDataConvert.INSTANCE.convert02(dictData); 37 + return BeanUtils.toBean(dictData, DictDataRespDTO.class);
38 } 38 }
39 39
40 } 40 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/oauth2/OAuth2TokenApiImpl.java
1 package cn.iocoder.yudao.module.system.api.oauth2; 1 package cn.iocoder.yudao.module.system.api.oauth2;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
3 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO; 4 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO;
4 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO; 5 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCreateReqDTO;
5 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenRespDTO; 6 import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenRespDTO;
6 -import cn.iocoder.yudao.module.system.convert.auth.OAuth2TokenConvert;  
7 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; 7 import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
8 import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService; 8 import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
@@ -25,24 +25,25 @@ public class OAuth2TokenApiImpl implements OAuth2TokenApi { @@ -25,24 +25,25 @@ public class OAuth2TokenApiImpl implements OAuth2TokenApi {
25 public OAuth2AccessTokenRespDTO createAccessToken(OAuth2AccessTokenCreateReqDTO reqDTO) { 25 public OAuth2AccessTokenRespDTO createAccessToken(OAuth2AccessTokenCreateReqDTO reqDTO) {
26 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken( 26 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(
27 reqDTO.getUserId(), reqDTO.getUserType(), reqDTO.getClientId(), reqDTO.getScopes()); 27 reqDTO.getUserId(), reqDTO.getUserType(), reqDTO.getClientId(), reqDTO.getScopes());
28 - return OAuth2TokenConvert.INSTANCE.convert2(accessTokenDO); 28 + return BeanUtils.toBean(accessTokenDO, OAuth2AccessTokenRespDTO.class);
29 } 29 }
30 30
31 @Override 31 @Override
32 public OAuth2AccessTokenCheckRespDTO checkAccessToken(String accessToken) { 32 public OAuth2AccessTokenCheckRespDTO checkAccessToken(String accessToken) {
33 - return OAuth2TokenConvert.INSTANCE.convert(oauth2TokenService.checkAccessToken(accessToken)); 33 + OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.checkAccessToken(accessToken);
  34 + return BeanUtils.toBean(accessTokenDO, OAuth2AccessTokenCheckRespDTO.class);
34 } 35 }
35 36
36 @Override 37 @Override
37 public OAuth2AccessTokenRespDTO removeAccessToken(String accessToken) { 38 public OAuth2AccessTokenRespDTO removeAccessToken(String accessToken) {
38 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.removeAccessToken(accessToken); 39 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.removeAccessToken(accessToken);
39 - return OAuth2TokenConvert.INSTANCE.convert2(accessTokenDO); 40 + return BeanUtils.toBean(accessTokenDO, OAuth2AccessTokenRespDTO.class);
40 } 41 }
41 42
42 @Override 43 @Override
43 public OAuth2AccessTokenRespDTO refreshAccessToken(String refreshToken, String clientId) { 44 public OAuth2AccessTokenRespDTO refreshAccessToken(String refreshToken, String clientId) {
44 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, clientId); 45 OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.refreshAccessToken(refreshToken, clientId);
45 - return OAuth2TokenConvert.INSTANCE.convert2(accessTokenDO); 46 + return BeanUtils.toBean(accessTokenDO, OAuth2AccessTokenRespDTO.class);
46 } 47 }
47 48
48 } 49 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java
1 package cn.iocoder.yudao.module.system.api.social; 1 package cn.iocoder.yudao.module.system.api.social;
2 2
3 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; 3 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
  4 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
4 import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO; 5 import cn.iocoder.yudao.module.system.api.social.dto.SocialWxJsapiSignatureRespDTO;
5 import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO; 6 import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
6 -import cn.iocoder.yudao.module.system.convert.social.SocialClientConvert;  
7 import cn.iocoder.yudao.module.system.service.social.SocialClientService; 7 import cn.iocoder.yudao.module.system.service.social.SocialClientService;
8 import me.chanjar.weixin.common.bean.WxJsapiSignature; 8 import me.chanjar.weixin.common.bean.WxJsapiSignature;
9 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
@@ -31,13 +31,13 @@ public class SocialClientApiImpl implements SocialClientApi { @@ -31,13 +31,13 @@ public class SocialClientApiImpl implements SocialClientApi {
31 @Override 31 @Override
32 public SocialWxJsapiSignatureRespDTO createWxMpJsapiSignature(Integer userType, String url) { 32 public SocialWxJsapiSignatureRespDTO createWxMpJsapiSignature(Integer userType, String url) {
33 WxJsapiSignature signature = socialClientService.createWxMpJsapiSignature(userType, url); 33 WxJsapiSignature signature = socialClientService.createWxMpJsapiSignature(userType, url);
34 - return SocialClientConvert.INSTANCE.convert(signature); 34 + return BeanUtils.toBean(signature, SocialWxJsapiSignatureRespDTO.class);
35 } 35 }
36 36
37 @Override 37 @Override
38 public SocialWxPhoneNumberInfoRespDTO getWxMaPhoneNumberInfo(Integer userType, String phoneCode) { 38 public SocialWxPhoneNumberInfoRespDTO getWxMaPhoneNumberInfo(Integer userType, String phoneCode) {
39 WxMaPhoneNumberInfo info = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode); 39 WxMaPhoneNumberInfo info = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode);
40 - return SocialClientConvert.INSTANCE.convert(info); 40 + return BeanUtils.toBean(info, SocialWxPhoneNumberInfoRespDTO.class);
41 } 41 }
42 42
43 } 43 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
1 package cn.iocoder.yudao.module.system.api.user; 1 package cn.iocoder.yudao.module.system.api.user;
2 2
  3 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
3 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; 4 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
4 -import cn.iocoder.yudao.module.system.convert.user.UserConvert;  
5 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; 5 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
6 import cn.iocoder.yudao.module.system.service.user.AdminUserService; 6 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
@@ -24,25 +24,25 @@ public class AdminUserApiImpl implements AdminUserApi { @@ -24,25 +24,25 @@ public class AdminUserApiImpl implements AdminUserApi {
24 @Override 24 @Override
25 public AdminUserRespDTO getUser(Long id) { 25 public AdminUserRespDTO getUser(Long id) {
26 AdminUserDO user = userService.getUser(id); 26 AdminUserDO user = userService.getUser(id);
27 - return UserConvert.INSTANCE.convert4(user); 27 + return BeanUtils.toBean(user, AdminUserRespDTO.class);
28 } 28 }
29 29
30 @Override 30 @Override
31 public List<AdminUserRespDTO> getUserList(Collection<Long> ids) { 31 public List<AdminUserRespDTO> getUserList(Collection<Long> ids) {
32 List<AdminUserDO> users = userService.getUserList(ids); 32 List<AdminUserDO> users = userService.getUserList(ids);
33 - return UserConvert.INSTANCE.convertList4(users); 33 + return BeanUtils.toBean(users, AdminUserRespDTO.class);
34 } 34 }
35 35
36 @Override 36 @Override
37 public List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds) { 37 public List<AdminUserRespDTO> getUserListByDeptIds(Collection<Long> deptIds) {
38 List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds); 38 List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
39 - return UserConvert.INSTANCE.convertList4(users); 39 + return BeanUtils.toBean(users, AdminUserRespDTO.class);
40 } 40 }
41 41
42 @Override 42 @Override
43 public List<AdminUserRespDTO> getUserListByPostIds(Collection<Long> postIds) { 43 public List<AdminUserRespDTO> getUserListByPostIds(Collection<Long> postIds) {
44 List<AdminUserDO> users = userService.getUserListByPostIds(postIds); 44 List<AdminUserDO> users = userService.getUserListByPostIds(postIds);
45 - return UserConvert.INSTANCE.convertList4(users); 45 + return BeanUtils.toBean(users, AdminUserRespDTO.class);
46 } 46 }
47 47
48 @Override 48 @Override
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
@@ -17,11 +17,6 @@ import javax.annotation.Resource; @@ -17,11 +17,6 @@ import javax.annotation.Resource;
17 import javax.annotation.security.PermitAll; 17 import javax.annotation.security.PermitAll;
18 import javax.servlet.http.HttpServletRequest; 18 import javax.servlet.http.HttpServletRequest;
19 19
20 -/**  
21 - * 验证码  
22 - *  
23 - * @author 芋道源码  
24 - */  
25 @Tag(name = "管理后台 - 验证码") 20 @Tag(name = "管理后台 - 验证码")
26 @RestController("adminCaptchaController") 21 @RestController("adminCaptchaController")
27 @RequestMapping("/system/captcha") 22 @RequestMapping("/system/captcha")
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java
@@ -2,20 +2,22 @@ package cn.iocoder.yudao.module.system.controller.admin.dept; @@ -2,20 +2,22 @@ package cn.iocoder.yudao.module.system.controller.admin.dept;
2 2
3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 3 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 -import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.*;  
6 -import cn.iocoder.yudao.module.system.convert.dept.DeptConvert; 5 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  6 +import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
  7 +import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
  8 +import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
  9 +import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
7 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; 10 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
8 import cn.iocoder.yudao.module.system.service.dept.DeptService; 11 import cn.iocoder.yudao.module.system.service.dept.DeptService;
9 -import io.swagger.v3.oas.annotations.tags.Tag;  
10 -import io.swagger.v3.oas.annotations.Parameter;  
11 import io.swagger.v3.oas.annotations.Operation; 12 import io.swagger.v3.oas.annotations.Operation;
  13 +import io.swagger.v3.oas.annotations.Parameter;
  14 +import io.swagger.v3.oas.annotations.tags.Tag;
12 import org.springframework.security.access.prepost.PreAuthorize; 15 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.validation.annotation.Validated; 16 import org.springframework.validation.annotation.Validated;
14 import org.springframework.web.bind.annotation.*; 17 import org.springframework.web.bind.annotation.*;
15 18
16 import javax.annotation.Resource; 19 import javax.annotation.Resource;
17 import javax.validation.Valid; 20 import javax.validation.Valid;
18 -import java.util.Comparator;  
19 import java.util.List; 21 import java.util.List;
20 22
21 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 23 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -32,16 +34,16 @@ public class DeptController { @@ -32,16 +34,16 @@ public class DeptController {
32 @PostMapping("create") 34 @PostMapping("create")
33 @Operation(summary = "创建部门") 35 @Operation(summary = "创建部门")
34 @PreAuthorize("@ss.hasPermission('system:dept:create')") 36 @PreAuthorize("@ss.hasPermission('system:dept:create')")
35 - public CommonResult<Long> createDept(@Valid @RequestBody DeptCreateReqVO reqVO) {  
36 - Long deptId = deptService.createDept(reqVO); 37 + public CommonResult<Long> createDept(@Valid @RequestBody DeptSaveReqVO createReqVO) {
  38 + Long deptId = deptService.createDept(createReqVO);
37 return success(deptId); 39 return success(deptId);
38 } 40 }
39 41
40 @PutMapping("update") 42 @PutMapping("update")
41 @Operation(summary = "更新部门") 43 @Operation(summary = "更新部门")
42 @PreAuthorize("@ss.hasPermission('system:dept:update')") 44 @PreAuthorize("@ss.hasPermission('system:dept:update')")
43 - public CommonResult<Boolean> updateDept(@Valid @RequestBody DeptUpdateReqVO reqVO) {  
44 - deptService.updateDept(reqVO); 45 + public CommonResult<Boolean> updateDept(@Valid @RequestBody DeptSaveReqVO updateReqVO) {
  46 + deptService.updateDept(updateReqVO);
45 return success(true); 47 return success(true);
46 } 48 }
47 49
@@ -59,20 +61,15 @@ public class DeptController { @@ -59,20 +61,15 @@ public class DeptController {
59 @PreAuthorize("@ss.hasPermission('system:dept:query')") 61 @PreAuthorize("@ss.hasPermission('system:dept:query')")
60 public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) { 62 public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
61 List<DeptDO> list = deptService.getDeptList(reqVO); 63 List<DeptDO> list = deptService.getDeptList(reqVO);
62 - list.sort(Comparator.comparing(DeptDO::getSort));  
63 - return success(DeptConvert.INSTANCE.convertList(list)); 64 + return success(BeanUtils.toBean(list, DeptRespVO.class));
64 } 65 }
65 66
66 - @GetMapping("/list-all-simple") 67 + @GetMapping(value = {"/list-all-simple", "/simple-list"})
67 @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项") 68 @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
68 public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() { 69 public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
69 - // 获得部门列表,只要开启状态的  
70 - DeptListReqVO reqVO = new DeptListReqVO();  
71 - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());  
72 - List<DeptDO> list = deptService.getDeptList(reqVO);  
73 - // 排序后,返回给前端  
74 - list.sort(Comparator.comparing(DeptDO::getSort));  
75 - return success(DeptConvert.INSTANCE.convertList02(list)); 70 + List<DeptDO> list = deptService.getDeptList(
  71 + new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
  72 + return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
76 } 73 }
77 74
78 @GetMapping("/get") 75 @GetMapping("/get")
@@ -80,7 +77,8 @@ public class DeptController { @@ -80,7 +77,8 @@ public class DeptController {
80 @Parameter(name = "id", description = "编号", required = true, example = "1024") 77 @Parameter(name = "id", description = "编号", required = true, example = "1024")
81 @PreAuthorize("@ss.hasPermission('system:dept:query')") 78 @PreAuthorize("@ss.hasPermission('system:dept:query')")
82 public CommonResult<DeptRespVO> getDept(@RequestParam("id") Long id) { 79 public CommonResult<DeptRespVO> getDept(@RequestParam("id") Long id) {
83 - return success(DeptConvert.INSTANCE.convert(deptService.getDept(id))); 80 + DeptDO dept = deptService.getDept(id);
  81 + return success(BeanUtils.toBean(dept, DeptRespVO.class));
84 } 82 }
85 83
86 } 84 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java
@@ -73,7 +73,7 @@ public class PostController { @@ -73,7 +73,7 @@ public class PostController {
73 return success(BeanUtils.toBean(post, PostRespVO.class)); 73 return success(BeanUtils.toBean(post, PostRespVO.class));
74 } 74 }
75 75
76 - @GetMapping("/list-all-simple") 76 + @GetMapping(value = {"/list-all-simple", "simple-list"})
77 @Operation(summary = "获取岗位全列表", description = "只包含被开启的岗位,主要用于前端的下拉选项") 77 @Operation(summary = "获取岗位全列表", description = "只包含被开启的岗位,主要用于前端的下拉选项")
78 public CommonResult<List<PostSimpleRespVO>> getSimplePostList() { 78 public CommonResult<List<PostSimpleRespVO>> getSimplePostList() {
79 // 获得岗位列表,只要开启状态的 79 // 获得岗位列表,只要开启状态的
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;  
2 -import io.swagger.v3.oas.annotations.media.Schema;  
3 -import lombok.Data;  
4 -import lombok.EqualsAndHashCode;  
5 -import lombok.ToString;  
6 -  
7 -@Schema(description = "管理后台 - 部门创建 Request VO")  
8 -@Data  
9 -@EqualsAndHashCode(callSuper = true)  
10 -@ToString(callSuper = true)  
11 -public class DeptCreateReqVO extends DeptBaseVO {  
12 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptRespVO.java
@@ -2,19 +2,35 @@ package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept; @@ -2,19 +2,35 @@ package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
5 -import lombok.EqualsAndHashCode;  
6 5
7 import java.time.LocalDateTime; 6 import java.time.LocalDateTime;
8 7
9 @Schema(description = "管理后台 - 部门信息 Response VO") 8 @Schema(description = "管理后台 - 部门信息 Response VO")
10 @Data 9 @Data
11 -@EqualsAndHashCode(callSuper = true)  
12 -public class DeptRespVO extends DeptBaseVO { 10 +public class DeptRespVO {
13 11
14 - @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 12 + @Schema(description = "部门编号", example = "1024")
15 private Long id; 13 private Long id;
16 14
17 - @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 15 + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
  16 + private String name;
  17 +
  18 + @Schema(description = "父部门 ID", example = "1024")
  19 + private Long parentId;
  20 +
  21 + @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  22 + private Integer sort;
  23 +
  24 + @Schema(description = "负责人的用户编号", example = "2048")
  25 + private Long leaderUserId;
  26 +
  27 + @Schema(description = "联系电话", example = "15601691000")
  28 + private String phone;
  29 +
  30 + @Schema(description = "邮箱", example = "yudao@iocoder.cn")
  31 + private String email;
  32 +
  33 + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
18 private Integer status; 34 private Integer status;
19 35
20 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") 36 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptBaseVO.java renamed to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSaveReqVO.java
1 package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept; 1 package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.yudao.framework.common.validation.InEnum;
3 import io.swagger.v3.oas.annotations.media.Schema; 5 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 6 import lombok.Data;
5 7
@@ -8,19 +10,19 @@ import javax.validation.constraints.NotBlank; @@ -8,19 +10,19 @@ import javax.validation.constraints.NotBlank;
8 import javax.validation.constraints.NotNull; 10 import javax.validation.constraints.NotNull;
9 import javax.validation.constraints.Size; 11 import javax.validation.constraints.Size;
10 12
11 -/**  
12 - * 部门 Base VO,提供给添加、修改、详细的子 VO 使用  
13 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
14 - */ 13 +@Schema(description = "管理后台 - 部门创建/修改 Request VO")
15 @Data 14 @Data
16 -public class DeptBaseVO { 15 +public class DeptSaveReqVO {
17 16
18 - @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") 17 + @Schema(description = "部门编号", example = "1024")
  18 + private Long id;
  19 +
  20 + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
19 @NotBlank(message = "部门名称不能为空") 21 @NotBlank(message = "部门名称不能为空")
20 - @Size(max = 30, message = "部门名称长度不能超过30个字符") 22 + @Size(max = 30, message = "部门名称长度不能超过 30 个字符")
21 private String name; 23 private String name;
22 24
23 - @Schema(description = "父菜单 ID", example = "1024") 25 + @Schema(description = "父部门 ID", example = "1024")
24 private Long parentId; 26 private Long parentId;
25 27
26 @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 28 @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@@ -36,12 +38,12 @@ public class DeptBaseVO { @@ -36,12 +38,12 @@ public class DeptBaseVO {
36 38
37 @Schema(description = "邮箱", example = "yudao@iocoder.cn") 39 @Schema(description = "邮箱", example = "yudao@iocoder.cn")
38 @Email(message = "邮箱格式不正确") 40 @Email(message = "邮箱格式不正确")
39 - @Size(max = 50, message = "邮箱长度不能超过50个字符") 41 + @Size(max = 50, message = "邮箱长度不能超过 50 个字符")
40 private String email; 42 private String email;
41 43
42 @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 44 @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
43 @NotNull(message = "状态不能为空") 45 @NotNull(message = "状态不能为空")
44 -// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") 46 + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
45 private Integer status; 47 private Integer status;
46 48
47 } 49 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -  
7 -import javax.validation.constraints.NotNull;  
8 -  
9 -@Schema(description = "管理后台 - 部门更新 Request VO")  
10 -@Data  
11 -@EqualsAndHashCode(callSuper = true)  
12 -public class DeptUpdateReqVO extends DeptBaseVO {  
13 -  
14 - @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
15 - @NotNull(message = "部门编号不能为空")  
16 - private Long id;  
17 -  
18 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostRespVO.java
1 package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; 1 package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
2 2
3 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; 3 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
4 import cn.iocoder.yudao.module.system.enums.DictTypeConstants; 5 import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
5 import com.alibaba.excel.annotation.ExcelProperty; 7 import com.alibaba.excel.annotation.ExcelProperty;
6 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 9 import lombok.Data;
@@ -10,6 +12,7 @@ import java.time.LocalDateTime; @@ -10,6 +12,7 @@ import java.time.LocalDateTime;
10 12
11 @Schema(description = "管理后台 - 岗位信息 Response VO") 13 @Schema(description = "管理后台 - 岗位信息 Response VO")
12 @Data 14 @Data
  15 +@ExcelIgnoreUnannotated
13 public class PostRespVO { 16 public class PostRespVO {
14 17
15 @Schema(description = "岗位序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "岗位序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@@ -29,6 +32,7 @@ public class PostRespVO { @@ -29,6 +32,7 @@ public class PostRespVO {
29 private Integer sort; 32 private Integer sort;
30 33
31 @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 34 @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  35 + @ExcelProperty(value = "状态", converter = DictConvert.class)
32 @DictFormat(DictTypeConstants.COMMON_STATUS) 36 @DictFormat(DictTypeConstants.COMMON_STATUS)
33 private Integer status; 37 private Integer status;
34 38
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java
1 package cn.iocoder.yudao.module.system.controller.admin.dict; 1 package cn.iocoder.yudao.module.system.controller.admin.dict;
2 2
3 -import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;  
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
6 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
7 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
8 -import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.*;  
9 -import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert; 9 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO;
  10 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataRespVO;
  11 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSaveReqVO;
  12 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataSimpleRespVO;
  13 +import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
10 import cn.iocoder.yudao.module.system.service.dict.DictDataService; 14 import cn.iocoder.yudao.module.system.service.dict.DictDataService;
11 -import io.swagger.v3.oas.annotations.tags.Tag;  
12 -import io.swagger.v3.oas.annotations.Parameter;  
13 import io.swagger.v3.oas.annotations.Operation; 15 import io.swagger.v3.oas.annotations.Operation;
  16 +import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.tags.Tag;
14 import org.springframework.security.access.prepost.PreAuthorize; 18 import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.validation.annotation.Validated; 19 import org.springframework.validation.annotation.Validated;
16 import org.springframework.web.bind.annotation.*; 20 import org.springframework.web.bind.annotation.*;
@@ -36,16 +40,16 @@ public class DictDataController { @@ -36,16 +40,16 @@ public class DictDataController {
36 @PostMapping("/create") 40 @PostMapping("/create")
37 @Operation(summary = "新增字典数据") 41 @Operation(summary = "新增字典数据")
38 @PreAuthorize("@ss.hasPermission('system:dict:create')") 42 @PreAuthorize("@ss.hasPermission('system:dict:create')")
39 - public CommonResult<Long> createDictData(@Valid @RequestBody DictDataCreateReqVO reqVO) {  
40 - Long dictDataId = dictDataService.createDictData(reqVO); 43 + public CommonResult<Long> createDictData(@Valid @RequestBody DictDataSaveReqVO createReqVO) {
  44 + Long dictDataId = dictDataService.createDictData(createReqVO);
41 return success(dictDataId); 45 return success(dictDataId);
42 } 46 }
43 47
44 @PutMapping("/update") 48 @PutMapping("/update")
45 @Operation(summary = "修改字典数据") 49 @Operation(summary = "修改字典数据")
46 @PreAuthorize("@ss.hasPermission('system:dict:update')") 50 @PreAuthorize("@ss.hasPermission('system:dict:update')")
47 - public CommonResult<Boolean> updateDictData(@Valid @RequestBody DictDataUpdateReqVO reqVO) {  
48 - dictDataService.updateDictData(reqVO); 51 + public CommonResult<Boolean> updateDictData(@Valid @RequestBody DictDataSaveReqVO updateReqVO) {
  52 + dictDataService.updateDictData(updateReqVO);
49 return success(true); 53 return success(true);
50 } 54 }
51 55
@@ -58,19 +62,20 @@ public class DictDataController { @@ -58,19 +62,20 @@ public class DictDataController {
58 return success(true); 62 return success(true);
59 } 63 }
60 64
61 - @GetMapping("/list-all-simple") 65 + @GetMapping(value = {"/list-all-simple", "simple-list"})
62 @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地") 66 @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
63 // 无需添加权限认证,因为前端全局都需要 67 // 无需添加权限认证,因为前端全局都需要
64 public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() { 68 public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDataList() {
65 List<DictDataDO> list = dictDataService.getDictDataList(); 69 List<DictDataDO> list = dictDataService.getDictDataList();
66 - return success(DictDataConvert.INSTANCE.convertList(list)); 70 + return success(BeanUtils.toBean(list, DictDataSimpleRespVO.class));
67 } 71 }
68 72
69 @GetMapping("/page") 73 @GetMapping("/page")
70 @Operation(summary = "/获得字典类型的分页列表") 74 @Operation(summary = "/获得字典类型的分页列表")
71 @PreAuthorize("@ss.hasPermission('system:dict:query')") 75 @PreAuthorize("@ss.hasPermission('system:dict:query')")
72 - public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO reqVO) {  
73 - return success(DictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO))); 76 + public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO pageReqVO) {
  77 + PageResult<DictDataDO> pageResult = dictDataService.getDictDataPage(pageReqVO);
  78 + return success(BeanUtils.toBean(pageResult, DictDataRespVO.class));
74 } 79 }
75 80
76 @GetMapping(value = "/get") 81 @GetMapping(value = "/get")
@@ -78,18 +83,20 @@ public class DictDataController { @@ -78,18 +83,20 @@ public class DictDataController {
78 @Parameter(name = "id", description = "编号", required = true, example = "1024") 83 @Parameter(name = "id", description = "编号", required = true, example = "1024")
79 @PreAuthorize("@ss.hasPermission('system:dict:query')") 84 @PreAuthorize("@ss.hasPermission('system:dict:query')")
80 public CommonResult<DictDataRespVO> getDictData(@RequestParam("id") Long id) { 85 public CommonResult<DictDataRespVO> getDictData(@RequestParam("id") Long id) {
81 - return success(DictDataConvert.INSTANCE.convert(dictDataService.getDictData(id))); 86 + DictDataDO dictData = dictDataService.getDictData(id);
  87 + return success(BeanUtils.toBean(dictData, DictDataRespVO.class));
82 } 88 }
83 89
84 @GetMapping("/export") 90 @GetMapping("/export")
85 @Operation(summary = "导出字典数据") 91 @Operation(summary = "导出字典数据")
86 @PreAuthorize("@ss.hasPermission('system:dict:export')") 92 @PreAuthorize("@ss.hasPermission('system:dict:export')")
87 @OperateLog(type = EXPORT) 93 @OperateLog(type = EXPORT)
88 - public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {  
89 - List<DictDataDO> list = dictDataService.getDictDataList(reqVO);  
90 - List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list); 94 + public void export(HttpServletResponse response, @Valid DictDataPageReqVO exportReqVO) throws IOException {
  95 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  96 + List<DictDataDO> list = dictDataService.getDictDataPage(exportReqVO).getList();
91 // 输出 97 // 输出
92 - ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data); 98 + ExcelUtils.write(response, "字典数据.xls", "数据", DictDataRespVO.class,
  99 + BeanUtils.toBean(list, DictDataRespVO.class));
93 } 100 }
94 101
95 } 102 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictTypeController.java
1 package cn.iocoder.yudao.module.system.controller.admin.dict; 1 package cn.iocoder.yudao.module.system.controller.admin.dict;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; 7 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 8 import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
7 -import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.*;  
8 -import cn.iocoder.yudao.module.system.convert.dict.DictTypeConvert; 9 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypePageReqVO;
  10 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeRespVO;
  11 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSaveReqVO;
  12 +import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSimpleRespVO;
9 import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; 13 import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
10 import cn.iocoder.yudao.module.system.service.dict.DictTypeService; 14 import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
11 -import io.swagger.v3.oas.annotations.tags.Tag;  
12 -import io.swagger.v3.oas.annotations.Parameter;  
13 import io.swagger.v3.oas.annotations.Operation; 15 import io.swagger.v3.oas.annotations.Operation;
  16 +import io.swagger.v3.oas.annotations.Parameter;
  17 +import io.swagger.v3.oas.annotations.tags.Tag;
14 import org.springframework.security.access.prepost.PreAuthorize; 18 import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.validation.annotation.Validated; 19 import org.springframework.validation.annotation.Validated;
16 import org.springframework.web.bind.annotation.*; 20 import org.springframework.web.bind.annotation.*;
@@ -36,16 +40,16 @@ public class DictTypeController { @@ -36,16 +40,16 @@ public class DictTypeController {
36 @PostMapping("/create") 40 @PostMapping("/create")
37 @Operation(summary = "创建字典类型") 41 @Operation(summary = "创建字典类型")
38 @PreAuthorize("@ss.hasPermission('system:dict:create')") 42 @PreAuthorize("@ss.hasPermission('system:dict:create')")
39 - public CommonResult<Long> createDictType(@Valid @RequestBody DictTypeCreateReqVO reqVO) {  
40 - Long dictTypeId = dictTypeService.createDictType(reqVO); 43 + public CommonResult<Long> createDictType(@Valid @RequestBody DictTypeSaveReqVO createReqVO) {
  44 + Long dictTypeId = dictTypeService.createDictType(createReqVO);
41 return success(dictTypeId); 45 return success(dictTypeId);
42 } 46 }
43 47
44 @PutMapping("/update") 48 @PutMapping("/update")
45 @Operation(summary = "修改字典类型") 49 @Operation(summary = "修改字典类型")
46 @PreAuthorize("@ss.hasPermission('system:dict:update')") 50 @PreAuthorize("@ss.hasPermission('system:dict:update')")
47 - public CommonResult<Boolean> updateDictType(@Valid @RequestBody DictTypeUpdateReqVO reqVO) {  
48 - dictTypeService.updateDictType(reqVO); 51 + public CommonResult<Boolean> updateDictType(@Valid @RequestBody DictTypeSaveReqVO updateReqVO) {
  52 + dictTypeService.updateDictType(updateReqVO);
49 return success(true); 53 return success(true);
50 } 54 }
51 55
@@ -58,11 +62,12 @@ public class DictTypeController { @@ -58,11 +62,12 @@ public class DictTypeController {
58 return success(true); 62 return success(true);
59 } 63 }
60 64
61 - @Operation(summary = "/获得字典类型的分页列表")  
62 @GetMapping("/page") 65 @GetMapping("/page")
  66 + @Operation(summary = "获得字典类型的分页列表")
63 @PreAuthorize("@ss.hasPermission('system:dict:query')") 67 @PreAuthorize("@ss.hasPermission('system:dict:query')")
64 - public CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@Valid DictTypePageReqVO reqVO) {  
65 - return success(DictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO))); 68 + public CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@Valid DictTypePageReqVO pageReqVO) {
  69 + PageResult<DictTypeDO> pageResult = dictTypeService.getDictTypePage(pageReqVO);
  70 + return success(BeanUtils.toBean(pageResult, DictTypeRespVO.class));
66 } 71 }
67 72
68 @Operation(summary = "/查询字典类型详细") 73 @Operation(summary = "/查询字典类型详细")
@@ -70,26 +75,28 @@ public class DictTypeController { @@ -70,26 +75,28 @@ public class DictTypeController {
70 @GetMapping(value = "/get") 75 @GetMapping(value = "/get")
71 @PreAuthorize("@ss.hasPermission('system:dict:query')") 76 @PreAuthorize("@ss.hasPermission('system:dict:query')")
72 public CommonResult<DictTypeRespVO> getDictType(@RequestParam("id") Long id) { 77 public CommonResult<DictTypeRespVO> getDictType(@RequestParam("id") Long id) {
73 - return success(DictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id))); 78 + DictTypeDO dictType = dictTypeService.getDictType(id);
  79 + return success(BeanUtils.toBean(dictType, DictTypeRespVO.class));
74 } 80 }
75 81
76 - @GetMapping("/list-all-simple") 82 + @GetMapping(value = {"/list-all-simple", "simple-list"})
77 @Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") 83 @Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
78 // 无需添加权限认证,因为前端全局都需要 84 // 无需添加权限认证,因为前端全局都需要
79 public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() { 85 public CommonResult<List<DictTypeSimpleRespVO>> getSimpleDictTypeList() {
80 List<DictTypeDO> list = dictTypeService.getDictTypeList(); 86 List<DictTypeDO> list = dictTypeService.getDictTypeList();
81 - return success(DictTypeConvert.INSTANCE.convertList(list)); 87 + return success(BeanUtils.toBean(list, DictTypeSimpleRespVO.class));
82 } 88 }
83 89
84 @Operation(summary = "导出数据类型") 90 @Operation(summary = "导出数据类型")
85 @GetMapping("/export") 91 @GetMapping("/export")
86 @PreAuthorize("@ss.hasPermission('system:dict:query')") 92 @PreAuthorize("@ss.hasPermission('system:dict:query')")
87 @OperateLog(type = EXPORT) 93 @OperateLog(type = EXPORT)
88 - public void export(HttpServletResponse response, @Valid DictTypeExportReqVO reqVO) throws IOException {  
89 - List<DictTypeDO> list = dictTypeService.getDictTypeList(reqVO);  
90 - List<DictTypeExcelVO> data = DictTypeConvert.INSTANCE.convertList02(list);  
91 - // 输出  
92 - ExcelUtils.write(response, "字典类型.xls", "类型列表", DictTypeExcelVO.class, data); 94 + public void export(HttpServletResponse response, @Valid DictTypePageReqVO exportReqVO) throws IOException {
  95 + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
  96 + List<DictTypeDO> list = dictTypeService.getDictTypePage(exportReqVO).getList();
  97 + // 导出
  98 + ExcelUtils.write(response, "字典类型.xls", "数据", DictTypeRespVO.class,
  99 + BeanUtils.toBean(list, DictTypeRespVO.class));
93 } 100 }
94 101
95 } 102 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataCreateReqVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -  
7 -@Schema(description = "管理后台 - 字典数据创建 Request VO")  
8 -@Data  
9 -@EqualsAndHashCode(callSuper = true)  
10 -public class DictDataCreateReqVO extends DictDataBaseVO {  
11 -  
12 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExcelVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;  
2 -  
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.system.enums.DictTypeConstants;  
6 -import com.alibaba.excel.annotation.ExcelProperty;  
7 -import lombok.Data;  
8 -  
9 -/**  
10 - * 字典数据 Excel 导出响应 VO  
11 - */  
12 -@Data  
13 -public class DictDataExcelVO {  
14 -  
15 - @ExcelProperty("字典编码")  
16 - private Long id;  
17 -  
18 - @ExcelProperty("字典排序")  
19 - private Integer sort;  
20 -  
21 - @ExcelProperty("字典标签")  
22 - private String label;  
23 -  
24 - @ExcelProperty("字典键值")  
25 - private String value;  
26 -  
27 - @ExcelProperty("字典类型")  
28 - private String dictType;  
29 -  
30 - @ExcelProperty(value = "状态", converter = DictConvert.class)  
31 - @DictFormat(DictTypeConstants.COMMON_STATUS)  
32 - private Integer status;  
33 -  
34 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExportReqVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -  
6 -import javax.validation.constraints.Size;  
7 -  
8 -@Schema(description = "管理后台 - 字典类型导出 Request VO")  
9 -@Data  
10 -public class DictDataExportReqVO {  
11 -  
12 - @Schema(description = "字典标签", example = "芋道")  
13 - @Size(max = 100, message = "字典标签长度不能超过100个字符")  
14 - private String label;  
15 -  
16 - @Schema(description = "字典类型,模糊匹配", example = "sys_common_sex")  
17 - @Size(max = 100, message = "字典类型类型长度不能超过100个字符")  
18 - private String dictType;  
19 -  
20 - @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")  
21 - private Integer status;  
22 -  
23 -}  
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataPageReqVO.java
1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; 1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 import cn.iocoder.yudao.framework.common.pojo.PageParam; 4 import cn.iocoder.yudao.framework.common.pojo.PageParam;
  5 +import cn.iocoder.yudao.framework.common.validation.InEnum;
4 import io.swagger.v3.oas.annotations.media.Schema; 6 import io.swagger.v3.oas.annotations.media.Schema;
5 import lombok.Data; 7 import lombok.Data;
6 import lombok.EqualsAndHashCode; 8 import lombok.EqualsAndHashCode;
@@ -21,6 +23,7 @@ public class DictDataPageReqVO extends PageParam { @@ -21,6 +23,7 @@ public class DictDataPageReqVO extends PageParam {
21 private String dictType; 23 private String dictType;
22 24
23 @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") 25 @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
  26 + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
24 private Integer status; 27 private Integer status;
25 28
26 } 29 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataRespVO.java
1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; 1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
2 2
  3 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  5 +import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
  6 +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
  7 +import com.alibaba.excel.annotation.ExcelProperty;
3 import io.swagger.v3.oas.annotations.media.Schema; 8 import io.swagger.v3.oas.annotations.media.Schema;
4 -import lombok.AllArgsConstructor;  
5 import lombok.Data; 9 import lombok.Data;
6 -import lombok.EqualsAndHashCode;  
7 -import lombok.NoArgsConstructor;  
8 10
9 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
10 12
11 @Schema(description = "管理后台 - 字典数据信息 Response VO") 13 @Schema(description = "管理后台 - 字典数据信息 Response VO")
12 @Data 14 @Data
13 -@NoArgsConstructor  
14 -@AllArgsConstructor  
15 -@EqualsAndHashCode(callSuper = true)  
16 -public class DictDataRespVO extends DictDataBaseVO { 15 +@ExcelIgnoreUnannotated
  16 +public class DictDataRespVO {
17 17
18 @Schema(description = "字典数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 18 @Schema(description = "字典数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  19 + @ExcelProperty("字典编码")
19 private Long id; 20 private Long id;
20 21
  22 + @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
  23 + @ExcelProperty("字典排序")
  24 + private Integer sort;
  25 +
  26 + @Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
  27 + @ExcelProperty("字典标签")
  28 + private String label;
  29 +
  30 + @Schema(description = "字典值", requiredMode = Schema.RequiredMode.REQUIRED, example = "iocoder")
  31 + @ExcelProperty("字典键值")
  32 + private String value;
  33 +
  34 + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex")
  35 + @ExcelProperty("字典类型")
  36 + private String dictType;
  37 +
  38 + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  39 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  40 + @DictFormat(DictTypeConstants.COMMON_STATUS)
  41 + private Integer status;
  42 +
  43 + @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default")
  44 + private String colorType;
  45 +
  46 + @Schema(description = "css 样式", example = "btn-visible")
  47 + private String cssClass;
  48 +
  49 + @Schema(description = "备注", example = "我是一个角色")
  50 + private String remark;
  51 +
21 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") 52 @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
22 private LocalDateTime createTime; 53 private LocalDateTime createTime;
23 54
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataBaseVO.java renamed to yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataSaveReqVO.java
1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; 1 package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
2 2
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
  4 +import cn.iocoder.yudao.framework.common.validation.InEnum;
3 import io.swagger.v3.oas.annotations.media.Schema; 5 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 6 import lombok.Data;
5 7
@@ -7,12 +9,12 @@ import javax.validation.constraints.NotBlank; @@ -7,12 +9,12 @@ import javax.validation.constraints.NotBlank;
7 import javax.validation.constraints.NotNull; 9 import javax.validation.constraints.NotNull;
8 import javax.validation.constraints.Size; 10 import javax.validation.constraints.Size;
9 11
10 -/**  
11 - * 字典数据 Base VO,提供给添加、修改、详细的子 VO 使用  
12 - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成  
13 - */ 12 +@Schema(description = "管理后台 - 字典数据创建/修改 Request VO")
14 @Data 13 @Data
15 -public class DictDataBaseVO { 14 +public class DictDataSaveReqVO {
  15 +
  16 + @Schema(description = "字典数据编号", example = "1024")
  17 + private Long id;
16 18
17 @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") 19 @Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
18 @NotNull(message = "显示顺序不能为空") 20 @NotNull(message = "显示顺序不能为空")
@@ -35,11 +37,12 @@ public class DictDataBaseVO { @@ -35,11 +37,12 @@ public class DictDataBaseVO {
35 37
36 @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") 38 @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
37 @NotNull(message = "状态不能为空") 39 @NotNull(message = "状态不能为空")
38 -// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") 40 + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
39 private Integer status; 41 private Integer status;
40 42
41 @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default") 43 @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default")
42 private String colorType; 44 private String colorType;
  45 +
43 @Schema(description = "css 样式", example = "btn-visible") 46 @Schema(description = "css 样式", example = "btn-visible")
44 private String cssClass; 47 private String cssClass;
45 48
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataUpdateReqVO.java deleted
1 -package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;  
2 -  
3 -import io.swagger.v3.oas.annotations.media.Schema;  
4 -import lombok.Data;  
5 -import lombok.EqualsAndHashCode;  
6 -  
7 -import javax.validation.constraints.NotNull;  
8 -  
9 -@Schema(description = "管理后台 - 字典数据更新 Request VO")  
10 -@Data  
11 -@EqualsAndHashCode(callSuper = true)  
12 -public class DictDataUpdateReqVO extends DictDataBaseVO {  
13 -  
14 - @Schema(description = "字典数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")  
15 - @NotNull(message = "字典数据编号不能为空")  
16 - private Long id;  
17 -  
18 -}