Commit b60297c8 authored by 高建强's avatar 高建强

item:直流中心bug修改

parent 6b8da80d
...@@ -12,4 +12,5 @@ public class FireFightingSystemDto { ...@@ -12,4 +12,5 @@ public class FireFightingSystemDto {
private Integer alarmEquipTotal = 0; private Integer alarmEquipTotal = 0;
private Integer status = 0; private Integer status = 0;
private String image; private String image;
private Long sort;
} }
...@@ -2114,16 +2114,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2114,16 +2114,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if (!CollectionUtils.isEmpty(records)) { if (!CollectionUtils.isEmpty(records)) {
List<Long> idList = records.stream().map(FireFightingSystemDto::getId).collect(Collectors.toList()); List<Long> idList = records.stream().map(FireFightingSystemDto::getId).collect(Collectors.toList());
List<FireFightingSystemDto> list = equipmentSpecificSerivce.fireSysIotEquipAlarmCount(new Date(), bizOrgCode); List<FireFightingSystemDto> list = equipmentSpecificSerivce.fireSysIotEquipAlarmCount(new Date(), bizOrgCode);
if (!CollectionUtils.isEmpty(list)) {
//使用stream流把list1和list2根据属性userId合并一个list集合 //使用stream流把list1和list2根据属性userId合并一个list集合
List<FireFightingSystemDto> collect = records.stream().map(m -> { List<FireFightingSystemDto> collect = records.stream().peek(m -> list.stream().filter(m2 -> Objects.equals(m.getId(), m2.getId())).forEach(m2 -> {
list.stream().filter(m2-> Objects.equals(m.getId(),m2.getId())).forEach(m2-> {
m.setAlarmEquipTotal(m2.getAlarmEquipTotal()); m.setAlarmEquipTotal(m2.getAlarmEquipTotal());
m.setStatus(m2.getStatus()); m.setStatus(m2.getStatus());
}); })).sorted(Comparator.comparing(FireFightingSystemDto::getStatus, Comparator.reverseOrder())
return m; .thenComparing(FireFightingSystemDto::getSort)).collect(Collectors.toList());
}).collect(Collectors.toList()); // 根据状态倒序排序
pages.setRecords(collect); pages.setRecords(collect);
} }
}
return pages; return pages;
} }
} }
...@@ -2016,7 +2016,8 @@ ...@@ -2016,7 +2016,8 @@
fs.id, fs.id,
fs.`code`, fs.`code`,
fs.`name`, fs.`name`,
count( 1 ) AS equipTotal, fs.`sort`,
SUM(IF(e.is_iot = 1,1,0)) AS equipTotal,
ec.image ec.image
FROM FROM
f_fire_fighting_system fs f_fire_fighting_system fs
...@@ -2024,11 +2025,11 @@ ...@@ -2024,11 +2025,11 @@
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment e ON wed.`equipment_id` = e.`id` LEFT JOIN wl_equipment e ON wed.`equipment_id` = e.`id`
LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type
WHERE <where>
e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
and fs.biz_org_code like concat(#{bizOrgCode}, '%') fs.biz_org_code like concat(#{bizOrgCode}, '%')
</if> </if>
</where>
GROUP BY GROUP BY
fs.id fs.id
ORDER BY ORDER BY
...@@ -2039,22 +2040,14 @@ ...@@ -2039,22 +2040,14 @@
s.id, s.id,
s.`name`, s.`name`,
IFNULL(s.alarmEquipTotal, 0) AS alarmEquipTotal, IFNULL(s.alarmEquipTotal, 0) AS alarmEquipTotal,
<choose>
<when test="date != null">
IF(s.total > 0,1,0) AS `status`
</when>
<otherwise>
IF(s.alarmEquipTotal > 0,1,0) AS `status` IF(s.alarmEquipTotal > 0,1,0) AS `status`
</otherwise>
</choose>
FROM FROM
(SELECT (SELECT
fs.id, fs.id,
fs.`name`, fs.`name`,
count( 1 ) AS total,
<choose> <choose>
<when test="date != null"> <when test="date != null">
SUM(IF(TO_DAYS(esi.create_date) = TO_DAYS(#{date}),1,0)) AS alarmEquipTotal SUM(IF(TO_DAYS(esi.update_date) = TO_DAYS(#{date}),1,0)) AS alarmEquipTotal
</when> </when>
<otherwise> <otherwise>
COUNT( 1 ) AS alarmEquipTotal COUNT( 1 ) AS alarmEquipTotal
......
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