REM:
1. 增加任务启动、失败状态
2. 增加数据库状态处理
This commit is contained in:
HuangXin 2020-11-26 18:34:34 +08:00
parent 1d157e2d54
commit d76a627f2c
3 changed files with 18 additions and 0 deletions

View File

@ -30,6 +30,16 @@ public enum DisposeTaskStatus implements BaseEnum {
* The Task expired.
*/
TASK_EXPIRED(5, "过期"),
/**
* Task start failed dispose task status.
*/
TASK_START_FAILED(6, "启动失败"),
/**
* Task stop failed dispose task status.
*/
TASK_STOP_FAILED(7, "停止失败"),
;
/**

View File

@ -57,6 +57,7 @@
FROM device_task
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTING.getValue()}
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_START_FAILED.getValue()}
</select>
<select id="getRunningTaskInfos" resultMap="device_task">
@ -65,6 +66,7 @@
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTING.getValue()}
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTED.getValue()}
OR status = ${@com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED.getValue()}
</select>
<select id="getTaskByDetails" resultMap="device_task">
@ -79,6 +81,8 @@
SET status = #{status}
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
, endTime = CURRENT_TIMESTAMP
</if>

View File

@ -122,6 +122,8 @@
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_START_FAILED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED.getValue()} AND
dt.planEndTime > CURRENT_TIMESTAMP()
<if test="deviceId != -1">
AND dt.deviceId = #{deviceId}
@ -163,6 +165,8 @@
currentStatus = #{status}
<if test="status == @com.dispose.common.DisposeTaskStatus@TASK_FINISHED
or status == @com.dispose.common.DisposeTaskStatus@TASK_CANCELED
or status == @com.dispose.common.DisposeTaskStatus@TASK_START_FAILED
or status == @com.dispose.common.DisposeTaskStatus@TASK_STOP_FAILED
or status == @com.dispose.common.DisposeTaskStatus@TASK_EXPIRED">
, endTime = CURRENT_TIMESTAMP
</if>