feat: 优化项目结构
This commit is contained in:
parent
40b8592032
commit
0327da6418
|
@ -26,8 +26,6 @@ public class SchedulersAddDto {
|
||||||
private String jobGroup;
|
private String jobGroup;
|
||||||
|
|
||||||
@Schema(name = "description", title = "任务详情")
|
@Schema(name = "description", title = "任务详情")
|
||||||
@NotBlank(message = "任务详情不能为空")
|
|
||||||
@NotNull(message = "任务详情不能为空")
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(name = "jobClassName", title = "任务类名称")
|
@Schema(name = "jobClassName", title = "任务类名称")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.services.quartz.job;
|
package cn.bunny.services.quartz;
|
||||||
|
|
||||||
import cn.bunny.services.aop.annotation.QuartzSchedulers;
|
import cn.bunny.services.aop.annotation.QuartzSchedulers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.bunny.services.quartz.job;
|
package cn.bunny.services.quartz;
|
||||||
|
|
||||||
import cn.bunny.services.aop.annotation.QuartzSchedulers;
|
import cn.bunny.services.aop.annotation.QuartzSchedulers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
|
@ -117,12 +117,12 @@ public class SchedulersServiceImpl extends ServiceImpl<SchedulersMapper, Schedul
|
||||||
jobDetail.getJobDataMap().put("jobMethodName", "execute");
|
jobDetail.getJobDataMap().put("jobMethodName", "execute");
|
||||||
|
|
||||||
// 执行任务
|
// 执行任务
|
||||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(dto.getCronExpression());
|
|
||||||
CronTrigger trigger = TriggerBuilder.newTrigger()
|
CronTrigger trigger = TriggerBuilder.newTrigger()
|
||||||
.withIdentity(dto.getJobName(), dto.getJobGroup())
|
.withIdentity(dto.getJobName(), dto.getJobGroup())
|
||||||
.withDescription(dto.getDescription())
|
.withDescription(dto.getDescription())
|
||||||
.startNow()
|
.startNow()
|
||||||
.withSchedule(cronScheduleBuilder).build();
|
.withSchedule(CronScheduleBuilder.cronSchedule(dto.getCronExpression()))
|
||||||
|
.build();
|
||||||
scheduler.scheduleJob(jobDetail, trigger);
|
scheduler.scheduleJob(jobDetail, trigger);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
throw new BunnyException(exception.getMessage());
|
throw new BunnyException(exception.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue