Commit f85248cb authored by maoying's avatar maoying

合并公共模块组态建筑设备树接口优化

parents a71b83de d0bbeceb
...@@ -481,43 +481,45 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -481,43 +481,45 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @return * @return
*/ */
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) { public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) {
List<PointTreeVo> treeList = new ArrayList<>(); //TODO id为空,为消防建筑使用;id不为空,为点位图使用
// TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id); List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) { if (!CollectionUtils.isEmpty(pointData)) {
List<Long> idList = pointData.stream().map(PointTreeVo::getSequenceNbr).collect(Collectors.toList()); // 优化不查指标,
List<SpeIndexVo> indexVoList = fireFightingSystemMapper.getSpeIndexIn(idList); pointData.forEach(p -> {
if (!CollectionUtils.isEmpty(indexVoList)) { Map map = new HashMap(7);
Map<Long, List<SpeIndexVo>> indexMap = indexVoList.stream() map.put("imgPath", p.getImgPath());
.collect(Collectors.groupingBy(SpeIndexVo::getEquipmentSpecificId)); map.put("equipCode", p.getEquipCode());
pointData.stream().forEach(p -> { map.put("equipSyetemId", p.getEquipSyetemId());
Map map = new HashMap(); map.put("equipTypeId", p.getEquipId());
map.put("imgPath", p.getImgPath()); map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("equipCode", p.getEquipCode()); map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("equipSyetemId", p.getEquipSyetemId()); map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("equipTypeId", p.getEquipId()); p.setDataConfig(map);
map.put("speindexList", makeStatus(indexMap.get(p.getSequenceNbr()))); });
map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map);
});
}
} }
allRiskSource.addAll(pointData); allRiskSource.addAll(pointData);
for (PointTreeVo tree : allRiskSource) { // 树组装优化
if (tree.getParentId() == null || tree.getParentId() == -1) { Map<Long, PointTreeVo> map = new HashMap<>(allRiskSource.size());
treeList.add(tree); allRiskSource.forEach(e -> map.put(e.getSequenceNbr(), e));
} Set<? extends Map.Entry<Long, ? extends PointTreeVo>> entries = map.entrySet();
for (PointTreeVo treeNode : allRiskSource) { List<PointTreeVo> treeList = new ArrayList<>();
if (tree.getSequenceNbr().equals(treeNode.getParentId())) { entries.forEach(entry -> {
if (tree.getChildren() == null) { PointTreeVo value = entry.getValue();
tree.setChildren(new ArrayList<>()); 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);
} }
tree.getChildren().add(treeNode); children.add(value);
} else {
treeList.add(value);
} }
} }
} });
return treeList; return treeList;
} }
......
...@@ -643,6 +643,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -643,6 +643,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode())); throw new RuntimeException(String.format("货位编码[%S]填写错误,请输入正确的货位编码!",equipmentDetailDownloadVOS.getWarehouseStructCode()));
} else { } else {
equipmentSpecific.setPosition(warehouseStructure.getFullName()); equipmentSpecific.setPosition(warehouseStructure.getFullName());
equipmentSpecific.setWarehouseStructureId(warehouseStructure.getId());
equipmentSpecificMapper.updateById(equipmentSpecific); equipmentSpecificMapper.updateById(equipmentSpecific);
} }
// 插入库存 // 插入库存
......
...@@ -192,7 +192,10 @@ ...@@ -192,7 +192,10 @@
'component' as template, 'component' as template,
true as openStatus, true as openStatus,
<if test="id == null"> <if test="id == null">
if((select count(1) from `wl_source_scene` ss where find_in_set(spe.id, ss.point_in_scene) and EXISTS 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 (SELECT es.instance_id FROM `wl_form_instance` es WHERE ss.source_id = es.instance_id)) = 0,0,1) as
isBinding, -- 一个装备只能在一个建筑使用 isBinding, -- 一个装备只能在一个建筑使用
</if> </if>
...@@ -217,9 +220,9 @@ ...@@ -217,9 +220,9 @@
spe.iot_code as iotCode, spe.iot_code as iotCode,
equ.id as groupId, equ.id as groupId,
equ.name as groupName, equ.name as groupName,
null as ip, '' as ip,
null as token, '' as token,
null as address '' as address
from wl_stock_detail as det from wl_stock_detail as det
join wl_warehouse_structure as stru on det.warehouse_structure_id = stru.id join wl_warehouse_structure as stru on det.warehouse_structure_id = stru.id
join wl_equipment_specific as spe on det.qr_code = spe.qr_code join wl_equipment_specific as spe on det.qr_code = spe.qr_code
...@@ -238,7 +241,10 @@ ...@@ -238,7 +241,10 @@
TRUE AS openStatus, TRUE AS openStatus,
IF IF
( (
( SELECT ss.id FROM wl_source_scene ss WHERE ss.video_in_scene LIKE CONCAT( '%', vid.id, '%' ) ) IS NULL, ( 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, 0,
1 1
) AS isBinding, ) AS isBinding,
......
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