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);
} }
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -25,6 +26,7 @@ import com.yeejoin.equipmanage.common.entity.*; ...@@ -25,6 +26,7 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO; 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.enums.*; import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.utils.StringUtil; import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.*; import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.mapper.*; import com.yeejoin.equipmanage.mapper.*;
...@@ -280,7 +282,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -280,7 +282,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson()); FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult(); AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
if(userModel!=null&&userModel.getRealName()!=null){ if (userModel != null && userModel.getRealName() != null) {
vo.setChargePersonName(userModel.getRealName()); vo.setChargePersonName(userModel.getRealName());
} }
...@@ -400,22 +402,22 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -400,22 +402,22 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p); // responses.add(p);
// }); // });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList()); // List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode,null); List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode, null);
return transferListToPointTree(buildList, id,null); return transferListToPointTree(buildList, id, null);
} }
@Override @Override
public List<SpeIndexVo> getSpeIndex(Long id,int flag) { public List<SpeIndexVo> getSpeIndex(Long id, int flag) {
// 因此处代码其他地方有调用 增加表示判断 flag == 1 为 消防点位图处需要iot编码所用 // 因此处代码其他地方有调用 增加表示判断 flag == 1 为 消防点位图处需要iot编码所用
if (flag == 1){ if (flag == 1) {
List<SpeIndexVo> speIndexVos = makeStatus(fireFightingSystemMapper.getSpeIndex(id)); List<SpeIndexVo> speIndexVos = makeStatus(fireFightingSystemMapper.getSpeIndex(id));
if (!ValidationUtil.isEmpty(speIndexVos)){ if (!ValidationUtil.isEmpty(speIndexVos)) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectById(id); EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getBaseMapper().selectById(id);
if (!ValidationUtil.isEmpty(equipmentSpecific)){ if (!ValidationUtil.isEmpty(equipmentSpecific)) {
SpeIndexVo speIndexVo = new SpeIndexVo(); SpeIndexVo speIndexVo = new SpeIndexVo();
speIndexVo.setName("设备编码"); speIndexVo.setName("设备编码");
speIndexVo.setValue(equipmentSpecific.getCode()); speIndexVo.setValue(equipmentSpecific.getCode());
speIndexVos.add(0,speIndexVo); speIndexVos.add(0, speIndexVo);
} }
} }
return speIndexVos; return speIndexVos;
...@@ -495,9 +497,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -495,9 +497,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param id * @param id
* @return * @return
*/ */
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id,String instanceId) { public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id, String instanceId) {
//TODO id为空,为消防建筑使用;id不为空,为点位图使用 //TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id,instanceId); List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id, instanceId);
if (!CollectionUtils.isEmpty(pointData)) { if (!CollectionUtils.isEmpty(pointData)) {
// 查询所有wl_source_scene,判断是否绑定 // 查询所有wl_source_scene,判断是否绑定
LambdaQueryWrapper<SourceScene> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SourceScene> wrapper = new LambdaQueryWrapper<>();
...@@ -582,9 +584,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -582,9 +584,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param id * @param id
* @return * @return
*/ */
public List<PointTreeVo> transferListToPointTreeNew(List<PointTreeVo> allRiskSource, String id,String instanceId,String displayName) { public List<PointTreeVo> transferListToPointTreeNew(List<PointTreeVo> allRiskSource, String id, String instanceId, String displayName) {
//TODO id为空,为消防建筑使用;id不为空,为点位图使用 //TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointDataNew(id,instanceId,displayName); List<PointTreeVo> pointData = fireFightingSystemMapper.getPointDataNew(id, instanceId, displayName);
if (!CollectionUtils.isEmpty(pointData)) { if (!CollectionUtils.isEmpty(pointData)) {
// 查询所有wl_source_scene,判断是否绑定 // 查询所有wl_source_scene,判断是否绑定
List<SourceScene> sourceSceneList = sourceSceneMapper.selectList(null); List<SourceScene> sourceSceneList = sourceSceneMapper.selectList(null);
...@@ -782,7 +784,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -782,7 +784,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
try { try {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId())); FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
} catch (Exception e) { } catch (Exception e) {
log.error("远程调用 MORPHIC 服务的删除操作出错:"+e.getMessage().toString(),e); log.error("远程调用 MORPHIC 服务的删除操作出错:" + e.getMessage().toString(), e);
} }
} }
formInstanceMapper.clearSystemId(id); formInstanceMapper.clearSystemId(id);
...@@ -851,6 +853,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -851,6 +853,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}); });
return list; return list;
} }
@Override @Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountListIot(int hierarchy, String codeHead, public IPage<EquipTypeImgAmountVO> getColaCategoryAmountListIot(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) { EquipTypeAmountPageDTO equipTypeAmountPage) {
...@@ -868,6 +871,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -868,6 +871,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}); });
return list; return list;
} }
@Override @Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead, public IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) { EquipTypeAmountPageDTO equipTypeAmountPage) {
...@@ -1151,7 +1155,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1151,7 +1155,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
List<EquipmentCategory> equipmentTypeList = responseList.stream() List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode())) .filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.filter(m->!m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode())) .filter(m -> !m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.EQUIPMENT); List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.EQUIPMENT);
redisUtils.set(equipTypeAndCount + bizOrgCode, list, 86400); redisUtils.set(equipTypeAndCount + bizOrgCode, list, 86400);
...@@ -1263,4 +1267,65 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1263,4 +1267,65 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
@Override
public Map<String, Object> getSystemStatus(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
ArrayList<Object> status = new ArrayList<>();
status.add(map.get("status"));
resultMap.put("values", status);
resultMap.put("labels", status);
}
return resultMap;
}
@Override
public Map<String, Object> getSystemName(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = fireFightingSystemMapper.getFireSystemInfo(hashMap);
if (!map.isEmpty()) {
resultMap.put("name", map.get("name"));
}
return resultMap;
}
@Override
public Map<String, Object> equipAlarmTOP(HashMap<String, Object> hashMap) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = fireFightingSystemMapper.equipAlarmTOP(hashMap);
if (!CollectionUtils.isEmpty(list)) {
LinkedHashSet<String> yAxis = new LinkedHashSet<>();
ArrayList<String> xAxis = new ArrayList<>();
String yKey = "";
String xResult = "";
for (Map<String, Object> stringObjectMap : list) {
yKey = stringObjectMap.get("equipName").toString();
xResult = stringObjectMap.get("total").toString();
yAxis.add(yKey);
xAxis.add(xResult);
}
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
}
return resultMap;
}
@Override
public Page<Map<String, Object>> equipmentState(Page res, HashMap<String, Object> hashMap) {
Page result = new Page<>(res.getCurrent(), res.getSize());
String id = fireFightingSystemMapper.equipmentId(hashMap);
Page<Map<String, Object>> mapPage = fireFightingSystemMapper.equipmentState(result, id);
return mapPage;
}
@Override
public List<Map<String, Object>> getSmallWaterInfo(HashMap<String, Object> hashMap) {
String bizOrgCode = hashMap.get("bizOrgCode").toString();
String systemCode = hashMap.get("systemCode").toString();
return fireFightingSystemMapper.getWaterInfo(bizOrgCode, systemCode);
}
} }
...@@ -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