Commit f849ef13 authored by 张森's avatar 张森

液位单位转换

parent c579e363
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -723,14 +724,17 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -723,14 +724,17 @@ public class SupervisionConfigureController extends AbstractBaseController {
} }
List<EquipmentSpecificIndex> equipmentSpecificIndexes = equipmentSpecificIndexService.getEquipmentSpeIndexByEquipmentSecificId(Long.valueOf(equipmentSpecificId)); List<EquipmentSpecificIndex> equipmentSpecificIndexes = equipmentSpecificIndexService.getEquipmentSpeIndexByEquipmentSecificId(Long.valueOf(equipmentSpecificId));
String fieldKey = ""; String fieldKey = "";
String unit = "";
for (EquipmentSpecificIndex equipmentSpecificIndex : equipmentSpecificIndexes) { for (EquipmentSpecificIndex equipmentSpecificIndex : equipmentSpecificIndexes) {
if (Objects.equals(equipmentSpecificIndex.getEquipmentIndexKey(), "FHS_FirePoolDevice_WaterLevel") || Objects.equals(equipmentSpecificIndex.getEquipmentIndexKey(), "FHS_WirelessliquidDetector_WaterLevel")) { if (Objects.equals(equipmentSpecificIndex.getEquipmentIndexKey(), "FHS_FirePoolDevice_WaterLevel") || Objects.equals(equipmentSpecificIndex.getEquipmentIndexKey(), "FHS_WirelessliquidDetector_WaterLevel")) {
fieldKey = equipmentSpecificIndex.getEquipmentIndexKey(); fieldKey = equipmentSpecificIndex.getEquipmentIndexKey();
unit = equipmentSpecificIndex.getUnit();
} }
} }
if (StringUtils.isBlank(fieldKey)) { if (StringUtils.isBlank(fieldKey)) {
return CommonResponseUtil.success(null); return CommonResponseUtil.success(null);
} }
unit = ObjectUtil.isEmpty(unit) ? "M" : unit;
String iotCode = map.get("iot_code").toString(); String iotCode = map.get("iot_code").toString();
String prefix, suffix; String prefix, suffix;
if (iotCode.length() > 8) { if (iotCode.length() > 8) {
...@@ -761,7 +765,8 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -761,7 +765,8 @@ public class SupervisionConfigureController extends AbstractBaseController {
item.put("time", change(String.valueOf(m.get("time")))); item.put("time", change(String.valueOf(m.get("time"))));
for (String s : m.keySet()) { for (String s : m.keySet()) {
if (!s.equals("time")) { if (!s.equals("time")) {
item.put("value", m.get(s)); Map<String, Object> valueMap = UnitTransformUtil.transformValues(m.get(s), unit, "10", "10");
item.put("value", String.valueOf(valueMap.get("nowValue")));
item.remove(s); item.remove(s);
} }
} }
......
...@@ -156,7 +156,8 @@ ...@@ -156,7 +156,8 @@
wesi.create_date, wesi.create_date,
wesi.equipment_index_id, wesi.equipment_index_id,
wesi.equipment_index_key, wesi.equipment_index_key,
wli.`name` nameKey wli.`name` nameKey,
wesi.unit as unit
FROM wl_equipment_specific_index wesi FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id LEFT JOIN wl_equipment_index wli ON wesi.equipment_index_id = wli.id
where wesi.equipment_specific_id = #{id} where wesi.equipment_specific_id = #{id}
......
...@@ -7245,10 +7245,11 @@ ...@@ -7245,10 +7245,11 @@
`fs`.`name` AS `name`, `fs`.`name` AS `name`,
fs.system_type_code, fs.system_type_code,
fs.biz_org_name AS bizOrgName, fs.biz_org_name AS bizOrgName,
(SELECT count(DISTINCT t.equipment_specific_id) FROM wl_equipment_specific_alarm_log t WHERE 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, t.system_ids ) AND t.clean_time IS NULL) AS `value`, count( t.`status` = 0 OR NULL ) AS `value`,
(SELECT COUNT(DISTINCT wesal.equipment_specific_id) FROM wl_equipment_specific_alarm_log wesal WHERE 0 <![CDATA[<>]]> find_in_set(`fs`.`id`, wesal.`system_ids`)) AS equips count( DISTINCT t.`equipment_specific_id` ) AS equips
FROM FROM
`f_fire_fighting_system` `fs` `f_fire_fighting_system` `fs`
LEFT JOIN ( SELECT equipment_specific_id, system_ids, max( `status` ) AS `status` FROM wl_equipment_specific_alarm GROUP BY equipment_specific_id, system_ids ) t ON find_in_set( `fs`.`id`, t.system_ids )
WHERE WHERE
fs.system_type_code IS NOT NULL fs.system_type_code IS NOT NULL
AND LENGTH( AND LENGTH(
...@@ -7259,6 +7260,8 @@ ...@@ -7259,6 +7260,8 @@
<if test="systemType!=null and systemType!=''"> <if test="systemType!=null and systemType!=''">
AND fs.system_type_code LIKE CONCAT(#{systemType},'%') AND fs.system_type_code LIKE CONCAT(#{systemType},'%')
</if> </if>
GROUP BY
`fs`.`id`
) d ) d
<where> <where>
<if test="systemState == 'normal'"> <if test="systemState == 'normal'">
......
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