Commit 5c9d1dc1 authored by KeYong's avatar KeYong

提交直流中心统计接口

parent ed5a85ad
...@@ -902,4 +902,15 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -902,4 +902,15 @@ public class FireFightingSystemController extends AbstractBaseController {
public Object getSystemAlarmInfoList(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) throws Exception { public Object getSystemAlarmInfoList(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) throws Exception {
return fireFightingSystemService.getSystemAlarmInfoList(startDate, endDate); return fireFightingSystemService.getSystemAlarmInfoList(startDate, endDate);
} }
/**
* 获取消防系统总体运行情况
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防系统告警状态信息", notes = "获取消防系统告警状态信息")
@GetMapping(value = "/running/info")
public Object getSystemRunningInfoList() throws Exception {
return fireFightingSystemService.getSystemRunningInfoList();
}
} }
...@@ -617,4 +617,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -617,4 +617,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getSystemInfoList(); List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate); List<Map<String, Object>> getSystemAlarmInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
List<Map<String, Object>> getSystemCountInfo();
Map<String, Object> getSystemRunningInfoList();
} }
...@@ -293,4 +293,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -293,4 +293,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getSystemInfoList(); List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate); List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate);
List<Map<String, Object>> getSystemRunningInfoList();
} }
...@@ -2028,7 +2028,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2028,7 +2028,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map<String, Object>> list1 = new ArrayList(); List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name", x.get("status")); map.put("name", x.get("status"));
map.put("level", "success"); if ("正常".equals(String.valueOf(x.get("status")))) {
map.put("level", "success");
} else {
map.put("level", "failure");
}
list1.add(map); list1.add(map);
x.put("status", list1); x.put("status", list1);
}); });
...@@ -2040,4 +2044,35 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2040,4 +2044,35 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) { public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) {
return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate); return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate);
} }
@Override
public List<Map<String, Object>> getSystemRunningInfoList() {
List<Map<String, Object>> list = fireFightingSystemMapper.getSystemCountInfo();
Map<String, Object> alarmNumMap = fireFightingSystemMapper.getSystemRunningInfoList();
List<Map<String, Object>> resultList = new ArrayList<>();
if (0 < list.size()) {
list.forEach(x -> {
Map<String, Object> resultMap = new HashMap<>();
if (SystemTypeEnum.fireWaterSys.getCode().equals(String.valueOf(x.get("systemTypeCode")))) {
resultMap.put("name", SystemTypeEnum.fireWaterSys.getDesc());
resultMap.put("total", x.get("sysTotalNum"));
resultMap.put("alarmNum", alarmNumMap.get("waterSysNum"));
} else if (SystemTypeEnum.fireCAFSSys.getCode().equals(String.valueOf(x.get("systemTypeCode")))) {
resultMap.put("name", SystemTypeEnum.fireCAFSSys.getDesc());
resultMap.put("total", x.get("sysTotalNum"));
resultMap.put("alarmNum", alarmNumMap.get("cafsSysNum"));
} else if (SystemTypeEnum.fireAlarmSys.getCode().equals(String.valueOf(x.get("systemTypeCode")))) {
resultMap.put("name", SystemTypeEnum.fireAlarmSys.getDesc());
resultMap.put("total", x.get("sysTotalNum"));
resultMap.put("alarmNum", alarmNumMap.get("fireAlarmSysNum"));
} else {
resultMap.put("name", SystemTypeEnum.fireONLSys.getDesc());
resultMap.put("total", x.get("sysTotalNum"));
resultMap.put("alarmNum", alarmNumMap.get("onlSysNum"));
}
resultList.add(resultMap);
});
}
return resultList;
}
} }
...@@ -5213,7 +5213,69 @@ ...@@ -5213,7 +5213,69 @@
) AS `value` ) AS `value`
FROM FROM
`f_fire_fighting_system` `fs` `f_fire_fighting_system` `fs`
-- where where
-- fs.system_type_code IS NOT NULL fs.system_type_code IS NOT NULL
</select>
<select id="getSystemCountInfo" resultType="java.util.Map">
SELECT
fs.`name`,
fs.system_type_code AS systemTypeCode,
COUNT(1) AS sysNum
FROM
`f_fire_fighting_system` `fs`
WHERE fs.system_type_code IS NOT NULL AND fs.system_type_code IN ('fireWaterSys', 'fireCAFSSys', 'fireAlarmSys', 'fireONLSys')
GROUP BY fs.system_type_code
</select>
<select id="getSystemRunningInfoList" resultType="java.util.Map">
SELECT
(
SELECT
COUNT( DISTINCT fs.id )
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN `wl_equipment_specific_index` `wesi` ON wesi.equipment_specific_id = wes.id
WHERE
fs.system_type_code IS NOT NULL
AND fs.system_type_code = 'fireWaterSys'
AND ( wesi.is_alarm = 1 AND wesi.`value` = 'true' OR wesi.is_alarm = 0 AND wesi.`value` = 'false' )
) waterSysNum,
(
SELECT
COUNT( DISTINCT fs.id )
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN `wl_equipment_specific_index` `wesi` ON wesi.equipment_specific_id = wes.id
WHERE
fs.system_type_code IS NOT NULL
AND fs.system_type_code = 'fireCAFSSys'
AND ( wesi.is_alarm = 1 AND wesi.`value` = 'true' OR wesi.is_alarm = 0 AND wesi.`value` = 'false' )
) cafsSysNum,
(
SELECT
COUNT( DISTINCT fs.id )
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN `wl_equipment_specific_index` `wesi` ON wesi.equipment_specific_id = wes.id
WHERE
fs.system_type_code IS NOT NULL
AND fs.system_type_code = 'fireAlarmSys'
AND ( wesi.is_alarm = 1 AND wesi.`value` = 'true' OR wesi.is_alarm = 0 AND wesi.`value` = 'false' )
) fireAlarmSysNum,
(
SELECT
COUNT( DISTINCT fs.id )
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN `wl_equipment_specific_index` `wesi` ON wesi.equipment_specific_id = wes.id
WHERE
fs.system_type_code IS NOT NULL
AND fs.system_type_code = 'fireONLSys'
AND ( wesi.is_alarm = 1 AND wesi.`value` = 'true' OR wesi.is_alarm = 0 AND wesi.`value` = 'false' )
) onlSysNum
</select> </select>
</mapper> </mapper>
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