Commit 0a79e6c3 authored by 高建强's avatar 高建强

item:视频监控bug修改

parent def40fd2
...@@ -195,7 +195,8 @@ public interface EquipFeignClient { ...@@ -195,7 +195,8 @@ public interface EquipFeignClient {
@RequestParam("size") String size, @RequestParam("size") String size,
@RequestParam("buildingId") String buildingId, @RequestParam("buildingId") String buildingId,
@RequestParam("code") String code, @RequestParam("code") String code,
@RequestParam("equipmentName") String equipmentName @RequestParam("equipmentName") String equipmentName,
@RequestParam("orgTypes") String orgTypes
); );
......
...@@ -59,4 +59,16 @@ public class BuildingVideoListVO { ...@@ -59,4 +59,16 @@ public class BuildingVideoListVO {
@ApiModelProperty("部门号") @ApiModelProperty("部门号")
private String orgCode; private String orgCode;
/**
* id列表
*/
@ApiModelProperty("机构编码")
private List<String> bizOrgCodeList;
/**
* 部门号
*/
@ApiModelProperty("类型")
private String orgTypes;
} }
...@@ -325,10 +325,11 @@ public class CommandController extends BaseController { ...@@ -325,10 +325,11 @@ public class CommandController extends BaseController {
String size, String size,
String equipmentName, String equipmentName,
String code, String code,
String buildingId String buildingId,
@RequestParam(required = false) String orgTypes
) throws Exception { ) throws Exception {
ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.getVideopag(current, size, buildingId, code, equipmentName); ResponseModel<Page<Map<String, Object>>> data = equipFeignClient.getVideopag(current, size, buildingId, code, equipmentName, orgTypes);
Page<Map<String, Object>> pag = data != null ? data.getResult() : null; Page<Map<String, Object>> pag = data != null ? data.getResult() : null;
List<Map<String, Object>> records = pag != null ? pag.getRecords() : null; List<Map<String, Object>> records = pag != null ? pag.getRecords() : null;
if (records != null && records.size() > 0) { if (records != null && records.size() > 0) {
......
...@@ -43,12 +43,9 @@ public class BuildingVideoController extends AbstractBaseController { ...@@ -43,12 +43,9 @@ public class BuildingVideoController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑视屏监控树") @ApiOperation("消防建筑视屏监控树")
@GetMapping(value = "/treeByBizOrgTypeCode") @GetMapping(value = "/getBuildingVideoTree")
public List<BuildingTreeVo> getBuildingTreeByBizOrgTypeCode(@RequestParam(required = false) String orgTypes) { public List<BuildingTreeVo> getBuildingVideoTree() {
ReginParams reginParams = getSelectedOrgInfo(); return buildService.getBuildingVideoTreeNew();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
return buildService.getBuildingTreeByBizOrgTypeCode(orgTypes, bizOrgCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -174,4 +174,6 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> { ...@@ -174,4 +174,6 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
List<LinkedHashMap<String, Object>> getAllBuilding(); List<LinkedHashMap<String, Object>> getAllBuilding();
Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId); Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId);
List<Map<String, Long>> getBuildVideoCount();
} }
...@@ -208,14 +208,6 @@ public interface IBuilldService extends IService<Building> { ...@@ -208,14 +208,6 @@ public interface IBuilldService extends IService<Building> {
List<BuildingTreeVo> getBuildingVideoTree(); List<BuildingTreeVo> getBuildingVideoTree();
/** /**
* 消防建筑视屏监控统计树
* @param orgTypes
* @param bizOrgCode
* @return
*/
List<BuildingTreeVo> getBuildingTreeByBizOrgTypeCode(String orgTypes, String bizOrgCode);
/**
* 消防建筑视屏监控分页列表 * 消防建筑视屏监控分页列表
* @param page * @param page
* @param dto * @param dto
...@@ -315,4 +307,5 @@ public interface IBuilldService extends IService<Building> { ...@@ -315,4 +307,5 @@ public interface IBuilldService extends IService<Building> {
*/ */
List<BuildingTreeVo> getCompanyBuildingTree(); List<BuildingTreeVo> getCompanyBuildingTree();
List<BuildingTreeVo> getBuildingVideoTreeNew();
} }
...@@ -154,4 +154,5 @@ public interface IFormInstanceService extends IService<FormInstance> { ...@@ -154,4 +154,5 @@ public interface IFormInstanceService extends IService<FormInstance> {
List<UnitAreaTreeVo> getValueByColumn(Long instanceId, String bizOrgcode); List<UnitAreaTreeVo> getValueByColumn(Long instanceId, String bizOrgcode);
List<Map<String, Long>> getBuildVideoCount();
} }
...@@ -94,6 +94,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -94,6 +94,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Autowired @Autowired
ISourceSceneService sourceSceneService; ISourceSceneService sourceSceneService;
@Autowired
private IBuilldService buildService;
@Value("${morphic.projectSeq}") @Value("${morphic.projectSeq}")
private Long projectSeq; private Long projectSeq;
...@@ -709,87 +712,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -709,87 +712,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override
public List<BuildingTreeVo> getBuildingTreeByBizOrgTypeCode(String orgTypes, String bizOrgCode) {
List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes);
List<String> bizOrgCodeList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
List<BuildingTreeVo> buildingTreeList = list.stream()
.map(key -> {
String buildId = key.getBuildId();
String orgCode = key.getBizOrgCode();
BuildingTreeVo vo = new BuildingTreeVo();
vo.setId(key.getSequenceNbr());
vo.setInstanceId(StringUtils.isNotBlank(buildId) ? Long.parseLong(buildId) : null);
vo.setInstanceName(key.getBizOrgName());
vo.setGroupType(key.getBizOrgType());
vo.setGroupCode(orgCode);
vo.setBizOrgCode(orgCode);
vo.setParentId(key.getParentId());
bizOrgCodeList.add(orgCode);
return vo;
}).collect(Collectors.toList());
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getBuildVideoListCount(bizOrgCodeList);
List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class);
for (BuildingTreeVo vo : buildingTreeList) {
String orgCode = vo.getBizOrgCode();
if (StringUtils.isNotBlank(orgCode)) {
List<BuildingTreeVo> collect = allListVo.stream().filter(x -> orgCode.equals(x.getBizOrgCode())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
List<BuildingTreeVo> treeVoList = collect.stream().map(s -> {
BuildingTreeVo t = new BuildingTreeVo();
Bean.copyExistPropertis(s, t);
Map<String, Object> childrenTotal = this.getChildrenTotal(t.getInstanceId(), allListVo);
// t.setChildren((List<BuildingTreeVo>) childrenTotal.get("list"));
t.setTotal((Long) childrenTotal.get("total"));
t.setDetailPaneApi(address);
return t;
}).collect(Collectors.toList());
vo.setChildren(treeVoList);
}
}
}
return listGetStree(buildingTreeList);
}
return Lists.newArrayList();
}
private List<BuildingTreeVo> listGetStree(List<BuildingTreeVo> list) {
List<BuildingTreeVo> treeList = new ArrayList<BuildingTreeVo>();
for (int i = 0; i < list.size(); i++) {
BuildingTreeVo tree = list.get(i);
//找到子
for (BuildingTreeVo treeNode : list) {
if (String.valueOf(tree.getId()).equals(treeNode.getParentId())) {
List<BuildingTreeVo> children = tree.getChildren();
children.add(treeNode);
tree.setChildren(children);
}
}
if (i == 0) {
treeList.add(tree);
}
}
return treeList;
}
private List<BuildingTreeVo> getChildren(BuildingTreeVo root, List<BuildingTreeVo> all) {
String bizOrgCode = root.getBizOrgCode();
return all.stream().filter(d -> StringUtils.isNotBlank(d.getBizOrgCode()) && bizOrgCode.equals(d.getBizOrgCode().substring(0, d.getBizOrgCode().length() - 6)))
.peek(m -> {
List<BuildingTreeVo> children = m.getChildren();
if (CollectionUtils.isEmpty(children)) {
m.setChildren(getChildren(m, all));
} else {
children.addAll(getChildren(m, all));
m.setChildren(children);
}
})
.collect(Collectors.toList());
}
private List<BuildingTreeVo> buildColaBuildingData(FormGroup formGroup, List<Map<String, Object>> allList) { private List<BuildingTreeVo> buildColaBuildingData(FormGroup formGroup, List<Map<String, Object>> allList) {
List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class); List<BuildingTreeVo> allListVo = Bean.listMap2ListBean(allList, BuildingTreeVo.class);
BuildingTreeVo treeNode = new BuildingTreeVo(); BuildingTreeVo treeNode = new BuildingTreeVo();
...@@ -844,28 +766,28 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -844,28 +766,28 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public Page<BuildingVideoVO> buildingVideoList(Page page, BuildingVideoListVO dto) { public Page<BuildingVideoVO> buildingVideoList(Page page, BuildingVideoListVO dto) {
String buildingId = dto.getBuildingId(); String buildingId = dto.getBuildingId();
if ("0".equals(buildingId)) { String orgTypes = dto.getOrgTypes();
dto.setBuildingId(null); if ("0".equals(buildingId) && StringUtils.isNotBlank(orgTypes)) {
List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "DEPARTMENT,COMPANY"); List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<Long> buildIdList = new ArrayList<>(); List<String> bizOrgCodeList = new ArrayList<>();
list.stream().filter(x -> StringUtils.isNotEmpty(x.getBuildId())).forEach(o -> buildIdList.add(Long.parseLong(o.getBuildId()))); list.stream().filter(x -> StringUtils.isNotEmpty(x.getBizOrgCode())).forEach(o -> bizOrgCodeList.add(o.getBizOrgCode()));
dto.setBuildIdList(buildIdList); dto.setBizOrgCodeList(bizOrgCodeList);
} }
} }
Page<BuildingVideoVO> pages = videoService.pageBuildingVideo(page, dto); Page<BuildingVideoVO> pages = videoService.pageBuildingVideo(page, dto);
if (0 < pages.getRecords().size()) { // if (0 < pages.getRecords().size()) {
pages.getRecords().forEach(x -> { // pages.getRecords().forEach(x -> {
if (StringUtil.isNotEmpty(x.getLocation()) && StringUtil.isNotEmpty(x.getAddress())) { // if (StringUtil.isNotEmpty(x.getLocation()) && StringUtil.isNotEmpty(x.getAddress())) {
x.setLocation(x.getLocation() + '-' + x.getAddress()); // x.setLocation(x.getLocation() + '-' + x.getAddress());
} else { // } else {
if (!StringUtil.isNotEmpty(x.getLocation())) { // if (!StringUtil.isNotEmpty(x.getLocation())) {
x.setLocation(x.getAddress()); // x.setLocation(x.getAddress());
} // }
} // }
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode())); // x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
}); // });
} // }
return pages; return pages;
} }
...@@ -1226,6 +1148,38 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1226,6 +1148,38 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public List<BuildingTreeVo> getBuildingVideoTreeNew() {
List<BuildingTreeVo> list = buildService.getCompanyBuildingTree();
if (!CollectionUtils.isEmpty(list)) {
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
if (!CollectionUtils.isEmpty(countList)) {
Map<Long, Long> map = countList.stream().collect(Collectors.toMap(p->p.get("buildId"), p->p.get("total")));
for (BuildingTreeVo treeVo : list) {
List<BuildingTreeVo> children = treeVo.getChildren();
if (!CollectionUtils.isEmpty(children)) {
List<BuildingTreeVo> treeVoList = getBuildingVideoTotal(children, map);
treeVo.setChildren(treeVoList);
}
treeVo.setTotal(map.get(treeVo.getInstanceId()));
}
}
return list;
}
return Lists.newArrayList();
}
public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) {
for (BuildingTreeVo treeVo : children) {
List<BuildingTreeVo> childrenList = treeVo.getChildren();
if (!CollectionUtils.isEmpty(children)) {
getBuildingVideoTotal (childrenList, map);
}
treeVo.setTotal(map.get(treeVo.getInstanceId()));
}
return children;
}
private List<BuildingTreeVo> getCompanyBuildingChildrenTree(BuildingTreeVo root , List<BuildingTreeVo> all) { private List<BuildingTreeVo> getCompanyBuildingChildrenTree(BuildingTreeVo root , List<BuildingTreeVo> all) {
return all.stream().filter(b -> return all.stream().filter(b ->
(root.getId() != null && StringUtil.isNotEmpty(b.getParentId()) && b.getParentId().equals(root.getId().toString())) || (root.getId() != null && StringUtil.isNotEmpty(b.getParentId()) && b.getParentId().equals(root.getId().toString())) ||
......
...@@ -509,4 +509,9 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For ...@@ -509,4 +509,9 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
return listTree; return listTree;
} }
@Override
public List<Map<String, Long>> getBuildVideoCount() {
return formInstanceMapper.getBuildVideoCount();
}
} }
...@@ -482,4 +482,13 @@ FROM ...@@ -482,4 +482,13 @@ FROM
WHERE WHERE
instance_id = #{instanceId} instance_id = #{instanceId}
</select> </select>
<select id="getBuildVideoCount" resultType="hashmap">
SELECT
wlv.source_id AS buildId,
count( wlv.source_id ) AS total
FROM
`wl_video_source` wlv
GROUP BY
wlv.source_id
</select>
</mapper> </mapper>
...@@ -76,10 +76,10 @@ ...@@ -76,10 +76,10 @@
<if test="dto.buildingId!=null and dto.buildingId!=''"> <if test="dto.buildingId!=null and dto.buildingId!=''">
FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{dto.buildingId})) FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{dto.buildingId}))
</if> </if>
<if test="dto.buildIdList != null and dto.buildIdList.size > 0"> <if test="dto.bizOrgCodeList != null and dto.bizOrgCodeList.size > 0">
AND AND v.biz_org_code IN
<foreach collection="dto.buildIdList" item="item" index="index" open="(" close=")" separator=" OR "> <foreach collection="dto.bizOrgCodeList" item="item" index="index" open="(" close=")" separator=",">
FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{item, jdbcType=INTEGER})) #{item}
</foreach> </foreach>
</if> </if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''"> <if test="dto.equipmentName!=null and dto.equipmentName!=''">
......
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