Commit 2e50a7d4 authored by wdy's avatar wdy

任务开始结束时间

parent bd26a669
...@@ -10,6 +10,7 @@ import com.ruoyi.service.TaskState; ...@@ -10,6 +10,7 @@ import com.ruoyi.service.TaskState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Objects; import java.util.Objects;
@Component @Component
...@@ -42,6 +43,10 @@ public abstract class TaskStateAdapter implements TaskState { ...@@ -42,6 +43,10 @@ public abstract class TaskStateAdapter implements TaskState {
if (task.getPointer() + 1 <= task.getMaxPointer() ) { if (task.getPointer() + 1 <= task.getMaxPointer() ) {
task.setPointer(task.getPointer() + 1); task.setPointer(task.getPointer() + 1);
} }
if (task.getTaskBeginTime() == null) {
task.setTaskBeginTime(new Date());
}
taskService.updateById(task); taskService.updateById(task);
} }
......
...@@ -17,6 +17,7 @@ import org.springframework.context.ApplicationContext; ...@@ -17,6 +17,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -57,6 +58,7 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini ...@@ -57,6 +58,7 @@ public class TaskStatePending extends TaskStateAdapter implements TaskState, Ini
task.setRunStatus(Task.RUN_STATUS_RUNNABLE); task.setRunStatus(Task.RUN_STATUS_RUNNABLE);
} else { } else {
task.setTaskStatus(Task.TASK_STATUS_FINISH); task.setTaskStatus(Task.TASK_STATUS_FINISH);
task.setTaskEndTime(new Date());
task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING); task.setRunStatus(Task.RUN_STATUS_STATUS_RUNNING);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment