多模块重构 5:infra 模块的修改~~~
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.infra.api.file;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
/**
|
||||
* 文件 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface FileApi {
|
||||
|
||||
/**
|
||||
* 保存文件,并返回文件的访问路径
|
||||
*
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
default String createFile(byte[] content) {
|
||||
return createFile(IdUtil.fastUUID(), content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件,并返回文件的访问路径
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
String createFile(String path, byte[] content);
|
||||
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* infra API 包,定义暴露给其它模块的 API
|
||||
*/
|
||||
package cn.iocoder.yudao.module.infra.api;
|
@@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
*
|
||||
* infra 系统,使用 1-001-000-000 段
|
||||
*/
|
||||
public interface InfErrorCodeConstants {
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 参数配置 1001000000 ==========
|
||||
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1001000001, "参数配置不存在");
|
||||
@@ -27,4 +27,8 @@ public interface InfErrorCodeConstants {
|
||||
ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在");
|
||||
ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1001002001, "API 错误日志已处理");
|
||||
|
||||
// ========= 文件相关 1001003000=================
|
||||
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1001003000, "文件路径已存在");
|
||||
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003001, "文件不存在");
|
||||
|
||||
}
|
@@ -23,19 +23,26 @@
|
||||
<artifactId>yudao-module-member-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
@@ -54,6 +61,12 @@
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
@@ -73,6 +86,10 @@
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.smallbun.screw</groupId>
|
||||
<artifactId>screw-core</artifactId> <!-- 实现数据库文档 -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.infra.api.file;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 文件 API 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FileApiImpl implements FileApi {
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@Override
|
||||
public String createFile(String path, byte[] content) {
|
||||
return fileService.createFile(path, content);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
package cn.iocoder.yudao.module.infra.api;
|
@@ -1,17 +1,15 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.config;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert;
|
||||
import cn.iocoder.yudao.module.infra.service.config.InfConfigService;
|
||||
import cn.iocoder.yudao.module.infra.controller.config.vo.*;
|
||||
import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.service.config.ConfigService;
|
||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -25,18 +23,17 @@ import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "参数配置")
|
||||
@Api(tags = "管理后台 - 参数配置")
|
||||
@RestController
|
||||
@RequestMapping("/infra/config")
|
||||
@Validated
|
||||
public class ConfigController {
|
||||
|
||||
@Resource
|
||||
private InfConfigService configService;
|
||||
private ConfigService configService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建参数配置")
|
||||
@@ -67,19 +64,19 @@ public class ConfigController {
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
||||
public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
||||
return success(InfConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
||||
return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get-value-by-key")
|
||||
@ApiOperation(value = "根据参数键名查询参数值", notes = "敏感配置,不允许返回给前端")
|
||||
@ApiImplicitParam(name = "key", value = "参数键", required = true, example = "yunai.biz.username", dataTypeClass = String.class)
|
||||
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
||||
InfConfigDO config = configService.getConfigByKey(key);
|
||||
ConfigDO config = configService.getConfigByKey(key);
|
||||
if (config == null) {
|
||||
return null;
|
||||
}
|
||||
if (config.getSensitive()) {
|
||||
throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE);
|
||||
}
|
||||
return success(config.getValue());
|
||||
}
|
||||
@@ -88,8 +85,8 @@ public class ConfigController {
|
||||
@ApiOperation("获取参数配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
||||
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO reqVO) {
|
||||
PageResult<InfConfigDO> page = configService.getConfigPage(reqVO);
|
||||
return success(InfConfigConvert.INSTANCE.convertPage(page));
|
||||
PageResult<ConfigDO> page = configService.getConfigPage(reqVO);
|
||||
return success(ConfigConvert.INSTANCE.convertPage(page));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@@ -98,9 +95,9 @@ public class ConfigController {
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportSysConfig(@Valid ConfigExportReqVO reqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfConfigDO> list = configService.getConfigList(reqVO);
|
||||
List<ConfigDO> list = configService.getConfigList(reqVO);
|
||||
// 拼接数据
|
||||
List<ConfigExcelVO> datas = InfConfigConvert.INSTANCE.convertList(list);
|
||||
List<ConfigExcelVO> datas = ConfigConvert.INSTANCE.convertList(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("参数配置导出 Request VO")
|
||||
@ApiModel("管理后台 - 参数配置导出 Request VO")
|
||||
@Data
|
||||
public class ConfigExportReqVO {
|
||||
|
||||
|
@@ -12,7 +12,7 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("参数配置分页 Request VO")
|
||||
@ApiModel("管理后台 - 参数配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
|
@@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("参数配置信息 Response VO")
|
||||
@ApiModel("管理后台 - 参数配置信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ConfigRespVO extends ConfigBaseVO {
|
||||
|
@@ -8,7 +8,7 @@ import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("参数配置创建 Request VO")
|
||||
@ApiModel("管理后台 - 参数配置创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
|
@@ -16,7 +16,6 @@ import com.zaxxer.hikari.HikariDataSource;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -28,10 +27,10 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
@Api(tags = "数据库文档")
|
||||
@Api(tags = "管理后台 - 数据库文档")
|
||||
@RestController
|
||||
@RequestMapping("/infra/db-doc")
|
||||
public class InfDbDocController {
|
||||
public class DbDocController {
|
||||
|
||||
@Resource
|
||||
private DynamicDataSourceProperties dynamicDataSourceProperties;
|
@@ -1,16 +1,15 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.file;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.service.file.InfFileService;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.convert.file.InfFileConvert;
|
||||
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.file.FileConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -29,17 +28,15 @@ import java.io.IOException;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "文件存储")
|
||||
@Api(tags = "管理后台 - 文件存储")
|
||||
@RestController
|
||||
@RequestMapping("/infra/file")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class InfFileController {
|
||||
public class FileController {
|
||||
|
||||
@Resource
|
||||
private InfFileService fileService;
|
||||
@Resource
|
||||
private InfFileCoreService fileCoreService;
|
||||
private FileService fileService;
|
||||
|
||||
@PostMapping("/upload")
|
||||
@ApiOperation("上传文件")
|
||||
@@ -49,7 +46,7 @@ public class InfFileController {
|
||||
})
|
||||
public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("path") String path) throws IOException {
|
||||
return success(fileCoreService.createFile(path, IoUtil.readBytes(file.getInputStream())));
|
||||
return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@@ -57,7 +54,7 @@ public class InfFileController {
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = String.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
||||
public CommonResult<Boolean> deleteFile(@RequestParam("id") String id) {
|
||||
fileCoreService.deleteFile(id);
|
||||
fileService.deleteFile(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -66,7 +63,7 @@ public class InfFileController {
|
||||
@ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class)
|
||||
public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException {
|
||||
TenantContextHolder.setNullTenantId();
|
||||
InfFileDO file = fileCoreService.getFile(path);
|
||||
FileDO file = fileService.getFile(path);
|
||||
if (file == null) {
|
||||
log.warn("[getFile][path({}) 文件不存在]", path);
|
||||
response.setStatus(HttpStatus.NOT_FOUND.value());
|
||||
@@ -78,9 +75,9 @@ public class InfFileController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得文件分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:file:query')")
|
||||
public CommonResult<PageResult<InfFileRespVO>> getFilePage(@Valid InfFilePageReqVO pageVO) {
|
||||
PageResult<InfFileDO> pageResult = fileService.getFilePage(pageVO);
|
||||
return success(InfFileConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
|
||||
PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
|
||||
return success(FileConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
@@ -12,11 +12,11 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("文件分页 Request VO")
|
||||
@ApiModel("管理后台 - 文件分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfFilePageReqVO extends PageParam {
|
||||
public class FilePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "文件路径", example = "yudao", notes = "模糊匹配")
|
||||
private String id;
|
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.infra.vo;
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.file.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -6,9 +6,9 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "文件 Response VO", description = "不返回 content 字段,太大")
|
||||
@ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大")
|
||||
@Data
|
||||
public class InfFileRespVO {
|
||||
public class FileRespVO {
|
||||
|
||||
@ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg")
|
||||
private String id;
|
@@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
|
||||
import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
||||
import cn.iocoder.yudao.module.infra.service.job.InfJobService;
|
||||
import cn.iocoder.yudao.module.infra.controller.job.vo.job.*;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.JobConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import cn.iocoder.yudao.module.infra.service.job.JobService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -32,19 +30,19 @@ import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "定时任务")
|
||||
@Api(tags = "管理后台 - 定时任务")
|
||||
@RestController
|
||||
@RequestMapping("/infra/job")
|
||||
@Validated
|
||||
public class InfJobController {
|
||||
public class JobController {
|
||||
|
||||
@Resource
|
||||
private InfJobService jobService;
|
||||
private JobService jobService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建定时任务")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:create')")
|
||||
public CommonResult<Long> createJob(@Valid @RequestBody InfJobCreateReqVO createReqVO)
|
||||
public CommonResult<Long> createJob(@Valid @RequestBody JobCreateReqVO createReqVO)
|
||||
throws SchedulerException {
|
||||
return success(jobService.createJob(createReqVO));
|
||||
}
|
||||
@@ -52,7 +50,7 @@ public class InfJobController {
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新定时任务")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:update')")
|
||||
public CommonResult<Boolean> updateJob(@Valid @RequestBody InfJobUpdateReqVO updateReqVO)
|
||||
public CommonResult<Boolean> updateJob(@Valid @RequestBody JobUpdateReqVO updateReqVO)
|
||||
throws SchedulerException {
|
||||
jobService.updateJob(updateReqVO);
|
||||
return success(true);
|
||||
@@ -94,38 +92,38 @@ public class InfJobController {
|
||||
@ApiOperation("获得定时任务")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<InfJobRespVO> getJob(@RequestParam("id") Long id) {
|
||||
InfJobDO job = jobService.getJob(id);
|
||||
return success(InfJobConvert.INSTANCE.convert(job));
|
||||
public CommonResult<JobRespVO> getJob(@RequestParam("id") Long id) {
|
||||
JobDO job = jobService.getJob(id);
|
||||
return success(JobConvert.INSTANCE.convert(job));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得定时任务列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<List<InfJobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<InfJobDO> list = jobService.getJobList(ids);
|
||||
return success(InfJobConvert.INSTANCE.convertList(list));
|
||||
public CommonResult<List<JobRespVO>> getJobList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<JobDO> list = jobService.getJobList(ids);
|
||||
return success(JobConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得定时任务分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<PageResult<InfJobRespVO>> getJobPage(@Valid InfJobPageReqVO pageVO) {
|
||||
PageResult<InfJobDO> pageResult = jobService.getJobPage(pageVO);
|
||||
return success(InfJobConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<JobRespVO>> getJobPage(@Valid JobPageReqVO pageVO) {
|
||||
PageResult<JobDO> pageResult = jobService.getJobPage(pageVO);
|
||||
return success(JobConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出定时任务 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO,
|
||||
public void exportJobExcel(@Valid JobExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfJobDO> list = jobService.getJobList(exportReqVO);
|
||||
List<JobDO> list = jobService.getJobList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfJobExcelVO> datas = InfJobConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "定时任务.xls", "数据", InfJobExcelVO.class, datas);
|
||||
List<JobExcelVO> datas = JobConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "定时任务.xls", "数据", JobExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@GetMapping("/get_next_times")
|
||||
@@ -137,7 +135,7 @@ public class InfJobController {
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<List<Date>> getJobNextTimes(@RequestParam("id") Long id,
|
||||
@RequestParam(value = "count", required = false, defaultValue = "5") Integer count) {
|
||||
InfJobDO job = jobService.getJob(id);
|
||||
JobDO job = jobService.getJob(id);
|
||||
if (job == null) {
|
||||
return success(Collections.emptyList());
|
||||
}
|
@@ -4,13 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.InfJobLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.service.job.InfJobLogService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.JobLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.service.job.JobLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -31,51 +31,51 @@ import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "定时任务日志")
|
||||
@Api(tags = "管理后台 - 定时任务日志")
|
||||
@RestController
|
||||
@RequestMapping("/infra/job-log")
|
||||
@Validated
|
||||
public class InfJobLogController {
|
||||
public class JobLogController {
|
||||
|
||||
@Resource
|
||||
private InfJobLogService jobLogService;
|
||||
private JobLogService jobLogService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得定时任务日志")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<InfJobLogRespVO> getJobLog(@RequestParam("id") Long id) {
|
||||
InfJobLogDO jobLog = jobLogService.getJobLog(id);
|
||||
return success(InfJobLogConvert.INSTANCE.convert(jobLog));
|
||||
public CommonResult<JobLogRespVO> getJobLog(@RequestParam("id") Long id) {
|
||||
JobLogDO jobLog = jobLogService.getJobLog(id);
|
||||
return success(JobLogConvert.INSTANCE.convert(jobLog));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得定时任务日志列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<List<InfJobLogRespVO>> getJobLogList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<InfJobLogDO> list = jobLogService.getJobLogList(ids);
|
||||
return success(InfJobLogConvert.INSTANCE.convertList(list));
|
||||
public CommonResult<List<JobLogRespVO>> getJobLogList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<JobLogDO> list = jobLogService.getJobLogList(ids);
|
||||
return success(JobLogConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得定时任务日志分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<PageResult<InfJobLogRespVO>> getJobLogPage(@Valid InfJobLogPageReqVO pageVO) {
|
||||
PageResult<InfJobLogDO> pageResult = jobLogService.getJobLogPage(pageVO);
|
||||
return success(InfJobLogConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<JobLogRespVO>> getJobLogPage(@Valid JobLogPageReqVO pageVO) {
|
||||
PageResult<JobLogDO> pageResult = jobLogService.getJobLogPage(pageVO);
|
||||
return success(JobLogConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出定时任务日志 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportJobLogExcel(@Valid InfJobLogExportReqVO exportReqVO,
|
||||
public void exportJobLogExcel(@Valid JobLogExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfJobLogDO> list = jobLogService.getJobLogList(exportReqVO);
|
||||
List<JobLogDO> list = jobLogService.getJobLogList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfJobLogExcelVO> datas = InfJobLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "任务日志.xls", "数据", InfJobLogExcelVO.class, datas);
|
||||
List<JobLogExcelVO> datas = JobLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "任务日志.xls", "数据", JobLogExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfJobBaseVO {
|
||||
public class JobBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "任务名称", required = true, example = "测试任务")
|
||||
@NotNull(message = "任务名称不能为空")
|
@@ -8,11 +8,11 @@ import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("定时任务创建 Request VO")
|
||||
@ApiModel("管理后台 - 定时任务创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobCreateReqVO extends InfJobBaseVO {
|
||||
public class JobCreateReqVO extends JobBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob")
|
||||
@NotNull(message = "处理器的名字不能为空")
|
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfJobExcelVO {
|
||||
public class JobExcelVO {
|
||||
|
||||
@ExcelProperty("任务编号")
|
||||
private Long id;
|
@@ -4,17 +4,17 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的")
|
||||
@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfJobExportReqVO {
|
||||
public class JobExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "任务状态", example = "1", notes = "参见 InfJobStatusEnum 枚举")
|
||||
@ApiModelProperty(value = "任务状态", example = "1", notes = "参见 JobStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "处理器的名字", example = "sysUserSessionTimeoutJob", notes = "模糊匹配")
|
||||
@ApiModelProperty(value = "处理器的名字", example = "UserSessionTimeoutJob", notes = "模糊匹配")
|
||||
private String handlerName;
|
||||
|
||||
}
|
@@ -7,11 +7,11 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("定时任务分页 Request VO")
|
||||
@ApiModel("管理后台 - 定时任务分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobPageReqVO extends PageParam {
|
||||
public class JobPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配")
|
||||
private String name;
|
@@ -9,11 +9,11 @@ import lombok.ToString;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("定时任务 Response VO")
|
||||
@ApiModel("管理后台 - 定时任务 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobRespVO extends InfJobBaseVO {
|
||||
public class JobRespVO extends JobBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
private Long id;
|
@@ -8,11 +8,11 @@ import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("定时任务更新 Request VO")
|
||||
@ApiModel("管理后台 - 定时任务更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobUpdateReqVO extends InfJobBaseVO {
|
||||
public class JobUpdateReqVO extends JobBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
@NotNull(message = "任务编号不能为空")
|
@@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfJobLogBaseVO {
|
||||
public class JobLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", required = true, example = "1024")
|
||||
@NotNull(message = "任务编号不能为空")
|
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
* @author 芋艿
|
||||
*/
|
||||
@Data
|
||||
public class InfJobLogExcelVO {
|
||||
public class JobLogExcelVO {
|
||||
|
||||
@ExcelProperty("日志编号")
|
||||
private Long id;
|
@@ -9,9 +9,9 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的")
|
||||
@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfJobLogExportReqVO {
|
||||
public class JobLogExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", example = "10")
|
||||
private Long jobId;
|
@@ -12,11 +12,11 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("定时任务日志分页 Request VO")
|
||||
@ApiModel("管理后台 - 定时任务日志分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobLogPageReqVO extends PageParam {
|
||||
public class JobLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "任务编号", example = "10")
|
||||
private Long jobId;
|
@@ -8,11 +8,11 @@ import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("定时任务日志 Response VO")
|
||||
@ApiModel("管理后台 - 定时任务日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfJobLogRespVO extends InfJobLogBaseVO {
|
||||
public class JobLogRespVO extends JobLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "日志编号", required = true, example = "1024")
|
||||
private Long id;
|
@@ -1,16 +1,16 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.logger.InfApiAccessLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.service.logger.InfApiAccessLogService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
||||
import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -28,33 +28,33 @@ import java.util.List;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "API 访问日志")
|
||||
@Api(tags = "管理后台 - API 访问日志")
|
||||
@RestController
|
||||
@RequestMapping("/infra/api-access-log")
|
||||
@Validated
|
||||
public class InfApiAccessLogController {
|
||||
public class ApiAccessLogController {
|
||||
|
||||
@Resource
|
||||
private InfApiAccessLogService apiAccessLogService;
|
||||
private ApiAccessLogService apiAccessLogService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得API 访问日志分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:api-access-log:query')")
|
||||
public CommonResult<PageResult<InfApiAccessLogRespVO>> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) {
|
||||
PageResult<InfApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO);
|
||||
return success(InfApiAccessLogConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<ApiAccessLogRespVO>> getApiAccessLogPage(@Valid ApiAccessLogPageReqVO pageVO) {
|
||||
PageResult<ApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO);
|
||||
return success(ApiAccessLogConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出API 访问日志 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:api-access-log:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO,
|
||||
public void exportApiAccessLogExcel(@Valid ApiAccessLogExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO);
|
||||
List<ApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfApiAccessLogExcelVO> datas = InfApiAccessLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas);
|
||||
List<ApiAccessLogExcelVO> datas = ApiAccessLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "API 访问日志.xls", "数据", ApiAccessLogExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@@ -1,16 +1,16 @@
|
||||
package cn.iocoder.yudao.module.infra.controller.admin.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.logger.InfApiErrorLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.service.logger.InfApiErrorLogService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||
import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -29,14 +29,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Api(tags = "API 错误日志")
|
||||
@Api(tags = "管理后台 - API 错误日志")
|
||||
@RestController
|
||||
@RequestMapping("/infra/api-error-log")
|
||||
@Validated
|
||||
public class InfApiErrorLogController {
|
||||
public class ApiErrorLogController {
|
||||
|
||||
@Resource
|
||||
private InfApiErrorLogService apiErrorLogService;
|
||||
private ApiErrorLogService apiErrorLogService;
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@ApiOperation("更新 API 错误日志的状态")
|
||||
@@ -54,21 +54,21 @@ public class InfApiErrorLogController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得 API 错误日志分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:api-error-log:query')")
|
||||
public CommonResult<PageResult<InfApiErrorLogRespVO>> getApiErrorLogPage(@Valid InfApiErrorLogPageReqVO pageVO) {
|
||||
PageResult<InfApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageVO);
|
||||
return success(InfApiErrorLogConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<ApiErrorLogRespVO>> getApiErrorLogPage(@Valid ApiErrorLogPageReqVO pageVO) {
|
||||
PageResult<ApiErrorLogDO> pageResult = apiErrorLogService.getApiErrorLogPage(pageVO);
|
||||
return success(ApiErrorLogConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出 API 错误日志 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('infra:api-error-log:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportApiErrorLogExcel(@Valid InfApiErrorLogExportReqVO exportReqVO,
|
||||
public void exportApiErrorLogExcel(@Valid ApiErrorLogExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<InfApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO);
|
||||
List<ApiErrorLogDO> list = apiErrorLogService.getApiErrorLogList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<InfApiErrorLogExcelVO> datas = InfApiErrorLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "API 错误日志.xls", "数据", InfApiErrorLogExcelVO.class, datas);
|
||||
List<ApiErrorLogExcelVO> datas = ApiErrorLogConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "API 错误日志.xls", "数据", ApiErrorLogExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfApiAccessLogBaseVO {
|
||||
public class ApiAccessLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002")
|
||||
@NotNull(message = "链路追踪编号不能为空")
|
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfApiAccessLogExcelVO {
|
||||
public class ApiAccessLogExcelVO {
|
||||
|
||||
@ExcelProperty("日志主键")
|
||||
private Long id;
|
@@ -9,9 +9,9 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的")
|
||||
@ApiModel(value = "管理后台 - API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfApiAccessLogExportReqVO {
|
||||
public class ApiAccessLogExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "666")
|
||||
private Long userId;
|
@@ -12,11 +12,11 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("API 访问日志分页 Request VO")
|
||||
@ApiModel("管理后台 - API 访问日志分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfApiAccessLogPageReqVO extends PageParam {
|
||||
public class ApiAccessLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "666")
|
||||
private Long userId;
|
@@ -8,11 +8,11 @@ import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("API 访问日志 Response VO")
|
||||
@ApiModel("管理后台 - API 访问日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO {
|
||||
public class ApiAccessLogRespVO extends ApiAccessLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "日志主键", required = true, example = "1024")
|
||||
private Long id;
|
@@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class InfApiErrorLogBaseVO {
|
||||
public class ApiErrorLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002")
|
||||
@NotNull(message = "链路追踪编号不能为空")
|
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
|
||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -15,7 +14,7 @@ import java.util.Date;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class InfApiErrorLogExcelVO {
|
||||
public class ApiErrorLogExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Integer id;
|
||||
@@ -27,7 +26,7 @@ public class InfApiErrorLogExcelVO {
|
||||
private Integer userId;
|
||||
|
||||
@ExcelProperty(value = "用户类型", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.USER_TYPE)
|
||||
@DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE)
|
||||
private Integer userType;
|
||||
|
||||
@ExcelProperty("应用名")
|
@@ -9,9 +9,9 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel(value = "API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的")
|
||||
@ApiModel(value = "管理后台 - API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的")
|
||||
@Data
|
||||
public class InfApiErrorLogExportReqVO {
|
||||
public class ApiErrorLogExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "666")
|
||||
private Long userId;
|
@@ -12,11 +12,11 @@ import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("API 错误日志分页 Request VO")
|
||||
@ApiModel("管理后台 - API 错误日志分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfApiErrorLogPageReqVO extends PageParam {
|
||||
public class ApiErrorLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "666")
|
||||
private Long userId;
|
@@ -8,11 +8,11 @@ import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("API 错误日志 Response VO")
|
||||
@ApiModel("管理后台 - API 错误日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfApiErrorLogRespVO extends InfApiErrorLogBaseVO {
|
||||
public class ApiErrorLogRespVO extends ApiErrorLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||
private Integer id;
|
@@ -1,7 +1,9 @@
|
||||
### 请求 /infra/redis/get-monitor-info 接口 => 成功
|
||||
GET {{baseUrl}}/infra/redis/get-monitor-info
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenentId}}
|
||||
|
||||
### 请求 /infra/redis/get-key-list 接口 => 成功
|
||||
GET {{baseUrl}}/infra/redis/get-key-list
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenentId}}
|
||||
|
@@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.redis;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine;
|
||||
import cn.iocoder.yudao.framework.redis.core.RedisKeyRegistry;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -22,7 +22,7 @@ import java.util.Properties;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "Redis 监控")
|
||||
@Api(tags = "管理后台 - Redis 监控")
|
||||
@RestController
|
||||
@RequestMapping("/infra/redis")
|
||||
public class RedisController {
|
||||
@@ -33,7 +33,7 @@ public class RedisController {
|
||||
@GetMapping("/get-monitor-info")
|
||||
@ApiOperation("获得 Redis 监控信息")
|
||||
@PreAuthorize("@ss.hasPermission('infra:redis:get-monitor-info')")
|
||||
public CommonResult<InfRedisMonitorRespVO> getRedisMonitorInfo() {
|
||||
public CommonResult<RedisMonitorRespVO> getRedisMonitorInfo() {
|
||||
// 获得 Redis 统计信息
|
||||
Properties info = stringRedisTemplate.execute((RedisCallback<Properties>) RedisServerCommands::info);
|
||||
Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize);
|
||||
@@ -47,7 +47,7 @@ public class RedisController {
|
||||
@GetMapping("/get-key-list")
|
||||
@ApiOperation("获得 Redis Key 列表")
|
||||
@PreAuthorize("@ss.hasPermission('infra:redis:get-key-list')")
|
||||
public CommonResult<List<InfRedisKeyRespVO>> getKeyList() {
|
||||
public CommonResult<List<RedisKeyRespVO>> getKeyList() {
|
||||
List<RedisKeyDefine> keyDefines = RedisKeyRegistry.list();
|
||||
return success(RedisConvert.INSTANCE.convertList(keyDefines));
|
||||
}
|
||||
|
@@ -9,11 +9,11 @@ import lombok.Data;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@ApiModel("Redis Key 信息 Response VO")
|
||||
@ApiModel("管理后台 - Redis Key 信息 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class InfRedisKeyRespVO {
|
||||
public class RedisKeyRespVO {
|
||||
|
||||
@ApiModelProperty(value = "login_user:%s", required = true, example = "String")
|
||||
private String keyTemplate;
|
||||
@@ -22,7 +22,7 @@ public class InfRedisKeyRespVO {
|
||||
private RedisKeyDefine.KeyTypeEnum keyType;
|
||||
|
||||
@ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String")
|
||||
private Class valueType;
|
||||
private Class<?> valueType;
|
||||
|
||||
@ApiModelProperty(value = "超时类型", required = true, example = "1")
|
||||
private RedisKeyDefine.TimeoutTypeEnum timeoutType;
|
@@ -9,11 +9,11 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@ApiModel("Redis 监控信息 Response VO")
|
||||
@ApiModel("管理后台 - Redis 监控信息 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
public class InfRedisMonitorRespVO {
|
||||
public class RedisMonitorRespVO {
|
||||
|
||||
@ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档")
|
||||
private Properties info;
|
@@ -1,29 +1,29 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.config;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InfConfigConvert {
|
||||
public interface ConfigConvert {
|
||||
|
||||
InfConfigConvert INSTANCE = Mappers.getMapper(InfConfigConvert.class);
|
||||
ConfigConvert INSTANCE = Mappers.getMapper(ConfigConvert.class);
|
||||
|
||||
PageResult<ConfigRespVO> convertPage(PageResult<InfConfigDO> page);
|
||||
PageResult<ConfigRespVO> convertPage(PageResult<ConfigDO> page);
|
||||
|
||||
ConfigRespVO convert(InfConfigDO bean);
|
||||
ConfigRespVO convert(ConfigDO bean);
|
||||
|
||||
InfConfigDO convert(ConfigCreateReqVO bean);
|
||||
ConfigDO convert(ConfigCreateReqVO bean);
|
||||
|
||||
InfConfigDO convert(ConfigUpdateReqVO bean);
|
||||
ConfigDO convert(ConfigUpdateReqVO bean);
|
||||
|
||||
List<ConfigExcelVO> convertList(List<InfConfigDO> list);
|
||||
List<ConfigExcelVO> convertList(List<ConfigDO> list);
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface FileConvert {
|
||||
|
||||
FileConvert INSTANCE = Mappers.getMapper(FileConvert.class);
|
||||
|
||||
FileRespVO convert(FileDO bean);
|
||||
|
||||
PageResult<FileRespVO> convertPage(PageResult<FileDO> page);
|
||||
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.file;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface InfFileConvert {
|
||||
|
||||
InfFileConvert INSTANCE = Mappers.getMapper(InfFileConvert.class);
|
||||
|
||||
InfFileRespVO convert(InfFileDO bean);
|
||||
|
||||
PageResult<InfFileRespVO> convertPage(PageResult<InfFileDO> page);
|
||||
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfJobConvert {
|
||||
|
||||
InfJobConvert INSTANCE = Mappers.getMapper(InfJobConvert.class);
|
||||
|
||||
InfJobDO convert(InfJobCreateReqVO bean);
|
||||
|
||||
InfJobDO convert(InfJobUpdateReqVO bean);
|
||||
|
||||
InfJobRespVO convert(InfJobDO bean);
|
||||
|
||||
List<InfJobRespVO> convertList(List<InfJobDO> list);
|
||||
|
||||
PageResult<InfJobRespVO> convertPage(PageResult<InfJobDO> page);
|
||||
|
||||
List<InfJobExcelVO> convertList02(List<InfJobDO> list);
|
||||
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务日志 Convert
|
||||
*
|
||||
* @author 芋艿
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfJobLogConvert {
|
||||
|
||||
InfJobLogConvert INSTANCE = Mappers.getMapper(InfJobLogConvert.class);
|
||||
|
||||
InfJobLogRespVO convert(InfJobLogDO bean);
|
||||
|
||||
List<InfJobLogRespVO> convertList(List<InfJobLogDO> list);
|
||||
|
||||
PageResult<InfJobLogRespVO> convertPage(PageResult<InfJobLogDO> page);
|
||||
|
||||
List<InfJobLogExcelVO> convertList02(List<InfJobLogDO> list);
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface JobConvert {
|
||||
|
||||
JobConvert INSTANCE = Mappers.getMapper(JobConvert.class);
|
||||
|
||||
JobDO convert(JobCreateReqVO bean);
|
||||
|
||||
JobDO convert(JobUpdateReqVO bean);
|
||||
|
||||
JobRespVO convert(JobDO bean);
|
||||
|
||||
List<JobRespVO> convertList(List<JobDO> list);
|
||||
|
||||
PageResult<JobRespVO> convertPage(PageResult<JobDO> page);
|
||||
|
||||
List<JobExcelVO> convertList02(List<JobDO> list);
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务日志 Convert
|
||||
*
|
||||
* @author 芋艿
|
||||
*/
|
||||
@Mapper
|
||||
public interface JobLogConvert {
|
||||
|
||||
JobLogConvert INSTANCE = Mappers.getMapper(JobLogConvert.class);
|
||||
|
||||
JobLogRespVO convert(JobLogDO bean);
|
||||
|
||||
List<JobLogRespVO> convertList(List<JobLogDO> list);
|
||||
|
||||
PageResult<JobLogRespVO> convertPage(PageResult<JobLogDO> page);
|
||||
|
||||
List<JobLogExcelVO> convertList02(List<JobLogDO> list);
|
||||
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API 访问日志 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiAccessLogConvert {
|
||||
|
||||
ApiAccessLogConvert INSTANCE = Mappers.getMapper(ApiAccessLogConvert.class);
|
||||
|
||||
ApiAccessLogRespVO convert(ApiAccessLogDO bean);
|
||||
|
||||
List<ApiAccessLogRespVO> convertList(List<ApiAccessLogDO> list);
|
||||
|
||||
PageResult<ApiAccessLogRespVO> convertPage(PageResult<ApiAccessLogDO> page);
|
||||
|
||||
List<ApiAccessLogExcelVO> convertList02(List<ApiAccessLogDO> list);
|
||||
|
||||
ApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean);
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API 错误日志 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiErrorLogConvert {
|
||||
|
||||
ApiErrorLogConvert INSTANCE = Mappers.getMapper(ApiErrorLogConvert.class);
|
||||
|
||||
ApiErrorLogRespVO convert(ApiErrorLogDO bean);
|
||||
|
||||
PageResult<ApiErrorLogRespVO> convertPage(PageResult<ApiErrorLogDO> page);
|
||||
|
||||
List<ApiErrorLogExcelVO> convertList02(List<ApiErrorLogDO> list);
|
||||
|
||||
ApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean);
|
||||
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API 访问日志 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfApiAccessLogConvert {
|
||||
|
||||
InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class);
|
||||
|
||||
InfApiAccessLogRespVO convert(InfApiAccessLogDO bean);
|
||||
|
||||
List<InfApiAccessLogRespVO> convertList(List<InfApiAccessLogDO> list);
|
||||
|
||||
PageResult<InfApiAccessLogRespVO> convertPage(PageResult<InfApiAccessLogDO> page);
|
||||
|
||||
List<InfApiAccessLogExcelVO> convertList02(List<InfApiAccessLogDO> list);
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface InfApiAccessLogCoreConvert {
|
||||
|
||||
InfApiAccessLogCoreConvert INSTANCE = Mappers.getMapper(InfApiAccessLogCoreConvert.class);
|
||||
|
||||
InfApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean);
|
||||
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* API 错误日志 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfApiErrorLogConvert {
|
||||
|
||||
InfApiErrorLogConvert INSTANCE = Mappers.getMapper(InfApiErrorLogConvert.class);
|
||||
|
||||
InfApiErrorLogRespVO convert(InfApiErrorLogDO bean);
|
||||
|
||||
PageResult<InfApiErrorLogRespVO> convertPage(PageResult<InfApiErrorLogDO> page);
|
||||
|
||||
List<InfApiErrorLogExcelVO> convertList02(List<InfApiErrorLogDO> list);
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.convert.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface InfApiErrorLogCoreConvert {
|
||||
|
||||
InfApiErrorLogCoreConvert INSTANCE = Mappers.getMapper(InfApiErrorLogCoreConvert.class);
|
||||
|
||||
InfApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean);
|
||||
|
||||
}
|
@@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.convert.redis;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -16,11 +16,11 @@ public interface RedisConvert {
|
||||
|
||||
RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class);
|
||||
|
||||
default InfRedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) {
|
||||
InfRedisMonitorRespVO respVO = InfRedisMonitorRespVO.builder().info(info).dbSize(dbSize)
|
||||
default RedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) {
|
||||
RedisMonitorRespVO respVO = RedisMonitorRespVO.builder().info(info).dbSize(dbSize)
|
||||
.commandStats(new ArrayList<>(commandStats.size())).build();
|
||||
commandStats.forEach((key, value) -> {
|
||||
respVO.getCommandStats().add(InfRedisMonitorRespVO.CommandStat.builder()
|
||||
respVO.getCommandStats().add(RedisMonitorRespVO.CommandStat.builder()
|
||||
.command(StrUtil.subAfter((String) key, "cmdstat_", false))
|
||||
.calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ",")))
|
||||
.usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ",")))
|
||||
@@ -29,6 +29,6 @@ public interface RedisConvert {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
List<InfRedisKeyRespVO> convertList(List<RedisKeyDefine> list);
|
||||
List<RedisKeyRespVO> convertList(List<RedisKeyDefine> list);
|
||||
|
||||
}
|
||||
|
@@ -13,11 +13,11 @@ import lombok.ToString;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("inf_config")
|
||||
@TableName("infra_config")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class InfConfigDO extends BaseDO {
|
||||
public class ConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 参数主键
|
@@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.dataobject.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
@@ -16,13 +15,13 @@ import java.io.InputStream;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
@TableName("inf_file")
|
||||
@TableName("infra_file")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfFileDO extends TenantBaseDO {
|
||||
public class FileDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 文件路径
|
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.dataobject.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@@ -11,14 +11,14 @@ import lombok.*;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("inf_job")
|
||||
@TableName("infra_job")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfJobDO extends BaseDO {
|
||||
public class JobDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
@@ -32,7 +32,7 @@ public class InfJobDO extends BaseDO {
|
||||
/**
|
||||
* 任务状态
|
||||
*
|
||||
* 枚举 {@link InfJobStatusEnum}
|
||||
* 枚举 {@link JobStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
@@ -13,14 +13,14 @@ import java.util.Date;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("inf_job_log")
|
||||
@TableName("infra_job_log")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfJobLogDO extends BaseDO {
|
||||
public class JobLogDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 日志编号
|
||||
@@ -29,19 +29,19 @@ public class InfJobLogDO extends BaseDO {
|
||||
/**
|
||||
* 任务编号
|
||||
*
|
||||
* 关联 {@link InfJobDO#getId()}
|
||||
* 关联 {@link JobDO#getId()}
|
||||
*/
|
||||
private Long jobId;
|
||||
/**
|
||||
* 处理器的名字
|
||||
*
|
||||
* 冗余字段 {@link InfJobDO#getHandlerName()}
|
||||
* 冗余字段 {@link JobDO#getHandlerName()}
|
||||
*/
|
||||
private String handlerName;
|
||||
/**
|
||||
* 处理器的参数
|
||||
*
|
||||
* 冗余字段 {@link InfJobDO#getHandlerParam()}
|
||||
* 冗余字段 {@link JobDO#getHandlerParam()}
|
||||
*/
|
||||
private String handlerParam;
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class InfJobLogDO extends BaseDO {
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link InfJobLogStatusEnum}
|
||||
* 枚举 {@link JobLogStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
@@ -14,14 +14,14 @@ import java.util.Date;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("inf_api_access_log")
|
||||
@TableName("infra_api_access_log")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfApiAccessLogDO extends TenantBaseDO {
|
||||
public class ApiAccessLogDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
@@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.dataobject.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -14,14 +13,14 @@ import java.util.Date;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("inf_api_error_log")
|
||||
@TableName("infra_api_error_log")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InfApiErrorLogDO extends TenantBaseDO {
|
||||
public class ApiErrorLogDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
@@ -16,11 +16,11 @@ import java.util.List;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class InfConfigCoreDAOImpl implements ConfigFrameworkDAO {
|
||||
public class ConfigCoreDAOImpl implements ConfigFrameworkDAO {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
public InfConfigCoreDAOImpl(String jdbcUrl, String username, String password) {
|
||||
public ConfigCoreDAOImpl(String jdbcUrl, String username, String password) {
|
||||
DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
}
|
@@ -1,33 +1,33 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.config;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface InfConfigMapper extends BaseMapperX<InfConfigDO> {
|
||||
public interface ConfigMapper extends BaseMapperX<ConfigDO> {
|
||||
|
||||
default InfConfigDO selectByKey(String key) {
|
||||
return selectOne(new QueryWrapper<InfConfigDO>().eq("`key`", key));
|
||||
default ConfigDO selectByKey(String key) {
|
||||
return selectOne(new QueryWrapper<ConfigDO>().eq("`key`", key));
|
||||
}
|
||||
|
||||
default PageResult<InfConfigDO> selectPage(ConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfConfigDO>()
|
||||
default PageResult<ConfigDO> selectPage(ConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ConfigDO>()
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.likeIfPresent("`key`", reqVO.getKey())
|
||||
.eqIfPresent("`type`", reqVO.getType())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
|
||||
}
|
||||
|
||||
default List<InfConfigDO> selectList(ConfigExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<InfConfigDO>()
|
||||
default List<ConfigDO> selectList(ConfigExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ConfigDO>()
|
||||
.likeIfPresent("name", reqVO.getName())
|
||||
.likeIfPresent("`key`", reqVO.getKey())
|
||||
.eqIfPresent("`type`", reqVO.getType())
|
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 文件操作 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface FileMapper extends BaseMapperX<FileDO> {
|
||||
|
||||
default PageResult<FileDO> selectPage(FilePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<FileDO>()
|
||||
.likeIfPresent("id", reqVO.getId())
|
||||
.likeIfPresent("type", reqVO.getType())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc("create_time"));
|
||||
}
|
||||
|
||||
default Integer selectCountById(String id) {
|
||||
return selectCount(FileDO::getId, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于 Path 获取文件
|
||||
* 实际上,是基于 ID 查询
|
||||
* 由于前端使用 <img /> 的方式获取图片,所以需要忽略租户的查询
|
||||
*
|
||||
* @param path 路径
|
||||
* @return 文件
|
||||
*/
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
default FileDO selectByPath(String path) {
|
||||
return selectById(path);
|
||||
}
|
||||
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InfFileCoreMapper extends BaseMapperX<InfFileDO> {
|
||||
|
||||
default Integer selectCountById(String id) {
|
||||
return selectCount(InfFileDO::getId, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于 Path 获取文件
|
||||
* 实际上,是基于 ID 查询
|
||||
* 由于前端使用 <img /> 的方式获取图片,所以需要忽略租户的查询
|
||||
*
|
||||
* @param path 路径
|
||||
* @return 文件
|
||||
*/
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
default InfFileDO selectByPath(String path) {
|
||||
return selectById(path);
|
||||
}
|
||||
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.file;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* admin 文件操作 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfFileMapper extends BaseMapperX<InfFileDO> {
|
||||
default PageResult<InfFileDO> selectPage(InfFilePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfFileDO>()
|
||||
.likeIfPresent("id", reqVO.getId())
|
||||
.likeIfPresent("type", reqVO.getType())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc("create_time"));
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.job;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfJobMapper extends BaseMapperX<InfJobDO> {
|
||||
|
||||
default InfJobDO selectByHandlerName(String handlerName) {
|
||||
return selectOne(InfJobDO::getHandlerName, handlerName);
|
||||
}
|
||||
|
||||
default PageResult<InfJobDO> selectPage(InfJobPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<InfJobDO>()
|
||||
.likeIfPresent(InfJobDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfJobDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName())
|
||||
);
|
||||
}
|
||||
|
||||
default List<InfJobDO> selectList(InfJobExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<InfJobDO>()
|
||||
.likeIfPresent(InfJobDO::getName, reqVO.getName())
|
||||
.eqIfPresent(InfJobDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,10 +16,10 @@ import java.util.List;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfJobLogMapper extends BaseMapperX<InfJobLogDO> {
|
||||
public interface JobLogMapper extends BaseMapperX<JobLogDO> {
|
||||
|
||||
default PageResult<InfJobLogDO> selectPage(InfJobLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfJobLogDO>()
|
||||
default PageResult<JobLogDO> selectPage(JobLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<JobLogDO>()
|
||||
.eqIfPresent("job_id", reqVO.getJobId())
|
||||
.likeIfPresent("handler_name", reqVO.getHandlerName())
|
||||
.geIfPresent("begin_time", reqVO.getBeginTime())
|
||||
@@ -29,8 +29,8 @@ public interface InfJobLogMapper extends BaseMapperX<InfJobLogDO> {
|
||||
);
|
||||
}
|
||||
|
||||
default List<InfJobLogDO> selectList(InfJobLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<InfJobLogDO>()
|
||||
default List<JobLogDO> selectList(JobLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<JobLogDO>()
|
||||
.eqIfPresent("job_id", reqVO.getJobId())
|
||||
.likeIfPresent("handler_name", reqVO.getHandlerName())
|
||||
.geIfPresent("begin_time", reqVO.getBeginTime())
|
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.job;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface JobMapper extends BaseMapperX<JobDO> {
|
||||
|
||||
default JobDO selectByHandlerName(String handlerName) {
|
||||
return selectOne(JobDO::getHandlerName, handlerName);
|
||||
}
|
||||
|
||||
default PageResult<JobDO> selectPage(JobPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<JobDO>()
|
||||
.likeIfPresent(JobDO::getName, reqVO.getName())
|
||||
.eqIfPresent(JobDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName())
|
||||
);
|
||||
}
|
||||
|
||||
default List<JobDO> selectList(JobExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<JobDO>()
|
||||
.likeIfPresent(JobDO::getName, reqVO.getName())
|
||||
.eqIfPresent(JobDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,10 +16,10 @@ import java.util.List;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> {
|
||||
public interface ApiAccessLogMapper extends BaseMapperX<ApiAccessLogDO> {
|
||||
|
||||
default PageResult<InfApiAccessLogDO> selectPage(InfApiAccessLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfApiAccessLogDO>()
|
||||
default PageResult<ApiAccessLogDO> selectPage(ApiAccessLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
@@ -31,8 +31,8 @@ public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> {
|
||||
);
|
||||
}
|
||||
|
||||
default List<InfApiAccessLogDO> selectList(InfApiAccessLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<InfApiAccessLogDO>()
|
||||
default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
@@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,10 +16,10 @@ import java.util.List;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfApiErrorLogMapper extends BaseMapperX<InfApiErrorLogDO> {
|
||||
public interface ApiErrorLogMapper extends BaseMapperX<ApiErrorLogDO> {
|
||||
|
||||
default PageResult<InfApiErrorLogDO> selectPage(InfApiErrorLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<InfApiErrorLogDO>()
|
||||
default PageResult<ApiErrorLogDO> selectPage(ApiErrorLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
@@ -30,8 +30,8 @@ public interface InfApiErrorLogMapper extends BaseMapperX<InfApiErrorLogDO> {
|
||||
);
|
||||
}
|
||||
|
||||
default List<InfApiErrorLogDO> selectList(InfApiErrorLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<InfApiErrorLogDO>()
|
||||
default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* API 访问日志 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface InfApiAccessLogCoreMapper extends BaseMapperX<InfApiAccessLogDO> {
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InfApiErrorLogCoreMapper extends BaseMapperX<InfApiErrorLogDO> {
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* System 错误码枚举类
|
||||
*
|
||||
* system 系统,使用 1-006-000-000 段
|
||||
*/
|
||||
public interface SysErrorCodeConstants {
|
||||
|
||||
// ========= 文件相关 1006001000=================
|
||||
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在");
|
||||
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件不存在");
|
||||
|
||||
}
|
@@ -5,7 +5,7 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InfConfigTypeEnum {
|
||||
public enum ConfigTypeEnum {
|
||||
|
||||
/**
|
||||
* 系统配置
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InfJobLogStatusEnum {
|
||||
public enum JobLogStatusEnum {
|
||||
|
||||
RUNNING(0), // 运行中
|
||||
SUCCESS(1), // 成功
|
@@ -3,12 +3,11 @@ package cn.iocoder.yudao.module.infra.enums.job;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.quartz.impl.jdbcjobstore.Constants;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.quartz.impl.jdbcjobstore.Constants.*;
|
||||
|
||||
/**
|
||||
* 任务状态的枚举
|
||||
*
|
||||
@@ -16,7 +15,7 @@ import static org.quartz.impl.jdbcjobstore.Constants.*;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InfJobStatusEnum {
|
||||
public enum JobStatusEnum {
|
||||
|
||||
/**
|
||||
* 初始化中
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum InfApiErrorLogProcessStatusEnum {
|
||||
public enum ApiErrorLogProcessStatusEnum {
|
||||
|
||||
INIT(0, "未处理"),
|
||||
DONE(1, "已处理"),
|
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.infra.file.config;
|
||||
package cn.iocoder.yudao.module.infra.framework.file.config;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.infra.file.config;
|
||||
package cn.iocoder.yudao.module.infra.framework.file.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
@@ -13,4 +13,4 @@
|
||||
* 综合考虑,暂时使用方案 3 的方式,比较适合这样一个 all in one 的项目。
|
||||
* 随着文件的量级大了之后,还是推荐采用云服务。
|
||||
*/
|
||||
package cn.iocoder.yudao.coreservice.modules.infra.framework.file;
|
||||
package cn.iocoder.yudao.module.infra.framework.file;
|
@@ -2,21 +2,21 @@ package cn.iocoder.yudao.module.infra.mq.consumer.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository;
|
||||
import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener;
|
||||
import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage;
|
||||
import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 针对 {@link InfConfigRefreshMessage} 的消费者
|
||||
* 针对 {@link ConfigRefreshMessage} 的消费者
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class InfConfigRefreshConsumer extends AbstractChannelMessageListener<InfConfigRefreshMessage> {
|
||||
public class ConfigRefreshConsumer extends AbstractChannelMessageListener<ConfigRefreshMessage> {
|
||||
|
||||
@Override
|
||||
public void onMessage(InfConfigRefreshMessage message) {
|
||||
public void onMessage(ConfigRefreshMessage message) {
|
||||
log.info("[onMessage][收到 Config 刷新消息]");
|
||||
DBConfigRepository.noticeSync();
|
||||
}
|
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
* 配置数据刷新 Message
|
||||
*/
|
||||
@Data
|
||||
public class InfConfigRefreshMessage extends AbstractChannelMessage {
|
||||
public class ConfigRefreshMessage extends AbstractChannelMessage {
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
@@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.infra.mq.producer.config;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage;
|
||||
import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage;
|
||||
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -10,16 +10,16 @@ import javax.annotation.Resource;
|
||||
* Config 配置相关消息的 Producer
|
||||
*/
|
||||
@Component
|
||||
public class InfConfigProducer {
|
||||
public class ConfigProducer {
|
||||
|
||||
@Resource
|
||||
private RedisMQTemplate redisMQTemplate;
|
||||
|
||||
/**
|
||||
* 发送 {@link InfConfigRefreshMessage} 消息
|
||||
* 发送 {@link ConfigRefreshMessage} 消息
|
||||
*/
|
||||
public void sendConfigRefreshMessage() {
|
||||
InfConfigRefreshMessage message = new InfConfigRefreshMessage();
|
||||
ConfigRefreshMessage message = new ConfigRefreshMessage();
|
||||
redisMQTemplate.send(message);
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.infra.service.config;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfConfigService {
|
||||
public interface ConfigService {
|
||||
|
||||
/**
|
||||
* 创建参数配置
|
||||
@@ -45,7 +45,7 @@ public interface InfConfigService {
|
||||
* @param id 配置编号
|
||||
* @return 参数配置
|
||||
*/
|
||||
InfConfigDO getConfig(Long id);
|
||||
ConfigDO getConfig(Long id);
|
||||
|
||||
/**
|
||||
* 根据参数键,获得参数配置
|
||||
@@ -53,7 +53,7 @@ public interface InfConfigService {
|
||||
* @param key 配置键
|
||||
* @return 参数配置
|
||||
*/
|
||||
InfConfigDO getConfigByKey(String key);
|
||||
ConfigDO getConfigByKey(String key);
|
||||
|
||||
/**
|
||||
* 获得参数配置分页列表
|
||||
@@ -61,7 +61,7 @@ public interface InfConfigService {
|
||||
* @param reqVO 分页条件
|
||||
* @return 分页列表
|
||||
*/
|
||||
PageResult<InfConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO);
|
||||
PageResult<ConfigDO> getConfigPage(@Valid ConfigPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得参数配置列表
|
||||
@@ -69,7 +69,7 @@ public interface InfConfigService {
|
||||
* @param reqVO 列表
|
||||
* @return 列表
|
||||
*/
|
||||
List<InfConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO);
|
||||
List<ConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO);
|
||||
|
||||
|
||||
}
|
@@ -1,25 +1,23 @@
|
||||
package cn.iocoder.yudao.module.infra.service.config.impl;
|
||||
package cn.iocoder.yudao.module.infra.service.config;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.config.InfConfigMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.config.InfConfigTypeEnum;
|
||||
import cn.iocoder.yudao.module.infra.mq.producer.config.InfConfigProducer;
|
||||
import cn.iocoder.yudao.module.infra.service.config.InfConfigService;
|
||||
import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum;
|
||||
import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -28,21 +26,21 @@ import java.util.List;
|
||||
@Service
|
||||
@Slf4j
|
||||
@Validated
|
||||
public class InfConfigServiceImpl implements InfConfigService {
|
||||
public class ConfigServiceImpl implements ConfigService {
|
||||
|
||||
@Resource
|
||||
private InfConfigMapper configMapper;
|
||||
private ConfigMapper configMapper;
|
||||
|
||||
@Resource
|
||||
private InfConfigProducer configProducer;
|
||||
private ConfigProducer configProducer;
|
||||
|
||||
@Override
|
||||
public Long createConfig(ConfigCreateReqVO reqVO) {
|
||||
// 校验正确性
|
||||
checkCreateOrUpdate(null, reqVO.getKey());
|
||||
// 插入参数配置
|
||||
InfConfigDO config = InfConfigConvert.INSTANCE.convert(reqVO);
|
||||
config.setType(InfConfigTypeEnum.CUSTOM.getType());
|
||||
ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO);
|
||||
config.setType(ConfigTypeEnum.CUSTOM.getType());
|
||||
configMapper.insert(config);
|
||||
// 发送刷新消息
|
||||
configProducer.sendConfigRefreshMessage();
|
||||
@@ -54,7 +52,7 @@ public class InfConfigServiceImpl implements InfConfigService {
|
||||
// 校验正确性
|
||||
checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key
|
||||
// 更新参数配置
|
||||
InfConfigDO updateObj = InfConfigConvert.INSTANCE.convert(reqVO);
|
||||
ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO);
|
||||
configMapper.updateById(updateObj);
|
||||
// 发送刷新消息
|
||||
configProducer.sendConfigRefreshMessage();
|
||||
@@ -63,10 +61,10 @@ public class InfConfigServiceImpl implements InfConfigService {
|
||||
@Override
|
||||
public void deleteConfig(Long id) {
|
||||
// 校验配置存在
|
||||
InfConfigDO config = checkConfigExists(id);
|
||||
ConfigDO config = checkConfigExists(id);
|
||||
// 内置配置,不允许删除
|
||||
if (InfConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||
throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||
}
|
||||
// 删除
|
||||
configMapper.deleteById(id);
|
||||
@@ -75,22 +73,22 @@ public class InfConfigServiceImpl implements InfConfigService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfConfigDO getConfig(Long id) {
|
||||
public ConfigDO getConfig(Long id) {
|
||||
return configMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfConfigDO getConfigByKey(String key) {
|
||||
public ConfigDO getConfigByKey(String key) {
|
||||
return configMapper.selectByKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfConfigDO> getConfigPage(ConfigPageReqVO reqVO) {
|
||||
public PageResult<ConfigDO> getConfigPage(ConfigPageReqVO reqVO) {
|
||||
return configMapper.selectPage(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfConfigDO> getConfigList(ConfigExportReqVO reqVO) {
|
||||
public List<ConfigDO> getConfigList(ConfigExportReqVO reqVO) {
|
||||
return configMapper.selectList(reqVO);
|
||||
}
|
||||
|
||||
@@ -102,29 +100,29 @@ public class InfConfigServiceImpl implements InfConfigService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public InfConfigDO checkConfigExists(Long id) {
|
||||
public ConfigDO checkConfigExists(Long id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
InfConfigDO config = configMapper.selectById(id);
|
||||
ConfigDO config = configMapper.selectById(id);
|
||||
if (config == null) {
|
||||
throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_NOT_EXISTS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_NOT_EXISTS);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void checkConfigKeyUnique(Long id, String key) {
|
||||
InfConfigDO config = configMapper.selectByKey(key);
|
||||
ConfigDO config = configMapper.selectByKey(key);
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的参数配置
|
||||
if (id == null) {
|
||||
throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
||||
}
|
||||
if (!config.getId().equals(id)) {
|
||||
throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface FileService {
|
||||
|
||||
/**
|
||||
* 获得文件分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 文件分页
|
||||
*/
|
||||
PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 保存文件,并返回文件的访问路径
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
String createFile(String path, byte[] content);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFile(String id);
|
||||
|
||||
/**
|
||||
* 获得文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @return 文件
|
||||
*/
|
||||
FileDO getFile(String path);
|
||||
|
||||
}
|
@@ -1,39 +1,45 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file.impl;
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.hutool.core.io.FileTypeUtil;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper;
|
||||
import cn.iocoder.yudao.module.infra.framework.file.config.FileProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* core service 文件实现类
|
||||
* 文件 Service 实现类
|
||||
*
|
||||
* @author 宋天
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class InfFileCoreServiceImpl implements InfFileCoreService {
|
||||
public class FileServiceImpl implements FileService {
|
||||
|
||||
@Resource
|
||||
private InfFileCoreMapper fileMapper;
|
||||
private FileMapper fileMapper;
|
||||
|
||||
@Resource
|
||||
private FileProperties fileProperties;
|
||||
|
||||
@Override
|
||||
public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) {
|
||||
return fileMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createFile(String path, byte[] content) {
|
||||
if (fileMapper.selectCountById(path) > 0) {
|
||||
throw exception(FILE_PATH_EXISTS);
|
||||
}
|
||||
// 保存到数据库
|
||||
InfFileDO file = new InfFileDO();
|
||||
FileDO file = new FileDO();
|
||||
file.setId(path);
|
||||
file.setType(FileTypeUtil.getType(new ByteArrayInputStream(content)));
|
||||
file.setContent(content);
|
||||
@@ -57,7 +63,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfFileDO getFile(String path) {
|
||||
public FileDO getFile(String path) {
|
||||
return fileMapper.selectByPath(path);
|
||||
}
|
||||
|
@@ -1,35 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
|
||||
/**
|
||||
* core service 文件接口
|
||||
*
|
||||
* @author 宋天
|
||||
*/
|
||||
public interface InfFileCoreService {
|
||||
|
||||
/**
|
||||
* 保存文件,并返回文件的访问路径
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @param content 文件内容
|
||||
* @return 文件路径
|
||||
*/
|
||||
String createFile(String path, byte[] content);
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFile(String id);
|
||||
|
||||
/**
|
||||
* 获得文件
|
||||
*
|
||||
* @param path 文件路径
|
||||
* @return 文件
|
||||
*/
|
||||
InfFileDO getFile(String path);
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 文件 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfFileService {
|
||||
|
||||
/**
|
||||
* 获得文件分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 文件分页
|
||||
*/
|
||||
PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO);
|
||||
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.infra.service.file.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.InfFileMapper;
|
||||
import cn.iocoder.yudao.module.infra.service.file.InfFileService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 文件 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
public class InfFileServiceImpl implements InfFileService {
|
||||
|
||||
@Resource
|
||||
private InfFileMapper fileMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<InfFileDO> getFilePage(InfFilePageReqVO pageReqVO) {
|
||||
return fileMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfJobLogService extends JobLogFrameworkService {
|
||||
public interface JobLogService extends JobLogFrameworkService {
|
||||
|
||||
/**
|
||||
* 获得定时任务
|
||||
@@ -22,7 +22,7 @@ public interface InfJobLogService extends JobLogFrameworkService {
|
||||
* @param id 编号
|
||||
* @return 定时任务
|
||||
*/
|
||||
InfJobLogDO getJobLog(Long id);
|
||||
JobLogDO getJobLog(Long id);
|
||||
|
||||
/**
|
||||
* 获得定时任务列表
|
||||
@@ -30,7 +30,7 @@ public interface InfJobLogService extends JobLogFrameworkService {
|
||||
* @param ids 编号
|
||||
* @return 定时任务列表
|
||||
*/
|
||||
List<InfJobLogDO> getJobLogList(Collection<Long> ids);
|
||||
List<JobLogDO> getJobLogList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得定时任务分页
|
||||
@@ -38,7 +38,7 @@ public interface InfJobLogService extends JobLogFrameworkService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 定时任务分页
|
||||
*/
|
||||
PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO);
|
||||
PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得定时任务列表, 用于 Excel 导出
|
||||
@@ -46,6 +46,6 @@ public interface InfJobLogService extends JobLogFrameworkService {
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 定时任务分页
|
||||
*/
|
||||
List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO);
|
||||
List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO);
|
||||
|
||||
}
|
@@ -1,12 +1,11 @@
|
||||
package cn.iocoder.yudao.module.infra.service.job.impl;
|
||||
package cn.iocoder.yudao.module.infra.service.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobLogMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum;
|
||||
import cn.iocoder.yudao.module.infra.service.job.InfJobLogService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,15 +24,15 @@ import java.util.List;
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class InfJobLogServiceImpl implements InfJobLogService {
|
||||
public class JobLogServiceImpl implements JobLogService {
|
||||
|
||||
@Resource
|
||||
private InfJobLogMapper jobLogMapper;
|
||||
private JobLogMapper jobLogMapper;
|
||||
|
||||
@Override
|
||||
public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) {
|
||||
InfJobLogDO log = InfJobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex)
|
||||
.beginTime(beginTime).status(InfJobLogStatusEnum.RUNNING.getStatus()).build();
|
||||
JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex)
|
||||
.beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build();
|
||||
jobLogMapper.insert(log);
|
||||
return log.getId();
|
||||
}
|
||||
@@ -42,8 +41,8 @@ public class InfJobLogServiceImpl implements InfJobLogService {
|
||||
@Async
|
||||
public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) {
|
||||
try {
|
||||
InfJobLogDO updateObj = InfJobLogDO.builder().id(logId).endTime(endTime).duration(duration)
|
||||
.status(success ? InfJobLogStatusEnum.SUCCESS.getStatus() : InfJobLogStatusEnum.FAILURE.getStatus()).result(result).build();
|
||||
JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration)
|
||||
.status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()).result(result).build();
|
||||
jobLogMapper.updateById(updateObj);
|
||||
} catch (Exception ex) {
|
||||
log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]",
|
||||
@@ -52,22 +51,22 @@ public class InfJobLogServiceImpl implements InfJobLogService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfJobLogDO getJobLog(Long id) {
|
||||
public JobLogDO getJobLog(Long id) {
|
||||
return jobLogMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfJobLogDO> getJobLogList(Collection<Long> ids) {
|
||||
public List<JobLogDO> getJobLogList(Collection<Long> ids) {
|
||||
return jobLogMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfJobLogDO> getJobLogPage(InfJobLogPageReqVO pageReqVO) {
|
||||
public PageResult<JobLogDO> getJobLogPage(JobLogPageReqVO pageReqVO) {
|
||||
return jobLogMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfJobLogDO> getJobLogList(InfJobLogExportReqVO exportReqVO) {
|
||||
public List<JobLogDO> getJobLogList(JobLogExportReqVO exportReqVO) {
|
||||
return jobLogMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package cn.iocoder.yudao.module.infra.service.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface InfJobService {
|
||||
public interface JobService {
|
||||
|
||||
/**
|
||||
* 创建定时任务
|
||||
@@ -25,14 +25,14 @@ public interface InfJobService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createJob(@Valid InfJobCreateReqVO createReqVO) throws SchedulerException;
|
||||
Long createJob(@Valid JobCreateReqVO createReqVO) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateJob(@Valid InfJobUpdateReqVO updateReqVO) throws SchedulerException;
|
||||
void updateJob(@Valid JobUpdateReqVO updateReqVO) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 更新定时任务的状态
|
||||
@@ -62,7 +62,7 @@ public interface InfJobService {
|
||||
* @param id 编号
|
||||
* @return 定时任务
|
||||
*/
|
||||
InfJobDO getJob(Long id);
|
||||
JobDO getJob(Long id);
|
||||
|
||||
/**
|
||||
* 获得定时任务列表
|
||||
@@ -70,7 +70,7 @@ public interface InfJobService {
|
||||
* @param ids 编号
|
||||
* @return 定时任务列表
|
||||
*/
|
||||
List<InfJobDO> getJobList(Collection<Long> ids);
|
||||
List<JobDO> getJobList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得定时任务分页
|
||||
@@ -78,7 +78,7 @@ public interface InfJobService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 定时任务分页
|
||||
*/
|
||||
PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO);
|
||||
PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得定时任务列表, 用于 Excel 导出
|
||||
@@ -86,6 +86,6 @@ public interface InfJobService {
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 定时任务分页
|
||||
*/
|
||||
List<InfJobDO> getJobList(InfJobExportReqVO exportReqVO);
|
||||
List<JobDO> getJobList(JobExportReqVO exportReqVO);
|
||||
|
||||
}
|
@@ -1,17 +1,16 @@
|
||||
package cn.iocoder.yudao.module.infra.service.job.impl;
|
||||
package cn.iocoder.yudao.module.infra.service.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager;
|
||||
import cn.iocoder.yudao.framework.quartz.core.util.CronUtils;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum;
|
||||
import cn.iocoder.yudao.module.infra.service.job.InfJobService;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.infra.convert.job.JobConvert;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper;
|
||||
import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -22,7 +21,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny;
|
||||
|
||||
/**
|
||||
@@ -32,25 +31,25 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class InfJobServiceImpl implements InfJobService {
|
||||
public class JobServiceImpl implements JobService {
|
||||
|
||||
@Resource
|
||||
private InfJobMapper jobMapper;
|
||||
private JobMapper jobMapper;
|
||||
|
||||
@Resource
|
||||
private SchedulerManager schedulerManager;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createJob(InfJobCreateReqVO createReqVO) throws SchedulerException {
|
||||
public Long createJob(JobCreateReqVO createReqVO) throws SchedulerException {
|
||||
validateCronExpression(createReqVO.getCronExpression());
|
||||
// 校验唯一性
|
||||
if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) {
|
||||
throw exception(JOB_HANDLER_EXISTS);
|
||||
}
|
||||
// 插入
|
||||
InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO);
|
||||
job.setStatus(InfJobStatusEnum.INIT.getStatus());
|
||||
JobDO job = JobConvert.INSTANCE.convert(createReqVO);
|
||||
job.setStatus(JobStatusEnum.INIT.getStatus());
|
||||
fillJobMonitorTimeoutEmpty(job);
|
||||
jobMapper.insert(job);
|
||||
|
||||
@@ -58,7 +57,7 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(),
|
||||
createReqVO.getRetryCount(), createReqVO.getRetryInterval());
|
||||
// 更新
|
||||
InfJobDO updateObj = InfJobDO.builder().id(job.getId()).status(InfJobStatusEnum.NORMAL.getStatus()).build();
|
||||
JobDO updateObj = JobDO.builder().id(job.getId()).status(JobStatusEnum.NORMAL.getStatus()).build();
|
||||
jobMapper.updateById(updateObj);
|
||||
|
||||
// 返回
|
||||
@@ -67,16 +66,16 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateJob(InfJobUpdateReqVO updateReqVO) throws SchedulerException {
|
||||
public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException {
|
||||
validateCronExpression(updateReqVO.getCronExpression());
|
||||
// 校验存在
|
||||
InfJobDO job = this.validateJobExists(updateReqVO.getId());
|
||||
JobDO job = this.validateJobExists(updateReqVO.getId());
|
||||
// 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行
|
||||
if (!job.getStatus().equals(InfJobStatusEnum.NORMAL.getStatus())) {
|
||||
if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) {
|
||||
throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS);
|
||||
}
|
||||
// 更新
|
||||
InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO);
|
||||
JobDO updateObj = JobConvert.INSTANCE.convert(updateReqVO);
|
||||
fillJobMonitorTimeoutEmpty(updateObj);
|
||||
jobMapper.updateById(updateObj);
|
||||
|
||||
@@ -89,21 +88,21 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateJobStatus(Long id, Integer status) throws SchedulerException {
|
||||
// 校验 status
|
||||
if (!containsAny(status, InfJobStatusEnum.NORMAL.getStatus(), InfJobStatusEnum.STOP.getStatus())) {
|
||||
if (!containsAny(status, JobStatusEnum.NORMAL.getStatus(), JobStatusEnum.STOP.getStatus())) {
|
||||
throw exception(JOB_CHANGE_STATUS_INVALID);
|
||||
}
|
||||
// 校验存在
|
||||
InfJobDO job = this.validateJobExists(id);
|
||||
JobDO job = this.validateJobExists(id);
|
||||
// 校验是否已经为当前状态
|
||||
if (job.getStatus().equals(status)) {
|
||||
throw exception(JOB_CHANGE_STATUS_EQUALS);
|
||||
}
|
||||
// 更新 Job 状态
|
||||
InfJobDO updateObj = InfJobDO.builder().id(id).status(status).build();
|
||||
JobDO updateObj = JobDO.builder().id(id).status(status).build();
|
||||
jobMapper.updateById(updateObj);
|
||||
|
||||
// 更新状态 Job 到 Quartz 中
|
||||
if (InfJobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启
|
||||
if (JobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启
|
||||
schedulerManager.resumeJob(job.getHandlerName());
|
||||
} else { // 暂停
|
||||
schedulerManager.pauseJob(job.getHandlerName());
|
||||
@@ -113,7 +112,7 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
@Override
|
||||
public void triggerJob(Long id) throws SchedulerException {
|
||||
// 校验存在
|
||||
InfJobDO job = this.validateJobExists(id);
|
||||
JobDO job = this.validateJobExists(id);
|
||||
|
||||
// 触发 Quartz 中的 Job
|
||||
schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam());
|
||||
@@ -123,7 +122,7 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteJob(Long id) throws SchedulerException {
|
||||
// 校验存在
|
||||
InfJobDO job = this.validateJobExists(id);
|
||||
JobDO job = this.validateJobExists(id);
|
||||
// 更新
|
||||
jobMapper.deleteById(id);
|
||||
|
||||
@@ -131,8 +130,8 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
schedulerManager.deleteJob(job.getHandlerName());
|
||||
}
|
||||
|
||||
private InfJobDO validateJobExists(Long id) {
|
||||
InfJobDO job = jobMapper.selectById(id);
|
||||
private JobDO validateJobExists(Long id) {
|
||||
JobDO job = jobMapper.selectById(id);
|
||||
if (job == null) {
|
||||
throw exception(JOB_NOT_EXISTS);
|
||||
}
|
||||
@@ -146,26 +145,26 @@ public class InfJobServiceImpl implements InfJobService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfJobDO getJob(Long id) {
|
||||
public JobDO getJob(Long id) {
|
||||
return jobMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfJobDO> getJobList(Collection<Long> ids) {
|
||||
public List<JobDO> getJobList(Collection<Long> ids) {
|
||||
return jobMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<InfJobDO> getJobPage(InfJobPageReqVO pageReqVO) {
|
||||
public PageResult<JobDO> getJobPage(JobPageReqVO pageReqVO) {
|
||||
return jobMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InfJobDO> getJobList(InfJobExportReqVO exportReqVO) {
|
||||
public List<JobDO> getJobList(JobExportReqVO exportReqVO) {
|
||||
return jobMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
private static void fillJobMonitorTimeoutEmpty(InfJobDO job) {
|
||||
private static void fillJobMonitorTimeoutEmpty(JobDO job) {
|
||||
if (job.getMonitorTimeout() == null) {
|
||||
job.setMonitorTimeout(0);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user