|
|
|
@@ -1,12 +1,13 @@ |
|
|
|
package com.ruoyi.platform.service.impl; |
|
|
|
|
|
|
|
import com.ruoyi.platform.domain.ExperimentIns; |
|
|
|
import com.ruoyi.platform.domain.*; |
|
|
|
import com.ruoyi.platform.mapper.*; |
|
|
|
import com.ruoyi.platform.service.ExperimentInsService; |
|
|
|
import com.ruoyi.platform.service.ModelsService; |
|
|
|
import com.ruoyi.platform.service.WorkflowService; |
|
|
|
import com.ruoyi.platform.service.WorkspaceService; |
|
|
|
import lombok.val; |
|
|
|
import org.checkerframework.checker.units.qual.C; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@@ -58,7 +59,7 @@ public class WorkspaceServiceImpl implements WorkspaceService { |
|
|
|
|
|
|
|
// 获取运行中实验实例数量 |
|
|
|
List<ExperimentIns> experimentInsList = experimentInsService.queryByExperimentIsNotTerminated(); |
|
|
|
if (experimentInsList!=null&&!experimentInsList.isEmpty()) { |
|
|
|
if (experimentInsList!=null && !experimentInsList.isEmpty()) { |
|
|
|
Integer experimentInsCount = experimentInsList.size(); |
|
|
|
resMap.put("runningExperimentInsCount", experimentInsCount); |
|
|
|
}else{ |
|
|
|
@@ -67,12 +68,50 @@ public class WorkspaceServiceImpl implements WorkspaceService { |
|
|
|
//得到最近的三条实例记录,放进返回map |
|
|
|
List<ExperimentIns> latestExperimentInsList = experimentInsDao.getLatestInsList(); |
|
|
|
if (latestExperimentInsList != null && !latestExperimentInsList.isEmpty()) { |
|
|
|
for (ExperimentIns experimentIns : latestExperimentInsList){ |
|
|
|
Integer experimentId = experimentIns.getExperimentId(); |
|
|
|
Experiment experiment = this.experimentDao.queryById(experimentId); |
|
|
|
//拿到对应的流水线id |
|
|
|
Long correspondingWorkflowId = experiment.getWorkflowId(); |
|
|
|
experimentIns.setWorkflowId(correspondingWorkflowId); |
|
|
|
} |
|
|
|
resMap.put("latestExperimentInsList", latestExperimentInsList); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Long> statusMap = experimentInsService.countByStatus(); |
|
|
|
resMap.put("experimentInsStatus", statusMap); |
|
|
|
|
|
|
|
return resMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Integer> getAssetCount(Boolean isPublic) { |
|
|
|
Map<String,Integer> assetCountMap = new HashMap<String, Integer>(); |
|
|
|
int availableRange = isPublic ? 1 : 0; |
|
|
|
//统计数据集数量 |
|
|
|
Dataset dataset = new Dataset(); |
|
|
|
dataset.setAvailableRange(availableRange); |
|
|
|
Integer datasetCount = (int) this.datasetDao.count(dataset); |
|
|
|
assetCountMap.put("dataset", datasetCount); |
|
|
|
//统计模型数量 |
|
|
|
Models models = new Models(); |
|
|
|
models.setAvailableRange(availableRange); |
|
|
|
Integer modelCount = (int) this.modelsDao.count(models); |
|
|
|
assetCountMap.put("model", modelCount); |
|
|
|
//统计镜像数量 |
|
|
|
Image image = new Image(); |
|
|
|
image.setImageType(availableRange); |
|
|
|
Integer imageCount = (int) this.imageDao.count(image); |
|
|
|
assetCountMap.put("image", imageCount); |
|
|
|
//统计组件数量 |
|
|
|
Component component = new Component(); |
|
|
|
Integer componentCount = (int) this.componentDao.count(component); |
|
|
|
assetCountMap.put("component", componentCount); |
|
|
|
//统计流水线数量 |
|
|
|
Workflow workflow = new Workflow(); |
|
|
|
Integer workflowCount = (int) this.workflowDao.count(workflow); |
|
|
|
assetCountMap.put("workflow", workflowCount); |
|
|
|
|
|
|
|
return assetCountMap; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |