Commit d144bc0a authored by 李秀明's avatar 李秀明

统一消防资源-消防器材设备统计逻辑

parent 89e216c3
...@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -311,11 +312,13 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -311,11 +312,13 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
} }
} }
system.put("equipments", equipments); system.put("equipments", equipments);
AtomicLong equipmentCount = new AtomicLong(0);
systemEquipCountMaps.forEach(map -> { systemEquipCountMaps.forEach(map -> {
if (String.valueOf(map.get("systemId")).equals(systemId.toString())) { if (String.valueOf(map.get("systemId")).matches(".*" + systemId + ".*")) {
system.put("equipmentCount", map.getOrDefault("count", 0L)); equipmentCount.addAndGet(Long.parseLong(map.getOrDefault("count", 0L).toString()));
} }
}); });
system.put("equipmentCount", equipmentCount.get());
systems.add(system); systems.add(system);
} }
groups.add(group); groups.add(group);
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code
LEFT JOIN wl_unit u on u.id = we.unit_id LEFT JOIN wl_unit u on u.id = we.unit_id
<where> <where>
we.id IS NOT NULL AND wesp.system_id IS NOT NULL AND wesp.single = true we.id IS NOT NULL AND wesp.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND wesp.biz_org_code like concat(#{bizOrgCode},'%') AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if> </if>
...@@ -136,14 +136,14 @@ ...@@ -136,14 +136,14 @@
wl_equipment_specific wesp wl_equipment_specific wesp
LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code LEFT JOIN wl_equipment we ON we.code = wesp.equipment_code
<where> <where>
we.id IS NOT NULL AND wesp.system_id IS NOT NULL AND wesp.single = true we.id IS NOT NULL AND wesp.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND wesp.biz_org_code like concat(#{bizOrgCode},'%') AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if> </if>
<if test="systemIds != null and systemIds.size() > 0"> <if test="systemIds != null and systemIds.size() > 0">
AND ( AND (
<foreach collection="systemIds" item="systemId" separator="OR"> <foreach collection="systemIds" item="systemId" separator="OR">
find_in_set(wesp.system_id, #{systemId}) wesp.system_id LIKE concat('%',#{systemId},'%')
</foreach> </foreach>
) )
</if> </if>
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
<where> <where>
wle.id is not null wle.id is not null
and find_in_set(#{systemId},spe.system_id) and spe.single = true and find_in_set(#{systemId},spe.system_id)
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND spe.biz_org_code like concat (#{bizOrgCode},'%') AND spe.biz_org_code like concat (#{bizOrgCode},'%')
</if> </if>
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
<where> <where>
wle.id is not null and spe.single = true and spe.system_id is not null wle.id is not null and spe.system_id is not null
<if test="systemId != null and systemId != ''"> <if test="systemId != null and systemId != ''">
AND find_in_set(#{systemId},spe.system_id) AND find_in_set(#{systemId},spe.system_id)
</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