Browse Source

add:画布添加站点名称

zhongwei
luyie 2 months ago
parent
commit
04382a943a
  1. 19
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/business/service/impl/VectorDataServiceImpl.java

19
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.ModelAttrVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO; import com.hnac.hzinfo.sdk.v5.model.vo.ModelEventVO;
import com.hnac.hzinfo.sdk.v5.model.vo.ModelFuncVO; 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.ScadaClient;
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo; import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasInfo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -19,6 +21,7 @@ import org.springframework.stereotype.Service;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -32,6 +35,7 @@ public class VectorDataServiceImpl implements VectorDataService {
private final ModelClient modelClient; private final ModelClient modelClient;
private final DeviceClient deviceClient; private final DeviceClient deviceClient;
private final ScadaClient scadaClient; private final ScadaClient scadaClient;
private final ProjectClient projectClient;
@Override @Override
@ -91,6 +95,19 @@ public class VectorDataServiceImpl implements VectorDataService {
@Override @Override
public List<CanvasInfo> getScadaCanvas() { public List<CanvasInfo> getScadaCanvas() {
return scadaClient.listCanvas().getData(); List<CanvasInfo> list = scadaClient.listCanvas().getData();
List<String> projectIds = list.stream().map(CanvasInfo::getProjectId).collect(Collectors.toList());
List<ProjectNameVo> nameList = projectClient.getProjectNameList(projectIds).getData();
if (null == nameList || nameList.isEmpty()) {
return list;
}
Map<String, String> 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;
} }
} }

Loading…
Cancel
Save