Commit a69416f5 authored by tianyiming's avatar tianyiming

3小屏接口开发:包含(系统名称、系统工作状态、近一月top5、设备状态、水源信息)

parent 9ea52de8
...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -33,6 +34,9 @@ public class ConfigureController extends AbstractBaseController { ...@@ -33,6 +34,9 @@ public class ConfigureController extends AbstractBaseController {
@Autowired @Autowired
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService; private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@RequestMapping(value = "/alarmLogPage", method = RequestMethod.GET) @RequestMapping(value = "/alarmLogPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询") @ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
...@@ -161,12 +165,130 @@ public class ConfigureController extends AbstractBaseController { ...@@ -161,12 +165,130 @@ public class ConfigureController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "3小水源信息") @ApiOperation(value = "概览水源信息")
@GetMapping("/getWaterInfo") @GetMapping("/getWaterInfo")
public ResponseModel getWaterInfo() { public ResponseModel getWaterInfo() {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null; String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfo(bizOrgCode)); return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfo(bizOrgCode, null));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "3小水源信息")
@GetMapping("/getSmallWaterInfo")
public ResponseModel getSmallWaterInfo(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
}
return CommonResponseUtil.success(iFireFightingSystemService.getSmallWaterInfo(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取系统名称(根据系统编码查询)")
@GetMapping("/getSystemName")
public ResponseModel getEquipSystemName(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemName(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "获取系统工作状态(根据系统编码查询)")
@GetMapping("/getSystemStatus")
public ResponseModel getEquipSystemStatus(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
}
return CommonResponseUtil.success(iFireFightingSystemService.getSystemStatus(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统近一月告警设备top5(根据系统编码查询)")
@GetMapping("/getAlarmOneMonth")
public ResponseModel getSpecificAlarmOneMonthTOP(@RequestParam(required = false) String systemCode) {
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
}
return CommonResponseUtil.success(iFireFightingSystemService.equipAlarmTOP(hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统设备状态(根据系统编码查询)")
@GetMapping("/getEquipmentState")
public ResponseModel getEquipmentState(@RequestParam(required = false) String systemCode, CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page result = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
HashMap<String, Object> hashMap = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
String bizOrgCode = personIdentity.getBizOrgCode();
if (StringUtils.isNotBlank(bizOrgCode)) {
hashMap.put("bizOrgCode", bizOrgCode);
}
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
if (StringUtils.isNotBlank(systemCode)) {
hashMap.put("systemCode", systemCode);
}
return CommonResponseUtil.success(iFireFightingSystemService.equipmentState(result, hashMap));
} }
} }
package com.yeejoin.equipmanage.service; package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.morphic.model.ResourceDTO; import com.yeejoin.amos.feign.morphic.model.ResourceDTO;
...@@ -10,6 +11,8 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO; ...@@ -10,6 +11,8 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*; import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*; import com.yeejoin.equipmanage.common.vo.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -233,5 +236,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -233,5 +236,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Object refreshCarTypeAndCount(String bizOrgCode) throws Exception; Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
Map<String, Object> getSystemName(HashMap<String, Object> hashMap);
Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap);
Map<String, Object> equipAlarmTOP(HashMap<String, Object> hashMap);
List<Map<String, Object>> getSmallWaterInfo(HashMap<String, Object> hashMap);
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
} }
...@@ -1051,45 +1051,45 @@ ...@@ -1051,45 +1051,45 @@
GROUP BY GROUP BY
fs.id; fs.id;
</select> </select>
<select id="getFireSystemState" resultType="Map"> <select id="getFireSystemState" resultType="Map">
select * from v_fire_system_state select * from v_fire_system_state
</select> </select>
<select id="getFireOnlSystem" resultType="Map"> <select id="getFireOnlSystem" resultType="Map">
select * from v_fire_onl_num select * from v_fire_onl_num
</select> </select>
<select id="getFireCafsSystem" resultType="Map"> <select id="getFireCafsSystem" resultType="Map">
select * from v_fire_cafs_num select * from v_fire_cafs_num
</select> </select>
<select id="getFireFfsSystem" resultType="Map"> <select id="getFireFfsSystem" resultType="Map">
select * from v_fire_ffs_num select * from v_fire_ffs_num
</select> </select>
<select id="getFireFasSystem" resultType="Map"> <select id="getFireFasSystem" resultType="Map">
select * from v_fire_fas_num select * from v_fire_fas_num
</select> </select>
<select id="getFireAcsSystem" resultType="Map"> <select id="getFireAcsSystem" resultType="Map">
select * from v_fire_acs_num select * from v_fire_acs_num
</select> </select>
<select id="getFireFhsSystem" resultType="Map"> <select id="getFireFhsSystem" resultType="Map">
select * from v_fire_fhs_num select * from v_fire_fhs_num
</select> </select>
<select id="getTodayConfirmAlarmInfo" resultType="Map"> <select id="getTodayConfirmAlarmInfo" resultType="Map">
select * from v_equip_alarm_today_statistics select * from v_equip_alarm_today_statistics
</select> </select>
<select id="getPoolInfo" resultType="Map"> <select id="getPoolInfo" resultType="Map">
select * from v_fire_fhs_yl_num select * from v_fire_fhs_yl_num
</select> </select>
<select id="getFightingSysInfo" resultType="com.yeejoin.equipmanage.common.vo.FireFightingSystemVo"> <select id="getFightingSysInfo" resultType="com.yeejoin.equipmanage.common.vo.FireFightingSystemVo">
select * from v_fire_system_info fs select * from v_fire_system_info fs
<where> <where>
...@@ -1101,7 +1101,7 @@ ...@@ -1101,7 +1101,7 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getFireOnlSystemThreeSmall" resultType="Map"> <select id="getFireOnlSystemThreeSmall" resultType="Map">
select * from v_fire_onl_three_small select * from v_fire_onl_three_small
</select> </select>
...@@ -1804,7 +1804,7 @@ ...@@ -1804,7 +1804,7 @@
where where
si.equipment_index_key = 'ES_Elevator_Shield' si.equipment_index_key = 'ES_Elevator_Shield'
and si.`value` = 'true' and si.`value` = 'true'
) AS `dtpb`, ) AS `dtpb`,
( (
select select
...@@ -2560,6 +2560,7 @@ ...@@ -2560,6 +2560,7 @@
LEFT JOIN wl_equipment_index ei ON ei.equipment_id = ed.equipment_id LEFT JOIN wl_equipment_index ei ON ei.equipment_id = ed.equipment_id
LEFT JOIN wl_equipment e ON e.id = ei.equipment_id LEFT JOIN wl_equipment e ON e.id = ei.equipment_id
LEFT JOIN wl_equipment_category ec ON ec.id = e.category_id LEFT JOIN wl_equipment_category ec ON ec.id = e.category_id
LEFT JOIN f_fire_fighting_system fs ON fs.biz_org_code = r.biz_org_code
WHERE WHERE
r.resource_type IN ( 'pool', 'industryPool' ) r.resource_type IN ( 'pool', 'industryPool' )
AND r.is_delete = 1 AND r.is_delete = 1
...@@ -2567,7 +2568,138 @@ ...@@ -2567,7 +2568,138 @@
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR} AND r.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if> </if>
<if test="systemCode!=null and systemCode!=''">
AND fs.code = #{systemCode,jdbcType=VARCHAR}
</if>
GROUP BY GROUP BY
r.sequence_nbr r.sequence_nbr
</select> </select>
<select id="getFireSystemInfo" resultType="java.util.Map">
select `nz`.name,`nz`.status from ( SELECT
`fs`.`id` AS `id`,
`fs`.`code` AS `code`,
`fs`.`biz_org_code` AS `biz_org_code`,
`fs`.`name` AS `name`,
`fs`.`install_date` AS `installdate`,
`fs`.`charge_person_name` AS `chargeperson`,
`fs`.`charge_person_phone` AS `chargepersonphone`,
`mim`.`name` AS `maintenanceunit`,
`mic`.`name` AS `constructionunit`,(
CASE
WHEN ((
SELECT
count( 1 )
FROM
`wl_equipment_specific_alarm`
WHERE
((
`wl_equipment_specific_alarm`.`status` = 1
)
AND (
0 != find_in_set( `fs`.`id`, `wl_equipment_specific_alarm`.`system_ids` )))) > 0
) THEN
'异常' ELSE '正常'
END
) AS `status`
FROM
((
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_manufacturer_info` `mic` ON ((
`mic`.`id` = `fs`.`maintenance_unit`
)))
LEFT JOIN `wl_manufacturer_info` `mim` ON ((
`mim`.`id` = `fs`.`construction_unit`
)))) `nz` where `nz`.code = #{systemCode} and `nz`.biz_org_code = #{bizOrgCode}
</select>
<select id="equipAlarmTOP" resultType="java.util.Map">
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`,
`a`.`equipName` AS `equipName`,
sum( `a`.`total` ) AS `total`
FROM
(
SELECT
`rd`.`index_type` AS `indxKey`,
`rd`.`index_name` AS `index_name`,
`rd`.`equipment_specific_name` AS `equipName`,
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`,
`rd`.`equipment_specific_id` AS `equipId`
FROM
(
`wl_equipment_alarm_report_day` `rd`
LEFT JOIN `f_fire_fighting_system` `fs` ON ((
0 != find_in_set( `fs`.`id`, `rd`.`system_ids` ))))
WHERE
(((
curdate() - INTERVAL 30 DAY
) &lt;= cast( `rd`.`report_date` AS date ))
AND ( `fs`.`code` = #{systemCode} )
AND ( `fs`.`biz_org_code` = #{bizOrgCode} )
AND ((
`rd`.`index_type` LIKE '%Fault'
)
OR ( `rd`.`index_type` LIKE '%FireAlarm' )
OR ( `rd`.`index_type` LIKE '%Shield' ))
AND ( `rd`.`value` = 'true' ))
GROUP BY
`rd`.`equipment_specific_id`,
`rd`.`report_date`
) `a`
GROUP BY
`a`.`equipId`
ORDER BY
`total` DESC
LIMIT 5
</select>
<select id="equipmentId" resultType="String">
select
id
from
f_fire_fighting_system
where
code = #{systemCode} and
biz_org_code = #{bizOrgCode}
</select>
<select id="equipmentState" resultType="java.util.Map">
SELECT
b.equipName,
(CASE WHEN
b.totalNum > 0 THEN
'异常' ELSE '正常' END) `status`,
b.totalNum AS totalNum
FROM
(
SELECT
a.equipName,
count( wesl.id ) AS totalNum
FROM
(
SELECT
wes.`name` AS equipName,
wed.equipment_id AS equipmentId
FROM
wl_equipment_specific wes
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
WHERE
FIND_IN_SET( #{id}, wes.system_id ) > 0
GROUP BY
wed.equipment_id
) a
LEFT JOIN wl_equipment_specific_alarm_log wesl ON wesl.equipment_id = a.equipmentId
GROUP BY
a.equipmentId
) b
</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