Commit c2548881 authored by maoying's avatar maoying

组态树优化代码合并

parents a9dd0c82 ff00c72f
......@@ -24,14 +24,22 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.enums.AlarmStatusEnum;
import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum;
import com.yeejoin.equipmanage.common.enums.SystemTypeEnum;
import com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
<<<<<<< HEAD
import org.apache.commons.beanutils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
=======
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
>>>>>>> develop_station
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -484,43 +492,74 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) {
// 优化不查指标,
pointData.forEach(p -> {
// 查询所有wl_source_scene,判断是否绑定
List<SourceScene> sourceSceneList = sourceSceneMapper.selectList(null);
Map<Long, String> sourceSceneMap = null;
String equipSpecificIds = null;
if (!CollectionUtils.isEmpty(sourceSceneList)) {
sourceSceneMap = sourceSceneList.stream().collect(Collectors.toMap(SourceScene::getSourceId, SourceScene::getPointInScene));
List<String> equipSpecificIdList = sourceSceneList.stream().map(SourceScene::getPointInScene).collect(Collectors.toList());
equipSpecificIds = String.join(",", equipSpecificIdList);
}
// 优化不查指标
for (PointTreeVo p : pointData) {
Long buildOrSysId = p.getParentId();
Long equipSpecificId = p.getSequenceNbr();
Map map = new HashMap(7);
map.put("imgPath", p.getImgPath());
map.put("equipCode", p.getEquipCode());
map.put("equipSyetemId", p.getEquipSyetemId());
map.put("equipTypeId", p.getEquipId());
map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("speindexApi", speindexUrl + equipSpecificId);
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map);
});
}
allRiskSource.addAll(pointData);
// 树组装优化
Map<Long, PointTreeVo> map = new HashMap<>(allRiskSource.size());
allRiskSource.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends PointTreeVo>> entries = map.entrySet();
List<PointTreeVo> treeList = new ArrayList<>();
entries.forEach(entry -> {
PointTreeVo value = entry.getValue();
if (value != null) {
PointTreeVo treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<PointTreeVo> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
if (StringUtils.isEmpty(id)) {
// 建筑
if (equipSpecificIds.contains(String.valueOf(equipSpecificId))) {
p.setBinding(true);
} else {
p.setBinding(false);
}
children.add(value);
} else {
treeList.add(value);
if (sourceSceneMap != null) {
String pointInScene = sourceSceneMap.get(buildOrSysId);
if (!StringUtils.isEmpty(pointInScene)) {
// 系统
if (pointInScene.contains(String.valueOf(equipSpecificId))) {
p.setBinding(true);
} else {
p.setBinding(false);
}
}
}
}
}
});
return treeList;
allRiskSource.addAll(pointData);
// 树组装优化
Map<Long, PointTreeVo> map = new HashMap<>(allRiskSource.size());
allRiskSource.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends PointTreeVo>> entries = map.entrySet();
List<PointTreeVo> treeList = new ArrayList<>();
entries.forEach(entry -> {
PointTreeVo value = entry.getValue();
if (value != null) {
PointTreeVo treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<PointTreeVo> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
treeList.add(value);
}
}
});
return treeList;
}
return Collections.emptyList();
}
/**
......
......@@ -457,17 +457,7 @@
alter table `wl_equipment_specific_alarm` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-20">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="location"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column location</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-21">
<preConditions onFail="MARK_RAN">
<not>
......@@ -1007,6 +997,17 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备报警信息日志表';
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1621826150001-20">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="location"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column location</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `location` varchar(255) DEFAULT NULL COMMENT '设备位置';
</sql>
</changeSet>
<changeSet id="1630379025553-1" author="shg">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment_standard" columnName="create_id"/>
......
......@@ -191,18 +191,6 @@
select
'component' as template,
true as openStatus,
<if test="id == null">
if((select count(1) from `wl_source_scene` ss where
-- find_in_set(spe.id, ss.point_in_scene)
spe.id in (ss.point_in_scene)
and EXISTS
(SELECT es.instance_id FROM `wl_form_instance` es WHERE ss.source_id = es.instance_id)) = 0,0,1) as
isBinding, -- 一个装备只能在一个建筑使用
</if>
<if test="id != null and id !=''">
if((SELECT count(1) FROM `wl_source_scene` ss where ss.source_id = #{id} and
FIND_IN_SET(spe.id,ss.point_in_scene)) = 0,0,1) as isBinding,-- 一个装备可在多个系统使用
</if>
if(spe.code is null,eqdet.name,concat(eqdet.name,'(',spe.code,')')) as displayName,
'{\"width\": 20, \"height\": 20}'as initStyle,
'CommonEquip' as componentName,
......@@ -241,15 +229,6 @@
'component' AS template,
TRUE AS openStatus,
IF
(
( SELECT ss.id FROM wl_source_scene ss WHERE
-- ss.video_in_scene LIKE CONCAT( '%', vid.id, '%' )
vid.id in (ss.video_in_scene)
) IS NULL,
0,
1
) AS isBinding,
IF
( vid.CODE IS NULL, vid.NAME, concat( vid.NAME, '(', vid.CODE, ')' ) ) AS displayName,
'{\"width\": 20, \"height\": 20}' AS initStyle,
'CommonEquip' AS componentName,
......
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