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

item:三维告警信息初始化、消防水池信息接口提供

parent 0d5d5664
package com.yeejoin.amos.fas.dao.entity;
import javax.persistence.*;
import java.util.List;
import java.util.Map;
import javax.persistence.*;
/**
* 消防站点
* @author Administrator
......@@ -92,6 +91,29 @@ public class FireStation extends BasicEntity{
@Lob
private String ue4Rotation;
/**
* 高度/最大液位(m)
*/
@Transient
private Double height;
/**
* 低度/最小液位(m)
*/
@Transient
private Double low;
/**
* 实时液位(m)
*/
@Transient
private String level;
/**
* 设计容量(m³)
*/
@Transient
private Double designCapacity;
@Transient
public List<Map> getFireEquipmentInfo() {
return fireEquipmentInfo;
......@@ -206,4 +228,36 @@ public class FireStation extends BasicEntity{
public void setUe4Rotation(String ue4Rotation) {
this.ue4Rotation = ue4Rotation;
}
public Double getHeight() {
return height;
}
public void setHeight(Double height) {
this.height = height;
}
public Double getLow() {
return low;
}
public void setLow(Double low) {
this.low = low;
}
public Double getDesignCapacity() {
return designCapacity;
}
public void setDesignCapacity(Double designCapacity) {
this.designCapacity = designCapacity;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
}
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.controller
* @ClassName: EquipmentSpecificIndexController
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexController
* @Date: 2021/1/18 16:32
* @Version: 1.0
*/
@RestController
@RequestMapping(value = "/api/equipSpecificIndex")
@Api(tags = "装备性能指标Api")
public class EquipmentSpecificIndexController extends BaseController {
@Autowired
private EquipmentSpecificIndexService equipmentSpecificIndexService;
@Permission
@ApiOperation(httpMethod = "GET", value = "获取最新告警状态", notes = "获取最新告警状态")
@RequestMapping(value = "/queryInitAlarm", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryInitAlerm(@ApiParam(value = "告警状态", required = true) @RequestParam String status,
@ApiParam(value = "多nameKey,中间英文逗号隔开", required = true) @RequestParam String nameKeys,
@ApiParam(value = "多status,中间英文逗号隔开", required = true) @RequestParam String pollStatus) {
return CommonResponseUtil.success(equipmentSpecificIndexService.queryInitAlarm(status, nameKeys, pollStatus));
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 装备性能指标 Mapper 接口
*
* @author Jianqiang Gao
* @date 2021-01-18
*/
public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecificIndexVo> {
List<EquipmentSpecificIndexVo> findByDetailIdInAndNameKey(@Param("list") List<Object> equipDetailIdList, @Param("nameKey") String nameKey);
List<EquipmentSpecificIndexVo> queryInitAlarm(@Param("status") String status, @Param("list") String[] nameKeys);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.PollPointVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.dao.mapper
* @ClassName: PollPointMapper
* @Author: Jianqiang Gao
* @Description: 巡检点Mapper
* @Date: 2021/1/18 17:36
* @Version: 1.0
*/
public interface PollPointMapper extends BaseMapper<PollPointVo> {
List<PollPointVo> queryInitAlarm(@Param("list") String[] pollStatus);
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PollPointMapper;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.business.vo.PollPointVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service.impl
* @ClassName: EquipmentSpecificIndexServiceImpl
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexServiceImpl
* @Date: 2021/1/18 16:35
* @Version: 1.0
*/
@Service
public class EquipmentSpecificIndexServiceImpl implements EquipmentSpecificIndexService {
@Autowired
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private PollPointMapper pollPointMapper;
@Override
public Map<String, Object> queryInitAlarm(String status, String nameKeys, String pollStatus) {
Map<String, Object> map = new HashMap<>(16);
// 查询设备告警
List<EquipmentSpecificIndexVo> equipmentSpecificAlarmVoList = equipmentSpecificIndexMapper.queryInitAlarm(status, nameKeys.split(","));
map.put("equip", equipmentSpecificAlarmVoList);
// 查询巡检告警
List<PollPointVo> pollPointVoList = pollPointMapper.queryInitAlarm(pollStatus.split(","));
map.put("poll", pollPointVoList);
return map;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
......@@ -9,6 +10,7 @@ import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IFireEquipService;
import com.yeejoin.amos.fas.business.util.FireEquipmentType;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.common.enums.EquipClassifyEnum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.CommonPage;
......@@ -21,14 +23,16 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
@Service("fireEquipService")
public class FireEquipServiceImpl implements IFireEquipService {
/**
* 液位
*/
private final static String NAME_KEY = "liquidLevel";
@Autowired
FireEquipMapper fireEquipMapper;
......@@ -44,6 +48,9 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired
IFireStationDao iFireStationDao;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
public FireEquipment save(FireEquipment fireEquipment) {
Long id = fireEquipment.getId();
iFireEquipmentDao.save(fireEquipment);
......@@ -52,8 +59,8 @@ public class FireEquipServiceImpl implements IFireEquipService {
public FireEquipment queryOne(Long id) {
Optional<FireEquipment> fireEquipment1=iFireEquipmentDao.findById(id);
if(fireEquipment1.isPresent()){
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(id);
if (fireEquipment1.isPresent()) {
return fireEquipment1.get();
}
return null;
......@@ -62,9 +69,9 @@ public class FireEquipServiceImpl implements IFireEquipService {
public String[] delete(String[] idArray) throws Exception {
for (String id : idArray) {
Optional<FireEquipment> fireEquipment1 = iFireEquipmentDao.findById(Long.parseLong(id));
FireEquipment fireEquipment=null;
if(fireEquipment1.isPresent()){
fireEquipment= fireEquipment1.get();
FireEquipment fireEquipment = null;
if (fireEquipment1.isPresent()) {
fireEquipment = fireEquipment1.get();
}
if (fireEquipment != null) {
......@@ -107,7 +114,7 @@ public class FireEquipServiceImpl implements IFireEquipService {
String endTime,
CommonPageable commonPageable) {
long total = fireEquipMapper.queryForFireEquipmentHistoryCount( fireEquipmentName,equipmentName,
long total = fireEquipMapper.queryForFireEquipmentHistoryCount(fireEquipmentName, equipmentName,
startTime,
endTime);
......@@ -122,9 +129,9 @@ public class FireEquipServiceImpl implements IFireEquipService {
}
public Page queryForEquipmentList(String name, String code,String equipClassify,CommonPageable commonPageable,String bindStation) {
long total = fireEquipMapper.queryForEquipmentPageCount( name, code,equipClassify,bindStation);
List<Map> content = this.fireEquipMapper.queryForEquipmentPage(name, code,equipClassify,commonPageable.getOffset(),commonPageable.getPageSize(),bindStation);
public Page queryForEquipmentList(String name, String code, String equipClassify, CommonPageable commonPageable, String bindStation) {
long total = fireEquipMapper.queryForEquipmentPageCount(name, code, equipClassify, bindStation);
List<Map> content = this.fireEquipMapper.queryForEquipmentPage(name, code, equipClassify, commonPageable.getOffset(), commonPageable.getPageSize(), bindStation);
Page result = new CommonPage(content, commonPageable, total);
return result;
}
......@@ -132,42 +139,51 @@ public class FireEquipServiceImpl implements IFireEquipService {
/**
* 查询设备信息明细
*
* @param type
* @param id
* @return
* @throws Exception
*/
public Object queryForDetail(String type, Long id) throws Exception
{
public Object queryForDetail(String type, Long id) throws Exception {
Object returnEntity = null;
FireEquipmentType fireEquipmentType = FireEquipmentType.valueOf(type);
switch (fireEquipmentType)
{
switch (fireEquipmentType) {
case pool:
FireStation fireStation = fireEquipMapper.findFireStationById(id);
fireStation.setType("2");
fireStation.setFireEquipmentInfo(this.fireEquipMapper.queryStorageEquips(id));
List<Map> equipDetails = this.fireEquipMapper.queryStorageEquips(fireStation.getRiskSourceId());
fireStation.setFireEquipmentInfo(equipDetails);
// 获取水池实时液位
List<Object> equipDetailIdList = new ArrayList<>();
if (equipDetails != null && !equipDetails.isEmpty()) {
equipDetails.stream().forEach(map -> equipDetailIdList.add(map.get("id")));
List<EquipmentSpecificIndexVo> specificIndexVos = equipmentSpecificIndexMapper.findByDetailIdInAndNameKey(equipDetailIdList, NAME_KEY);
if (specificIndexVos != null && !specificIndexVos.isEmpty()) {
fireStation.setLevel(specificIndexVos.get(0).getValue());
}
}
returnEntity = fireStation;
break;
case fireFoamRoom:
FireStation fireStation1 = fireEquipMapper.findFireStationById(id);
fireStation1.setType("2");
fireStation1.setFireEquipmentInfo(this.fireEquipMapper.queryStorageEquips(id));
fireStation1.setFireEquipmentInfo(this.fireEquipMapper.queryStorageEquips(fireStation1.getRiskSourceId()));
returnEntity = fireStation1;
break;
case fireChamber:
FireStation fireStation11 = fireEquipMapper.findFireStationById(id);
fireStation11.setType("1");
fireStation11.setFireEquipmentInfo(this.fireEquipMapper.queryStorageEquips(id));
fireStation11.setFireEquipmentInfo(this.fireEquipMapper.queryStorageEquips(fireStation11.getRiskSourceId()));
returnEntity = fireStation11;
break;
case extinguisher:
case hydrant:
case monitorEquipment:
FireEquipment fireEquipment=fireEquipMapper.findFireEquipById(id);
FireEquipment fireEquipment = fireEquipMapper.findFireEquipById(id);
fireEquipment.setEquipClassify(Integer.parseInt(EquipClassifyEnum.EQUIPMENT.getCode()));
returnEntity = fireEquipment;
break;
......@@ -179,9 +195,9 @@ public class FireEquipServiceImpl implements IFireEquipService {
case fireDetection:
Optional<FireEquipment> fireDetection1 = this.iFireEquipmentDao.findById(id);
FireEquipment fireDetection=null;
if(fireDetection1.isPresent()){
fireDetection=fireDetection1.get();
FireEquipment fireDetection = null;
if (fireDetection1.isPresent()) {
fireDetection = fireDetection1.get();
}
fireDetection.setProtectObjNames(this.impEquipMapper.queryProtectObjNames(fireDetection.getId()));
returnEntity = fireDetection;
......
package com.yeejoin.amos.fas.business.service.intfc;
import java.util.Map;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.service.intfc
* @ClassName: EquipmentSpecificIndexService
* @Author: Jianqiang Gao
* @Description: EquipmentSpecificIndexService
* @Date: 2021/1/18 16:34
* @Version: 1.0
*/
public interface EquipmentSpecificIndexService {
Map<String, Object> queryInitAlarm(String status, String nameKeys, String pollStatus);
}
\ No newline at end of file
......@@ -25,6 +25,8 @@ public class EquipmentSpecificIndexVo {
// 性能指标id
private Long equipmentIndexId;
private String name;
private String equipmentIndexName;
private String equipmentIndexUnitName;
......@@ -105,16 +107,45 @@ public class EquipmentSpecificIndexVo {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEquipmentIndexName() {
return equipmentIndexName;
}
public void setEquipmentIndexName(String equipmentIndexName) {
this.equipmentIndexName = equipmentIndexName;
}
public String getEquipmentIndexUnitName() {
return equipmentIndexUnitName;
}
public void setEquipmentIndexUnitName(String equipmentIndexUnitName) {
this.equipmentIndexUnitName = equipmentIndexUnitName;
}
public EquipmentSpecificIndexVo() {
}
public EquipmentSpecificIndexVo(Long equipmentSpecificId, String value, Long equipmentIndexId, String nameKey, String code, String iotCode, String type) {
public EquipmentSpecificIndexVo(long id, Long equipmentSpecificId, String value, Long equipmentIndexId, String name, String equipmentIndexName, String equipmentIndexUnitName, String nameKey, String code, String iotCode, String type) {
this.id = id;
this.equipmentSpecificId = equipmentSpecificId;
this.value = value;
this.equipmentIndexId = equipmentIndexId;
this.name = name;
this.equipmentIndexName = equipmentIndexName;
this.equipmentIndexUnitName = equipmentIndexUnitName;
this.nameKey = nameKey;
this.code = code;
this.iotCode = iotCode;
this.type = type;
}
}
package com.yeejoin.amos.fas.business.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.vo
* @ClassName: EquipmentSpecificAlarm
* @Author: Jianqiang Gao
* @Description: 巡检点Vo
* @Date: 2021/1/18 15:54
* @Version: 1.0
*/
@Data
@Api("巡检点Vo")
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
public class PollPointVo {
@ApiModelProperty("巡检点名称")
private String name;
@ApiModelProperty("巡检点编码")
private String code;
@ApiModelProperty("巡检点状态:0 未纳入巡检,1 合格;2 不合格;3 漏检")
private String status;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper">
<select id="findByDetailIdInAndNameKey"
resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
wsi.`value`
FROM
`wl_equipment_index` wei
RIGHT JOIN wl_equipment_specific_index wsi ON wei.id = wsi.equipment_index_id
LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id
WHERE
wsi.`value` != ''
<if test="nameKey != null and nameKey !=''">
AND wei.name_key = #{nameKey}
</if>
<if test="list != null and list.size() > 0">
AND wes.equipment_detail_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY
wsi.id
ORDER BY
wsi.update_date DESC
</select>
<select id="queryInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo">
SELECT
wed.`name`,
wed.`code`,
wei.name_key
FROM
`wl_equipment_specific_index` wsi
LEFT JOIN wl_equipment_index wei ON wsi.equipment_index_id = wei.id
LEFT JOIN wl_equipment_specific wes ON wsi.equipment_specific_id = wes.id
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
<where>
<if test="status != null and status != ''">
AND wsi.`value` = #{status}
</if>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wei.name_key = #{item}
</foreach>
</if>
</where>
GROUP BY
wsi.equipment_specific_id
ORDER BY
wsi.update_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -289,6 +289,7 @@
<select id="queryStorageEquips" resultType="map">
SELECT
wed.id,
wed.`name`,
u.`name` AS unit,
sum(wsd.amount) fireEquipmentCount
......@@ -298,8 +299,11 @@
LEFT JOIN wl_equipment we ON we.id = wed.equipment_id
LEFT JOIN wl_unit u ON u.id = we.unit_id
LEFT JOIN wl_warehouse_structure ws ON ws.id = wsd.warehouse_structure_id
WHERE
ws.source_id = #{riskSourceId}
<where>
<if test="riskSourceId != null">
AND ws.source_id = #{riskSourceId}
</if>
</where>
GROUP BY
wsd.equipment_detail_id,
wed.`name`
......@@ -607,7 +611,10 @@
wb.`name`,
wb.`code`,
wb.address,
wb.region_id AS riskSourceId
wb.region_id AS riskSourceId,
wb.height,
wb.low,
wb.design_capacity
FROM
wl_building wb
WHERE
......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PollPointMapper">
<select id="queryInitAlarm" resultType="com.yeejoin.amos.fas.business.vo.PollPointVo">
SELECT
p.`name`,
p.point_no AS `code`,
p.`status`
FROM
`p_point` p
<where>
<if test="list != null and list.length > 0">
AND
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
p.`status` = #{item}
</foreach>
</if>
</where>
</select>
</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