feat: 视频站树级结构查询-站点维度
This commit is contained in:
parent
9409efa0c3
commit
26837f30c5
@ -53,6 +53,12 @@ public class VdMonitorController {
|
|||||||
return ResponseResult.successData(vdMonitorService.getVdTreeKendoListCust(dataSourceRequest));
|
return ResponseResult.successData(vdMonitorService.getVdTreeKendoListCust(dataSourceRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tree/GetKendoListCustSt")
|
||||||
|
@Operation(summary = "视频站树级结构查询-站点维度")
|
||||||
|
public ResponseResult getVdTreeKendoListCustSt(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
return ResponseResult.successData(vdMonitorService.getVdTreeKendoListCustSt(dataSourceRequest));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/vdpoint/GetKendoListCust")
|
@PostMapping("/vdpoint/GetKendoListCust")
|
||||||
@Operation(summary = "视频站锚点接口")
|
@Operation(summary = "视频站锚点接口")
|
||||||
public ResponseResult getVdPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getVdPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
|||||||
@ -16,6 +16,8 @@ public interface VdMonitorService {
|
|||||||
|
|
||||||
DataSourceResult<VdTreeNodeVo> getVdTreeKendoListCust(DataSourceRequest dataSourceRequest);
|
DataSourceResult<VdTreeNodeVo> getVdTreeKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
|
DataSourceResult<VdTreeNodeVo> getVdTreeKendoListCustSt(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<?> getVdPointKendoListCust(DataSourceRequest dataSourceRequest);
|
DataSourceResult<?> getVdPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<VdRunDataVo> getRunDataKendoListCust(DataSourceRequest dataSourceRequest);
|
DataSourceResult<VdRunDataVo> getRunDataKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
|
|||||||
@ -171,6 +171,55 @@ public class VdMonitorServiceImpl implements VdMonitorService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceResult<VdTreeNodeVo> getVdTreeKendoListCustSt(DataSourceRequest dataSourceRequest) {
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
String filterSql = buildVdTreeFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT ")
|
||||||
|
.append("t.stcd AS stcd, ")
|
||||||
|
.append("t.stCode AS stCode, ")
|
||||||
|
.append("t.stName AS stName, ")
|
||||||
|
.append("t.stnm AS stnm, ")
|
||||||
|
.append("t.sttpCode AS sttpCode, ")
|
||||||
|
.append("t.sttpName AS sttpName, ")
|
||||||
|
.append("t.sttpFullPath AS sttpFullPath, ")
|
||||||
|
.append("t.rstcd AS rstcd, ")
|
||||||
|
.append("t.ennm AS ennm, ")
|
||||||
|
.append("t.baseId AS baseId, ")
|
||||||
|
.append("t.baseName AS baseName, ")
|
||||||
|
.append("t.url AS url, ")
|
||||||
|
.append("t.playWay AS playWay, ")
|
||||||
|
.append("t.baseSort AS baseSort, ")
|
||||||
|
.append("t.rstcdStepSort AS rstcdStepSort, ")
|
||||||
|
.append("t.siteStepSort AS siteStepSort, ")
|
||||||
|
.append("t.deviceSerial AS deviceSerial, ")
|
||||||
|
.append("t.accessWay AS accessWay, ")
|
||||||
|
.append("t.protocol AS protocol, ")
|
||||||
|
.append("t.quality AS quality, ")
|
||||||
|
.append("t.controlMode AS controlMode, ")
|
||||||
|
.append("t.status AS status, ")
|
||||||
|
.append("t.statusTm AS statusTm ")
|
||||||
|
.append("FROM (")
|
||||||
|
.append(buildVdTreeCoreSql())
|
||||||
|
.append(") t WHERE 1 = 1 ");
|
||||||
|
if (StrUtil.isNotBlank(filterSql)) {
|
||||||
|
sql.append(" AND ").append(filterSql).append(" ");
|
||||||
|
}
|
||||||
|
sql.append(" ORDER BY t.baseSort ASC NULLS LAST, t.rstcdStepSort ASC NULLS LAST, t.siteStepSort ASC NULLS LAST, t.stcd ASC");
|
||||||
|
|
||||||
|
List<VdTreeRowVo> rows = microservicDynamicSQLMapper.getAllListWithResultType(sql.toString(), paramMap, VdTreeRowVo.class);
|
||||||
|
boolean baseScoped = containsNonBlankFilterValue(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), "baseId");
|
||||||
|
|
||||||
|
DataSourceResult<VdTreeNodeVo> result = new DataSourceResult<>();
|
||||||
|
List<VdTreeNodeVo> treeData = buildVdTreeNodesByStation(rows, baseScoped);
|
||||||
|
result.setData(treeData);
|
||||||
|
result.setTotal((long) treeData.size());
|
||||||
|
result.setAggregates(new HashMap<>());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSourceResult<?> getVdPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
public DataSourceResult<?> getVdPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||||
@ -1388,6 +1437,51 @@ public class VdMonitorServiceImpl implements VdMonitorService {
|
|||||||
return sortTreeNodes(result);
|
return sortTreeNodes(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<VdTreeNodeVo> buildVdTreeNodesByStation(List<VdTreeRowVo> rows, boolean baseScoped) {
|
||||||
|
List<VdTreeNodeVo> stationNodes = buildStationCodeTreeNodes(rows, baseScoped);
|
||||||
|
if (baseScoped) {
|
||||||
|
return sortTreeNodes(stationNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinkedHashMap<String, VdTreeNodeVo> baseNodeMap = new LinkedHashMap<>();
|
||||||
|
List<VdTreeNodeVo> topLevelWithoutBase = new ArrayList<>();
|
||||||
|
for (VdTreeRowVo row : rows) {
|
||||||
|
if (row == null || StrUtil.isBlank(row.getBaseId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
baseNodeMap.computeIfAbsent(row.getBaseId(), key -> {
|
||||||
|
VdTreeNodeVo node = new VdTreeNodeVo();
|
||||||
|
node.setId(key);
|
||||||
|
node.setName(StrUtil.blankToDefault(row.getBaseName(), key));
|
||||||
|
node.setType("PSB");
|
||||||
|
node.setTypeName("基地");
|
||||||
|
node.setSort(defaultSort(row.getBaseSort()));
|
||||||
|
node.setHasChildren(1);
|
||||||
|
node.setParentId(null);
|
||||||
|
node.setParentName(null);
|
||||||
|
return node;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, List<VdTreeNodeVo>> stationByBase = new LinkedHashMap<>();
|
||||||
|
for (VdTreeNodeVo stationNode : stationNodes) {
|
||||||
|
if (StrUtil.isBlank(stationNode.getParentId())) {
|
||||||
|
topLevelWithoutBase.add(stationNode);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stationByBase.computeIfAbsent(stationNode.getParentId(), key -> new ArrayList<>()).add(stationNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<VdTreeNodeVo> result = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, VdTreeNodeVo> entry : baseNodeMap.entrySet()) {
|
||||||
|
VdTreeNodeVo baseNode = entry.getValue();
|
||||||
|
baseNode.setChildren(sortTreeNodes(stationByBase.get(entry.getKey())));
|
||||||
|
result.add(baseNode);
|
||||||
|
}
|
||||||
|
result.addAll(topLevelWithoutBase);
|
||||||
|
return sortTreeNodes(result);
|
||||||
|
}
|
||||||
|
|
||||||
private List<VdTreeNodeVo> buildStationTreeNodes(List<VdTreeRowVo> rows, boolean baseScoped) {
|
private List<VdTreeNodeVo> buildStationTreeNodes(List<VdTreeRowVo> rows, boolean baseScoped) {
|
||||||
LinkedHashMap<String, List<VdTreeRowVo>> stationRowMap = new LinkedHashMap<>();
|
LinkedHashMap<String, List<VdTreeRowVo>> stationRowMap = new LinkedHashMap<>();
|
||||||
for (VdTreeRowVo row : rows) {
|
for (VdTreeRowVo row : rows) {
|
||||||
@ -1453,6 +1547,71 @@ public class VdMonitorServiceImpl implements VdMonitorService {
|
|||||||
return sortTreeNodes(new ArrayList<>(siteNodeMap.values()));
|
return sortTreeNodes(new ArrayList<>(siteNodeMap.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<VdTreeNodeVo> buildStationCodeTreeNodes(List<VdTreeRowVo> rows, boolean baseScoped) {
|
||||||
|
LinkedHashMap<String, List<VdTreeRowVo>> stationRowMap = new LinkedHashMap<>();
|
||||||
|
for (VdTreeRowVo row : rows) {
|
||||||
|
if (row == null || StrUtil.isBlank(row.getStCode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stationRowMap.computeIfAbsent(row.getStCode(), key -> new ArrayList<>()).add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<VdTreeNodeVo> stationNodes = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, List<VdTreeRowVo>> entry : stationRowMap.entrySet()) {
|
||||||
|
List<VdTreeRowVo> stationRows = entry.getValue();
|
||||||
|
if (CollUtil.isEmpty(stationRows)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
VdTreeRowVo sample = stationRows.get(0);
|
||||||
|
VdTreeNodeVo stationNode = new VdTreeNodeVo();
|
||||||
|
stationNode.setId(entry.getKey());
|
||||||
|
stationNode.setName(StrUtil.blankToDefault(sample.getStName(), entry.getKey()));
|
||||||
|
stationNode.setType("VD_FB");
|
||||||
|
stationNode.setTypeName("鱼类增殖站");
|
||||||
|
stationNode.setSort(defaultSort(sample.getRstcdStepSort()));
|
||||||
|
stationNode.setHasChildren(1);
|
||||||
|
if (baseScoped) {
|
||||||
|
stationNode.setParentId(null);
|
||||||
|
stationNode.setParentName(null);
|
||||||
|
} else {
|
||||||
|
stationNode.setParentId(sample.getBaseId());
|
||||||
|
stationNode.setParentName(sample.getBaseName());
|
||||||
|
}
|
||||||
|
stationNode.setChildren(buildSiteTreeNodesByStation(stationRows));
|
||||||
|
stationNodes.add(stationNode);
|
||||||
|
}
|
||||||
|
return sortTreeNodes(stationNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<VdTreeNodeVo> buildSiteTreeNodesByStation(List<VdTreeRowVo> rows) {
|
||||||
|
LinkedHashMap<String, VdTreeNodeVo> siteNodeMap = new LinkedHashMap<>();
|
||||||
|
for (VdTreeRowVo row : rows) {
|
||||||
|
if (row == null || StrUtil.isBlank(row.getStcd()) || siteNodeMap.containsKey(row.getStcd())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
VdTreeNodeVo node = new VdTreeNodeVo();
|
||||||
|
node.setId(row.getStcd());
|
||||||
|
node.setName(StrUtil.blankToDefault(row.getStnm(), row.getStcd()));
|
||||||
|
node.setType(row.getSttpCode());
|
||||||
|
node.setTypeName(row.getSttpName());
|
||||||
|
node.setSort(defaultSort(row.getSiteStepSort()));
|
||||||
|
node.setHasChildren(0);
|
||||||
|
node.setParentId(row.getStCode());
|
||||||
|
node.setParentName(row.getStName());
|
||||||
|
node.setUrl(row.getUrl());
|
||||||
|
node.setPlayWay(row.getPlayWay());
|
||||||
|
node.setDeviceSerial(row.getDeviceSerial());
|
||||||
|
node.setAccessWay(row.getAccessWay());
|
||||||
|
node.setProtocol(row.getProtocol());
|
||||||
|
node.setQuality(row.getQuality());
|
||||||
|
node.setControlMode(row.getControlMode());
|
||||||
|
node.setStatus(row.getStatus());
|
||||||
|
node.setStatusTm(row.getStatusTm());
|
||||||
|
siteNodeMap.put(row.getStcd(), node);
|
||||||
|
}
|
||||||
|
return sortTreeNodes(new ArrayList<>(siteNodeMap.values()));
|
||||||
|
}
|
||||||
|
|
||||||
private List<VdTreeNodeVo> sortTreeNodes(List<VdTreeNodeVo> nodes) {
|
private List<VdTreeNodeVo> sortTreeNodes(List<VdTreeNodeVo> nodes) {
|
||||||
if (CollUtil.isEmpty(nodes)) {
|
if (CollUtil.isEmpty(nodes)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user