Commit 62e61d7b authored by zhangsen's avatar zhangsen

大屏API提供

parent 53bed829
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.Map;
@Data
public class BigScreenVo {
private Map<String, Object> systemAlarmInfoNum;
private Map<String, Object> pool;
private Map<String, Object> industryPool;
private Integer carNum;
}
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.BigScreenVo;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "一张图大屏API")
@RequestMapping(value = "/bigScreen", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class BigScreenController {
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@GetMapping(value = "/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "系统、消防水池、工业水池、水源总容积、消防车辆", notes = "系统、消防水池、工业水池、水源总容积、消防车辆")
public ResponseModel<BigScreenVo> getSystemAlarmInfoNum(@RequestParam(required = false, value = "companyCode") String companyCode) {
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmInfoNum(companyCode));
}
}
......@@ -371,4 +371,32 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @return
*/
List<EquipmentExportVO> exportEquipmentList(@Param("dto") EquipTypeAmountPageDTO dto);
/**
* 获取系统告警信息
* @param companyCode
* @return
*/
Map<String, Object> getSystemAlarmInfoNum(@Param("companyCode") String companyCode);
/**
* 消防水池或者工业水池信息
* @param companyCode
* @return
*/
Map<String, Object> getWaterPoolInfoNum(@Param("companyCode") String companyCode, @Param("poolType") String poolType);
/**
* 消防水源总量统计
* @param companyCode
* @return
*/
Map<String, Object> getWaterPoolVolumeInfo(@Param("companyCode") String companyCode);
/**
* 获取车辆总数
* @param companyCode
* @return
*/
Integer getCarNum(@Param("companyCode") String companyCode);
}
......@@ -17,13 +17,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO;
import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.EquipmentManageVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystem3dVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTypeTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemVo;
import com.yeejoin.equipmanage.common.vo.SpeIndexVo;
import com.yeejoin.equipmanage.common.vo.*;
public interface IFireFightingSystemService extends IService<FireFightingSystemEntity> {
......@@ -254,4 +248,11 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
/**
* 获取系统告警数量等信息
* @param companyCode
* @return
*/
BigScreenVo getSystemAlarmInfoNum(String companyCode);
}
......@@ -1322,4 +1322,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, systemCode);
}
@Override
public BigScreenVo getSystemAlarmInfoNum(String companyCode) {
BigScreenVo bigScreenVo = new BigScreenVo();
Map<String, Object> systemAlarmInfoNum = fireFightingSystemMapper.getSystemAlarmInfoNum(companyCode);
bigScreenVo.setSystemAlarmInfoNum(systemAlarmInfoNum);
Map<String, Object> pool = fireFightingSystemMapper.getWaterPoolInfoNum(companyCode, "pool");
bigScreenVo.setPool(pool);
Map<String, Object> industryPool = fireFightingSystemMapper.getWaterPoolInfoNum(companyCode, "industryPool");
bigScreenVo.setIndustryPool(industryPool);
Integer carNum = fireFightingSystemMapper.getCarNum(companyCode);
bigScreenVo.setCarNum(carNum);
return bigScreenVo;
}
}
......@@ -2654,4 +2654,146 @@
</select>
<select id="getSystemAlarmInfoNum" resultType="java.util.Map">
SELECT
count( a.alarmNum > 0 OR NULL ) AS exceptionNum,
count( a.id ) AS totalSystemNum,
(
count( a.id ) - count( a.alarmNum &gt; 0 OR NULL )) AS normalNum,
(
TRUNCATE (
abs(((
count( a.id ) - count( a.alarmNum > 0 OR NULL )) /
IF
(( count( a.id ) = 0 ), 1, count( a.id ) ))),
0
) * 100
) AS normalAbs
FROM
(
SELECT
fs.id,
IFNULL( sum( esa.`status` ), 0 ) AS alarmNum
FROM
f_fire_fighting_system fs
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = fs.biz_org_code
LEFT JOIN wl_equipment_specific_alarm esa ON FIND_IN_SET( fs.id, esa.system_ids )
<where>
<if test="companyCode != null and companyCode != ''">
ou.`code` = #{companyCode}
</if>
</where>
GROUP BY
fs.id
) a
</select>
<select id="getWaterPoolInfoNum" resultType="java.util.Map">
SELECT
count( 1 ) AS totalNum,
count( a.nowLevel &lt; a.minLevel OR NULL ) AS abnomalNum,
count( a.nowLevel &gt;= a.minLevel OR NULL ) AS nomalNum,
(
TRUNCATE (
abs(((
count( a.nowLevel &gt;= a.minLevel OR NULL )) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) ))),
0
) * 100
) AS normalAbs
FROM
(
SELECT
`ou`.`code` AS `code`,
ifnull( `rp`.`min_water_level`, 0 ) AS `minLevel`,
ifnull( `rp`.`max_water_level`, 0 ) AS `maxLevel`,
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) AS `nowLevel`
FROM
`cb_water_resource` `r`
LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`
LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`
LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`
LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`
LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
WHERE
`r`.`is_delete` = 1
AND `ou`.`code` IS NOT NULL
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
AND `r`.`resource_type` = #{poolType}
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<select id="getWaterPoolVolumeInfo" resultType="java.util.Map">
SELECT
IFNULL( sum( a.margin ), 0 ) AS margin,
IFNULL( sum( volume ), 0 ) AS volume
FROM
(
SELECT
`ou`.`code` AS `code`,
ifnull((
abs((
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) /
IF
((
ifnull( `rp`.`max_water_level`, 0 ) = 0
),
1,
ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),
0
) AS `margin`,
ifnull( `rp`.`volume`, 0 ) AS `volume`
FROM
`cb_water_resource` `r`
LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`
LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`
LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`
LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`
LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
WHERE
`r`.`resource_type` IN ( 'pool', 'industryPool' )
AND `r`.`is_delete` = 1
AND `ou`.`code` IS NOT NULL
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<select id="getCarNum" resultType="java.lang.Integer">
SELECT
count( wc.id ) as carNum
FROM
wl_car wc
LEFT JOIN cb_org_usr ou ON ou.amos_org_code = wc.org_code
<where>
<if test="companyCode != null and companyCode != ''">
ou.`code` = #{companyCode}
</if>
</where>
</select>
</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