Commit d21c49d5 authored by xixinzhao's avatar xixinzhao

视频监控

parent 35b58fb4
...@@ -58,4 +58,12 @@ public class FireBuildingController extends BaseController { ...@@ -58,4 +58,12 @@ public class FireBuildingController extends BaseController {
@ApiParam(value = "换流站code") @PathVariable String stationCode) { @ApiParam(value = "换流站code") @PathVariable String stationCode) {
return ResponseHelper.buildResponse(fireBuildingServiceImpl.buildingTree(stationCode)); return ResponseHelper.buildResponse(fireBuildingServiceImpl.buildingTree(stationCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "stationBuildingTree")
@ApiOperation(httpMethod = "GET", value = "换流站建筑树", notes = "换流站建筑树")
public ResponseModel stationBuildingTree (@ApiParam(value = "换流站code")
@RequestParam(value = "stationCode", required = false) String stationCode) {
return ResponseHelper.buildResponse(fireBuildingServiceImpl.stationBuildingTree(stationCode));
}
} }
...@@ -51,6 +51,7 @@ public class FireVideoController extends BaseController { ...@@ -51,6 +51,7 @@ public class FireVideoController extends BaseController {
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current, @ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页大小", required = true) @RequestParam(value = "size") int size, @ApiParam(value = "页大小", required = true) @RequestParam(value = "size") int size,
@ApiParam(value = "换流站code", required = true) @PathVariable String stationCode, @ApiParam(value = "换流站code", required = true) @PathVariable String stationCode,
@ApiParam(value = "摄像头编码") @RequestParam(value = "videoMrid", required = false) String videoMrid,
@ApiParam(value = "所在建筑,多个用逗号分隔") @RequestParam(value = "buildingMrids", required = false) String buildingMrids) { @ApiParam(value = "所在建筑,多个用逗号分隔") @RequestParam(value = "buildingMrids", required = false) String buildingMrids) {
List<String> buildingMridList = new ArrayList<>(); List<String> buildingMridList = new ArrayList<>();
//根节点id(全部建筑时使用,本来可以不送来实现过滤,但是地图前端不支持) //根节点id(全部建筑时使用,本来可以不送来实现过滤,但是地图前端不支持)
...@@ -61,7 +62,8 @@ public class FireVideoController extends BaseController { ...@@ -61,7 +62,8 @@ public class FireVideoController extends BaseController {
Page<FireVideoDto> page = new Page<>(); Page<FireVideoDto> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(fireVideoServiceImpl.queryForFireVideoPage(page, name, stationCode, buildingMridList)); String code = ("-1").equals(stationCode) ? "" : stationCode;
return ResponseHelper.buildResponse(fireVideoServiceImpl.queryForFireVideoPage(page, name, code, buildingMridList, videoMrid));
} }
} }
...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -48,6 +49,30 @@ public class FireBuildingServiceImpl extends BaseService<FireBuildingDto, FireBu ...@@ -48,6 +49,30 @@ public class FireBuildingServiceImpl extends BaseService<FireBuildingDto, FireBu
} }
private List<FireBuildingDto> getChildren(String mrid, List<FireBuildingDto> dtoList) { private List<FireBuildingDto> getChildren(String mrid, List<FireBuildingDto> dtoList) {
return dtoList.stream().filter(d -> StringUtils.isNotBlank(d.getParentMrid()) && d.getParentMrid().equals(mrid)).peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList()); return dtoList.stream().filter(d -> StringUtils.isNotBlank(d.getParentMrid()) && d.getParentMrid().equals(mrid)).
peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).
sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList());
}
public List<FireBuildingDto> stationBuildingTree(String stationCode) {
List<FireBuildingDto> dtoList = this.queryForList("create_date", true, stationCode);
// 根据换流站code分组list
Map<String, List<FireBuildingDto>> stationMap = dtoList.stream().collect(Collectors.groupingBy(f -> f.getStationName()+"_"+f.getStationCode()));
return stationMap.keySet().stream().map(key -> {
FireBuildingDto parentNode = new FireBuildingDto();
String[] temp = key.split("_");
String name = temp[0];
String code = temp[1];
parentNode.setStationCode(code);
parentNode.setStationName(name);
parentNode.setId(code);
parentNode.setType("station");
parentNode.setName(name);
List<FireBuildingDto> childrenNode = stationMap.get(key).stream().filter(d -> StringUtils.isBlank(d.getParentMrid()) || "0".equals(d.getParentMrid()) || "-1".equals(d.getParentMrid())).
peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).
sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList());
parentNode.setChildren(childrenNode);
return parentNode;
}).collect(Collectors.toList());
} }
} }
\ No newline at end of file
...@@ -23,8 +23,9 @@ public class FireVideoServiceImpl extends BaseService<FireVideoDto, FireVideo, F ...@@ -23,8 +23,9 @@ public class FireVideoServiceImpl extends BaseService<FireVideoDto, FireVideo, F
/** /**
* 分页查询 * 分页查询
*/ */
public Page<FireVideoDto> queryForFireVideoPage(Page<FireVideoDto> page, @Condition(Operator.like) String name, String stationCode, @Condition(Operator.in) List<String> buildingMrid) { public Page<FireVideoDto> queryForFireVideoPage(Page<FireVideoDto> page, @Condition(Operator.like) String name, String stationCode, @Condition(Operator.in) List<String> buildingMrid,
return this.queryForPage(page, "create_date", false, name, stationCode, buildingMrid); @Condition(Operator.like) String mrid) {
return this.queryForPage(page, "create_date", false, name, stationCode, buildingMrid, mrid);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment