diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java index 657b7f9..6e5b1fa 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java @@ -10,6 +10,8 @@ import com.hnac.hzinfo.sdk.v5.model.ModelClient; import com.hnac.hzinfo.sdk.v5.model.vo.ModelAttrVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; +import com.hnac.hzinfo.sdk.v5.project.ProjectClient; +import com.hnac.hzinfo.sdk.v5.project.vo.ProjectNameVo; import com.hnac.hzinfo.sdk.v5.scada.ScadaClient; import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo; import lombok.AllArgsConstructor; @@ -19,6 +21,7 @@ import org.springframework.stereotype.Service; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -32,6 +35,7 @@ public class VectorDataServiceImpl implements VectorDataService { private final ModelClient modelClient; private final DeviceClient deviceClient; private final ScadaClient scadaClient; + private final ProjectClient projectClient; @Override @@ -91,6 +95,19 @@ public class VectorDataServiceImpl implements VectorDataService { @Override public List getScadaCanvas() { - return scadaClient.listCanvas().getData(); + List list = scadaClient.listCanvas().getData(); + List projectIds = list.stream().map(CanvasInfo::getProjectId).collect(Collectors.toList()); + List nameList = projectClient.getProjectNameList(projectIds).getData(); + if (null == nameList || nameList.isEmpty()) { + return list; + } + Map map = nameList.stream().collect(Collectors.toMap(ProjectNameVo::getId, ProjectNameVo::getName)); + list.forEach(item -> { + String projectName = map.get(item.getProjectId()); + if (null != projectName) { + item.setProjectName(projectName); + } + }); + return list; } }