feat: 任务调度日志,修改部分缺陷,新增文档内容
This commit is contained in:
parent
d44b9f1138
commit
5f38730956
88
ReadMe.md
88
ReadMe.md
|
@ -118,3 +118,91 @@ docker run -d \
|
||||||
-e "MINIO_ROOT_PASSWORD=02120212" \
|
-e "MINIO_ROOT_PASSWORD=02120212" \
|
||||||
minio/minio server /data --console-address ":9090"
|
minio/minio server /data --console-address ":9090"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Quartz 方法
|
||||||
|
|
||||||
|
## TriggerBuilder
|
||||||
|
|
||||||
|
`TriggerBuilder` 是一个用于构建 `Trigger` 实例的类。它提供了一系列方法来设置触发器的各种属性。以下是一些常用的方法:
|
||||||
|
|
||||||
|
1. `withIdentity(String name, String group)` 或 `withIdentity(TriggerKey triggerKey)`:设置触发器的名称和组名。
|
||||||
|
|
||||||
|
2. `startAt(Date startTime)`:设置触发器首次触发的时间。
|
||||||
|
|
||||||
|
3. `endAt(Date endTime)`:设置触发器最后一次触发的时间。
|
||||||
|
|
||||||
|
4. `withSchedule(ScheduleBuilder scheduleBuilder)`:设置触发器的调度计划,可以是简单重复、按日历重复等。
|
||||||
|
|
||||||
|
5. `forJob(JobKey jobKey)` 或 `forJob(String jobName, String jobGroup)`:指定触发器关联的作业(Job)。
|
||||||
|
|
||||||
|
6. `usingJobData(String key, String value)`:为触发器添加自定义数据。
|
||||||
|
|
||||||
|
7. `modifiedByCalendar(String calName)`:指定一个日历,用于修改触发器的触发时间。
|
||||||
|
|
||||||
|
8. `build()`:构建并返回最终的 `Trigger` 实例。
|
||||||
|
|
||||||
|
9. `withDescription(String description)`:为触发器设置描述信息。
|
||||||
|
|
||||||
|
10. `usingJobData(JobDataMap jobData)`:使用 `JobDataMap` 为触发器设置多个作业数据。
|
||||||
|
|
||||||
|
11. `withPriority(int priority)`:设置触发器的优先级。
|
||||||
|
|
||||||
|
12. `replaceTriggerKey(TriggerKey oldKey, TriggerKey newKey)`:替换触发器的键值。
|
||||||
|
|
||||||
|
## JobBuilder
|
||||||
|
|
||||||
|
`JobBuilder` 类用于构建 `JobDetail` 实例,它定义了要执行的作业(Job)的属性。以下是一些常用的方法:
|
||||||
|
|
||||||
|
1. `withIdentity(String name, String group)` 或 `withIdentity(JobKey jobKey)`:设置作业的名称和组名。
|
||||||
|
|
||||||
|
2. `storeDurably()`:当作业没有触发器时,仍然允许作业被存储。这对于持久作业(即不被触发器触发,但可以手动调度的作业)很有用。
|
||||||
|
|
||||||
|
3. `requestRecovery()`:指示Quartz在作业执行失败或调度器重启时尝试恢复作业。
|
||||||
|
|
||||||
|
4. `usingJobData(JobDataMap jobData)`:为作业添加自定义数据。
|
||||||
|
|
||||||
|
5. `usingJobData(String key, String value)`:为作业添加单个自定义数据。
|
||||||
|
|
||||||
|
6. `ofType(Class<? extends Job> jobClass)`:指定作业的类型(实现 `Job` 接口的类)。
|
||||||
|
|
||||||
|
7. `build()`:构建并返回最终的 `JobDetail` 实例。
|
||||||
|
|
||||||
|
8. `withDescription(String description)`:为作业设置描述信息。
|
||||||
|
|
||||||
|
9. `usingJobData(JobDataMap jobData, boolean merge)`:添加自定义数据,并指定是否与现有的 `JobDataMap` 合并。
|
||||||
|
|
||||||
|
10. `build()`:构建并返回最终的 `JobDetail` 实例。
|
||||||
|
|
||||||
|
# 展望未来
|
||||||
|
|
||||||
|
## 定时任务加入
|
||||||
|
|
||||||
|
数据备份:根据数据的重要性和变化频率,定时备份数据库或文件系统。例如,每晚备份数据库,或者在数据变更达到一定量后触发备份。
|
||||||
|
|
||||||
|
系统维护:包括软件更新、系统清理、磁盘碎片整理等,这些任务可能在系统负载较低的时段执行。
|
||||||
|
|
||||||
|
监控报告:定时生成系统或网络的使用报告、性能报告等,用于分析和审计。
|
||||||
|
|
||||||
|
内容更新:对于网站或应用,定时更新内容,如新闻网站定时更新新闻,天气应用定时更新天气信息。
|
||||||
|
|
||||||
|
缓存清理:定期清理缓存文件,以释放存储空间和提高系统性能。
|
||||||
|
|
||||||
|
日志轮转:自动归档和压缩旧的日志文件,以便于管理和分析。
|
||||||
|
|
||||||
|
邮件发送:定时发送邮件,如账单、通知、营销邮件等。
|
||||||
|
|
||||||
|
资源调度:在云计算环境中,根据需求动态调整资源分配,如自动扩展或缩减服务器实例。
|
||||||
|
|
||||||
|
数据同步:在多个系统或数据库之间定时同步数据,保持数据一致性。
|
||||||
|
|
||||||
|
安全扫描:定期执行安全扫描,检测系统漏洞或异常行为。
|
||||||
|
|
||||||
|
任务调度:在工作流管理系统中,根据预设的规则和条件动态触发任务。
|
||||||
|
|
||||||
|
库存管理:在电子商务或仓库管理中,定时检查库存水平,自动触发补货或调整价格。
|
||||||
|
|
||||||
|
广告轮播:在广告系统中,定时更换展示的广告内容。
|
||||||
|
|
||||||
|
用户行为分析:定时收集和分析用户行为数据,用于改进产品或服务。
|
||||||
|
|
||||||
|
健康检查:对关键系统组件进行定时健康检查,确保系统稳定运行。
|
|
@ -14,13 +14,13 @@ public class AdminCodeGenerator {
|
||||||
// 作者名称
|
// 作者名称
|
||||||
public static final String author = "Bunny";
|
public static final String author = "Bunny";
|
||||||
// 公共路径
|
// 公共路径
|
||||||
// public static final String outputDir = "D:\\MyFolder\\Bunny\\BunnyBBS\\BunnyBBS-server-admin\\service";
|
public static final String outputDir = "D:\\MyFolder\\auth-admin\\auth-server-java\\service";
|
||||||
public static final String outputDir = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service";
|
// public static final String outputDir = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service";
|
||||||
// 实体类名称
|
// 实体类名称
|
||||||
public static final String entity = "Bunny";
|
public static final String entity = "Bunny";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Generation("sys_schedulers_group");
|
Generation("quartz_execute_log");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@ public class AdminCodeGenerator {
|
||||||
.controller("controller")// 控制层包名
|
.controller("controller")// 控制层包名
|
||||||
.mapper("mapper")// mapper层包名
|
.mapper("mapper")// mapper层包名
|
||||||
.service("service")// service层包名
|
.service("service")// service层包名
|
||||||
.serviceImpl("service·impl")// service实现类包名
|
.serviceImpl("service.impl")// service实现类包名
|
||||||
// 自定义mapper.xml文件输出目录
|
// 自定义mapper.xml文件输出目录
|
||||||
.pathInfo(Collections.singletonMap(OutputFile.xml, outputDir + "/src/main/resources/mapper")))
|
.pathInfo(Collections.singletonMap(OutputFile.xml, outputDir + "/src/main/resources/mapper")))
|
||||||
.strategyConfig(builder -> {
|
.strategyConfig(builder -> {
|
||||||
|
|
|
@ -3,11 +3,11 @@ package cn.bunny.common.generator.generator;
|
||||||
import cn.bunny.common.generator.entity.BaseField;
|
import cn.bunny.common.generator.entity.BaseField;
|
||||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupAddDto;
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogAddDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupDto;
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupUpdateDto;
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogUpdateDto;
|
||||||
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLog;
|
||||||
import cn.bunny.dao.vo.quartz.SchedulersGroupVo;
|
import cn.bunny.dao.vo.quartz.QuartzExecuteLogVo;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -36,26 +36,26 @@ import java.util.stream.Stream;
|
||||||
@Service
|
@Service
|
||||||
public class WebGeneratorCode {
|
public class WebGeneratorCode {
|
||||||
// 公共路径
|
// 公共路径
|
||||||
public static String commonPath = "D:\\Project\\web\\PC\\auth\\auth-web\\src";
|
public static String commonPath = "D:\\MyFolder\\auth-admin\\auth-web\\src";
|
||||||
// 生成API请求路径
|
// 生成API请求路径
|
||||||
public static String apiPath = commonPath + "\\api\\v1\\";
|
public static String apiPath = commonPath + "\\api\\v1\\";
|
||||||
// 生成vue路径
|
// 生成vue路径
|
||||||
public static String vuePath = commonPath + "\\views\\monitor\\";
|
public static String vuePath = commonPath + "\\views\\scheduler\\";
|
||||||
// 生成仓库路径
|
// 生成仓库路径
|
||||||
public static String storePath = commonPath + "\\store\\monitor\\";
|
public static String storePath = commonPath + "\\store\\scheduler\\";
|
||||||
// 后端controller
|
// 后端controller
|
||||||
public static String controllerPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
public static String controllerPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\controller\\";
|
||||||
public static String servicePath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
public static String servicePath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\";
|
||||||
public static String serviceImplPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
public static String serviceImplPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\service\\impl\\";
|
||||||
public static String mapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
public static String mapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\java\\cn\\bunny\\services\\mapper\\";
|
||||||
public static String resourceMapperPath = "D:\\Project\\web\\PC\\auth\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
Class<?> originalClass = SchedulersGroup.class;
|
Class<?> originalClass = QuartzExecuteLog.class;
|
||||||
Class<?> dtoClass = SchedulersGroupDto.class;
|
Class<?> dtoClass = QuartzExecuteLogDto.class;
|
||||||
Class<?> addDtoClass = SchedulersGroupAddDto.class;
|
Class<?> addDtoClass = QuartzExecuteLogAddDto.class;
|
||||||
Class<?> updateDtoClass = SchedulersGroupUpdateDto.class;
|
Class<?> updateDtoClass = QuartzExecuteLogUpdateDto.class;
|
||||||
Class<?> voClass = SchedulersGroupVo.class;
|
Class<?> voClass = QuartzExecuteLogVo.class;
|
||||||
|
|
||||||
// 设置velocity资源加载器
|
// 设置velocity资源加载器
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.bunny.dao.dto.quartz.executeLog;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLogJson;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "QuartzExecuteLogAddDto对象", title = "添加调度任务执行日志", description = "添加调度任务执行日志")
|
||||||
|
public class QuartzExecuteLogAddDto {
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
@Schema(name = "jobClassName", title = "执行任务类名")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobClassName;
|
||||||
|
|
||||||
|
@Schema(name = "cronExpression", title = "执行任务core表达式")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(name = "triggerName", title = "触发器名称")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String triggerName;
|
||||||
|
|
||||||
|
@Schema(name = "executeResult", title = "执行结果")
|
||||||
|
private QuartzExecuteLogJson executeResult;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "执行时间")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
@Schema(name = "endTime", title = "结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.bunny.dao.dto.quartz.executeLog;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "QuartzExecuteLogDto对象", title = "调度任务执行日志分页查询", description = "调度任务执行日志分页查询")
|
||||||
|
public class QuartzExecuteLogDto {
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
@Schema(name = "jobClassName", title = "执行任务类名")
|
||||||
|
private String jobClassName;
|
||||||
|
|
||||||
|
@Schema(name = "cronExpression", title = "执行任务core表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(name = "triggerName", title = "触发器名称")
|
||||||
|
private String triggerName;
|
||||||
|
|
||||||
|
@Schema(name = "endTime", title = "结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package cn.bunny.dao.dto.quartz.executeLog;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLogJson;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "QuartzExecuteLogUpdateDto对象", title = "更新调度任务执行日志", description = "更新调度任务执行日志")
|
||||||
|
public class QuartzExecuteLogUpdateDto {
|
||||||
|
|
||||||
|
@Schema(name = "id", title = "主键")
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
@Schema(name = "jobClassName", title = "执行任务类名")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String jobClassName;
|
||||||
|
|
||||||
|
@Schema(name = "cronExpression", title = "执行任务core表达式")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(name = "triggerName", title = "触发器名称")
|
||||||
|
@NotBlank(message = "任务分组不能为空")
|
||||||
|
@NotNull(message = "任务分组不能为空")
|
||||||
|
private String triggerName;
|
||||||
|
|
||||||
|
@Schema(name = "executeResult", title = "执行结果")
|
||||||
|
private QuartzExecuteLogJson executeResult;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "执行时间")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
@Schema(name = "endTime", title = "结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.schedule;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.schedule;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.schedule;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.scheduleGroup;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.scheduleGroup;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.dao.dto.quartz;
|
package cn.bunny.dao.dto.quartz.scheduleGroup;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bunny.dao.dto.system.router;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "RouterUpdateByIdWithRankDto对象", title = "根据菜单Id更新菜单排序", description = "根据菜单Id更新菜单排序")
|
||||||
|
public class RouterUpdateByIdWithRankDto {
|
||||||
|
|
||||||
|
@Schema(name = "id", title = "唯一标识")
|
||||||
|
@NotNull(message = "id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(name = "routerRank", title = "等级")
|
||||||
|
@JsonProperty("rank")
|
||||||
|
private Integer routerRank;
|
||||||
|
|
||||||
|
}
|
|
@ -59,3 +59,4 @@ public class RouterUpdateDto {
|
||||||
@Schema(name = "visible", title = "是否显示")
|
@Schema(name = "visible", title = "是否显示")
|
||||||
private Boolean visible;
|
private Boolean visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package cn.bunny.dao.entity.quartz;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 调度任务执行日志
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-10-18
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("quartz_execute_log")
|
||||||
|
@Schema(name = "QuartzExecuteLog对象", title = "调度任务执行日志", description = "调度任务执行日志")
|
||||||
|
public class QuartzExecuteLog extends BaseEntity {
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
@Schema(name = "jobClassName", title = "执行任务类名")
|
||||||
|
private String jobClassName;
|
||||||
|
|
||||||
|
@Schema(name = "cronExpression", title = "执行任务core表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(name = "triggerName", title = "触发器名称")
|
||||||
|
private String triggerName;
|
||||||
|
|
||||||
|
@Schema(name = "executeResult", title = "执行结果")
|
||||||
|
private String executeResult;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "执行时间")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
@Schema(name = "endTime", title = "结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package cn.bunny.dao.entity.quartz;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "QuartzExecuteLog对象", title = "执行任务的日志", description = "执行任务的日志")
|
||||||
|
public class QuartzExecuteLogJson {
|
||||||
|
|
||||||
|
@Schema(name = "result", title = "执行结果")
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
@Schema(name = "status", title = "执行状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(name = "message", title = "执行消息")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Schema(name = "operationTime", title = "操作时间")
|
||||||
|
private String operationTime;
|
||||||
|
|
||||||
|
@Schema(name = "executeParams", title = "执行任务参数")
|
||||||
|
private String executeParams;
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@TableName("qrtz_schedulers_group")
|
@TableName("quartz_schedulers_group")
|
||||||
@Schema(name = "SchedulersGroup对象", title = "任务调度分组", description = "任务调度分组")
|
@Schema(name = "SchedulersGroup对象", title = "任务调度分组", description = "任务调度分组")
|
||||||
public class SchedulersGroup extends BaseEntity {
|
public class SchedulersGroup extends BaseEntity {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.bunny.dao.vo.quartz;
|
||||||
|
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLogJson;
|
||||||
|
import cn.bunny.dao.vo.BaseVo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Schema(name = "QuartzExecuteLogVo对象", title = "调度任务执行日志返回对象", description = "调度任务执行日志返回对象")
|
||||||
|
public class QuartzExecuteLogVo extends BaseVo {
|
||||||
|
|
||||||
|
@Schema(name = "jobName", title = "任务名称")
|
||||||
|
private String jobName;
|
||||||
|
|
||||||
|
@Schema(name = "jobGroup", title = "任务分组")
|
||||||
|
private String jobGroup;
|
||||||
|
|
||||||
|
@Schema(name = "jobClassName", title = "执行任务类名")
|
||||||
|
private String jobClassName;
|
||||||
|
|
||||||
|
@Schema(name = "cronExpression", title = "执行任务core表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(name = "triggerName", title = "触发器名称")
|
||||||
|
private String triggerName;
|
||||||
|
|
||||||
|
@Schema(name = "executeResult", title = "执行结果")
|
||||||
|
private QuartzExecuteLogJson executeResult;
|
||||||
|
|
||||||
|
@Schema(name = "duration", title = "执行时间")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
@Schema(name = "endTime", title = "结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogDto;
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLog;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.pojo.result.Result;
|
||||||
|
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||||
|
import cn.bunny.dao.vo.quartz.QuartzExecuteLogVo;
|
||||||
|
import cn.bunny.services.service.QuartzExecuteLogService;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 调度任务执行日志表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-10-18 12:56:39
|
||||||
|
*/
|
||||||
|
@Tag(name = "调度任务执行日志", description = "调度任务执行日志相关接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("admin/quartzExecuteLog")
|
||||||
|
public class QuartzExecuteLogController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QuartzExecuteLogService quartzExecuteLogService;
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询调度任务执行日志", description = "分页查询调度任务执行日志")
|
||||||
|
@GetMapping("getQuartzExecuteLogList/{page}/{limit}")
|
||||||
|
public Mono<Result<PageResult<QuartzExecuteLogVo>>> getQuartzExecuteLogList(
|
||||||
|
@Parameter(name = "page", description = "当前页", required = true)
|
||||||
|
@PathVariable("page") Integer page,
|
||||||
|
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||||
|
@PathVariable("limit") Integer limit,
|
||||||
|
QuartzExecuteLogDto dto) {
|
||||||
|
Page<QuartzExecuteLog> pageParams = new Page<>(page, limit);
|
||||||
|
PageResult<QuartzExecuteLogVo> pageResult = quartzExecuteLogService.getQuartzExecuteLogList(pageParams, dto);
|
||||||
|
return Mono.just(Result.success(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除调度任务执行日志", description = "删除调度任务执行日志")
|
||||||
|
@DeleteMapping("deleteQuartzExecuteLog")
|
||||||
|
public Mono<Result<String>> deleteQuartzExecuteLog(@RequestBody List<Long> ids) {
|
||||||
|
quartzExecuteLogService.deleteQuartzExecuteLog(ids);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cn.bunny.services.controller;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
||||||
|
import cn.bunny.dao.dto.system.router.RouterUpdateByIdWithRankDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
||||||
import cn.bunny.dao.entity.system.Router;
|
import cn.bunny.dao.entity.system.Router;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
@ -80,6 +81,13 @@ public class RouterController {
|
||||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "快速更新菜单排序", description = "快速更新菜单排序")
|
||||||
|
@PutMapping("updateMenuByIdWithRank")
|
||||||
|
public Mono<Result<String>> updateMenuByIdWithRank(@Valid @RequestBody RouterUpdateByIdWithRankDto dto) {
|
||||||
|
routerService.updateMenuByIdWithRank(dto);
|
||||||
|
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除路由菜单", description = "删除路由菜单")
|
@Operation(summary = "删除路由菜单", description = "删除路由菜单")
|
||||||
@DeleteMapping("deletedMenuByIds")
|
@DeleteMapping("deletedMenuByIds")
|
||||||
public Mono<Result<String>> deletedMenuByIds(@RequestBody List<Long> ids) {
|
public Mono<Result<String>> deletedMenuByIds(@RequestBody List<Long> ids) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.controller;
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersAddDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersAddDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersDto;
|
||||||
import cn.bunny.dao.entity.quartz.Schedulers;
|
import cn.bunny.dao.entity.quartz.Schedulers;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.pojo.result.Result;
|
import cn.bunny.dao.pojo.result.Result;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.controller;
|
package cn.bunny.services.controller;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupAddDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupAddDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupUpdateDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupUpdateDto;
|
||||||
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.pojo.result.Result;
|
import cn.bunny.dao.pojo.result.Result;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogDto;
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLog;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 调度任务执行日志 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-10-18 12:56:39
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface QuartzExecuteLogMapper extends BaseMapper<QuartzExecuteLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 分页查询调度任务执行日志内容
|
||||||
|
*
|
||||||
|
* @param pageParams 调度任务执行日志分页参数
|
||||||
|
* @param dto 调度任务执行日志查询表单
|
||||||
|
* @return 调度任务执行日志分页结果
|
||||||
|
*/
|
||||||
|
IPage<QuartzExecuteLog> selectListByPage(@Param("page") Page<QuartzExecuteLog> pageParams, @Param("dto") QuartzExecuteLogDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物理删除调度任务执行日志
|
||||||
|
*
|
||||||
|
* @param ids 删除 id 列表
|
||||||
|
*/
|
||||||
|
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.bunny.services.mapper;
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupDto;
|
||||||
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.bunny.services.mapper;
|
package cn.bunny.services.mapper;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersDto;
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersDto;
|
||||||
import cn.bunny.dao.entity.quartz.Schedulers;
|
import cn.bunny.dao.entity.quartz.Schedulers;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogDto;
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLog;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.quartz.QuartzExecuteLogVo;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 调度任务执行日志 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-10-18 12:56:39
|
||||||
|
*/
|
||||||
|
public interface QuartzExecuteLogService extends IService<QuartzExecuteLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 获取调度任务执行日志列表
|
||||||
|
*
|
||||||
|
* @return 调度任务执行日志返回列表
|
||||||
|
*/
|
||||||
|
PageResult<QuartzExecuteLogVo> getQuartzExecuteLogList(Page<QuartzExecuteLog> pageParams, QuartzExecuteLogDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 删除|批量删除调度任务执行日志类型
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
void deleteQuartzExecuteLog(List<Long> ids);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cn.bunny.services.service;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
||||||
|
import cn.bunny.dao.dto.system.router.RouterUpdateByIdWithRankDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
||||||
import cn.bunny.dao.entity.system.Router;
|
import cn.bunny.dao.entity.system.Router;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
@ -65,4 +66,11 @@ public interface RouterService extends IService<Router> {
|
||||||
* @param ids 删除id列表
|
* @param ids 删除id列表
|
||||||
*/
|
*/
|
||||||
void deletedMenuByIds(List<Long> ids);
|
void deletedMenuByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 快速更新菜单排序
|
||||||
|
*
|
||||||
|
* @param dto 根据菜单Id更新菜单排序
|
||||||
|
*/
|
||||||
|
void updateMenuByIdWithRank(RouterUpdateByIdWithRankDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.service;
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupAddDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupAddDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupUpdateDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupUpdateDto;
|
||||||
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.vo.quartz.SchedulersGroupVo;
|
import cn.bunny.dao.vo.quartz.SchedulersGroupVo;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.service;
|
package cn.bunny.services.service;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersAddDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersAddDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersDto;
|
||||||
import cn.bunny.dao.entity.quartz.Schedulers;
|
import cn.bunny.dao.entity.quartz.Schedulers;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.vo.quartz.SchedulersVo;
|
import cn.bunny.dao.vo.quartz.SchedulersVo;
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
|
import cn.bunny.dao.dto.quartz.executeLog.QuartzExecuteLogDto;
|
||||||
|
import cn.bunny.dao.entity.quartz.QuartzExecuteLog;
|
||||||
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
|
import cn.bunny.dao.vo.quartz.QuartzExecuteLogVo;
|
||||||
|
import cn.bunny.services.mapper.QuartzExecuteLogMapper;
|
||||||
|
import cn.bunny.services.service.QuartzExecuteLogService;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 调度任务执行日志 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Bunny
|
||||||
|
* @since 2024-10-18 12:56:39
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class QuartzExecuteLogServiceImpl extends ServiceImpl<QuartzExecuteLogMapper, QuartzExecuteLog> implements QuartzExecuteLogService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 调度任务执行日志 服务实现类
|
||||||
|
*
|
||||||
|
* @param pageParams 调度任务执行日志分页查询page对象
|
||||||
|
* @param dto 调度任务执行日志分页查询对象
|
||||||
|
* @return 查询分页调度任务执行日志返回对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<QuartzExecuteLogVo> getQuartzExecuteLogList(Page<QuartzExecuteLog> pageParams, QuartzExecuteLogDto dto) {
|
||||||
|
// 分页查询菜单图标
|
||||||
|
IPage<QuartzExecuteLog> page = baseMapper.selectListByPage(pageParams, dto);
|
||||||
|
|
||||||
|
List<QuartzExecuteLogVo> voList = page.getRecords().stream().map(quartzExecuteLog -> {
|
||||||
|
QuartzExecuteLogVo quartzExecuteLogVo = new QuartzExecuteLogVo();
|
||||||
|
BeanUtils.copyProperties(quartzExecuteLog, quartzExecuteLogVo);
|
||||||
|
return quartzExecuteLogVo;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return PageResult.<QuartzExecuteLogVo>builder()
|
||||||
|
.list(voList)
|
||||||
|
.pageNo(page.getCurrent())
|
||||||
|
.pageSize(page.getSize())
|
||||||
|
.total(page.getTotal())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除|批量删除调度任务执行日志
|
||||||
|
*
|
||||||
|
* @param ids 删除id列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteQuartzExecuteLog(List<Long> ids) {
|
||||||
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import cn.bunny.common.service.context.BaseContext;
|
||||||
import cn.bunny.common.service.exception.BunnyException;
|
import cn.bunny.common.service.exception.BunnyException;
|
||||||
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
import cn.bunny.dao.dto.system.router.RouterAddDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
import cn.bunny.dao.dto.system.router.RouterManageDto;
|
||||||
|
import cn.bunny.dao.dto.system.router.RouterUpdateByIdWithRankDto;
|
||||||
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
import cn.bunny.dao.dto.system.router.RouterUpdateDto;
|
||||||
import cn.bunny.dao.entity.system.Router;
|
import cn.bunny.dao.entity.system.Router;
|
||||||
import cn.bunny.dao.pojo.constant.RedisUserConstant;
|
import cn.bunny.dao.pojo.constant.RedisUserConstant;
|
||||||
|
@ -221,4 +222,23 @@ public class RouterServiceImpl extends ServiceImpl<RouterMapper, Router> impleme
|
||||||
|
|
||||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 快速更新菜单排序
|
||||||
|
*
|
||||||
|
* @param dto 根据菜单Id更新菜单排序
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateMenuByIdWithRank(RouterUpdateByIdWithRankDto dto) {
|
||||||
|
Router router = getOne(Wrappers.<Router>lambdaQuery().eq(Router::getId, dto.getId()));
|
||||||
|
|
||||||
|
// 判断更新数据是否存在
|
||||||
|
if (router == null) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST);
|
||||||
|
|
||||||
|
// 更新排序
|
||||||
|
router = new Router();
|
||||||
|
router.setId(dto.getId());
|
||||||
|
router.setRouterRank(dto.getRouterRank());
|
||||||
|
updateById(router);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.bunny.services.service.impl;
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupAddDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupAddDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupDto;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersGroupUpdateDto;
|
import cn.bunny.dao.dto.quartz.scheduleGroup.SchedulersGroupUpdateDto;
|
||||||
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
import cn.bunny.dao.entity.quartz.SchedulersGroup;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.vo.quartz.SchedulersGroupVo;
|
import cn.bunny.dao.vo.quartz.SchedulersGroupVo;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package cn.bunny.services.service.impl;
|
package cn.bunny.services.service.impl;
|
||||||
|
|
||||||
import cn.bunny.common.service.exception.BunnyException;
|
import cn.bunny.common.service.exception.BunnyException;
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersAddDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersDto;
|
|
||||||
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
import cn.bunny.dao.dto.quartz.SchedulersOperationDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersAddDto;
|
||||||
|
import cn.bunny.dao.dto.quartz.schedule.SchedulersDto;
|
||||||
import cn.bunny.dao.entity.quartz.Schedulers;
|
import cn.bunny.dao.entity.quartz.Schedulers;
|
||||||
import cn.bunny.dao.pojo.result.PageResult;
|
import cn.bunny.dao.pojo.result.PageResult;
|
||||||
import cn.bunny.dao.vo.quartz.SchedulersVo;
|
import cn.bunny.dao.vo.quartz.SchedulersVo;
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.bunny.services.mapper.QuartzExecuteLogMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.quartz.QuartzExecuteLog">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<id column="create_time" property="createTime"/>
|
||||||
|
<id column="update_time" property="updateTime"/>
|
||||||
|
<id column="create_user" property="createUser"/>
|
||||||
|
<id column="update_user" property="updateUser"/>
|
||||||
|
<id column="is_deleted" property="isDeleted"/>
|
||||||
|
<id column="job_name" property="jobName"/>
|
||||||
|
<id column="job_group" property="jobGroup"/>
|
||||||
|
<id column="job_class_name" property="jobClassName"/>
|
||||||
|
<id column="cron_expression" property="cronExpression"/>
|
||||||
|
<id column="trigger_name" property="triggerName"/>
|
||||||
|
<id column="execute_result" property="executeResult"/>
|
||||||
|
<id column="duration" property="duration"/>
|
||||||
|
<id column="end_time" property="endTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, create_time, update_time, create_user, update_user, is_deleted, job_name, job_group, job_class_name, cron_expression, trigger_name, execute_result, duration, end_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询调度任务执行日志内容 -->
|
||||||
|
<select id="selectListByPage" resultType="cn.bunny.dao.entity.quartz.QuartzExecuteLog">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from quartz_execute_log
|
||||||
|
<where>
|
||||||
|
<if test="dto.jobName != null and dto.jobName != ''">
|
||||||
|
and job_name like CONCAT('%',#{dto.jobName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.jobGroup != null and dto.jobGroup != ''">
|
||||||
|
and job_group like CONCAT('%',#{dto.jobGroup},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.jobClassName != null and dto.jobClassName != ''">
|
||||||
|
and job_class_name like CONCAT('%',#{dto.jobClassName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.cronExpression != null and dto.cronExpression != ''">
|
||||||
|
and cron_expression like CONCAT('%',#{dto.cronExpression},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.triggerName != null and dto.triggerName != ''">
|
||||||
|
and trigger_name like CONCAT('%',#{dto.triggerName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.endTime != null and dto.endTime != ''">
|
||||||
|
and end_time like CONCAT('%',#{dto.endTime},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by update_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 物理删除调度任务执行日志 -->
|
||||||
|
<delete id="deleteBatchIdsWithPhysics">
|
||||||
|
delete
|
||||||
|
from quartz_execute_log
|
||||||
|
where id in
|
||||||
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -1,35 +0,0 @@
|
||||||
package cn.bunny.service;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
class Solution {
|
|
||||||
public int longestConsecutive(int[] nums) {
|
|
||||||
if (nums.length == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<Integer> numSet = new HashSet<>();
|
|
||||||
for (int num : nums) {
|
|
||||||
numSet.add(num);
|
|
||||||
}
|
|
||||||
|
|
||||||
int longestStreak = 0;
|
|
||||||
|
|
||||||
for (int num : numSet) {
|
|
||||||
if (!numSet.contains(num - 1)) {
|
|
||||||
int currentStreak = 1;
|
|
||||||
|
|
||||||
while (numSet.contains(num + 1)) {
|
|
||||||
num++;
|
|
||||||
currentStreak++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新最长连续序列长度
|
|
||||||
longestStreak = Math.max(longestStreak, currentStreak);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return longestStreak;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue