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

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

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