定时任务
parent
71f2bb4d86
commit
583548c3e6
|
|
@ -1,6 +1,7 @@
|
||||||
package com.njzscloud.common.mp.support;
|
package com.njzscloud.common.mp.support;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import cn.hutool.core.util.PageUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
@ -49,7 +50,7 @@ public final class PageResult<T> {
|
||||||
if (data == null) data = Collections.emptyList();
|
if (data == null) data = Collections.emptyList();
|
||||||
int total = data.size();
|
int total = data.size();
|
||||||
int pages = Math.toIntExact(total % size == 0 ? (total / size) : (total / size + 1));
|
int pages = Math.toIntExact(total % size == 0 ? (total / size) : (total / size + 1));
|
||||||
|
PageUtil.setFirstPageNo(1);
|
||||||
return new PageResult<>(ListUtil.page(current, size, data), total, pages, current, size);
|
return new PageResult<>(ListUtil.page(current, size, data), total, pages, current, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.njzscloud.common.core.thread.ThreadPool;
|
||||||
import com.njzscloud.common.sichen.contant.ScheduleType;
|
import com.njzscloud.common.sichen.contant.ScheduleType;
|
||||||
import com.njzscloud.common.sichen.contant.TaskLogLevel;
|
import com.njzscloud.common.sichen.contant.TaskLogLevel;
|
||||||
import com.njzscloud.common.sichen.controller.TaskController;
|
import com.njzscloud.common.sichen.controller.TaskController;
|
||||||
|
import com.njzscloud.common.sichen.controller.TaskExecuteLogController;
|
||||||
|
import com.njzscloud.common.sichen.controller.TaskScheduleRecodeController;
|
||||||
import com.njzscloud.common.sichen.executor.SichenExecutor;
|
import com.njzscloud.common.sichen.executor.SichenExecutor;
|
||||||
import com.njzscloud.common.sichen.scheduler.SichenScheduler;
|
import com.njzscloud.common.sichen.scheduler.SichenScheduler;
|
||||||
import com.njzscloud.common.sichen.service.*;
|
import com.njzscloud.common.sichen.service.*;
|
||||||
|
|
@ -60,6 +62,16 @@ public class TaskAutoConfiguration {
|
||||||
return new TaskController(combineStoreService);
|
return new TaskController(combineStoreService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public TaskScheduleRecodeController taskScheduleRecodeController(TaskScheduleRecodeService taskScheduleRecodeService) {
|
||||||
|
return new TaskScheduleRecodeController(taskScheduleRecodeService);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public TaskExecuteLogController taskExecuteLogController(TaskExecuteLogService taskExecuteLogService) {
|
||||||
|
return new TaskExecuteLogController(taskExecuteLogService);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TaskExecuteLogService taskExecuteLogService() {
|
public TaskExecuteLogService taskExecuteLogService() {
|
||||||
return new TaskExecuteLogService();
|
return new TaskExecuteLogService();
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,18 @@ public class TaskController {
|
||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用
|
||||||
|
*/
|
||||||
|
@GetMapping("/disable")
|
||||||
|
public R<?> disable(
|
||||||
|
@RequestParam("id") Long id,
|
||||||
|
@RequestParam("disable") Boolean disable
|
||||||
|
) {
|
||||||
|
taskStore.dbTaskService.disable(id, disable);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.njzscloud.common.sichen.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.common.sichen.pojo.entity.TaskExecuteLogEntity;
|
||||||
|
import com.njzscloud.common.sichen.pojo.param.SearchTaskExecuteLogParam;
|
||||||
|
import com.njzscloud.common.sichen.service.TaskExecuteLogService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务执行日志表
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/task_execute_log")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TaskExecuteLogController {
|
||||||
|
private final TaskExecuteLogService taskExecuteLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody TaskExecuteLogEntity taskExecuteLogEntity) {
|
||||||
|
taskExecuteLogService.add(taskExecuteLogEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody TaskExecuteLogEntity taskExecuteLogEntity) {
|
||||||
|
taskExecuteLogService.modify(taskExecuteLogEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
taskExecuteLogService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<TaskExecuteLogEntity> detail(@RequestParam("id") Long id) {
|
||||||
|
return R.success(taskExecuteLogService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<TaskExecuteLogEntity>> paging(PageParam pageParam, SearchTaskExecuteLogParam searchTaskExecuteLogParam) {
|
||||||
|
return R.success(taskExecuteLogService.paging(pageParam, searchTaskExecuteLogParam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.njzscloud.common.sichen.controller;
|
||||||
|
|
||||||
|
import com.njzscloud.common.core.utils.R;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.common.sichen.pojo.entity.TaskScheduleRecodeEntity;
|
||||||
|
import com.njzscloud.common.sichen.pojo.param.SearchTaskScheduleRecodeParam;
|
||||||
|
import com.njzscloud.common.sichen.service.TaskScheduleRecodeService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务调度记录表
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/task_schedule_recode")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TaskScheduleRecodeController {
|
||||||
|
private final TaskScheduleRecodeService taskScheduleRecodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public R<?> add(@RequestBody TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
|
||||||
|
taskScheduleRecodeService.add(taskScheduleRecodeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
@PostMapping("/modify")
|
||||||
|
public R<?> modify(@RequestBody TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
|
||||||
|
taskScheduleRecodeService.modify(taskScheduleRecodeEntity);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@PostMapping("/del")
|
||||||
|
public R<?> del(@RequestBody List<Long> ids) {
|
||||||
|
taskScheduleRecodeService.del(ids);
|
||||||
|
return R.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R<TaskScheduleRecodeEntity> detail(@RequestParam("id") Long id) {
|
||||||
|
return R.success(taskScheduleRecodeService.detail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public R<PageResult<TaskScheduleRecodeEntity>> paging(PageParam pageParam, SearchTaskScheduleRecodeParam searchTaskScheduleRecodeParam) {
|
||||||
|
return R.success(taskScheduleRecodeService.paging(pageParam, searchTaskScheduleRecodeParam));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.njzscloud.common.sichen.pojo.param;
|
||||||
|
|
||||||
|
import com.njzscloud.common.sichen.contant.TaskLogLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务执行日志表
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SearchTaskExecuteLogParam {
|
||||||
|
/**
|
||||||
|
* 调度 Id
|
||||||
|
*/
|
||||||
|
private Long scheduleId;
|
||||||
|
/**
|
||||||
|
* 日志等级
|
||||||
|
*/
|
||||||
|
private TaskLogLevel logLevel;
|
||||||
|
/**
|
||||||
|
* 日志时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startLogTime;
|
||||||
|
private LocalDateTime endLogTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.njzscloud.common.sichen.pojo.param;
|
||||||
|
|
||||||
|
import com.njzscloud.common.sichen.contant.TaskStatus;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务调度记录表
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SearchTaskScheduleRecodeParam {
|
||||||
|
/**
|
||||||
|
* 任务 Id
|
||||||
|
*/
|
||||||
|
private Long taskId;
|
||||||
|
/**
|
||||||
|
* 任务开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
/**
|
||||||
|
* 任务结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态
|
||||||
|
*/
|
||||||
|
private TaskStatus taskStatus;
|
||||||
|
/**
|
||||||
|
* 本次调度是否为手动触发
|
||||||
|
*/
|
||||||
|
private Boolean manually;
|
||||||
|
|
||||||
|
private Boolean builtin;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -147,10 +147,18 @@ public class DbTaskService extends ServiceImpl<TaskMapper, TaskEntity> implement
|
||||||
public boolean trigger(Long id) {
|
public boolean trigger(Long id) {
|
||||||
TaskEntity taskEntity = this.getById(id);
|
TaskEntity taskEntity = this.getById(id);
|
||||||
if (taskEntity != null) {
|
if (taskEntity != null) {
|
||||||
|
Assert.isFalse(taskEntity.getDisabled(), () -> Exceptions.exception("请先启用任务"));
|
||||||
TaskUtil.execute(BeanUtil.copyProperties(taskEntity, TaskInfo.class), true);
|
TaskUtil.execute(BeanUtil.copyProperties(taskEntity, TaskInfo.class), true);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void disable(Long id, Boolean disable) {
|
||||||
|
this.updateById(new TaskEntity()
|
||||||
|
.setId(id)
|
||||||
|
.setDisabled(disable)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,59 @@
|
||||||
package com.njzscloud.common.sichen.service;
|
package com.njzscloud.common.sichen.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.common.sichen.mapper.TaskExecuteLogMapper;
|
import com.njzscloud.common.sichen.mapper.TaskExecuteLogMapper;
|
||||||
import com.njzscloud.common.sichen.pojo.entity.TaskExecuteLogEntity;
|
import com.njzscloud.common.sichen.pojo.entity.TaskExecuteLogEntity;
|
||||||
|
import com.njzscloud.common.sichen.pojo.param.SearchTaskExecuteLogParam;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class TaskExecuteLogService extends ServiceImpl<TaskExecuteLogMapper, TaskExecuteLogEntity> implements IService<TaskExecuteLogEntity> {
|
public class TaskExecuteLogService extends ServiceImpl<TaskExecuteLogMapper, TaskExecuteLogEntity> implements IService<TaskExecuteLogEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
public void add(TaskExecuteLogEntity taskExecuteLogEntity) {
|
||||||
|
this.save(taskExecuteLogEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public void modify(TaskExecuteLogEntity taskExecuteLogEntity) {
|
||||||
|
this.updateById(taskExecuteLogEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
public TaskExecuteLogEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
public PageResult<TaskExecuteLogEntity> paging(PageParam pageParam, SearchTaskExecuteLogParam searchTaskExecuteLogParam) {
|
||||||
|
Long scheduleId = searchTaskExecuteLogParam.getScheduleId();
|
||||||
|
Assert.notNull(scheduleId, () -> Exceptions.clierr("未指调度记录"));
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<TaskExecuteLogEntity>lambdaQuery()
|
||||||
|
.eq(TaskExecuteLogEntity::getScheduleId, scheduleId)
|
||||||
|
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,30 @@ package com.njzscloud.common.sichen.service;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
import com.njzscloud.common.core.tuple.Tuple2;
|
import com.njzscloud.common.core.tuple.Tuple2;
|
||||||
import com.njzscloud.common.core.utils.CallerUtil;
|
import com.njzscloud.common.core.utils.CallerUtil;
|
||||||
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.common.sichen.config.TaskProperties;
|
import com.njzscloud.common.sichen.config.TaskProperties;
|
||||||
import com.njzscloud.common.sichen.contant.TaskLogLevel;
|
import com.njzscloud.common.sichen.contant.TaskLogLevel;
|
||||||
import com.njzscloud.common.sichen.mapper.TaskScheduleRecodeMapper;
|
import com.njzscloud.common.sichen.mapper.TaskScheduleRecodeMapper;
|
||||||
import com.njzscloud.common.sichen.pojo.entity.TaskExecuteLogEntity;
|
import com.njzscloud.common.sichen.pojo.entity.TaskExecuteLogEntity;
|
||||||
import com.njzscloud.common.sichen.pojo.entity.TaskScheduleRecodeEntity;
|
import com.njzscloud.common.sichen.pojo.entity.TaskScheduleRecodeEntity;
|
||||||
|
import com.njzscloud.common.sichen.pojo.param.SearchTaskScheduleRecodeParam;
|
||||||
import com.njzscloud.common.sichen.support.Task;
|
import com.njzscloud.common.sichen.support.Task;
|
||||||
import com.njzscloud.common.sichen.support.TaskHandle;
|
import com.njzscloud.common.sichen.support.TaskHandle;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -28,6 +35,47 @@ public class TaskScheduleRecodeService extends ServiceImpl<TaskScheduleRecodeMap
|
||||||
private final TaskProperties taskProperties;
|
private final TaskProperties taskProperties;
|
||||||
private final Thread recodeLogThread;
|
private final Thread recodeLogThread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
public void add(TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
|
||||||
|
this.save(taskScheduleRecodeEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public void modify(TaskScheduleRecodeEntity taskScheduleRecodeEntity) {
|
||||||
|
this.updateById(taskScheduleRecodeEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void del(List<Long> ids) {
|
||||||
|
this.removeBatchByIds(ids);
|
||||||
|
taskExecuteLogService.remove(Wrappers.<TaskExecuteLogEntity>lambdaQuery().in(TaskExecuteLogEntity::getScheduleId, ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
public TaskScheduleRecodeEntity detail(Long id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
public PageResult<TaskScheduleRecodeEntity> paging(PageParam pageParam, SearchTaskScheduleRecodeParam searchTaskScheduleRecodeParam) {
|
||||||
|
Long taskId = searchTaskScheduleRecodeParam.getTaskId();
|
||||||
|
Assert.notNull(taskId, () -> Exceptions.clierr("未指定任务"));
|
||||||
|
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<TaskScheduleRecodeEntity>lambdaQuery()
|
||||||
|
.eq(TaskScheduleRecodeEntity::getTaskId, taskId)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
public TaskScheduleRecodeService(TaskProperties taskProperties, TaskExecuteLogService taskExecuteLogService) {
|
public TaskScheduleRecodeService(TaskProperties taskProperties, TaskExecuteLogService taskExecuteLogService) {
|
||||||
this.taskProperties = taskProperties;
|
this.taskProperties = taskProperties;
|
||||||
this.taskExecuteLogService = taskExecuteLogService;
|
this.taskExecuteLogService = taskExecuteLogService;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public class Example {
|
||||||
TaskHandle.debug("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
TaskHandle.debug("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
||||||
TaskHandle.info("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
TaskHandle.info("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
||||||
TaskHandle.warn("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
TaskHandle.warn("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
||||||
TaskHandle.error("A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
TaskHandle.error(new RuntimeException("错误错误错误错误错误错误错误"), "A-------当前时间:{} 线程名称:{} 是否虚拟线程:{}", System.currentTimeMillis() / 1000, name, virtual);
|
||||||
try {
|
try {
|
||||||
int sleepTime = RandomUtil.randomInt(1000, 5000);
|
int sleepTime = RandomUtil.randomInt(1000, 5000);
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue