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

item:视频监控树优化

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