Commit f14228a4 authored by KeYong's avatar KeYong Committed by 李秀明

Merge remote-tracking branch 'origin/develop_dl' into develop_dl

parents 09929453 1efc552c
......@@ -349,7 +349,7 @@ public class WaterResourceDto extends BaseDto {
// @ExplicitConstraint(indexNum = 42, sourceClass = CommonExplicitConstraint.class, method = "getEquipCategory")
// @ExcelProperty(value = "设施分类名称", index = 42)
private String equipCategoryName;
@ApiModelProperty("设施分类编码")
@ExcelIgnore
private String equipCategoryCode;
......@@ -397,4 +397,8 @@ public class WaterResourceDto extends BaseDto {
@ExcelProperty(value = "水池液位显示装置", index = 45)
@ExplicitConstraint(indexNum = 45, sourceClass = CommonExplicitConstraint.class, method = "getListByEquipmentCode")
private String levelDeviceName;
@ExcelProperty(value = "出口流量(L/s)", index = 44)
@ApiModelProperty(value = "出口流量(L/s)")
private Float outputFlowRate;
}
......@@ -6,7 +6,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
*
* @author system_generator
* @date 2021-06-29
......@@ -74,4 +74,6 @@ public class WaterResourcePoolDto extends BaseDto {
@ApiModelProperty("水池液位显示装置名称")
private String levelDeviceName;
@ApiModelProperty(value = "最高报警水位(m)")
private Float outputFlowRate;
}
......@@ -379,11 +379,13 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getListByEquipmentCode/{code}")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public List<Map<String, Object>> getListByEquipmentCode( @PathVariable String code){
ReginParams ReginParams=getSelectedOrgInfo();
String bizCode= ReginParams.getPersonIdentity().getCompanyBizOrgCode();
public List<Map<String, Object>> getListByEquipmentCode( @PathVariable String code, @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode){
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams ReginParams=getSelectedOrgInfo();
bizOrgCode = ReginParams.getPersonIdentity().getCompanyBizOrgCode();
}
return equipmentSpecificSerivce.getListByEquipmentCodeJ(code,bizCode);
return equipmentSpecificSerivce.getListByEquipmentCodeJ(code, bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -61,11 +61,13 @@ public class FireResourceSupervisionController extends BaseController {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
FireResourceStatsDTO fireSystemStats = iFireResourceSupervisionService.getFireSystemStats(bizOrgCode);
FireResourceStatsDTO fireEquipStats = iFireResourceSupervisionService.getFireEquipStats(bizOrgCode);
FireResourceStatsDTO fireCarStats = iFireResourceSupervisionService.getFireCarStats(bizOrgCode);
FireResourceStatsDTO socialPowerStats = socialPowerService.getStatistics(bizOrgCode);
Map<String, FireResourceStatsDTO> result = new HashMap<String, FireResourceStatsDTO>() {{
put("fireSystemStats", fireSystemStats);
put("fireEquipStats", fireEquipStats);
put("fireCarStats", fireCarStats);
put("socialPowerStats", socialPowerStats);
......
......@@ -29,6 +29,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -81,7 +82,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getWaterInfoBySuper(page, bizOrgCode);
List<Map<String, Object>> res = page1.getRecords();
if (0 < res.size()) {
if (!res.isEmpty()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
......@@ -92,16 +93,91 @@ public class SupervisionConfigureController extends AbstractBaseController {
m.put("levelStatus", "--");
}
m.put("abs", transResult.get("abs"));
BigDecimal levelAbsLiter = new BigDecimal(0); // 储水量(升)
if (!String.valueOf(transResult.get("abs")).equals("--") && !ObjectUtils.isEmpty(m.get("volume"))) {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, BigDecimal.ROUND_HALF_UP);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, RoundingMode.HALF_UP);
levelAbsLiter = levelAbsLiter.add(bigDecimal.multiply(new BigDecimal(1000)));
m.put("levelAbs", bigDecimal + "m³ " + " (" + transResult.get("abs") + "%)");
} else if (String.valueOf(transResult.get("abs")).equals("100") && String.valueOf(transResult.get("status")).equals("1")) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume")));
levelAbsLiter = levelAbsLiter.add(bigDecimal.multiply(new BigDecimal(1000)));
m.put("levelAbs", bigDecimal + "m³ " + " (" + transResult.get("abs") + "%)");
} else {
m.put("levelAbs", transResult.get("abs"));
}
// 计算可使用时间:储水量(L) / 出口流量(L/s), 单位为小时
float outputFlowRate = Float.parseFloat(m.getOrDefault("outputFlowRate", "0").toString());
if (levelAbsLiter.compareTo(new BigDecimal(0)) != 0 && outputFlowRate != 0) {
long availableSeconds = (long) (levelAbsLiter.divide(new BigDecimal(outputFlowRate), 0, RoundingMode.HALF_UP).doubleValue());
long availableHours = availableSeconds / 3600;
if (availableHours > 24) {
m.put("availableTime", availableHours / 24 + " d" + availableHours % 24 + " h");
} else {
m.put("availableTime", availableHours + "h");
}
} else {
m.put("availableTime", "--");
}
}
}
return CommonResponseUtil.success(page1);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览泡沫罐和水箱信息")
@GetMapping("/getFoamTank")
public ResponseModel getFoamTankBySuper(@RequestParam(value = "pageNumber", required = false) Long pageNumber,
@RequestParam(value = "pageSize", required = false) Long pageSize,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode
) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(pageNumber, pageSize);
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getFoamTank(page, bizOrgCode);
List<Map<String, Object>> res = page1.getRecords();
if (!res.isEmpty()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("levelStatus", "--");
}
m.put("levelAbs", transResult.get("abs"));
// 计算可使用时间:储水量(L) / 出口流量(L/s), 单位为小时
BigDecimal levelAbsLiter = new BigDecimal(0); // 储水量(升)
BigDecimal volume = new BigDecimal(0);
if (ObjectUtils.isEmpty(m.get("volume")) || Objects.equals(m.get("volume"), "--")) {
volume = new BigDecimal(0);
} else {
volume = new BigDecimal(String.valueOf(m.get("volume")));
}
if ((String.valueOf(transResult.get("abs")).equals("100") || String.valueOf(transResult.get("abs")).equals("--"))) {
levelAbsLiter = volume.multiply(new BigDecimal(1000));
}else {
BigDecimal abs = new BigDecimal(String.valueOf(transResult.get("abs")));
levelAbsLiter = volume.multiply(abs.divide(new BigDecimal(100),2, RoundingMode.HALF_UP));
}
float outputFlowRate = Float.parseFloat(String.valueOf(m.get("outputFlowRate")));
if (levelAbsLiter.compareTo(new BigDecimal(0)) != 0 && outputFlowRate != 0) {
long availableSeconds = (long) (levelAbsLiter.divide(new BigDecimal(outputFlowRate), 0, RoundingMode.HALF_UP).doubleValue());
long availableHours = availableSeconds / 3600;
if (availableHours > 24) {
m.put("availableTime", availableHours / 24 + " d" + availableHours % 24 + " h");
} else {
m.put("availableTime", availableHours + "h");
}
} else {
m.put("availableTime", "--");
}
}
}
return CommonResponseUtil.success(page1);
......
......@@ -349,6 +349,14 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getWaterInfoBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 监盘概览泡沫罐和水箱信息
* @param page
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getFoamTank(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 监盘概览泡沫罐和水箱信息(监盘概览)
* @param page
* @param bizOrgCode
......
......@@ -66,9 +66,9 @@ public class IFireResourceSupervisionServiceImpl implements IFireResourceSupervi
private FireResourceStatsDTO buildFireResourceStatsDTO(Map<String, Object> resultMap) {
FireResourceStatsDTO fireResourceStats = new FireResourceStatsDTO();
fireResourceStats.setTotalCounts(Long.valueOf(resultMap.get("totalCount").toString()));
fireResourceStats.setYellowCounts(Long.valueOf(resultMap.get("yellowCodeCount").toString()) );
fireResourceStats.setRedCounts(Long.valueOf(resultMap.get("redCodeCount").toString()));
fireResourceStats.setTotalCounts(Long.parseLong(resultMap.get("totalCount").toString()));
fireResourceStats.setYellowCounts(Long.parseLong(resultMap.get("yellowCodeCount").toString()) );
fireResourceStats.setRedCounts(Long.parseLong(resultMap.get("redCodeCount").toString()));
long expCount = fireResourceStats.getYellowCounts() + fireResourceStats.getRedCounts();
double abnormalRatio = 0;
......
......@@ -1759,7 +1759,8 @@
wes.value_label valueLabel,
wes.realtime_iot_es_index_id realtimeIotSpecificIndexId,
wes.realtime_iot_index_update_date realtiemIotIndexUpdateDate,
wes.realtime_iot_index_id realtimeIotIndexId
wes.realtime_iot_index_id realtimeIotIndexId,
wes.equip_status equipStatus
FROM
wl_equipment_specific wes
<where>
......
......@@ -4906,6 +4906,7 @@
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
-- 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,
IFNULL((select
avg(IFNULL(ei.`value`, 0))
......@@ -4942,6 +4943,7 @@
a.equipmentSpecificId,
a.minLevel,
a.maxLevel,
a.outputFlowRate,
IFNULL( a.nowLevel, '--' ) nowLevel,
a.`unit`,
a.volume,
......@@ -4956,6 +4958,7 @@
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
(select
avg(IFNULL(ei.`value`,0))
from
......@@ -4998,6 +5001,120 @@
status ASC
</select>
<select id="getFoamTank" resultType="java.util.Map">
select
*,
(
CASE
WHEN nowLevel IS NOT NULL AND maxLevel IS NOT NULL AND nowLevel - maxLevel > 0 THEN '1'
WHEN nowLevel IS NOT NULL AND minLevel IS NOT NULL AND nowLevel != '--' AND nowLevel - minLevel >= 0 THEN '2'
WHEN nowLevel IS NOT NULL AND minLevel IS NOT NULL AND nowLevel != '--' AND minLevel - nowLevel > 0 THEN '0'
ELSE '4'
END
) AS status
from
(
SELECT
a.id,
a.name,
IFNULL( a.image, '' ) AS image,
a.unit,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
IF( a.outputFlowRate IS NULL OR a.outputFlowRate = '', 0, a.outputFlowRate ) AS outputFlowRate,
IF( a.volume IS NULL OR a.volume = '', 0, a.volume ) AS volume,
(
CASE
WHEN a.nowLevel IS NULL OR a.minLevel IS NULL THEN '--'
WHEN a.minLevel - a.nowLevel > 0 THEN '缺水'
ELSE '正常'
END
) AS levelStatus,
'foamTank' AS type
FROM
(
SELECT
ed.name,
es.iot_code,
es.id,
ec.image,
ei.unit,
max( CASE WHEN ei.equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' THEN ei.value END ) AS nowLevel,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) AS minLevel,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) AS maxLevel,
max( CASE WHEN fi.field_name = 'outputFlowRate' THEN fi.field_value END ) AS outputFlowRate,
max( CASE WHEN fi.field_name = 'volume' THEN fi.field_value END ) AS volume
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_specific_index ei ON es.id = ei.equipment_specific_id
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
LEFT JOIN wl_equipment_category ec ON e.category_id = ec.id
LEFT JOIN wl_form_instance_equip fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92031900%'
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND es.iot_code IS NOT NULL
GROUP BY
es.id
) a
UNION ALL
SELECT
a.id,
a.name,
IFNULL( a.image, '' ) AS image,
'M' AS unit,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
IF( a.outputFlowRate IS NULL OR a.outputFlowRate = '', 0, a.outputFlowRate ) AS outputFlowRate,
IF( a.volume IS NULL OR a.volume = '', 0, a.volume ) AS volume,
(
CASE
WHEN a.nowLevel IS NULL OR a.minLevel IS NULL THEN '--'
WHEN a.minLevel - a.nowLevel > 0 THEN '缺水'
ELSE '正常'
END
) AS levelStatus,
a.type AS type
FROM
(
SELECT
r.name,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
IFNULL( rp.volume, 0 ) AS volume,
(
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,
ec.image,
r.resource_type AS type,
r.sequence_nbr AS id
FROM
cb_water_resource r
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
WHERE
r.resource_type = 'waterTank'
AND r.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND r.is_delete = 1
GROUP BY
r.sequence_nbr
) a
ORDER BY
levelStatus DESC
) as b
order by status asc
</select>
<select id="getFoamTankBySuper" resultType="java.util.Map">
select
......@@ -6366,14 +6483,14 @@
<select id="getEquipStats" resultType="java.util.Map">
SELECT
count(1) AS totalCount,
0 AS yellowCodeCount,
0 AS redCodeCount
sum(case equip_status when '1' then 1 else 0 end) AS yellowCodeCount,
sum(case equip_status when '2' then 1 else 0 end) AS redCodeCount
FROM
wl_equipment_specific wes
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
wl_equipment_specific wes
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
<where>
<if test="list != null and list.size > 0">
<foreach collection="sysIds" item="item" index="index" open="(" close=")" separator="OR">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wes.equipment_code LIKE CONCAT(#{item}, '%')
</foreach>
</if>
......@@ -6382,6 +6499,5 @@
</if>
AND wed.equipment_name is not null
</where>
ORDER BY CONVERT(bizOrgName USING gbk) ASC
</select>
</mapper>
......@@ -39,8 +39,8 @@
<select id="getStatistics" resultType="com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO">
SELECT
COUNT(1) AS totalCounts,
0 AS yellowCounts,
0 AS redCountsrr
sum(case power_status when '1' then 1 else 0 end) AS yellowCounts,
sum(case power_status when '2' then 1 else 0 end) AS redCounts
FROM wl_social_power wsp
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
......
......@@ -3918,4 +3918,30 @@
</sql>
</changeSet>
<changeSet author="ltw" id="202403120101">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_water_resource_pool" columnName="output_flow_rate"/>
</not>
</preConditions>
<comment>cb_water_resource_pool add column</comment>
<sql>
ALTER TABLE `cb_water_resource_pool`
ADD COLUMN `output_flow_rate` float(10, 2) NULL COMMENT '出口流量(L/s)' AFTER `level_device_name`;
</sql>
</changeSet>
<changeSet author="tym" id="202403120102">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_form_group_column_equip" />
<not>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="wl_form_group_column_equip"/>
</not>
</preConditions>
<comment>wl_form_group_column_equip 添加表单字段</comment>
<sql>
REPLACE INTO `wl_form_group_column_equip` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000360, 'outputFlowRate', '出口流量(L/s)', 'inputNumber', 132828674825, 'eq', b'0', '92031900', 2581805, '2024-03-12 09:24:37');
</sql>
</changeSet>
</databaseChangeLog>
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