Browse Source

查询状态接口增加返回时间feature,修复bug

tags/v20240126
西大锐 2 years ago
parent
commit
54178069a7
3 changed files with 24 additions and 12 deletions
  1. +2
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java
  2. +14
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java
  3. +8
    -8
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml

+ 2
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java View File

@@ -29,7 +29,7 @@ public interface ExperimentInsDao {
* @param pageable 分页对象
* @return 对象列表
*/
List<ExperimentIns> queryAllByLimit(@Param("experimentIns")ExperimentIns experimentIns, @Param("pageable") Pageable pageable);
List<ExperimentIns> queryAllByLimit(@Param("experimentIns") ExperimentIns experimentIns, @Param("pageable") Pageable pageable);

/**
* 统计总行数
@@ -70,7 +70,7 @@ public interface ExperimentInsDao {
* @param experimentIns 实例对象
* @return 影响行数
*/
int update(ExperimentIns experimentIns);
int update(@Param("experimentIns") ExperimentIns experimentIns);

/**
* 通过主键删除数据


+ 14
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java View File

@@ -17,6 +17,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -77,7 +78,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
}

}

return experimentIns;
}

@@ -242,6 +242,19 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
if (status == null || status.isEmpty()) {
throw new RuntimeException("工作流状态为空。");
}
//解析流水线开始时间,开始时间一定存在,所以不需要判断
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

String startedAtString = (String) status.get("startedAt");
Date startTime = dateFormat.parse(startedAtString);
experimentIns.setStartTime(startTime);

//解析流水线结束时间
String finishedAtString = (String) status.get("finishedAt");
if (finishedAtString != null && !finishedAtString.isEmpty()) {
Date finishTime = dateFormat.parse(finishedAtString);
experimentIns.setFinishTime(finishTime);
}

// 解析nodes字段,提取节点状态并转换为JSON字符串
Map<String, Object> nodes = (Map<String, Object>) status.get("nodes");
@@ -262,7 +275,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {

}


/**
* 终止已经创建的实验实例
*


+ 8
- 8
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml View File

@@ -62,10 +62,10 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.startTime != null and experimentIns.startTime != ''">
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
<if test="experimentIns.finishTime != null and experimentIns.finishTime != ''">
<if test="experimentIns.finishTime != null">
and finish_time = #{experimentIns.finishTime}
</if>
<if test="experimentIns.createBy != null and experimentIns.createBy != ''">
@@ -111,10 +111,10 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.startTime != null and experimentIns.startTime != ''">
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
<if test="experimentIns.finishTime != null and experimentIns.finishTime != ''">
<if test="experimentIns.finishTime != null">
and finish_time = #{experimentIns.finishTime}
</if>
<if test="experimentIns.createBy != null and experimentIns.createBy != ''">
@@ -161,10 +161,10 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.startTime != null and experimentIns.startTime != ''">
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
<if test="experimentIns.finishTime != null and experimentIns.finishTime != ''">
<if test="experimentIns.finishTime != null">
and finish_time = #{experimentIns.finishTime}
</if>
<if test="experimentIns.createBy != null and experimentIns.createBy != ''">
@@ -231,10 +231,10 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
nodes_logs = #{experimentIns.nodesLogs},
</if>
<if test="experimentIns.startTime != null and experimentIns.startTime != ''">
<if test="experimentIns.startTime != null">
start_time = #{experimentIns.startTime},
</if>
<if test="experimentIns.finishTime != null and experimentIns.finishTime != ''">
<if test="experimentIns.finishTime != null">
finish_time = #{experimentIns.finishTime},
</if>
<if test="experimentIns.createBy != null and experimentIns.createBy != ''">


Loading…
Cancel
Save