|
|
|
@ -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<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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|