Commit 37adfa43 authored by 高建强's avatar 高建强

item:视频监控树优化

parent 014db0b1
package com.yeejoin.equipmanage.common.entity; package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity; import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
...@@ -130,10 +131,10 @@ public class Video extends BaseEntity { ...@@ -130,10 +131,10 @@ public class Video extends BaseEntity {
private String belongAreaId; private String belongAreaId;
@ApiModelProperty(value = "机构编码") @ApiModelProperty(value = "机构编码")
@TableField(value = "biz_org_code") @TableField(value = "biz_org_code", updateStrategy = FieldStrategy.IGNORED)
private String bizOrgCode; private String bizOrgCode;
@ApiModelProperty(value = "机构/部门名称") @ApiModelProperty(value = "机构/部门名称")
@TableField(value = "biz_org_name") @TableField(value = "biz_org_name", updateStrategy = FieldStrategy.IGNORED)
private String bizOrgName; private String bizOrgName;
} }
...@@ -63,6 +63,12 @@ public class BuildingVideoListVO { ...@@ -63,6 +63,12 @@ public class BuildingVideoListVO {
* id列表 * id列表
*/ */
@ApiModelProperty("机构编码") @ApiModelProperty("机构编码")
private String bizOrgCode;
/**
* id列表
*/
@ApiModelProperty("机构编码")
private List<String> bizOrgCodeList; private List<String> bizOrgCodeList;
/** /**
......
...@@ -285,8 +285,8 @@ public class BuildingController extends AbstractBaseController { ...@@ -285,8 +285,8 @@ public class BuildingController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("公司消防建筑树") @ApiOperation("公司消防建筑树")
@GetMapping(value = "/companyBuildingTree") @GetMapping(value = "/companyBuildingTree")
public List<BuildingTreeVo> getCompanyBuildingTree() { public List<BuildingTreeVo> getCompanyBuildingTree(@RequestParam(required = false) String authKey) {
return buildService.getCompanyBuildingTree(); return buildService.getCompanyBuildingTree(authKey);
} }
} }
...@@ -304,8 +304,9 @@ public interface IBuilldService extends IService<Building> { ...@@ -304,8 +304,9 @@ public interface IBuilldService extends IService<Building> {
/** /**
* 根据登陆人获取公司部门树 * 根据登陆人获取公司部门树
* @return list * @return list
* @param authKey
*/ */
List<BuildingTreeVo> getCompanyBuildingTree(); List<BuildingTreeVo> getCompanyBuildingTree(String authKey);
List<BuildingTreeVo> getBuildingVideoTreeNew(); List<BuildingTreeVo> getBuildingVideoTreeNew();
} }
...@@ -94,9 +94,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -94,9 +94,6 @@ 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;
...@@ -124,6 +121,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -124,6 +121,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Value("${auth-key-fire-building:fire_building_info}") @Value("${auth-key-fire-building:fire_building_info}")
private String authKey; private String authKey;
@Value("${auth-key-fire-building:auth-key-fire-build-video}")
private String buildVideoAuthKey;
@Autowired @Autowired
private JCSRemoteService jcsRemoteService; private JCSRemoteService jcsRemoteService;
...@@ -770,9 +770,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -770,9 +770,8 @@ 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 orgTypes = dto.getOrgTypes(); String orgTypes = dto.getOrgTypes();
if ("0".equals(buildingId) && StringUtils.isNotBlank(orgTypes)) { if (StringUtils.isNotBlank(orgTypes)) {
List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes); List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<String> bizOrgCodeList = new ArrayList<>(); List<String> bizOrgCodeList = new ArrayList<>();
...@@ -1125,7 +1124,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1125,7 +1124,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
@Override @Override
public List<BuildingTreeVo> getCompanyBuildingTree() { public List<BuildingTreeVo> getCompanyBuildingTree(String authKey) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
List<BuildingTreeVo> allListVo = getBuildingTreeVos(); List<BuildingTreeVo> allListVo = getBuildingTreeVos();
// 获取公司部门list // 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY"); List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY");
...@@ -1155,7 +1157,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1155,7 +1157,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public List<BuildingTreeVo> getBuildingVideoTreeNew() { public List<BuildingTreeVo> getBuildingVideoTreeNew() {
List<BuildingTreeVo> list = buildService.getCompanyBuildingTree(); List<BuildingTreeVo> list = getCompanyBuildingTree(buildVideoAuthKey);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount(); List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
if (!CollectionUtils.isEmpty(countList)) { if (!CollectionUtils.isEmpty(countList)) {
...@@ -1177,7 +1179,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1177,7 +1179,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) { public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) {
for (BuildingTreeVo treeVo : children) { for (BuildingTreeVo treeVo : children) {
List<BuildingTreeVo> childrenList = treeVo.getChildren(); List<BuildingTreeVo> childrenList = treeVo.getChildren();
if (!CollectionUtils.isEmpty(children)) { if (!CollectionUtils.isEmpty(childrenList)) {
getBuildingVideoTotal (childrenList, map); getBuildingVideoTotal (childrenList, map);
} }
treeVo.setTotal(map.get(treeVo.getInstanceId())); treeVo.setTotal(map.get(treeVo.getInstanceId()));
......
...@@ -482,13 +482,23 @@ FROM ...@@ -482,13 +482,23 @@ 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>-->
<select id="getBuildVideoCount" resultType="hashmap"> <select id="getBuildVideoCount" resultType="hashmap">
SELECT SELECT
wlv.source_id AS buildId, b.instanceId AS buildId,
count( wlv.source_id ) AS total COUNT( vs.video_id ) AS total
FROM FROM
`wl_video_source` wlv get_building_tree b
LEFT JOIN wl_video_source vs ON FIND_IN_SET( vs.source_id, getBuildChildIdsByRootId ( b.instanceId ) )
GROUP BY GROUP BY
wlv.source_id b.instanceId
</select> </select>
</mapper> </mapper>
...@@ -74,14 +74,21 @@ ...@@ -74,14 +74,21 @@
JOIN wl_video_source vc ON vc.video_id = v.id JOIN wl_video_source vc ON vc.video_id = v.id
<where> <where>
<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, getBuildChildIdsByRootId(#{dto.buildingId}))
</if> </if>
<choose>
<when test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
OR v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</when>
<otherwise>
<if test="dto.bizOrgCodeList != null and dto.bizOrgCodeList.size > 0"> <if test="dto.bizOrgCodeList != null and dto.bizOrgCodeList.size > 0">
AND v.biz_org_code IN AND v.biz_org_code IN
<foreach collection="dto.bizOrgCodeList" item="item" index="index" open="(" close=")" separator=","> <foreach collection="dto.bizOrgCodeList" item="item" index="index" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
</otherwise>
</choose>
<if test="dto.equipmentName!=null and dto.equipmentName!=''"> <if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%') and v.name like concat('%',#{dto.equipmentName},'%')
</if> </if>
......
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