Commit 1d8f7d05 authored by zhangsen's avatar zhangsen

xuqiu

parent 652c0701
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.action.model.ProtalDataRo; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.action.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.bo.DangerResultBo; import com.yeejoin.amos.fas.business.bo.DangerResultBo;
import com.yeejoin.amos.fas.business.bo.PlanFlagBo; import com.yeejoin.amos.fas.business.bo.PlanFlagBo;
import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo; import com.yeejoin.amos.fas.business.bo.RiskSourceSynBo;
import com.yeejoin.amos.fas.business.dao.mapper.ContingencyPlanInstanceMapper;
import com.yeejoin.amos.fas.business.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService; import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
...@@ -16,10 +17,7 @@ import com.yeejoin.amos.fas.config.Permission; ...@@ -16,10 +17,7 @@ import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse; import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.enums.ReserveEnum; import com.yeejoin.amos.fas.core.enums.ReserveEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -48,6 +46,9 @@ public class RiskSourceController extends BaseController { ...@@ -48,6 +46,9 @@ public class RiskSourceController extends BaseController {
@Autowired @Autowired
IRiskSourceService riskSourceService; IRiskSourceService riskSourceService;
@Autowired
ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Permission @Permission
//@Authorization(ingore = true) //@Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "查询风险点子项", notes = "查询风险点子项") @ApiOperation(httpMethod = "GET", value = "查询风险点子项", notes = "查询风险点子项")
...@@ -719,6 +720,26 @@ public class RiskSourceController extends BaseController { ...@@ -719,6 +720,26 @@ public class RiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.queryContingencyWater()); return CommonResponseUtil.success(riskSourceService.queryContingencyWater());
} }
@ApiOperation(value = "概览水源信息")
@GetMapping("/getWaterInfo")
public CommonResponse getWaterInfo(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams);
String bizOrgCode = null;
if (StringUtil.isNotEmpty(orgCode)) {
bizOrgCode = contingencyPlanInstanceMapper.getBizOrgCode(orgCode);
if (!StringUtil.isNotEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
} else {
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(riskSourceService.getWaterInfo(commonPageable, bizOrgCode));
}
/** /**
* 获取危险因素树二级节点 * 获取危险因素树二级节点
* *
......
package com.yeejoin.amos.fas.business.dao.mapper; package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -33,4 +34,11 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla ...@@ -33,4 +34,11 @@ public interface ContingencyPlanInstanceMapper extends BaseMapper<ContingencyPla
* @return * @return
*/ */
Boolean updateMessageById(@Param("dto") ContingencyPlanInstance contingencyPlanInstance); Boolean updateMessageById(@Param("dto") ContingencyPlanInstance contingencyPlanInstance);
String getBizOrgCode(@Param("amosOrgCode") String amosOrgCode);
List<Map<String, Object>> getWaterInfo(@Param("current") Integer current, @Param("size") Integer size, @Param("bizOrgCode") String bizOrgCode);
long countWater(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -193,6 +193,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -193,6 +193,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Override @Override
public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception { public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception {
RiskSource riskSource = (RiskSource) map.get("param"); RiskSource riskSource = (RiskSource) map.get("param");
...@@ -2010,6 +2013,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -2010,6 +2013,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return riskSource; return riskSource;
} }
@Autowired
private ContingencyPlanInstanceMapper contingencyPlanInstanceMapper;
@Override
public Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode) {
List<Map<String, Object>> content = Lists.newArrayList();
long total = contingencyPlanInstanceMapper.countWater(bizOrgCode);
if (total <= 0) {
return new PageImpl<>(content, commonPageable, total);
}
Integer start = (commonPageable.getPageNumber() - 1) * commonPageable.getPageSize();
content = contingencyPlanInstanceMapper.getWaterInfo(start, commonPageable.getPageSize(), bizOrgCode);
return new PageImpl<>(content, commonPageable, total);
}
} }
...@@ -220,4 +220,6 @@ public interface IRiskSourceService { ...@@ -220,4 +220,6 @@ public interface IRiskSourceService {
void processProtalDataFromDanger(DangerResultBo dangerResultBo) throws Exception; void processProtalDataFromDanger(DangerResultBo dangerResultBo) throws Exception;
RiskSource updateAreaSyn(String code, String compCode, RiskSourceSynBo synBo); RiskSource updateAreaSyn(String code, String compCode, RiskSourceSynBo synBo);
Page<Map<String, Object>> getWaterInfo(CommonPageable commonPageable, String bizOrgCode);
} }
...@@ -71,4 +71,336 @@ ...@@ -71,4 +71,336 @@
<select id="getMessageById" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance"> <select id="getMessageById" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select * from contingency_plan_instance where id = #{id} select * from contingency_plan_instance where id = #{id}
</select> </select>
<select id="getBizOrgCode" resultType="java.lang.String">
select
biz_org_code
from cb_org_usr where amos_org_code = #{amosOrgCode} and is_delete = 0 limit 1
</select>
<select id="getWaterInfo" resultType="java.util.Map">
select * from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
ORDER BY
levelStatus DESC,sequence_nbr DESC
limit #{current},#{size}
</select>
<select id="countWater" resultType="long">
select count(1) from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL THEN
'--'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) >= IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'100'
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) &lt; IFNULL( rp.min_water_level, 0 )
AND rp.max_water_level IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) /
IF
(
IFNULL( rp.max_water_level, 0 ) = 0,
1,
IFNULL( rp.max_water_level, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
IFNULL(max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),'--') AS nowLevel,
(
CASE
WHEN max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ) IS NULL
OR rp.min_water_level IS NULL THEN
'--'
WHEN IFNULL(
max( CASE WHEN ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' THEN ei.`value` END ),
IFNULL( rp.min_water_level, 0 )) &lt; IFNULL( rp.min_water_level, 0 ) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
CASE
WHEN a.nowLevel IS NULL THEN
'--'
WHEN a.nowLevel >= IFNULL( a.minLevel, 0 )
AND a.maxLevel IS NULL THEN
'100'
WHEN IFNULL( a.minLevel, 0 ) > a.nowLevel
AND a.maxLevel IS NULL THEN
'--' ELSE IFNULL((
FORMAT(
abs(
IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) /
IF
(
IFNULL( a.maxLevel, 0 ) = 0,
1,
IFNULL( a.maxLevel, 0 ))) * 100,
2
)
),
0
)
END
) AS levelAbs,
a.nowLevel,
(
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN
'--'
WHEN IFNULL( a.minLevel, 0 ) > IFNULL(
a.nowLevel,
IFNULL( a.minLevel, 0 )) THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
a.volume,
<!-- a.image,-->
a.resource_type,
a.sequence_nbr
<!-- ,a.`code` AS systemCode-->
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
FORMAT(avg(IFNULL(ei.`value`,0)), 2)
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
IFNULL( rp.volume, 0 ) AS volume,
<!-- ec.image,-->
r.resource_type,
r.sequence_nbr,
rp.level_device_id
<!-- ,fs.`code` AS systemCode-->
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
<!-- LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id-->
<!-- LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id-->
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a
)) b
</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