| @@ -19,10 +19,7 @@ import org.springframework.stereotype.Service; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.*; | |||||
| /** | /** | ||||
| * (ExperimentIns)表服务实现类 | * (ExperimentIns)表服务实现类 | ||||
| @@ -262,11 +259,19 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| // 解析nodes字段,提取节点状态并转换为JSON字符串 | // 解析nodes字段,提取节点状态并转换为JSON字符串 | ||||
| Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); | Map<String, Object> nodes = (Map<String, Object>) status.get("nodes"); | ||||
| if (nodes == null || nodes.isEmpty()) { | if (nodes == null || nodes.isEmpty()) { | ||||
| throw new RuntimeException("工作流的节点数据为空。"); | throw new RuntimeException("工作流的节点数据为空。"); | ||||
| } | } | ||||
| String nodeStatusJson = JsonUtils.mapToJson(nodes); | |||||
| Map<String, Object> modifiedNodes = new LinkedHashMap<>(); | |||||
| for (Map.Entry<String, Object> nodeEntry : nodes.entrySet()) { | |||||
| Map<String,Object> nodeDetails = (Map<String, Object>) nodeEntry.getValue(); | |||||
| String templateName = (String) nodeDetails.get("templateName"); | |||||
| modifiedNodes.put(templateName, nodeDetails); | |||||
| } | |||||
| String nodeStatusJson = JsonUtils.mapToJson(modifiedNodes); | |||||
| experimentIns.setNodesStatus(nodeStatusJson); | experimentIns.setNodesStatus(nodeStatusJson); | ||||
| this.experimentInsDao.update(experimentIns); | this.experimentInsDao.update(experimentIns); | ||||
| @@ -32,9 +32,12 @@ | |||||
| <select id="getByExperimentId" resultMap="ExperimentInsMap"> | <select id="getByExperimentId" resultMap="ExperimentInsMap"> | ||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | ||||
| from experiment_ins | from experiment_ins | ||||
| where experiment_id = #{experiment_id} and state = 1 order by create_time limit 5 | |||||
| where experiment_id = #{experiment_id} and state = 1 | |||||
| order by create_time DESC | |||||
| limit 5 | |||||
| </select> | </select> | ||||
| <select id="queryByExperiment" resultMap="ExperimentInsMap"> | <select id="queryByExperiment" resultMap="ExperimentInsMap"> | ||||
| select | select | ||||
| id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_logs, start_time, finish_time, create_by, create_time, update_by, update_time, state | ||||