日志修改
This commit is contained in:
parent
b8e344547a
commit
359a5e1e27
@ -19,4 +19,5 @@ public class SingletonRunContextResp {
|
|||||||
private Integer state;
|
private Integer state;
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
private String duration;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -559,6 +560,11 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
|||||||
taskState.setEndTime(taskContext.getEndTime());
|
taskState.setEndTime(taskContext.getEndTime());
|
||||||
taskStateMap.put(taskId,taskState);
|
taskStateMap.put(taskId,taskState);
|
||||||
taskList.add(taskState);
|
taskList.add(taskState);
|
||||||
|
if (taskState.getEndTime()==null) {
|
||||||
|
taskState.setDuration(between(taskState.getStartTime(),LocalDateTime.now()));
|
||||||
|
} else {
|
||||||
|
taskState.setDuration(between(taskState.getStartTime(),taskState.getEndTime()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pipeline;
|
return pipeline;
|
||||||
@ -566,4 +572,25 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
|||||||
|
|
||||||
return new TreeRunContextResp();
|
return new TreeRunContextResp();
|
||||||
}
|
}
|
||||||
|
private String between(LocalDateTime startTime,LocalDateTime endTime){
|
||||||
|
Duration between = Duration.between(startTime, LocalDateTime.now());
|
||||||
|
long days = between.toDays();
|
||||||
|
long hours = between.toHours()%24;
|
||||||
|
long minutes = between.toMinutes() % 60;
|
||||||
|
long seconds = between.toSeconds() % 60;
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
if (days>0) {
|
||||||
|
stringBuilder.append(days).append("天");
|
||||||
|
}
|
||||||
|
if (hours>0) {
|
||||||
|
stringBuilder.append(hours).append("小时");
|
||||||
|
}
|
||||||
|
if (minutes>0) {
|
||||||
|
stringBuilder.append(minutes).append("分");
|
||||||
|
}
|
||||||
|
if (seconds>0) {
|
||||||
|
stringBuilder.append(seconds).append("秒");
|
||||||
|
}
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user