Commit 25626401 authored by KeYong's avatar KeYong

提交指标等统计接口

parent db69e2f5
...@@ -361,6 +361,34 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -361,6 +361,34 @@ public class EquipmentSpecificController extends AbstractBaseController {
return equipmentSpecificSerivce.getListByEquipmentCode(code); return equipmentSpecificSerivce.getListByEquipmentCode(code);
} }
@GetMapping(value = "/index/normal")
@ApiOperation(httpMethod = "GET", value = "查询非告警指标list", notes = "查询非告警指标list")
public ResponseModel normalIndexInfoList(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.normalIndexInfoList(startDate, endDate));
}
@GetMapping(value = "/info/fire")
@ApiOperation(httpMethod = "GET", value = "查询火报系统指标", notes = "查询火报系统指标")
public ResponseModel getFireAutoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getFireAutoSysInfo(startDate, endDate));
}
@GetMapping(value = "/info/paomo")
@ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标")
public ResponseModel getPaomoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getPaomoSysInfo(startDate, endDate));
}
@GetMapping(value = "/info/water")
@ApiOperation(httpMethod = "GET", value = "查询给水系统指标", notes = "查询给水系统指标")
public ResponseModel getWaterSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getWaterSysInfo(startDate, endDate));
}
@RequestMapping(value = "/equipment/iotIndexInfo/{equipSpeId}", method = RequestMethod.GET) @RequestMapping(value = "/equipment/iotIndexInfo/{equipSpeId}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据装备id获取物联日志", notes = "根据装备id获取物联日志") @ApiOperation(httpMethod = "GET", value = "根据装备id获取物联日志", notes = "根据装备id获取物联日志")
...@@ -398,4 +426,6 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -398,4 +426,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey)); return CommonResponseUtil.success(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey));
} }
} }
...@@ -230,4 +230,12 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -230,4 +230,12 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings); List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings);
Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode); Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
Map<String, Object> getFireAutoSysInfo();
Map<String, Object> getPaomoSysInfo();
Map<String, Object> getWaterSysInfo();
} }
...@@ -237,4 +237,11 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -237,4 +237,11 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
*/ */
List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey); List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey);
Map<String, Object> normalIndexInfoList(String startDate, String endDate);
Map<String, Object> getFireAutoSysInfo(String startDate, String endDate);
Map<String, Object> getPaomoSysInfo(String startDate, String endDate);
Map<String, Object> getWaterSysInfo(String startDate, String endDate);
} }
...@@ -1892,4 +1892,23 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1892,4 +1892,23 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
} }
@Override
public Map<String, Object> normalIndexInfoList(String startDate, String endDate) {
return equipmentSpecificMapper.normalIndexInfoList(startDate, endDate);
}
@Override
public Map<String, Object> getFireAutoSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getFireAutoSysInfo();
}
@Override
public Map<String, Object> getPaomoSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getPaomoSysInfo();
}
@Override
public Map<String, Object> getWaterSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getWaterSysInfo();
}
} }
...@@ -1640,4 +1640,334 @@ ...@@ -1640,4 +1640,334 @@
</if> </if>
</where> </where>
</select> </select>
<select id="normalIndexInfoList" resultType="java.util.Map">
SELECT
`s`.`name` AS `equipName`,
`si`.`equipment_index_key` AS `equipmentIndexKey`,
(CASE si.`value` WHEN 'true' THEN '是' WHEN 'false' THEN '否' ELSE concat(si.`value`, IFNULL(wei.unit, '')) END) AS `value`,
-- (CONCAT((SELECT field_value FROM wl_form_instance_equip fie WHERE fie.instance_id = s.id AND fie.field_name like 'min%'),'-',(SELECT field_value FROM wl_form_instance_equip fie WHERE fie.instance_id = s.id AND fie.field_name like 'max%'), IFNULL(wei.unit, ''))) AS standardValue,
'' AS standardValue,
si.update_date AS `time`,
`si`.`equipment_index_name` AS `equipmentIndexName`,
`s`.`code` AS `code`,
a.`name` AS `areaName`,
(SELECT
group_concat( `fs`.`charge_person_name` SEPARATOR ',' )
FROM
`f_fire_fighting_system` `fs`
WHERE
(
0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `s`.`system_id` ))) AS `chargePersonName`,
(SELECT
group_concat( `fs`.`name` SEPARATOR ',' )
FROM
`f_fire_fighting_system` `fs`
WHERE
(
0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `s`.`system_id` ))) AS `fightSysName`
FROM
`wl_equipment_specific_index` `si` JOIN `wl_equipment_specific` `s`
LEFT JOIN wl_area a ON a.id = s.area_id
LEFT JOIN wl_equipment_index wei ON wei.id = si.equipment_index_id
WHERE
`si`.`equipment_specific_id` = `s`.`id` AND si.is_alarm = 0
<if test="startDate!=null">
AND DATE_FORMAT(si.update_date,'%y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{startDate},'%y-%m-%d')
</if>
<if test="endDate!=null">
AND DATE_FORMAT(si.update_date,'%y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{endDate},'%y-%m-%d')
</if>
</select>
<select id="getFireAutoSysInfo" resultType="java.util.Map">
SELECT
ifnull(`b`.`fightSysId`, NULL) AS `fightSysId`,
ifnull(`b`.`fightSysCode`, NULL) AS `fightSysCode`,
ifnull(`b`.`fightSysName`, NULL) AS `fightSysName`,
ifnull(
`b`.`reportDate`,
`c`.`click_date`
) AS `reportDate`,
ifnull(`b`.`Fault`, 0) AS `Fault`,
ifnull(`b`.`Alarm`, 0) AS `Alarm`,
ifnull(`b`.`Field`, 0) AS `Field`
FROM
(
(
SELECT
curdate() AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 1 DAY) AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 2 DAY) AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 3 DAY) AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 4 DAY) AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 5 DAY) AS `click_date`
UNION ALL
SELECT
(curdate() - INTERVAL 6 DAY) AS `click_date`
) `c`
LEFT JOIN (
SELECT
ifnull(`a`.`fightSysName`, NULL) AS `fightSysName`,
ifnull(`a`.`fightSysCode`, NULL) AS `fightSysCode`,
ifnull(`a`.`fightSysId`, NULL) AS `fightSysId`,
ifnull(`a`.`report_date`, NULL) AS `reportDate`,
sum(
IF (
locate('Fault', `a`.`indxKey`),
`a`.`total`,
0
)
) AS `Fault`,
sum(
IF (
locate('Alarm', `a`.`indxKey`),
`a`.`total`,
0
)
) AS `Alarm`,
sum(
IF (
locate('Shield', `a`.`indxKey`),
`a`.`total`,
0
)
) AS `Field`
FROM
(
SELECT
`rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`,
count(
DISTINCT `rd`.`equipment_specific_id`
) AS `total`,
`rd`.`report_date` AS `report_date`,
`fs`.`name` AS `fightSysName`,
`fs`.`code` AS `fightSysCode`,
`fs`.`id` AS `fightSysId`
FROM
(
`wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON (
(
0 <![CDATA[<>]]> find_in_set(
`fs`.`id`,
`rd`.`system_ids`
)
)
)
)
WHERE
(
(
(curdate() - INTERVAL 7 DAY) <![CDATA[<=]]> cast(`rd`.`report_date` AS date)
)
AND (
`fs`.`code` = '011023306003010000000013'
)
AND (
(
`rd`.`index_type` LIKE '%Fault'
)
OR (
`rd`.`index_type` LIKE '%Alarm'
)
OR (
`rd`.`index_type` LIKE '%Shield'
)
)
AND (`rd`.`value` = 'true')
)
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`,
`rd`.`alarm_type_name`
) `a`
GROUP BY
`a`.`report_date`,
`a`.`fightSysCode`
) `b` ON (
(
to_days(`c`.`click_date`) = to_days(`b`.`reportDate`)
)
)
)
ORDER BY
`c`.`click_date`
</select>
<select id="getPaomoSysInfo" resultType="java.util.Map">
SELECT
ifnull( `b`.`equipName`, NULL ) AS `equipName`,
ifnull( `b`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull( `b`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull( `b`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull( `b`.`reportDate`, `c`.`click_date` ) AS `reportDate`,
ifnull( `b`.`FireAlarm`, 0 ) AS `FireAlarm`,
ifnull( `b`.`Fault`, 0 ) AS `Fault`,
ifnull( `b`.`Shield`, 0 ) AS `Shield`,
ifnull( `b`.`Startup`, 0 ) AS `Startup`,
ifnull( `b`.`State`, 0 ) AS `State`
FROM
((
SELECT
curdate() AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 1 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 2 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 3 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 4 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 5 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 6 DAY ) AS `click_date`
) `c`
LEFT JOIN (
SELECT
ifnull( `a`.`equipName`, NULL ) AS equipName,
ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull( `a`.`report_date`, NULL ) AS `reportDate`,
sum(
IF
( locate( 'Fault', `a`.`indxKey` ), `a`.`total`, 0 )) AS `Fault`,
sum(
IF
( locate( 'FireAlarm', `a`.`indxKey` ), `a`.`total`, 0 )) AS `FireAlarm`,
sum(
IF
( locate( 'Shield', `a`.`indxKey` ), `a`.`total`, 0 )) AS `Shield`,
sum(
IF
( locate( 'Start', `a`.`indxKey` ), `a`.`total`, 0 )) AS `Startup`,
sum(
IF
( locate( 'State', `a`.`indxKey` ), `a`.`total`, 0 )) AS `State`
FROM
(
SELECT
rd.equipment_specific_name AS equipName,
`rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`,
count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,
`rd`.`report_date` AS `report_date`,
`fs`.`name` AS `fightSysName`,
`fs`.`code` AS `fightSysCode`,
`fs`.`id` AS `fightSysId`
FROM
(
`wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON ((
0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
WHERE
(((
curdate() - INTERVAL 7 DAY
) <![CDATA[<=]]> cast( `rd`.`report_date` AS date ))
AND ( `fs`.`code` = '011023306003010000000075' )
AND ((
`rd`.`index_type` LIKE '%Fault'
)
OR ( `rd`.`index_type` LIKE '%FireAlarm' )
OR ( `rd`.`index_type` LIKE '%Shield' )
OR ( `rd`.`index_type` LIKE '%Start' )
OR ( `rd`.`index_type` LIKE '%State' ))
AND ( `rd`.`value` = 'true' ))
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`,
`rd`.`alarm_type_name`
) `a`
GROUP BY
`a`.`report_date`,
`a`.`fightSysCode`
) `b` ON ((
to_days( `c`.`click_date` ) = to_days( `b`.`reportDate` ))))
ORDER BY
`c`.`click_date`
</select>
<select id="getWaterSysInfo" resultType="java.util.Map">
SELECT
ifnull( `b`.`equipName`, NULL ) AS `equipName`,
ifnull( `b`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull( `b`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull( `b`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull( `b`.`reportDate`, `c`.`click_date` ) AS `reportDate`,
ifnull( `b`.`FireAlarm`, 0 ) AS `alarm`
FROM
((
SELECT
curdate() AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 1 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 2 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 3 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 4 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 5 DAY ) AS `click_date` UNION ALL
SELECT
( curdate() - INTERVAL 6 DAY ) AS `click_date`
) `c`
LEFT JOIN (
SELECT
ifnull( `a`.`equipName`, NULL ) AS `equipName`,
ifnull( `a`.`fightSysName`, NULL ) AS `fightSysName`,
ifnull( `a`.`fightSysCode`, NULL ) AS `fightSysCode`,
ifnull( `a`.`fightSysId`, NULL ) AS `fightSysId`,
ifnull( `a`.`report_date`, NULL ) AS `reportDate`,
sum(
IF
( locate( 'Alarm', `a`.`indxKey` ), `a`.`total`, 0 )) AS `FireAlarm`
FROM
(
SELECT
rd.equipment_specific_name AS equipName,
`rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`,
count( DISTINCT `rd`.`equipment_specific_id` ) AS `total`,
`rd`.`report_date` AS `report_date`,
`fs`.`name` AS `fightSysName`,
`fs`.`code` AS `fightSysCode`,
`fs`.`id` AS `fightSysId`
FROM
(
`wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON ((
0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
WHERE
(((
curdate() - INTERVAL 7 DAY
) <![CDATA[<=]]> cast( `rd`.`report_date` AS date ))
AND ( `fs`.`code` = '029026401813010000000047' )
AND (( `rd`.`index_type` LIKE '%Alarm' )
)
AND ( `rd`.`value` = 'true' ))
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`,
`rd`.`alarm_type_name`
) `a`
GROUP BY
`a`.`report_date`,
`a`.`fightSysCode`
) `b` ON ((
to_days( `c`.`click_date` ) = to_days( `b`.`reportDate` ))))
ORDER BY
`c`.`click_date`
</select>
</mapper> </mapper>
\ No newline at end of file
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